public async Task <IActionResult> Callback(ImplicitFlowResponseFormViewModel implicitFlowResponseFormViewModel) { var configurationName = (string)TempData.ReadAndClear(TempDataNames.OAuthTesterConfigurationName); var originalState = (string)TempData.ReadAndClear(Common.State); var codeVerifier = (string)TempData.ReadAndClear(Common.CodeVerifier); var oAuthTesterViewModel = Utils.Mappers.OAuthMapper.GetNewOAuthTesterViewModel(configurationName); oAuthTesterViewModel.OAuthClientConfiguration = _optionsMonitor.GetEx(configurationName); var oAuthFlows = _oAuthFlowsFactory.CreateOAuthFlows(configurationName); var implicitFlowCallbackResponse = Utils.Mappers.OAuthMapper.Map(implicitFlowResponseFormViewModel); var response = await oAuthFlows.RunFlow( oAuthTesterViewModel.OAuthClientConfiguration, implicitFlowResponse : implicitFlowCallbackResponse, originalState : originalState, codeVerifier : codeVerifier); switch (response) { case AccessTokenResponse accessTokenResponse: oAuthTesterViewModel.AccessTokenResponse = Utils.Mappers.OAuthMapper.Map(accessTokenResponse); break; case ErrorResponse errorResponse: return(ProcessOAuthClientErrorResponse(errorResponse)); } return(View("Index", oAuthTesterViewModel)); }
public static ImplicitFlowResponse Map(ImplicitFlowResponseFormViewModel source) { if (source == null) { return(null); } var destination = new ImplicitFlowResponse { AccessToken = source.AccessToken, State = source.State, TokenType = source.TokenType, ExpiresIn = source.ExpiresIn, Scope = source.Scope }; return(destination); }