Skip to content
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

poc: ldap integration #283

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

poc: ldap integration #283

wants to merge 1 commit into from

Conversation

nsklikas
Copy link
Contributor

@nsklikas nsklikas commented Sep 20, 2024

PoC for using Hydra to integrate ldap with Kratos.

The werther project is used to bridge Hydra and LDAP servers. The project is unmaintained, but it proves that it shouldn't be very hard to implement this functionality.

Werther was using the hydra sdk v1, so I had to make some changes to the code (see here)

As discussed, the proposed architecture uses a 2nd hydra server (using different cookie names) that runs behind Kratos that is used to talk with LDAP.

To try the flow, you need to run:

$ docker compose  up --remove-orphans --force-recreate

When everything is up and running you can try to login via hydra, to do this you can use this script:

code_client=$(hydra create client \
  --endpoint http://localhost:4445 \
  --grant-type authorization_code,refresh_token,urn:ietf:params:oauth:grant-type:device_code \
  --response-type code \
  --format json \
  --scope openid,offline_access,email,profile \
  --redirect-uri http://127.0.0.1:4446/callback \
)
hydra perform authorization-code \
  --endpoint http://localhost:4444 \
  --client-id `echo "$code_client" | yq .client_id` \
  --client-secret  `echo "$code_client" | yq .client_secret` \
  --scope openid,profile,email,offline_access \
  --redirect http://127.0.0.1:4446/callback

To login with LDAP you can use:
username: aaa
password: 123

The user attributes can be found at https://github.com/canonical/identity-platform-login-ui/blob/IAM-1015/docker/ldap/ldap.ldif

@nsklikas nsklikas added the nomerge Review ready but not mergeable label Sep 20, 2024
@nsklikas nsklikas requested a review from a team as a code owner September 20, 2024 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nomerge Review ready but not mergeable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants