asp.net-core-security

Specifying Windows AuthenticationScheme and Roles Doesn't Work

本秂侑毒 提交于 2019-12-13 20:47:25
问题 How do I specify that the AuthenticationScheme is Windows and check that the user is a member of an AD Group? When I specify the AuthenticationScheme , setting the Roles no longer works, why not? And how do I fix that? public class SomeController : Controller { //this works [Authorize(Roles = @"SOME.DOMAIN\SOME GROUP")] public IActionResult SomeAction(){ ... } //this works [Authorize(AuthenticationSchemes = "Windows")] //this doesn't work //[Authorize(Roles = @"SOME.DOMAIN\SOME GROUP",

.AspNetCore.Correlation. state property not found. Unknown Location

此生再无相见时 提交于 2019-12-13 20:41:31
问题 I am using hybrid authentication flow with OIDC. options.Events.OnRedirectToIdentityProvider = redirectContext => { if (redirectContext.Request.Path.StartsWithSegments("/api")) { if (redirectContext.Response.StatusCode == (int)HttpStatusCode.OK) { AuthenticationProperties properties = new AuthenticationProperties(); properties.RedirectUri = redirectContext.ProtocolMessage.RedirectUri; redirectContext.ProtocolMessage.State = options.StateDataFormat.Protect(properties); redirectContext.Response