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

Don't work on KeyCloak 20.0.3 #1

Open
Andrew140992 opened this issue Apr 17, 2023 · 2 comments
Open

Don't work on KeyCloak 20.0.3 #1

Andrew140992 opened this issue Apr 17, 2023 · 2 comments

Comments

@Andrew140992
Copy link

Hello!
I am trying to set up extension and use it on version KeyCloak 20.0.3 but it doesn't work.

About server:
image

What I do step by step:

  1. Building a jar with "mvn clean install"
    image
  2. I place the artifact at /opt/bitnami/keycloak/providers/test.jar. After launch Keycloak everything is displayed correctly:
    image
  3. I create realm (clear) and client (factor) with service accounts enable toggle
    image
  4. Using postman I make a request to the url "https://kk.local/admin/realms/clear/manage-2fa/"user-id"/generate-2fa" and get 404 error
    image

Why does the api call not work and i get an error?
At what stage did I make a mistake when installing the extension?
Could you give me a more detailed manual?

Thank you!

@tozzi21
Copy link
Contributor

tozzi21 commented Apr 17, 2023 via email

@stale-vegait
Copy link

stale-vegait commented Jun 14, 2023

@Andrew140992
Before you are able to call the API you need to add a ream role "manage-2fa" and assign it to the "factor" client service account.

The url is also wrong. What you are missing is part of the url that represent the provider "two_factor_auth" in your case:
https://kk.local/**auth**/realms/clear/**two_factor_auth**/manage-2fa/userid/generate-2fa
also it's auth not admin.

Optionally:
In Keycloak 21 one of the API's is deprecated. So instead of:
final CredentialModel credentialModel = session.userCredentialManager().getStoredCredentialByNameAndType(realm, user, submission.getDeviceName(), OTPCredentialModel.TYPE);
put:
final CredentialModel credentialModel = user.credentialManager().getStoredCredentialByNameAndType(submission.getDeviceName(), OTPCredentialModel.TYPE);

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants