public Fido2LinkFlow(IServiceProvider serviceProvider) : base(serviceProvider, FlowType.Fido2Link)
        {
            // 1.Starting 2.AcceptStart
            AddStartingTransitions(StepType.Fido2Authorize);

            // 3. Fido2Authorize (link)
            AddHandler <Fido2LinkTransitionHandler, TransitionInput <string> >((_, item) =>
                                                                               FrontendBehavior.CreateSuccessFinish(item.ChallengeType));
        }
        public RecoveryWithPinFlow(IServiceProvider serviceProvider, IOwnIdCoreConfiguration coreConfiguration) : base(
                serviceProvider, FlowType.RecoverWithPin, coreConfiguration)
        {
            // 1.Starting 2.PinApprovalStatus 3.AcceptStart
            AddStartingTransitionsWithPin <RecoverAcceptStartTransitionHandler>(StepType.Recover);

            // 4. Recover
            AddHandler <RecoveryTransitionHandler, TransitionInput <JwtContainer> >((_, item) =>
                                                                                    FrontendBehavior.CreateSuccessFinish(item.ChallengeType));
        }
Esempio n. 3
0
        public LinkWithPinFlow(IServiceProvider serviceProvider, IOwnIdCoreConfiguration ownIdCoreConfiguration) : base(
                serviceProvider, FlowType.LinkWithPin, ownIdCoreConfiguration)
        {
            // 1.Starting 2.PinApprovalStatus 3.AcceptStart
            AddStartingTransitionsWithPin(StepType.Link);

            // 4. Link
            AddHandler <LinkBaseTransitionHandler, TransitionInput <JwtContainer> >((_, item) =>
                                                                                    FrontendBehavior.CreateSuccessFinish(item.ChallengeType));
        }
Esempio n. 4
0
        private FrontendBehavior OnSuccess(TransitionInput <string> _, CacheItem item)
        {
            var challengeType = item.ChallengeType;

            if (item.ChallengeType == ChallengeType.Register && item.InitialChallengeType == ChallengeType.Login)
            {
                challengeType = ChallengeType.LinkOnLogin;
            }

            return(FrontendBehavior.CreateSuccessFinish(challengeType));
        }
Esempio n. 5
0
        private FrontendBehavior OnSuccess <T>(TransitionInput <T> _, CacheItem item)
        {
            var challengeType = item.ChallengeType;

            if (item.ChallengeType == ChallengeType.Register && item.InitialChallengeType == ChallengeType.Login &&
                !CoreConfiguration.LoginOnlyEnabled)
            {
                challengeType = ChallengeType.LinkOnLogin;
            }

            return(FrontendBehavior.CreateSuccessFinish(challengeType));
        }
Esempio n. 6
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)));
        }
        public RecoveryFlow(IServiceProvider serviceProvider, IOwnIdCoreConfiguration coreConfiguration) : base(
                serviceProvider, FlowType.Recover, coreConfiguration)
        {
            // 1. Starting
            AddHandler <StartFlowTransitionHandler, TransitionInput <StartRequest> >((input, item) =>
                                                                                     GetReferenceToExistingStep(StepType.AcceptStart, input.Context, item.ChallengeType));

            // 2. AcceptStart
            AddHandler <RecoverAcceptStartTransitionHandler, TransitionInput <AcceptStartRequest> >((input, item) =>
            {
                var next = GetReferenceToExistingStep(StepType.Recover, input.Context, item.ChallengeType);
                return(TryAddFido2DisclaimerToBehavior(input, item, next));
            });

            // 3. Recover
            AddHandler <RecoveryTransitionHandler, TransitionInput <JwtContainer> >((_, item) =>
                                                                                    FrontendBehavior.CreateSuccessFinish(item.ChallengeType));
        }