io.github.kilmajster.keycloak.utils.UserAttributeLabelGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of keycloak-username-password-attribute-authenticator Show documentation
Show all versions of keycloak-username-password-attribute-authenticator Show documentation
Default Keycloak login form with additional user attribute validation️
package io.github.kilmajster.keycloak.utils;
public final class UserAttributeLabelGenerator {
public static String from(final String attributeName) {
final String lowercaseWithSpaces = attributeName
.toLowerCase()
.replace("_", " ")
.replace("-", " ");
return capitalizeFirstChar(lowercaseWithSpaces);
}
private static String capitalizeFirstChar(final String lowercaseWithSpaces) {
return lowercaseWithSpaces.substring(0,1).toUpperCase() + lowercaseWithSpaces.substring(1).toLowerCase();
}
}