Skip to content

Commit

Permalink
Fix hydra registration
Browse files Browse the repository at this point in the history
  • Loading branch information
kghost committed Jan 19, 2024
1 parent 55560a1 commit 795a140
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 1 addition & 21 deletions selfservice/flow/registration/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit 795a140

Please sign in to comment.