/* helpers */ public async Task LoginAsync(ClaimsPrincipal subject) { var old = BrowserClient.AllowAutoRedirect; BrowserClient.AllowAutoRedirect = false; Subject = subject; await BrowserClient.GetAsync(LoginPage); BrowserClient.AllowAutoRedirect = old; }
public async Task <AuthorizeResponse> RequestAuthorizationEndpointAsync( string clientId, string responseType, string scope = null, string redirectUri = null, string state = null, string nonce = null, string loginHint = null, string acrValues = null, string responseMode = null, string codeChallenge = null, string codeChallengeMethod = null, object extra = null) { var old = BrowserClient.AllowAutoRedirect; BrowserClient.AllowAutoRedirect = false; var url = CreateAuthorizeUrl(clientId, responseType, scope, redirectUri, state, nonce, loginHint, acrValues, responseMode, codeChallenge, codeChallengeMethod, extra); var result = await BrowserClient.GetAsync(url); result.StatusCode.Should().Be(HttpStatusCode.Found); BrowserClient.AllowAutoRedirect = old; var redirect = result.Headers.Location.ToString(); if (redirect.StartsWith(IdentityServerPipeline.ErrorPage)) { // request error page in pipeline so we can get error info await BrowserClient.GetAsync(redirect); // no redirect to client return(null); } return(new AuthorizeResponse(redirect)); }