private async Task OnTokenIssued(TokenIssuedEventArgs args) { var context = (OAuthTokenEndpointResponseContext)args.Context; // Create new principal for cookie authentication var cookiePrincipal = this.principalProvider.Create(DefaultAuthenticationTypes.ApplicationCookie, context.Identity.Claims.Select(x => new SentinelClaim(x)).ToArray()); // Log in using cookie authenticator context.Request.Context.Authentication.SignOut(DefaultAuthenticationTypes.ApplicationCookie); context.Request.Context.Authentication.SignIn( new AuthenticationProperties { IsPersistent = true, ExpiresUtc = DateTimeOffset.UtcNow.Add(context.Options.AccessTokenExpireTimeSpan) }, cookiePrincipal.Identity.AsClaimsIdentity()); }
private void Sut_TokenIssued(object sender, TokenIssuedEventArgs e) { _callbackTokensIssued.Add(e); }