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 92c3f106de..e83248659b 100755 --- a/core/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java +++ b/core/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java @@ -14,6 +14,7 @@ public class RealmRepresentation { protected String realm; protected int tokenLifespan; protected int accessCodeLifespan; + protected int accessCodeLifespanUserAction; protected boolean enabled; protected boolean sslNotRequired; protected boolean cookieLoginAllowed; @@ -190,6 +191,14 @@ public class RealmRepresentation { this.accessCodeLifespan = accessCodeLifespan; } + public int getAccessCodeLifespanUserAction() { + return accessCodeLifespanUserAction; + } + + public void setAccessCodeLifespanUserAction(int accessCodeLifespanUserAction) { + this.accessCodeLifespanUserAction = accessCodeLifespanUserAction; + } + public List getRoles() { return roles; } diff --git a/core/src/main/java/org/keycloak/representations/idm/UserRepresentation.java b/core/src/main/java/org/keycloak/representations/idm/UserRepresentation.java index 2b3d02cf87..db12aced40 100755 --- a/core/src/main/java/org/keycloak/representations/idm/UserRepresentation.java +++ b/core/src/main/java/org/keycloak/representations/idm/UserRepresentation.java @@ -13,12 +13,13 @@ public class UserRepresentation { protected String self; // link protected String username; - protected boolean enabled; + protected String status; protected String firstName; protected String lastName; protected String email; protected Map attributes; protected List credentials; + protected List requiredActions; public String getSelf() { return self; @@ -91,11 +92,19 @@ public class UserRepresentation { return this; } - public boolean isEnabled() { - return enabled; + public String getStatus() { + return status; } - public void setEnabled(boolean enabled) { - this.enabled = enabled; + public void setStatus(String status) { + this.status = status; + } + + public List getRequiredActions() { + return requiredActions; + } + + public void setRequiredActions(List requiredActions) { + this.requiredActions = requiredActions; } } diff --git a/examples/as7-eap-demo/server/src/main/resources/META-INF/testrealm.json b/examples/as7-eap-demo/server/src/main/resources/META-INF/testrealm.json index bb918efc31..177b45fdca 100755 --- a/examples/as7-eap-demo/server/src/main/resources/META-INF/testrealm.json +++ b/examples/as7-eap-demo/server/src/main/resources/META-INF/testrealm.json @@ -3,6 +3,7 @@ "enabled": true, "tokenLifespan": 300, "accessCodeLifespan": 10, + "accessCodeLifespanUserAction": 600, "sslNotRequired": true, "cookieLoginAllowed": true, "registrationAllowed": true, @@ -17,7 +18,7 @@ "users" : [ { "username" : "bburke@redhat.com", - "enabled" : true, + "status": "ENABLED", "attributes" : { "email" : "bburke@redhat.com" }, @@ -28,7 +29,7 @@ }, { "username" : "third-party", - "enabled" : true, + "status": "ENABLED", "credentials" : [ { "type" : "password", "value" : "password" } diff --git a/forms/src/main/java/org/keycloak/forms/TotpBean.java b/forms/src/main/java/org/keycloak/forms/TotpBean.java index b0a412b0ec..b1445743eb 100644 --- a/forms/src/main/java/org/keycloak/forms/TotpBean.java +++ b/forms/src/main/java/org/keycloak/forms/TotpBean.java @@ -69,7 +69,7 @@ public class TotpBean { } public boolean isEnabled() { - return "ENABLED".equals(user.getUser().getAttribute("KEYCLOAK_TOTP")); + return user.getUser().isTotp(); } public String getTotpSecret() { diff --git a/forms/src/main/java/org/keycloak/forms/UrlBean.java b/forms/src/main/java/org/keycloak/forms/UrlBean.java index 62017d00bb..f846ee1907 100644 --- a/forms/src/main/java/org/keycloak/forms/UrlBean.java +++ b/forms/src/main/java/org/keycloak/forms/UrlBean.java @@ -31,6 +31,7 @@ import javax.faces.context.FacesContext; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.UriBuilder; +import org.keycloak.services.resources.flows.FormFlows; import org.keycloak.services.resources.flows.Urls; /** @@ -56,6 +57,11 @@ public class UrlBean { UriBuilder b = UriBuilder.fromUri(request.getRequestURI()).replaceQuery(request.getQueryString()) .replacePath(request.getContextPath()).path("rest"); + + if (request.getAttribute(FormFlows.CODE) != null) { + b.queryParam("code", request.getAttribute(FormFlows.CODE)); + } + baseURI = b.build(); } diff --git a/forms/src/main/resources/META-INF/resources/forms/theme/default/login-totp.xhtml b/forms/src/main/resources/META-INF/resources/forms/theme/default/login-totp.xhtml index 1deed994bb..e265db2543 100755 --- a/forms/src/main/resources/META-INF/resources/forms/theme/default/login-totp.xhtml +++ b/forms/src/main/resources/META-INF/resources/forms/theme/default/login-totp.xhtml @@ -2,6 +2,7 @@ + Log in to #{realm.name} Log in to #{realm.name} diff --git a/forms/src/main/resources/META-INF/resources/forms/theme/default/login.xhtml b/forms/src/main/resources/META-INF/resources/forms/theme/default/login.xhtml index 8f4ab5762c..325cde74c1 100755 --- a/forms/src/main/resources/META-INF/resources/forms/theme/default/login.xhtml +++ b/forms/src/main/resources/META-INF/resources/forms/theme/default/login.xhtml @@ -2,6 +2,7 @@ + Log in to #{realm.name} Log in to #{realm.name} diff --git a/forms/src/main/resources/META-INF/resources/forms/theme/default/register.xhtml b/forms/src/main/resources/META-INF/resources/forms/theme/default/register.xhtml index ca9d8b6745..98b21dc2be 100755 --- a/forms/src/main/resources/META-INF/resources/forms/theme/default/register.xhtml +++ b/forms/src/main/resources/META-INF/resources/forms/theme/default/register.xhtml @@ -4,6 +4,7 @@ + #{messages.registerWith} #{realm.name} #{messages.registerWith} #{realm.name} diff --git a/forms/src/main/resources/META-INF/resources/forms/theme/default/template-login.xhtml b/forms/src/main/resources/META-INF/resources/forms/theme/default/template-login.xhtml index e99a442c26..0a313ec616 100644 --- a/forms/src/main/resources/META-INF/resources/forms/theme/default/template-login.xhtml +++ b/forms/src/main/resources/META-INF/resources/forms/theme/default/template-login.xhtml @@ -3,7 +3,7 @@ - #{messages.logInTo} #{realm.name} + <ui:insert name="title" />