-
Notifications
You must be signed in to change notification settings - Fork 0
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
✨ Use HTTP API for userli user lookup #22
Conversation
5f4f5b2
to
da4865a
Compare
pom.xml
Outdated
@@ -24,12 +24,36 @@ | |||
<version>${version.keycloak}</version> | |||
<scope>provided</scope> | |||
</dependency> | |||
<dependency> |
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.
These dependencies are not needed. Also, the Jakarta Sodium dependencies can be safely removed.
pom.xml
Outdated
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>1.18.32</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> |
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.
This can also be removed as we need the logging only for development purposes.
public String REALM_DOMAIN = "userliRealmDomain"; | ||
public String BASE_URL = "userliBaseUrl"; | ||
public String KEYCLOAK_API_TOKEN = "userliKeycloakToken"; |
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.
public String REALM_DOMAIN = "userliRealmDomain"; | |
public String BASE_URL = "userliBaseUrl"; | |
public String KEYCLOAK_API_TOKEN = "userliKeycloakToken"; | |
public final String REALM_DOMAIN = "userliRealmDomain"; | |
public final String BASE_URL = "userliBaseUrl"; | |
public final String KEYCLOAK_API_TOKEN = "userliKeycloakToken"; |
Constants should be final to ensure they cannot be modified.
@@ -0,0 +1,34 @@ | |||
package org.systemli.keycloak; |
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.
This interface only makes sense when we would expose an API in Keycloak, which we don't do. So this makes no sense here.
.auth(keycloakApiToken) | ||
.asResponse(); | ||
if (response.getStatus() == 404) { | ||
throw new WebApplicationException(response.getStatus()); |
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.
This exception is the only reason why we still need the Jakarta package. So I would recommend creating an exception on our own.
@Override | ||
@SneakyThrows | ||
public Boolean validate(String email, String password) { | ||
log.warn("UserliUserClientSimpleHttp validate: User with email '{}' and password '{}' tries to login", email, password); |
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.
log.warn("UserliUserClientSimpleHttp validate: User with email '{}' and password '{}' tries to login", email, password); |
Security! :-)
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.
Haha ouch, this was a debugging leftover 🙈
return ProviderConfigurationBuilder.create() | ||
.property(Constants.REALM_DOMAIN, "Realm domain", "Limit users to this domain", ProviderConfigProperty.STRING_TYPE, "", null) | ||
.property(Constants.BASE_URL, "Base URL", "Base URL of the API", ProviderConfigProperty.STRING_TYPE, "", null) | ||
.property(Constants.KEYCLOAK_API_TOKEN, "Keycloak API token", "Token for the userli keycloak API", ProviderConfigProperty.STRING_TYPE, "", null) |
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.
.property(Constants.KEYCLOAK_API_TOKEN, "Keycloak API token", "Token for the userli keycloak API", ProviderConfigProperty.STRING_TYPE, "", null) | |
.property(Constants.API_TOKEN, "API token", "Token for the userli keycloak API", ProviderConfigProperty.STRING_TYPE, "", null) |
Would call that only API token.
This requires systemli/userli#595