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

Service Accounts #110

Open
omid opened this issue Apr 24, 2024 · 0 comments
Open

Service Accounts #110

omid opened this issue Apr 24, 2024 · 0 comments

Comments

@omid
Copy link
Contributor

omid commented Apr 24, 2024

To continue the discussion here and here...

AFAIK, the main grant_types for this case are password and client_credentials.

For password, based on this article, we need username and password mostly. We can send client_id but in this case, we need to send client_secret (Either in query param or HTTP Basic Auth header). In Keycloak, if the client is confidential, then we need all 4 params.

For client_credentials, based on this, we need to send client_id and client_secret (Either in query param or HTTP Basic Auth header).

The current implementation is like this:

let response = client
            .post(&format!(
                "{url}/realms/{realm}/protocol/openid-connect/token",
            ))
            .form(&json!({
                "username": username,
                "password": password,
                "client_id": client_id,
                "grant_type": grant_type
            }))
            .send()
            .await?;

So we lack client_secret here. And the whole logic to choose between grant_types is missing. Or we need to remove client_id from here, since we have another struct (KeycloakServiceAccountAdminTokenRetriever) for this or any other solution.

And also it can be better to have an enum for grant_types, instead of just a string.

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

1 participant