-
-
Notifications
You must be signed in to change notification settings - Fork 218
Integrating Hydra and Kratos #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
hydra-specific stuff to extra-endpoint, more verbose logging
Jeremy Bogle seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
quickstart/config/kratos/email-password/identity.traits.schema.json
Outdated
Show resolved
Hide resolved
Logging can be quite useful to find errors, but using |
@jpbogle for this to be merged into master we would need you to sign the CLA (see first comment on this PR). Would you be ok with that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not looked into the logic of the login flow itself too much yet. It looks to me as if there could be some serious session hijaking vulnerabilities. I'll give it another pass once the review comments are addressed.
Regarding workflows, I highly recommend using the following pattern - this will help you keep your fork clean. Committing on your fork's master is bad practice because you want the master of your fork and the origin to stay in sync.
Here's how I generally work with forks:
# First you clone the original repository
git clone [email protected]:ory/kratos-selfservice-ui-node.git
# Next you add a git remote that is your fork:
git remote add fork [email protected]:k9ert/kratos-selfservice-ui-node.git
# Next you fetch the latest changes from origin for master:
git fetch origin
git checkout master
git pull --rebase
# Next you create a new feature branch off of master:
git checkout my-feature-branch
# Now you do your work and commit your changes:
git add -A # <füge alle files hinzu
git commit -a -m "fix: this is the subject line" -m "This is the body line. Closes #123"
# And the last step is pushing this to your fork
git push -u fork my-feature-branch
src/routes/hydra.ts
Outdated
.catch((err:any) => { | ||
// Something went wrong with the whoami call | ||
logger.error(err) | ||
next(err) | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we apply the return we don't need to catch here because the catch is executed further down.
Co-authored-by: hackerman <[email protected]>
Co-authored-by: hackerman <[email protected]>
Co-authored-by: hackerman <[email protected]>
Co-authored-by: hackerman <[email protected]>
I also encounter redirect loop on Jeremy's fork from time to time until I delete EVERYTHING from browser. Everything - because I have no idea which domain keeps an outdated cookie. I think that it's Hydra's one. |
Oh, I've got it! Redirect loop goes away when I restart Hydra sample auth which I use for testing. So probably it's the app itself storing session. |
refactor: clean up code base and resolve issues
# Conflicts: # package-lock.json # package.json # src/index.ts
# Conflicts: # src/routes/auth.ts
# Conflicts: # src/routes/auth.ts # src/routes/error.ts # src/routes/recovery.ts # src/routes/settings.ts # src/routes/verification.ts
@k9ert I'm trying this branch in my domain-based environment and always getting strange redirect related errors similar to what I've already fixed in /session/whoami Kratos request. At first I've got errors with Kratos. After entering password it shows an error with request/response description and a subject of an error is actually return of 302 redirect.
As You can see it's 307 and not 302. It is definitely not Traefik. |
I think your problem is a duplicate
which causes a redirect. Most likely coming from a misconfigured env var or something. |
Definitely yes. I was inconsiderate. |
…a-1.8.5 (#108) Also removed all unnecessary deltas over master. Based on previous commits in hydra-integration branch by: - Kim Neunert <[email protected]> - Jeremy Bogle <[email protected]> - hackerman <[email protected]> - Alexander Konotop <[email protected]> Other squashed commit messages: - preliminary ORY Hydra integration (#50) - fix: redirect issues for hydra integration in domain (not port) based env (#68) See #67
…a-1.10.6 (ory#108) Also removed all unnecessary deltas over master. Based on previous commits in hydra-integration branch by: - Kim Neunert <[email protected]> - Jeremy Bogle <[email protected]> - hackerman <[email protected]> - Alexander Konotop <[email protected]> Other squashed commit messages: - preliminary ORY Hydra integration (ory#50) - fix: redirect issues for hydra integration in domain (not port) based env (ory#68) See ory#67
…a-1.10.6 (ory#108) Also removed all unnecessary deltas over master. Based on previous commits in hydra-integration branch by: - Kim Neunert <[email protected]> - Jeremy Bogle <[email protected]> - hackerman <[email protected]> - Alexander Konotop <[email protected]> Other squashed commit messages: - preliminary ORY Hydra integration (ory#50) - fix: redirect issues for hydra integration in domain (not port) based env (ory#68) See ory#67
This feature allows Ory Kratos to act as a login provider for Ory Hydra using the `oauth2_provider.url` configuration value. Closes #273 Closes #2293 See ory/kratos-selfservice-ui-node#50 See ory/kratos-selfservice-ui-node#68 See ory/kratos-selfservice-ui-node#108 See ory/kratos-selfservice-ui-node#111 See ory/kratos-selfservice-ui-node#149 See ory/kratos-selfservice-ui-node#170 See ory/kratos-selfservice-ui-node#198 See ory/kratos-selfservice-ui-node#207
This feature allows Ory Kratos to act as a login provider for Ory Hydra using the `oauth2_provider.url` configuration value. Closes ory#273 Closes ory#2293 See ory/kratos-selfservice-ui-node#50 See ory/kratos-selfservice-ui-node#68 See ory/kratos-selfservice-ui-node#108 See ory/kratos-selfservice-ui-node#111 See ory/kratos-selfservice-ui-node#149 See ory/kratos-selfservice-ui-node#170 See ory/kratos-selfservice-ui-node#198 See ory/kratos-selfservice-ui-node#207
Related issue
Having Kratos as the user-DB for Hydra is quite useful. This PR is based on code from @jpbogle announcing his work here:
https://community.ory.sh/t/ory-hydra-with-ory-kratos-as-idp/1845
Also related is this issue:
ory/kratos#273
@aeneasr
Proposed changes
More details and discussions in the forum:
https://community.ory.sh/t/ory-hydra-with-ory-kratos-as-idp/1845
UPDATE:

Here is a sequence-diagram of how this is supposed to work. Note that an integrated registration-flow is not possible in the PR.
Although it increased the complexity of the diagram, i've included redirect-arrows back to the browser and used to them to show when and which cookies are set.
Checklist
vulnerability. If this pull request addresses a security vulnerability, I
confirm that I got green light (please contact
[email protected]) from the maintainers to push
the changes.
Further comments
Removing the necessity for a cookie might be a quite good idea.
UPDATE: cookies no longer necessary.