public async Task <IActionResult> Post([FromBody] StartApplicationRequest request)
        {
            var command = new StartApplicationSaga
            {
                FirstName = request.FirstName,
                LastName  = request.LastName,
                Email     = request.Email,
                Password  = request.Password,
                EligibilityQualifierId = request.EligibilityQualifierId,
                ProductId = request.ProductId
            };

            var commandResponse = await _bus.SendCommand <StartApplicationSagaResponse>(command);

            Log.Debug("Got response back from StartApplicationSaga");
            Log.Debug("Attempting to get a token from the identity server at " + _identityClient.EndpointUri);
            var authResult = await _identityClient.GetToken(request.Email, request.Password);

            Log.Debug("Got a response from the Identity Server");

            var response = new StartApplicationResponse
            {
                ApplicationId          = commandResponse.ApplicationId,
                FirstName              = request.FirstName,
                LastName               = request.LastName,
                Email                  = request.Email,
                Token                  = authResult.AccessToken,
                EligibilityQualifierId = request.EligibilityQualifierId,
                ProductId              = request.ProductId
            };

            return(OaoResult.Created(response.ApplicationId, response, commandResponse.Actions));
        }
Beispiel #2
0
        private async Task OAuthLoginCommandExecute()
        {
            var loginModel = new LoginModel
            {
                UserName = UserName,
                Password = Password
            };
            var result = await _identityClient.GetToken(loginModel);

            if (result.AccessToken != null)
            {
                var accessToken = result.AccessToken;
                Settings.AccessToken         = accessToken;
                Application.Current.MainPage = new NavigationPage(new MenuPage(UserName));
                IsValid = true;
            }
            else
            {
                IsValid = false;
            }
        }