From 795a140abbcdde6f100767f386c1d5fccb66e025 Mon Sep 17 00:00:00 2001 From: Zang MingJie Date: Fri, 19 Jan 2024 11:19:58 +0800 Subject: [PATCH] Fix hydra registration --- Makefile | 4 ++-- selfservice/flow/registration/hook.go | 22 +--------------------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index fd023e75bf13..3bdd463fa17f 100644 --- a/Makefile +++ b/Makefile @@ -151,12 +151,12 @@ sdk: .bin/swagger .bin/ory node_modules quickstart: docker pull oryd/kratos:latest docker pull oryd/kratos-selfservice-ui-node:latest - docker-compose -f quickstart.yml -f quickstart-standalone.yml up --build --force-recreate + docker compose -f quickstart.yml -f quickstart-standalone.yml up --build --force-recreate .PHONY: quickstart-dev quickstart-dev: docker build -f .docker/Dockerfile-build -t oryd/kratos:latest . - docker-compose -f quickstart.yml -f quickstart-standalone.yml -f quickstart-latest.yml $(QUICKSTART_OPTIONS) up --build --force-recreate + docker compose -f quickstart.yml -f quickstart-standalone.yml -f quickstart-latest.yml up --build --force-recreate authors: # updates the AUTHORS file curl https://raw.githubusercontent.com/ory/ci/master/authors/authors.sh | env PRODUCT="Ory Kratos" bash diff --git a/selfservice/flow/registration/hook.go b/selfservice/flow/registration/hook.go index 6a997009c1c5..6c4f210119a1 100644 --- a/selfservice/flow/registration/hook.go +++ b/selfservice/flow/registration/hook.go @@ -292,28 +292,8 @@ func (e *HookExecutor) PostRegistrationHook(w http.ResponseWriter, r *http.Reque } finalReturnTo := returnTo.String() - if registrationFlow.OAuth2LoginChallenge != "" { - if registrationFlow.ReturnToVerification != "" { - // Special case: If Kratos is used as a login UI *and* we want to show the verification UI, - // redirect to the verification URL first and then return to Hydra. - finalReturnTo = registrationFlow.ReturnToVerification - } else { - callbackURL, err := e.d.Hydra().AcceptLoginRequest(r.Context(), - hydra.AcceptLoginRequestParams{ - LoginChallenge: string(registrationFlow.OAuth2LoginChallenge), - IdentityID: i.ID.String(), - SessionID: s.ID.String(), - AuthenticationMethods: s.AMR, - }) - if err != nil { - return err - } - finalReturnTo = callbackURL - } - span.SetAttributes(attribute.String("redirect_reason", "oauth2 login challenge")) - } else if registrationFlow.ReturnToVerification != "" { + if registrationFlow.ReturnToVerification != "" { finalReturnTo = registrationFlow.ReturnToVerification - span.SetAttributes(attribute.String("redirect_reason", "verification requested")) } span.SetAttributes(attribute.String("return_to", finalReturnTo))