private static CommandResult ProcessResponse(IOptions options, Saml2Response samlResponse) { var principal = new ClaimsPrincipal(samlResponse.GetClaims(options)); principal = options.SPOptions.SystemIdentityModelIdentityConfiguration .ClaimsAuthenticationManager.Authenticate(null, principal); var requestState = samlResponse.GetRequestState(options); if(requestState == null && options.SPOptions.ReturnUrl == null) { throw new ConfigurationErrorsException(MissingReturnUrlMessage); } return new CommandResult() { HttpStatusCode = HttpStatusCode.SeeOther, Location = requestState?.ReturnUrl ?? options.SPOptions.ReturnUrl, Principal = principal, RelayData = requestState == null ? null : requestState.RelayData }; }
private static CommandResult ProcessResponse(IOptions options, Saml2Response samlResponse, string returnURL) { var principal = new ClaimsPrincipal(samlResponse.GetClaims(options)); principal = options.SPOptions.SystemIdentityModelIdentityConfiguration .ClaimsAuthenticationManager.Authenticate(null, principal); var requestState = samlResponse.GetRequestState(options); UriBuilder builder = new UriBuilder(requestState != null && requestState.ReturnUrl != null ? requestState.ReturnUrl : options.SPOptions.ReturnUrl); if (!string.IsNullOrEmpty(returnURL) && builder.Path.ToString().IndexOf(returnURL, StringComparison.OrdinalIgnoreCase) < 0) { builder = new UriBuilder(returnURL); } return new CommandResult() { HttpStatusCode = HttpStatusCode.SeeOther, Location = builder.Uri, Principal = principal, RelayData = requestState == null ? null : requestState.RelayData }; }
private static CommandResult ProcessResponse(IOptions options, Saml2Response samlResponse) { var principal = new ClaimsPrincipal(samlResponse.GetClaims(options)); principal = options.SPOptions.SystemIdentityModelIdentityConfiguration .ClaimsAuthenticationManager.Authenticate(null, principal); var requestState = samlResponse.GetRequestState(options); return new CommandResult() { HttpStatusCode = HttpStatusCode.SeeOther, Location = requestState != null && requestState.ReturnUrl != null ? requestState.ReturnUrl : options.SPOptions.ReturnUrl, Principal = principal, RelayData = requestState == null ? null : requestState.RelayData }; }