diff --git a/common/src/main/java/org/keycloak/common/Version.java b/common/src/main/java/org/keycloak/common/Version.java index 73c4959665..895eda5b4c 100755 --- a/common/src/main/java/org/keycloak/common/Version.java +++ b/common/src/main/java/org/keycloak/common/Version.java @@ -12,6 +12,8 @@ import java.util.Properties; */ public class Version { public static final String UNKNOWN = "UNKNOWN"; + public static String NAME; + public static String NAME_HTML; public static String VERSION; public static String RESOURCES_VERSION; public static String BUILD_TIME; @@ -21,6 +23,8 @@ public class Version { InputStream is = Version.class.getResourceAsStream("/keycloak-version.properties"); try { props.load(is); + Version.NAME = props.getProperty("name"); + Version.NAME_HTML = props.getProperty("name-html"); Version.VERSION = props.getProperty("version"); Version.BUILD_TIME = props.getProperty("build-time"); Version.RESOURCES_VERSION = Version.VERSION.toLowerCase(); diff --git a/common/src/main/resources/keycloak-version.properties b/common/src/main/resources/keycloak-version.properties index fa367b82b5..7ef5089ebe 100755 --- a/common/src/main/resources/keycloak-version.properties +++ b/common/src/main/resources/keycloak-version.properties @@ -1,2 +1,4 @@ +name=${product.name} +name-html=${product.name-html} version=${product.version} build-time=${product.build-time} \ No newline at end of file diff --git a/core/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java b/core/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java index cc57124991..3359f2195f 100755 --- a/core/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java +++ b/core/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java @@ -9,6 +9,8 @@ import java.util.*; public class RealmRepresentation { protected String id; protected String realm; + protected String displayName; + protected String displayNameHtml; protected Integer notBefore; protected Boolean revokeRefreshToken; protected Integer accessTokenLifespan; @@ -129,6 +131,22 @@ public class RealmRepresentation { this.realm = realm; } + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public String getDisplayNameHtml() { + return displayNameHtml; + } + + public void setDisplayNameHtml(String displayNameHtml) { + this.displayNameHtml = displayNameHtml; + } + public List getUsers() { return users; } diff --git a/forms/common-themes/src/main/resources/theme/base/admin/messages/admin-messages_en.properties b/forms/common-themes/src/main/resources/theme/base/admin/messages/admin-messages_en.properties index f33d6b835a..ca128ccaa8 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/messages/admin-messages_en.properties +++ b/forms/common-themes/src/main/resources/theme/base/admin/messages/admin-messages_en.properties @@ -1,6 +1,8 @@ # Common messages enabled=Enabled name=Name +displayName=Display name +displayNameHtml=HTML Display name save=Save cancel=Cancel onText=ON diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html index d39ba1403b..19561ea5d6 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html @@ -9,6 +9,20 @@ +
+ +
+ +
+
+ +
+ +
+ +
+
+
diff --git a/forms/common-themes/src/main/resources/theme/base/login/login-idp-link-email.ftl b/forms/common-themes/src/main/resources/theme/base/login/login-idp-link-email.ftl index 0ba068603c..5dc29f1c11 100644 --- a/forms/common-themes/src/main/resources/theme/base/login/login-idp-link-email.ftl +++ b/forms/common-themes/src/main/resources/theme/base/login/login-idp-link-email.ftl @@ -6,7 +6,7 @@ ${msg("emailLinkIdpTitle", idpAlias)} <#elseif section = "form">

- ${msg("emailLinkIdp1", idpAlias, brokerContext.username, realm.name)} + ${msg("emailLinkIdp1", idpAlias, brokerContext.username, realm.displayName)}

${msg("emailLinkIdp2")} ${msg("doClickHere")} ${msg("emailLinkIdp3")} diff --git a/forms/common-themes/src/main/resources/theme/base/login/login-oauth-grant.ftl b/forms/common-themes/src/main/resources/theme/base/login/login-oauth-grant.ftl index 2d596d09e4..edafc660e0 100755 --- a/forms/common-themes/src/main/resources/theme/base/login/login-oauth-grant.ftl +++ b/forms/common-themes/src/main/resources/theme/base/login/login-oauth-grant.ftl @@ -3,7 +3,7 @@ <#if section = "title"> ${msg("oauthGrantTitle")} <#elseif section = "header"> - ${msg("oauthGrantTitleHtml",(realm.name!''))} <#if client.name??>${advancedMsg(client.name)}<#else>${client.clientId}. + ${msg("oauthGrantTitleHtml",(realm.displayNameHtml!''))} <#if client.name??>${advancedMsg(client.name)}<#else>${client.clientId}. <#elseif section = "form">

${msg("oauthGrantRequest")}

diff --git a/forms/common-themes/src/main/resources/theme/base/login/login-totp.ftl b/forms/common-themes/src/main/resources/theme/base/login/login-totp.ftl index 3f46b76ba1..12cda214ec 100755 --- a/forms/common-themes/src/main/resources/theme/base/login/login-totp.ftl +++ b/forms/common-themes/src/main/resources/theme/base/login/login-totp.ftl @@ -1,9 +1,9 @@ <#import "template.ftl" as layout> <@layout.registrationLayout; section> <#if section = "title"> - ${msg("loginTitle",realm.name)} + ${msg("loginTitle",realm.displayName)} <#elseif section = "header"> - ${msg("loginTitleHtml",realm.name)} + ${msg("loginTitleHtml",realm.displayNameHtml)} <#elseif section = "form">
diff --git a/forms/common-themes/src/main/resources/theme/base/login/login.ftl b/forms/common-themes/src/main/resources/theme/base/login/login.ftl index 5786807722..840bf4e135 100755 --- a/forms/common-themes/src/main/resources/theme/base/login/login.ftl +++ b/forms/common-themes/src/main/resources/theme/base/login/login.ftl @@ -1,9 +1,9 @@ <#import "template.ftl" as layout> <@layout.registrationLayout displayInfo=social.displayInfo; section> <#if section = "title"> - ${msg("loginTitle",(realm.name!''))} + ${msg("loginTitle",(realm.displayName!''))} <#elseif section = "header"> - ${msg("loginTitleHtml",(realm.name!''))} + ${msg("loginTitleHtml",(realm.displayNameHtml!''))} <#elseif section = "form"> <#if realm.password> diff --git a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_ca.properties b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_ca.properties index 55ccb7b24f..720e73ee6d 100644 --- a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_ca.properties +++ b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_ca.properties @@ -15,9 +15,9 @@ kerberosNotConfiguredTitle=Kerberos no configurat bypassKerberosDetail=O b\u00E9 no est\u00E0s identificat mitjan\u00E7ant Kerberos o el teu navegador no est\u00E0 configurat per identificar-se mitjan\u00E7ant Kerberos. Si us plau fes clic per identificar-te per un altre mitj\u00E0. kerberosNotSetUp=Kerberos no est\u00E0 configurat. No pots identificar-te. registerWithTitle=Registra''t amb {0} -registerWithTitleHtml=Registra''t amb {0} +registerWithTitleHtml={0} loginTitle=Inicia sessi\u00F3 a {0} -loginTitleHtml=Inicia sessi\u00F3 a {0} +loginTitleHtml={0} impersonateTitle={0}\u00A0Personifica Usuari impersonateTitleHtml={0} Personifica Usuari realmChoice=Domini @@ -26,7 +26,7 @@ loginTotpTitle=Configura la teva aplicaci\u00F3 d''identificaci\u00F3 m\u00F2bil loginProfileTitle=Actualitza la informaci\u00F3 del teu compte loginTimeout=Has trigat massa a identificar-te. Inicia de nou la identificaci\u00F3. oauthGrantTitle=Concessi\u00F3 OAuth -oauthGrantTitleHtml=Acc\u00E9s temporal per {0} sol\u00B7licitat per +oauthGrantTitleHtml={0} errorTitle=Ho sentim... errorTitleHtml=Ho sentim... emailVerifyTitle=Verificaci\u00F3 de l''email diff --git a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_de.properties b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_de.properties index d968379dcc..2d96a2c495 100644 --- a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_de.properties +++ b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_de.properties @@ -19,9 +19,9 @@ recaptchaNotConfigured=Recaptcha is required, but not configured consentDenied=Consent denied. registerWithTitle=Registrierung bei {0} -registerWithTitleHtml=Registrierung bei {0} +registerWithTitleHtml={0} loginTitle=Anmeldung bei {0} -loginTitleHtml=Anmeldung bei {0} +loginTitleHtml={0} loginOauthTitle= loginOauthTitleHtml=Tempor\u00E4rer zugriff auf {0} angefordert von {1}. loginTotpTitle=Mobile Authentifizierung Einrichten @@ -32,7 +32,7 @@ impersonateTitleHtml={0} Impersonate User unknownUser=Unknown user realmChoice=Realm oauthGrantTitle=OAuth gew\u00E4hren -oauthGrantTitleHtml=Tempor\u00E4rer zugriff auf {0} angefordert von +oauthGrantTitleHtml={0} errorTitle=Es tut uns leid... errorTitleHtml=Es tut uns leid... emailVerifyTitle=E-Mail verifizieren diff --git a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_en.properties b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_en.properties index b1b5890d6e..4b5df27367 100644 --- a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_en.properties +++ b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_en.properties @@ -15,9 +15,9 @@ kerberosNotConfiguredTitle=Kerberos Not Configured bypassKerberosDetail=Either you are not logged in via Kerberos or your browser is not set up for Kerberos login. Please click continue to login in through other means kerberosNotSetUp=Kerberos is not set up. You cannot login. registerWithTitle=Register with {0} -registerWithTitleHtml=Register with {0} +registerWithTitleHtml={0} loginTitle=Log in to {0} -loginTitleHtml=Log in to {0} +loginTitleHtml={0} impersonateTitle={0} Impersonate User impersonateTitleHtml={0} Impersonate User realmChoice=Realm @@ -25,8 +25,8 @@ unknownUser=Unknown user loginTotpTitle=Mobile Authenticator Setup loginProfileTitle=Update Account Information loginTimeout=You took too long to login. Login process starting from beginning. -oauthGrantTitle=OAuth Grant -oauthGrantTitleHtml=Temporary access for {0} requested by +oauthGrantTitle=Grant Access +oauthGrantTitleHtml={0} errorTitle=We''re sorry... errorTitleHtml=We''re sorry ... emailVerifyTitle=Email verification diff --git a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_es.properties b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_es.properties index f497d07ce7..a42f7d2480 100644 --- a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_es.properties +++ b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_es.properties @@ -15,9 +15,9 @@ kerberosNotConfiguredTitle=Kerberos no configurado bypassKerberosDetail=O bien no est\u00E1s identificado mediante Kerberos o tu navegador no est\u00E1 configurado para identificarse mediante Kerberos. Por favor haz clic para identificarte por otro medio. kerberosNotSetUp=Kerberos no est\u00E1 configurado. No puedes identificarte. registerWithTitle=Reg\u00EDstrate con {0} -registerWithTitleHtml=Reg\u00EDstrate con {0} +registerWithTitleHtml={0} loginTitle=Inicia sesi\u00F3n en {0} -loginTitleHtml=Inicia sesi\u00F3n en {0} +loginTitleHtml={0} impersonateTitle={0}\u00A0Personificar Usuario impersonateTitleHtml={0} Personificar Usuario realmChoice=Dominio @@ -26,7 +26,7 @@ loginTotpTitle=Configura tu aplicaci\u00F3n de identificaci\u00F3n m\u00F3vil loginProfileTitle=Actualiza la informaci\u00F3n de tu cuenta loginTimeout=Has tardado demasiado en identificarte. Inicia de nuevo la identificaci\u00F3n. oauthGrantTitle=Concesi\u00F3n OAuth -oauthGrantTitleHtml=Acceso temporal para {0} solicitado por +oauthGrantTitleHtml={0} errorTitle=Lo sentimos... errorTitleHtml=Lo sentimos... emailVerifyTitle=Verificaci\u00F3n del email diff --git a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_fr.properties b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_fr.properties index 495dde695d..662e9d940a 100644 --- a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_fr.properties +++ b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_fr.properties @@ -15,9 +15,9 @@ kerberosNotConfiguredTitle=Kerberos non configur\u00e9 bypassKerberosDetail=Si vous n''\u00eates pas connect\u00e9 via Kerberos ou bien que votre navigateur n''est pas configur\u00e9 pour la connexion via Kerberos. Veuillez cliquer pour vous connecter via un autre moyen. kerberosNotSetUp=Kerberos n''est pas configur\u00e9. Connexion impossible. registerWithTitle=Enregistrement avec {0} -registerWithTitleHtml=Enregistrement avec {0} +registerWithTitleHtml={0} loginTitle=Se connecter \u00e0 {0} -loginTitleHtml=Se connecter \u00e0 {0} +loginTitleHtml={0} impersonateTitle={0} utilisateur impersonate impersonateTitleHtml={0} utilisateur impersonate realmChoice=Domaine @@ -26,7 +26,7 @@ loginTotpTitle=Configuration de l''authentification par mobile loginProfileTitle=Mise \u00e0 jour du compte loginTimeout=Le temps imparti pour la connexion est \u00e9coul\u00e9. Le processus de connexion red\u00e9marre depuis le d\u00e9but. oauthGrantTitle=OAuth Grant -oauthGrantTitleHtml=Acc\u00e8s temporaire pour {0} demand\u00e9 par +oauthGrantTitleHtml={0} errorTitle=Nous sommes d\u00e9sol\u00e9 ... errorTitleHtml=Nous sommes d\u00e9sol\u00e9 ... emailVerifyTitle=V\u00e9rification du courriel diff --git a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_it.properties b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_it.properties index 026c7a4fa2..0fd7d99d0e 100644 --- a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_it.properties +++ b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_it.properties @@ -19,9 +19,9 @@ recaptchaNotConfigured=Recaptcha is required, but not configured consentDenied=Consent denied. registerWithTitle=Registrati come {0} -registerWithTitleHtml=Registrati come {0} +registerWithTitleHtml={0} loginTitle=Accedi a {0} -loginTitleHtml=Accedi a {0} +loginTitleHtml={0} loginTotpTitle=Configura Autenticazione Mobile loginProfileTitle=Aggiorna Profilo loginTimeout=You took too long to login. Login process starting from beginning. @@ -30,7 +30,7 @@ impersonateTitleHtml={0} Impersonate User unknownUser=Unknown user realmChoice=Realm oauthGrantTitle=OAuth Grant -oauthGrantTitleHtml=Accesso temporaneo per {0} richiesto da +oauthGrantTitleHtml={0} errorTitle=Siamo spiacenti... errorTitleHtml=Siamo spiacenti ... emailVerifyTitle=Verifica Email diff --git a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_pt_BR.properties b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_pt_BR.properties index 7c44eeb89f..a1441202bd 100644 --- a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_pt_BR.properties +++ b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_pt_BR.properties @@ -15,9 +15,9 @@ kerberosNotConfiguredTitle=Kerberos N\u00E3o Configurado bypassKerberosDetail=Ou voc\u00EA n\u00E3o est\u00E1 logado via Kerberos ou o seu navegador n\u00E3o est\u00E1 configurado para login Kerberos. Por favor, clique em continuar para fazer o login no atrav\u00E9s de outros meios kerberosNotSetUp=Kerberos n\u00E3o est\u00E1 configurado. Voc\u00EA n\u00E3o pode acessar. registerWithTitle=Registre-se com {0} -registerWithTitleHtml=Registre-se com {0} +registerWithTitleHtml={0} loginTitle=Entrar em {0} -loginTitleHtml=Entrar em {0} +loginTitleHtml={0} impersonateTitle={0} Impersonate User impersonateTitleHtml={0} Impersonate User realmChoice=Realm @@ -26,7 +26,7 @@ loginTotpTitle=Configura\u00E7\u00E3o do autenticador mobile loginProfileTitle=Atualiza\u00E7\u00E3o das Informa\u00E7\u00F5es da Conta loginTimeout=Voc\u00EA demorou muito para entrar. Por favor, refa\u00E7a o processo de login a partir do in\u00EDcio. oauthGrantTitle=Concess\u00E3o OAuth -oauthGrantTitleHtml=Acesso tempor\u00E1rio para {0} solicitado pela +oauthGrantTitleHtml={0} errorTitle=N\u00F3s lamentamos... errorTitleHtml=N\u00F3s lamentamos ... emailVerifyTitle=Verifica\u00E7\u00E3o de e-mail diff --git a/forms/common-themes/src/main/resources/theme/base/login/register.ftl b/forms/common-themes/src/main/resources/theme/base/login/register.ftl index d1593daedf..18a01cff17 100755 --- a/forms/common-themes/src/main/resources/theme/base/login/register.ftl +++ b/forms/common-themes/src/main/resources/theme/base/login/register.ftl @@ -1,9 +1,9 @@ <#import "template.ftl" as layout> <@layout.registrationLayout; section> <#if section = "title"> - ${msg("registerWithTitle",(realm.name!''))} + ${msg("registerWithTitle",(realm.displayName!''))} <#elseif section = "header"> - ${msg("registerWithTitleHtml",(realm.name!''))} + ${msg("registerWithTitleHtml",(realm.displayNameHtml!''))} <#elseif section = "form"> <#if !realm.registrationEmailAsUsername> diff --git a/forms/common-themes/src/main/resources/theme/base/login/template.ftl b/forms/common-themes/src/main/resources/theme/base/login/template.ftl index aca358fd4c..a637969419 100755 --- a/forms/common-themes/src/main/resources/theme/base/login/template.ftl +++ b/forms/common-themes/src/main/resources/theme/base/login/template.ftl @@ -29,7 +29,7 @@ - +
diff --git a/forms/common-themes/src/main/resources/theme/keycloak/login/resources/css/login.css b/forms/common-themes/src/main/resources/theme/keycloak/login/resources/css/login.css index 8f09a97946..f951c1d3eb 100644 --- a/forms/common-themes/src/main/resources/theme/keycloak/login/resources/css/login.css +++ b/forms/common-themes/src/main/resources/theme/keycloak/login/resources/css/login.css @@ -74,11 +74,12 @@ #kc-logo-wrapper { background-image: url("../img/keycloak-logo.png"); background-repeat: no-repeat; - background-position: top right; + position: absolute; + top: 50px; + right: 50px; height: 37px; - - margin: 50px; + width: 154px; } #kc-header { @@ -281,8 +282,8 @@ ol#kc-totp-settings li:first-of-type { @media (max-width: 767px) { #kc-logo-wrapper { - margin-top: 30px; - margin-right: 15px; + top: 15px; + right: 15px; } #kc-header { diff --git a/forms/common-themes/src/main/resources/theme/keycloak/login/theme.properties b/forms/common-themes/src/main/resources/theme/keycloak/login/theme.properties index 7319690b4b..b2364e1427 100644 --- a/forms/common-themes/src/main/resources/theme/keycloak/login/theme.properties +++ b/forms/common-themes/src/main/resources/theme/keycloak/login/theme.properties @@ -6,6 +6,8 @@ meta=viewport==width=device-width,initial-scale=1 kcHtmlClass=login-pf +kcLogoLink=http://www.keycloak.org + kcContentClass=col-sm-12 col-md-12 col-lg-12 container kcContentWrapperClass=row diff --git a/forms/login-freemarker/src/main/java/org/keycloak/login/freemarker/model/RealmBean.java b/forms/login-freemarker/src/main/java/org/keycloak/login/freemarker/model/RealmBean.java index e6ae21de98..027a2c2b0b 100755 --- a/forms/login-freemarker/src/main/java/org/keycloak/login/freemarker/model/RealmBean.java +++ b/forms/login-freemarker/src/main/java/org/keycloak/login/freemarker/model/RealmBean.java @@ -42,6 +42,24 @@ public class RealmBean { return realm.getName(); } + public String getDisplayName() { + String displayName = realm.getDisplayName(); + if (displayName != null && displayName.length() > 0) { + return displayName; + } else { + return getName(); + } + } + + public String getDisplayNameHtml() { + String displayNameHtml = realm.getDisplayNameHtml(); + if (displayNameHtml != null && displayNameHtml.length() > 0) { + return displayNameHtml; + } else { + return getDisplayName(); + } + } + public boolean isIdentityFederationEnabled() { return realm.isIdentityFederationEnabled(); } diff --git a/model/api/src/main/java/org/keycloak/models/RealmModel.java b/model/api/src/main/java/org/keycloak/models/RealmModel.java index 3e50b737d5..c0aa05f077 100755 --- a/model/api/src/main/java/org/keycloak/models/RealmModel.java +++ b/model/api/src/main/java/org/keycloak/models/RealmModel.java @@ -35,6 +35,14 @@ public interface RealmModel extends RoleContainerModel { void setName(String name); + String getDisplayName(); + + void setDisplayName(String displayName); + + String getDisplayNameHtml(); + + void setDisplayNameHtml(String displayNameHtml); + boolean isEnabled(); void setEnabled(boolean enabled); diff --git a/model/api/src/main/java/org/keycloak/models/entities/RealmEntity.java b/model/api/src/main/java/org/keycloak/models/entities/RealmEntity.java index 7a08bca7fb..69fdeaef15 100755 --- a/model/api/src/main/java/org/keycloak/models/entities/RealmEntity.java +++ b/model/api/src/main/java/org/keycloak/models/entities/RealmEntity.java @@ -11,6 +11,8 @@ import java.util.Map; public class RealmEntity extends AbstractIdentifiableEntity { private String name; + private String displayName; + private String displayNameHtml; private boolean enabled; private String sslRequired; private boolean registrationAllowed; @@ -105,6 +107,22 @@ public class RealmEntity extends AbstractIdentifiableEntity { this.name = name; } + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public String getDisplayNameHtml() { + return displayNameHtml; + } + + public void setDisplayNameHtml(String displayNameHtml) { + this.displayNameHtml = displayNameHtml; + } + public boolean isEnabled() { return enabled; } diff --git a/model/api/src/main/java/org/keycloak/models/utils/ModelToRepresentation.java b/model/api/src/main/java/org/keycloak/models/utils/ModelToRepresentation.java index e891582a63..a18d0f8097 100755 --- a/model/api/src/main/java/org/keycloak/models/utils/ModelToRepresentation.java +++ b/model/api/src/main/java/org/keycloak/models/utils/ModelToRepresentation.java @@ -164,6 +164,8 @@ public class ModelToRepresentation { RealmRepresentation rep = new RealmRepresentation(); rep.setId(realm.getId()); rep.setRealm(realm.getName()); + rep.setDisplayName(realm.getDisplayName()); + rep.setDisplayNameHtml(realm.getDisplayNameHtml()); rep.setEnabled(realm.isEnabled()); rep.setNotBefore(realm.getNotBefore()); rep.setSslRequired(realm.getSslRequired().name().toLowerCase()); diff --git a/model/api/src/main/java/org/keycloak/models/utils/RepresentationToModel.java b/model/api/src/main/java/org/keycloak/models/utils/RepresentationToModel.java index 2d99c3b2a3..2432fc1274 100755 --- a/model/api/src/main/java/org/keycloak/models/utils/RepresentationToModel.java +++ b/model/api/src/main/java/org/keycloak/models/utils/RepresentationToModel.java @@ -85,6 +85,8 @@ public class RepresentationToModel { convertDeprecatedApplications(session, rep); newRealm.setName(rep.getRealm()); + if (rep.getDisplayName() != null) newRealm.setDisplayName(rep.getDisplayName()); + if (rep.getDisplayNameHtml() != null) newRealm.setDisplayNameHtml(rep.getDisplayNameHtml()); if (rep.isEnabled() != null) newRealm.setEnabled(rep.isEnabled()); if (rep.isBruteForceProtected() != null) newRealm.setBruteForceProtected(rep.isBruteForceProtected()); if (rep.getMaxFailureWaitSeconds() != null) newRealm.setMaxFailureWaitSeconds(rep.getMaxFailureWaitSeconds()); @@ -595,6 +597,8 @@ public class RepresentationToModel { if (rep.getRealm() != null) { realm.setName(rep.getRealm()); } + if (rep.getDisplayName() != null) realm.setDisplayName(rep.getDisplayName()); + if (rep.getDisplayNameHtml() != null) realm.setDisplayNameHtml(rep.getDisplayNameHtml()); if (rep.isEnabled() != null) realm.setEnabled(rep.isEnabled()); if (rep.isBruteForceProtected() != null) realm.setBruteForceProtected(rep.isBruteForceProtected()); if (rep.getMaxFailureWaitSeconds() != null) realm.setMaxFailureWaitSeconds(rep.getMaxFailureWaitSeconds()); diff --git a/model/invalidation-cache/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RealmAdapter.java b/model/invalidation-cache/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RealmAdapter.java index e7d15eb862..77ac4306e7 100755 --- a/model/invalidation-cache/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RealmAdapter.java +++ b/model/invalidation-cache/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RealmAdapter.java @@ -59,6 +59,30 @@ public class RealmAdapter implements RealmModel { updated.setName(name); } + @Override + public String getDisplayName() { + if (updated != null) return updated.getDisplayName(); + return cached.getDisplayName(); + } + + @Override + public void setDisplayName(String displayName) { + getDelegateForUpdate(); + updated.setDisplayName(displayName); + } + + @Override + public String getDisplayNameHtml() { + if (updated != null) return updated.getDisplayNameHtml(); + return cached.getDisplayNameHtml(); + } + + @Override + public void setDisplayNameHtml(String displayNameHtml) { + getDelegateForUpdate(); + updated.setDisplayNameHtml(displayNameHtml); + } + @Override public boolean isEnabled() { if (updated != null) return updated.isEnabled(); diff --git a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedRealm.java b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedRealm.java index 40e4851f94..5b0be489bb 100755 --- a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedRealm.java +++ b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedRealm.java @@ -38,6 +38,8 @@ public class CachedRealm implements Serializable { private String id; private String name; + private String displayName; + private String displayNameHtml; private boolean enabled; private SslRequired sslRequired; private boolean registrationAllowed; @@ -125,6 +127,8 @@ public class CachedRealm implements Serializable { public CachedRealm(RealmCache cache, RealmProvider delegate, RealmModel model) { id = model.getId(); name = model.getName(); + displayName = model.getDisplayName(); + displayNameHtml = model.getDisplayNameHtml(); enabled = model.isEnabled(); sslRequired = model.getSslRequired(); registrationAllowed = model.isRegistrationAllowed(); @@ -265,6 +269,14 @@ public class CachedRealm implements Serializable { return name; } + public String getDisplayName() { + return displayName; + } + + public String getDisplayNameHtml() { + return displayNameHtml; + } + public List getDefaultRoles() { return defaultRoles; } diff --git a/model/jpa/src/main/java/org/keycloak/models/jpa/RealmAdapter.java b/model/jpa/src/main/java/org/keycloak/models/jpa/RealmAdapter.java index 1530b12f98..ce72bbac04 100755 --- a/model/jpa/src/main/java/org/keycloak/models/jpa/RealmAdapter.java +++ b/model/jpa/src/main/java/org/keycloak/models/jpa/RealmAdapter.java @@ -21,21 +21,7 @@ import org.keycloak.models.RoleModel; import org.keycloak.models.UserFederationMapperModel; import org.keycloak.models.UserFederationProviderCreationEventImpl; import org.keycloak.models.UserFederationProviderModel; -import org.keycloak.models.jpa.entities.AuthenticationExecutionEntity; -import org.keycloak.models.jpa.entities.AuthenticationFlowEntity; -import org.keycloak.models.jpa.entities.AuthenticatorConfigEntity; -import org.keycloak.models.jpa.entities.ClientEntity; -import org.keycloak.models.jpa.entities.ClientTemplateEntity; -import org.keycloak.models.jpa.entities.GroupEntity; -import org.keycloak.models.jpa.entities.IdentityProviderEntity; -import org.keycloak.models.jpa.entities.IdentityProviderMapperEntity; -import org.keycloak.models.jpa.entities.RealmAttributeEntity; -import org.keycloak.models.jpa.entities.RealmEntity; -import org.keycloak.models.jpa.entities.RequiredActionProviderEntity; -import org.keycloak.models.jpa.entities.RequiredCredentialEntity; -import org.keycloak.models.jpa.entities.RoleEntity; -import org.keycloak.models.jpa.entities.UserFederationMapperEntity; -import org.keycloak.models.jpa.entities.UserFederationProviderEntity; +import org.keycloak.models.jpa.entities.*; import org.keycloak.models.utils.KeycloakModelUtils; import javax.persistence.EntityManager; @@ -98,6 +84,26 @@ public class RealmAdapter implements RealmModel { em.flush(); } + @Override + public String getDisplayName() { + return getAttribute(RealmAttributes.DISPLAY_NAME); + } + + @Override + public void setDisplayName(String displayName) { + setAttribute(RealmAttributes.DISPLAY_NAME, displayName); + } + + @Override + public String getDisplayNameHtml() { + return getAttribute(RealmAttributes.DISPLAY_NAME_HTML); + } + + @Override + public void setDisplayNameHtml(String displayNameHtml) { + setAttribute(RealmAttributes.DISPLAY_NAME_HTML, displayNameHtml); + } + @Override public boolean isEnabled() { return realm.isEnabled(); diff --git a/model/jpa/src/main/java/org/keycloak/models/jpa/entities/RealmAttributes.java b/model/jpa/src/main/java/org/keycloak/models/jpa/entities/RealmAttributes.java new file mode 100644 index 0000000000..ecc8768dca --- /dev/null +++ b/model/jpa/src/main/java/org/keycloak/models/jpa/entities/RealmAttributes.java @@ -0,0 +1,12 @@ +package org.keycloak.models.jpa.entities; + +/** + * @author Stian Thorgersen + */ +public interface RealmAttributes { + + String DISPLAY_NAME = "displayName"; + + String DISPLAY_NAME_HTML = "displayNameHtml"; + +} diff --git a/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java index 6a1a84d0bf..707c9535d0 100755 --- a/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java +++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java @@ -97,6 +97,28 @@ public class RealmAdapter extends AbstractMongoAdapter impleme updateRealm(); } + @Override + public String getDisplayName() { + return realm.getDisplayName(); + } + + @Override + public void setDisplayName(String displayName) { + realm.setDisplayName(displayName); + updateRealm(); + } + + @Override + public String getDisplayNameHtml() { + return realm.getDisplayNameHtml(); + } + + @Override + public void setDisplayNameHtml(String displayNameHtml) { + realm.setDisplayNameHtml(displayNameHtml); + updateRealm(); + } + @Override public boolean isEnabled() { return realm.isEnabled(); diff --git a/pom.xml b/pom.xml index b2038aaf6d..b2aa2f416b 100755 --- a/pom.xml +++ b/pom.xml @@ -19,6 +19,7 @@ Keycloak + \u003Cstrong\u003EKeycloak\u003C\u002Fstrong\u003E ${project.version} ${timestamp} diff --git a/services/src/main/java/org/keycloak/services/managers/ApplianceBootstrap.java b/services/src/main/java/org/keycloak/services/managers/ApplianceBootstrap.java index a868aa8fee..84020166d7 100755 --- a/services/src/main/java/org/keycloak/services/managers/ApplianceBootstrap.java +++ b/services/src/main/java/org/keycloak/services/managers/ApplianceBootstrap.java @@ -2,6 +2,7 @@ package org.keycloak.services.managers; import org.jboss.logging.Logger; import org.keycloak.Config; +import org.keycloak.common.Version; import org.keycloak.common.enums.SslRequired; import org.keycloak.models.AdminRoles; import org.keycloak.models.ClientModel; @@ -39,6 +40,8 @@ public class ApplianceBootstrap { manager.setContextPath(contextPath); RealmModel realm = manager.createRealm(adminRealmName, adminRealmName); realm.setName(adminRealmName); + realm.setDisplayName(Version.NAME); + realm.setDisplayNameHtml(Version.NAME_HTML); realm.setEnabled(true); realm.addRequiredCredential(CredentialRepresentation.PASSWORD); realm.setSsoSessionIdleTimeout(1800); diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/OAuthGrantPage.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/OAuthGrantPage.java index baa1ae9a73..660beb0c07 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/OAuthGrantPage.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/OAuthGrantPage.java @@ -45,7 +45,7 @@ public class OAuthGrantPage extends AbstractPage { @Override public boolean isCurrent() { - return driver.getTitle().equals("OAuth Grant"); + return driver.getTitle().equals("Grant Access"); } @Override