protected virtual async Task PostAuthenticate(HttpContext context) { var claimsPrincipal = context.User.Transform(_options.ClaimType); BedrockUser = SecurityModel.BedrockUser.CreateFromPrincipal(claimsPrincipal, _options.ClaimType); var bedrockIdentity = new BedrockIdentity(BedrockUser, (ClaimsIdentity)context.User.Identity); var bedrockPrincipal = new BedrockPrincipal(BedrockUser, bedrockIdentity); bedrockPrincipal.AddIdentity(bedrockIdentity); context.User = bedrockPrincipal; Thread.CurrentPrincipal = bedrockPrincipal; }
public override Task TokenValidated(TokenValidatedContext context) { ClaimsPrincipal = context.Principal.Transform(ClaimType); BedrockUser = SecurityModel.BedrockUser.CreateFromPrincipal(ClaimsPrincipal, ClaimType); var bedrockIdentity = new BedrockIdentity(BedrockUser); var bedrockPrincipal = new BedrockPrincipal(BedrockUser, bedrockIdentity); bedrockIdentity.AddClaims(ClaimsPrincipal.Claims); bedrockPrincipal.AddIdentity(bedrockIdentity); context.Principal = bedrockPrincipal; Thread.CurrentPrincipal = bedrockPrincipal; ClaimsPrincipal = bedrockPrincipal; return(base.TokenValidated(context)); }