Ich erhalte den Fehler 'Die Clientanwendung ist nicht bekannt oder nicht autorisiert.' wenn ich auf einen geschützten Bereich meiner Site zugreife.Identity Server 3 - Die Clientanwendung ist nicht bekannt oder nicht autorisiert.
Hier ist meine Kunden:
public static class Clients
{
public static IEnumerable<Client> Get()
{
return new[]
{
new Client
{
Enabled = true,
ClientName = "Web Application",
ClientId = "webapplication",
Flow = Flows.AuthorizationCode,
ClientSecrets = new List<Secret>
{
new Secret("webappsecret".Sha256())
},
RedirectUris = new List<string>
{
UrlManager.WebApplication
},
PostLogoutRedirectUris = new List<string>
{
UrlManager.WebApplication
},
AllowedScopes = new List<string>
{
Constants.StandardScopes.OpenId,
Constants.StandardScopes.Profile,
Constants.StandardScopes.Email,
Constants.StandardScopes.Roles,
Constants.StandardScopes.OfflineAccess,
"read",
"write"
}
}
};
}
}
Hier Start meine Web-Anwendung:
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies"
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
Authority = UrlManager.AuthenticationService + "identity",
ClientId = "webapplication",
Scope = "openid profile",
ResponseType = "code id_token",
RedirectUri = UrlManager.WebApplication,
SignInAsAuthenticationType = "Cookies"
});
}
}
Dies ist mein Authentifizierungsdienst (wo IDS3 installiert ist) Inbetriebnahme:
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.Map("/identity", idsrvApp =>
{
idsrvApp.UseIdentityServer(new IdentityServerOptions
{
SiteName = "Authentication Service - Embedded IdentityServer",
SigningCertificate = Certificate.LoadCertificate(),
Factory = new IdentityServerServiceFactory()
.UseInMemoryUsers(Users.Get())
.UseInMemoryClients(Clients.Get())
.UseInMemoryScopes(Scopes.Get())
});
});
}
}
Dies ist UrlManager:
public static class UrlManager
{
public static string WebApplication
{
get { return "https://localhost:44381/"; }
}
public static string AuthenticationService
{
get { return "https://localhost:44329/"; }
}
}
Das ist mein Home Controller: ‚Die Client-Anwendung ist nicht bekannt oder nicht berechtigt ist,‘
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
[Authorize]
public ActionResult Private()
{
return View((User as ClaimsPrincipal).Claims);
}
}
Wenn ich Privat greife ich auf einen Identity Server 3-Bildschirm erhalten, die mir die Fehlermeldung gibt.
Ich habe gelesen, dass dies von falschen Übereinstimmungen in den Umleitungs-URIs kommen kann, aber soweit ich sehen kann, sind meine korrekt. Ich weiß nicht, was sonst noch dazu führen kann. Die Anwendung funktioniert perfekt, wenn ich den Fluss zu implizit ändere, aber ich möchte AutorisierungCode-Ablauf implementieren.
Die Dokumentation scheint dies auch nicht zu beleuchten.
Ich wäre daran interessiert, wie Sie dies behoben haben, wenn es der eigentliche Fehler war. Prost – Ian