protected override async Task <ITransitionResult> ExecuteInternalAsync(TransitionInput <JwtContainer> input,
                                                                               CacheItem relatedItem)
        {
            var userData = _jwtService.GetDataFromJwt <UserIdentitiesData>(input.Data.Jwt).Data;

            relatedItem.AuthCookieType = CookieType.Passcode;

            await _savePartialConnectionCommand.ExecuteAsync(userData, relatedItem);

            await _userHandlerAdapter.UpgradeConnectionAsync(userData.PublicKey, new OwnIdConnection
            {
                AuthType      = ConnectionAuthType.Passcode,
                PublicKey     = userData.PublicKey,
                RecoveryData  = userData.RecoveryData,
                RecoveryToken = relatedItem.RecoveryToken
            });

            var composeInfo = new BaseJwtComposeInfo(input)
            {
                Behavior = GetNextBehaviorFunc(input, relatedItem)
            };
            var jwt = JwtComposer.GenerateFinalStepJwt(composeInfo);

            return(new StateResult(jwt, _cookieService.CreateAuthCookies(relatedItem)));
        }
Ejemplo n.º 2
0
        private async Task <ITransitionResult> FinishAuthProcessAsync(UserIdentitiesData userData, CacheItem relatedItem,
                                                                      TransitionInput <JwtContainer> input)
        {
            await _savePartialConnectionCommand.ExecuteAsync(userData, relatedItem);

            var composeInfo = new BaseJwtComposeInfo(input)
            {
                Behavior = FrontendBehavior.CreateSuccessFinish(relatedItem.ChallengeType)
            };

            var jwt = JwtComposer.GenerateFinalStepJwt(composeInfo);

            return(new StateResult(jwt, _cookieService.CreateAuthCookies(relatedItem)));
        }
        protected override async Task <ITransitionResult> ExecuteInternalAsync(TransitionInput <JwtContainer> input,
                                                                               CacheItem relatedItem)
        {
            var userData = _jwtService.GetDataFromJwt <UserIdentitiesData>(input.Data.Jwt).Data;

            await _savePartialConnectionCommand.ExecuteAsync(userData, relatedItem);

            var composeInfo = new BaseJwtComposeInfo(input)
            {
                Behavior = GetNextBehaviorFunc(input, relatedItem),
            };
            var jwt = JwtComposer.GenerateFinalStepJwt(composeInfo);

            return(new StateResult(jwt, _cookieService.CreateAuthCookies(relatedItem)));
        }