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

add Keycloak provider #2485

Merged
merged 4 commits into from Aug 23, 2021
Merged

add Keycloak provider #2485

merged 4 commits into from Aug 23, 2021

Conversation

bbigras
Copy link
Contributor

@bbigras bbigras commented Aug 5, 2021

Reasoning 💡

Add a Keycloak provider.

I tested with a self-hosted Keycloak.

I based this PR on the auth0 provider.

I was first wondering if it was possible in #2411 (comment).

Checklist 🧢

  • Documentation
  • Tests
  • Ready to be merged

Affected issues 🎟

Related: #1261

@vercel
Copy link

vercel bot commented Aug 5, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/nextauthjs/next-auth/8Rrr2Nv7aWb8AipCyYN1sRcfF8si
✅ Preview: https://next-auth-git-fork-bbigras-keycloak-nextauthjs.vercel.app

@vercel vercel bot temporarily deployed to Preview August 5, 2021 05:34 Inactive
@github-actions github-actions bot added core Refers to `@auth/core` documentation Relates to documentation providers labels Aug 5, 2021
@balazsorban44
Copy link
Member

Awesome, so I assume you were able to get it to work! 🎉 I will have a closer look. From now on, I will want us to enforce stricter defaults for built-in providers for consistency, and I also want to see if we can get an account on the provider platform for testing purposes before merging. But this looks promising.

@bbigras
Copy link
Contributor Author

bbigras commented Aug 5, 2021

so I assume you were able to get it to work!

Yep, and I just tested with please-open.it.

To reproduce:

  • create client with http://localhost:3000 as the root URL
  • set Access Type to confidential (the secret will be in the credentials tab after save)
  • you can create a user, but when I tested it used mine as I was already logged.

KEYCLOAK_ISSUER=https://app.please-open.it/auth/realms/<realm_id>

@masone
Copy link

masone commented Aug 17, 2021

Apart from testing this in our stack, is there something we can do to help moving this forward?

@balazsorban44
Copy link
Member

balazsorban44 commented Aug 17, 2021

I just want to have a look myself before merging. Just use the source code as a custom provider if you need this already. Currently busy with migrating our adapters.

There is also a merge conflict. @bbigras could you address that please?

@vercel vercel bot temporarily deployed to Preview August 18, 2021 14:13 Inactive
@bbigras
Copy link
Contributor Author

bbigras commented Aug 18, 2021

There is also a merge conflict. @bbigras could you address that please?

@balazsorban44 Done. It seems a rebase was enough.

@vercel vercel bot temporarily deployed to Preview August 23, 2021 10:58 Inactive
@vercel vercel bot temporarily deployed to Preview August 23, 2021 20:10 Inactive
@codecov-commenter
Copy link

Codecov Report

Merging #2485 (5a4650d) into next (a9f699f) will decrease coverage by 0.03%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             next    #2485      +/-   ##
==========================================
- Coverage   11.52%   11.48%   -0.04%     
==========================================
  Files          84       85       +1     
  Lines        1319     1323       +4     
  Branches      378      378              
==========================================
  Hits          152      152              
- Misses        970      974       +4     
  Partials      197      197              
Impacted Files Coverage Δ
src/providers/keycloak.js 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a9f699f...5a4650d. Read the comment docs.

Copy link
Member

@balazsorban44 balazsorban44 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, finally got around to check this out! 👍 Looks good, I only had a small comment/suggestion. Other than that, it is good to go!

src/providers/keycloak.js Outdated Show resolved Hide resolved
Co-authored-by: Balázs Orbán <info@balazsorban.com>
@vercel vercel bot temporarily deployed to Preview August 23, 2021 20:34 Inactive
@bbigras
Copy link
Contributor Author

bbigras commented Aug 23, 2021

Done. Do you want me to squash it, or do you want to do it while merging or something?

@balazsorban44 balazsorban44 merged commit eb8ba69 into nextauthjs:next Aug 23, 2021
@balazsorban44
Copy link
Member

balazsorban44 commented Aug 23, 2021

It's merged! Give me a sec, and I'll release it too.

Here it is: v4.0.0-next.24

@bbigras bbigras deleted the keycloak branch August 24, 2021 14:09
@digzom
Copy link

digzom commented Sep 1, 2021

It's merged! Give me a sec, and I'll release it too.

Here it is: v4.0.0-next.24

@balazsorban44
Is there any forecast when it can be used? Can I download this v4.0.0-next.24 release?

@balazsorban44
Copy link
Member

balazsorban44 commented Sep 1, 2021

Absolutely, npm install next-auth@4.0.0-next.24 😉. Make sure you don't have a caret (^) in the version number in package.json. Had a small trouble with NPM a while ago and there is a buggy 4.0.0 version out unfortunately. 😬 So you have to force the exact version above. This will be solved when we release this into stable.

Check out the migration as well: https://docs-nextauthjs.vercel.app/getting-started/upgrade-v4

@digzom
Copy link

digzom commented Sep 1, 2021

I downloaded the version, but I was trying to use it like the previous versions. Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Refers to `@auth/core` documentation Relates to documentation providers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants