From b162190c7f7978aa2140a7763286bdaea8101b1d Mon Sep 17 00:00:00 2001 From: Bill Burke Date: Wed, 15 Jan 2014 20:31:01 -0500 Subject: [PATCH 1/2] remove cookieLoginAllowed --- .../META-INF/resources/admin/js/controllers/realm.js | 3 +-- .../resources/admin/partials/realm-detail.html | 4 ---- .../representations/idm/RealmRepresentation.java | 9 --------- examples/as7-eap-demo/testrealm.json | 1 - examples/wildfly-demo/testrealm.json | 1 - .../src/main/java/org/keycloak/models/RealmModel.java | 4 ---- .../java/org/keycloak/models/jpa/RealmAdapter.java | 11 ----------- .../org/keycloak/models/jpa/entities/RealmEntity.java | 9 --------- .../org/keycloak/models/picketlink/RealmAdapter.java | 11 ----------- .../models/picketlink/mappings/RealmData.java | 10 ---------- .../models/picketlink/mappings/RealmEntity.java | 10 ---------- .../services/managers/ApplianceBootstrap.java | 1 - .../org/keycloak/services/managers/RealmManager.java | 3 --- .../keycloak/services/resources/flows/OAuthFlows.java | 4 +--- .../services/managers/AuthenticationManagerTest.java | 1 - .../src/test/java/org/keycloak/test/AdapterTest.java | 2 -- .../src/test/java/org/keycloak/test/ModelTest.java | 2 -- services/src/test/resources/testrealm-demo.json | 1 - .../integration/src/test/resources/testrealm.json | 1 - 19 files changed, 2 insertions(+), 86 deletions(-) diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/realm.js b/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/realm.js index 2579f4cc35..d74a7ae092 100755 --- a/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/realm.js +++ b/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/realm.js @@ -147,8 +147,7 @@ module.controller('RealmDetailCtrl', function($scope, Current, Realm, realm, $ht if ($scope.createRealm) { $scope.realm = { enabled: true, - requireSsl: true, - cookieLoginAllowed: true + requireSsl: true }; } else { if (Current.realm == null || Current.realm.realm != realm.realm) { diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-detail.html b/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-detail.html index a3ef383b1f..2628dcca1b 100755 --- a/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-detail.html +++ b/admin-ui/src/main/resources/META-INF/resources/admin/partials/realm-detail.html @@ -69,10 +69,6 @@ -
- - -
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 33c56f694f..45ec844664 100755 --- a/core/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java +++ b/core/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java @@ -19,7 +19,6 @@ public class RealmRepresentation { protected Boolean enabled; protected Boolean accountManagement; protected Boolean sslNotRequired; - protected Boolean cookieLoginAllowed; protected Boolean registrationAllowed; protected Boolean verifyEmail; protected Boolean resetPasswordAllowed; @@ -124,14 +123,6 @@ public class RealmRepresentation { this.sslNotRequired = sslNotRequired; } - public Boolean isCookieLoginAllowed() { - return cookieLoginAllowed; - } - - public void setCookieLoginAllowed(Boolean cookieLoginAllowed) { - this.cookieLoginAllowed = cookieLoginAllowed; - } - public Integer getTokenLifespan() { return tokenLifespan; } diff --git a/examples/as7-eap-demo/testrealm.json b/examples/as7-eap-demo/testrealm.json index dab68ee01a..f9354df4c8 100755 --- a/examples/as7-eap-demo/testrealm.json +++ b/examples/as7-eap-demo/testrealm.json @@ -6,7 +6,6 @@ "accessCodeLifespanUserAction": 6000, "accountManagement": true, "sslNotRequired": true, - "cookieLoginAllowed": true, "registrationAllowed": false, "social": false, "automaticRegistrationAfterSocialLogin": false, diff --git a/examples/wildfly-demo/testrealm.json b/examples/wildfly-demo/testrealm.json index dab68ee01a..f9354df4c8 100755 --- a/examples/wildfly-demo/testrealm.json +++ b/examples/wildfly-demo/testrealm.json @@ -6,7 +6,6 @@ "accessCodeLifespanUserAction": 6000, "accountManagement": true, "sslNotRequired": true, - "cookieLoginAllowed": true, "registrationAllowed": false, "social": false, "automaticRegistrationAfterSocialLogin": false, 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 40d4eeb6d7..42ab0e684a 100755 --- a/model/api/src/main/java/org/keycloak/models/RealmModel.java +++ b/model/api/src/main/java/org/keycloak/models/RealmModel.java @@ -26,10 +26,6 @@ public interface RealmModel extends RoleContainerModel, RoleMapperModel, ScopeMa void setSslNotRequired(boolean sslNotRequired); - boolean isCookieLoginAllowed(); - - void setCookieLoginAllowed(boolean cookieLoginAllowed); - boolean isRegistrationAllowed(); void setRegistrationAllowed(boolean registrationAllowed); 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 93abb75f0e..d08ed73b53 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 @@ -83,17 +83,6 @@ public class RealmAdapter implements RealmModel { em.flush(); } - @Override - public boolean isCookieLoginAllowed() { - return realm.isCookieLoginAllowed(); - } - - @Override - public void setCookieLoginAllowed(boolean cookieLoginAllowed) { - realm.setCookieLoginAllowed(cookieLoginAllowed); - em.flush(); - } - @Override public boolean isRegistrationAllowed() { return realm.isRegistrationAllowed(); diff --git a/model/jpa/src/main/java/org/keycloak/models/jpa/entities/RealmEntity.java b/model/jpa/src/main/java/org/keycloak/models/jpa/entities/RealmEntity.java index 7bf11030bd..6f4fadf3a2 100755 --- a/model/jpa/src/main/java/org/keycloak/models/jpa/entities/RealmEntity.java +++ b/model/jpa/src/main/java/org/keycloak/models/jpa/entities/RealmEntity.java @@ -34,7 +34,6 @@ public class RealmEntity { protected String name; protected boolean enabled; protected boolean sslNotRequired; - protected boolean cookieLoginAllowed; protected boolean registrationAllowed; protected boolean verifyEmail; protected boolean resetPasswordAllowed; @@ -118,14 +117,6 @@ public class RealmEntity { this.sslNotRequired = sslNotRequired; } - public boolean isCookieLoginAllowed() { - return cookieLoginAllowed; - } - - public void setCookieLoginAllowed(boolean cookieLoginAllowed) { - this.cookieLoginAllowed = cookieLoginAllowed; - } - public boolean isRegistrationAllowed() { return registrationAllowed; } diff --git a/model/picketlink/src/main/java/org/keycloak/models/picketlink/RealmAdapter.java b/model/picketlink/src/main/java/org/keycloak/models/picketlink/RealmAdapter.java index 668b00fdee..0fb2c22a0f 100755 --- a/model/picketlink/src/main/java/org/keycloak/models/picketlink/RealmAdapter.java +++ b/model/picketlink/src/main/java/org/keycloak/models/picketlink/RealmAdapter.java @@ -146,17 +146,6 @@ public class RealmAdapter implements RealmModel { updateRealm(); } - @Override - public boolean isCookieLoginAllowed() { - return realm.isCookieLoginAllowed(); - } - - @Override - public void setCookieLoginAllowed(boolean cookieLoginAllowed) { - realm.setCookieLoginAllowed(cookieLoginAllowed); - updateRealm(); - } - @Override public boolean isRegistrationAllowed() { return realm.isRegistrationAllowed(); diff --git a/model/picketlink/src/main/java/org/keycloak/models/picketlink/mappings/RealmData.java b/model/picketlink/src/main/java/org/keycloak/models/picketlink/mappings/RealmData.java index ad1fbe5b71..2914cbcc8d 100755 --- a/model/picketlink/src/main/java/org/keycloak/models/picketlink/mappings/RealmData.java +++ b/model/picketlink/src/main/java/org/keycloak/models/picketlink/mappings/RealmData.java @@ -13,7 +13,6 @@ public class RealmData extends AbstractPartition { private String realmName; private boolean enabled; private boolean sslNotRequired; - private boolean cookieLoginAllowed; private boolean registrationAllowed; private boolean verifyEmail; private boolean resetPasswordAllowed; @@ -81,15 +80,6 @@ public class RealmData extends AbstractPartition { this.sslNotRequired = sslNotRequired; } - @AttributeProperty - public boolean isCookieLoginAllowed() { - return cookieLoginAllowed; - } - - public void setCookieLoginAllowed(boolean cookieLoginAllowed) { - this.cookieLoginAllowed = cookieLoginAllowed; - } - @AttributeProperty public boolean isRegistrationAllowed() { return registrationAllowed; diff --git a/model/picketlink/src/main/java/org/keycloak/models/picketlink/mappings/RealmEntity.java b/model/picketlink/src/main/java/org/keycloak/models/picketlink/mappings/RealmEntity.java index 4be31e64a0..21913c7f4d 100755 --- a/model/picketlink/src/main/java/org/keycloak/models/picketlink/mappings/RealmEntity.java +++ b/model/picketlink/src/main/java/org/keycloak/models/picketlink/mappings/RealmEntity.java @@ -33,8 +33,6 @@ public class RealmEntity implements Serializable { @AttributeValue private boolean sslNotRequired; @AttributeValue - private boolean cookieLoginAllowed; - @AttributeValue private boolean registrationAllowed; @AttributeValue private boolean verifyEmail; @@ -98,14 +96,6 @@ public class RealmEntity implements Serializable { this.sslNotRequired = sslNotRequired; } - public boolean isCookieLoginAllowed() { - return cookieLoginAllowed; - } - - public void setCookieLoginAllowed(boolean cookieLoginAllowed) { - this.cookieLoginAllowed = cookieLoginAllowed; - } - public boolean isRegistrationAllowed() { return registrationAllowed; } 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 f62f28c851..554a910f0b 100755 --- a/services/src/main/java/org/keycloak/services/managers/ApplianceBootstrap.java +++ b/services/src/main/java/org/keycloak/services/managers/ApplianceBootstrap.java @@ -52,7 +52,6 @@ public class ApplianceBootstrap { realm.setAccessCodeLifespan(60); realm.setAccessCodeLifespanUserAction(300); realm.setSslNotRequired(true); - realm.setCookieLoginAllowed(true); realm.setRegistrationAllowed(false); manager.generateRealmKeys(realm); diff --git a/services/src/main/java/org/keycloak/services/managers/RealmManager.java b/services/src/main/java/org/keycloak/services/managers/RealmManager.java index e6bd3f836d..0cd9fe3951 100755 --- a/services/src/main/java/org/keycloak/services/managers/RealmManager.java +++ b/services/src/main/java/org/keycloak/services/managers/RealmManager.java @@ -99,7 +99,6 @@ public class RealmManager { } if (rep.isEnabled() != null) realm.setEnabled(rep.isEnabled()); if (rep.isSocial() != null) realm.setSocial(rep.isSocial()); - if (rep.isCookieLoginAllowed() != null) realm.setCookieLoginAllowed(rep.isCookieLoginAllowed()); if (rep.isRegistrationAllowed() != null) realm.setRegistrationAllowed(rep.isRegistrationAllowed()); if (rep.isVerifyEmail() != null) realm.setVerifyEmail(rep.isVerifyEmail()); if (rep.isResetPasswordAllowed() != null) realm.setResetPasswordAllowed(rep.isResetPasswordAllowed()); @@ -198,7 +197,6 @@ public class RealmManager { else newRealm.setAccessCodeLifespanUserAction(300); if (rep.isSslNotRequired() != null) newRealm.setSslNotRequired(rep.isSslNotRequired()); - if (rep.isCookieLoginAllowed() != null) newRealm.setCookieLoginAllowed(rep.isCookieLoginAllowed()); if (rep.isRegistrationAllowed() != null) newRealm.setRegistrationAllowed(rep.isRegistrationAllowed()); if (rep.isVerifyEmail() != null) newRealm.setVerifyEmail(rep.isVerifyEmail()); if (rep.isResetPasswordAllowed() != null) newRealm.setResetPasswordAllowed(rep.isResetPasswordAllowed()); @@ -479,7 +477,6 @@ public class RealmManager { rep.setSocial(realm.isSocial()); rep.setAutomaticRegistrationAfterSocialLogin(realm.isAutomaticRegistrationAfterSocialLogin()); rep.setSslNotRequired(realm.isSslNotRequired()); - rep.setCookieLoginAllowed(realm.isCookieLoginAllowed()); rep.setPublicKey(realm.getPublicKeyPem()); rep.setPrivateKey(realm.getPrivateKeyPem()); rep.setRegistrationAllowed(realm.isRegistrationAllowed()); diff --git a/services/src/main/java/org/keycloak/services/resources/flows/OAuthFlows.java b/services/src/main/java/org/keycloak/services/resources/flows/OAuthFlows.java index 8771313639..0ed81dc594 100755 --- a/services/src/main/java/org/keycloak/services/resources/flows/OAuthFlows.java +++ b/services/src/main/java/org/keycloak/services/resources/flows/OAuthFlows.java @@ -73,9 +73,7 @@ public class OAuthFlows { if (state != null) redirectUri.queryParam("state", state); Response.ResponseBuilder location = Response.status(302).location(redirectUri.build()); - if (realm.isCookieLoginAllowed()) { - location.cookie(authManager.createLoginCookie(realm, accessCode.getUser(), uriInfo)); - } + location.cookie(authManager.createLoginCookie(realm, accessCode.getUser(), uriInfo)); return location.build(); } diff --git a/services/src/test/java/org/keycloak/services/managers/AuthenticationManagerTest.java b/services/src/test/java/org/keycloak/services/managers/AuthenticationManagerTest.java index 4d678383b1..527838ddd3 100755 --- a/services/src/test/java/org/keycloak/services/managers/AuthenticationManagerTest.java +++ b/services/src/test/java/org/keycloak/services/managers/AuthenticationManagerTest.java @@ -128,7 +128,6 @@ public class AuthenticationManagerTest extends AbstractKeycloakTest { super.before(); realm = getRealmManager().createRealm("Test"); realm.setAccessCodeLifespan(100); - realm.setCookieLoginAllowed(true); realm.setEnabled(true); realm.setName("Test"); realm.setPrivateKeyPem("0234234"); diff --git a/services/src/test/java/org/keycloak/test/AdapterTest.java b/services/src/test/java/org/keycloak/test/AdapterTest.java index b3e760d01a..0fc412fb9c 100755 --- a/services/src/test/java/org/keycloak/test/AdapterTest.java +++ b/services/src/test/java/org/keycloak/test/AdapterTest.java @@ -60,7 +60,6 @@ public class AdapterTest extends AbstractKeycloakTest { realmModel = getRealmManager().createRealm("JUGGLER"); realmModel.setAccessCodeLifespan(100); realmModel.setAccessCodeLifespanUserAction(600); - realmModel.setCookieLoginAllowed(true); realmModel.setEnabled(true); realmModel.setName("JUGGLER"); realmModel.setPrivateKeyPem("0234234"); @@ -89,7 +88,6 @@ public class AdapterTest extends AbstractKeycloakTest { realmModel = getRealmManager().createRealm("JUGGLER"); realmModel.setAccessCodeLifespan(100); realmModel.setAccessCodeLifespanUserAction(600); - realmModel.setCookieLoginAllowed(true); realmModel.setEnabled(true); realmModel.setName("JUGGLER"); realmModel.setPrivateKeyPem("0234234"); diff --git a/services/src/test/java/org/keycloak/test/ModelTest.java b/services/src/test/java/org/keycloak/test/ModelTest.java index 5f0728a8ea..35ea589728 100755 --- a/services/src/test/java/org/keycloak/test/ModelTest.java +++ b/services/src/test/java/org/keycloak/test/ModelTest.java @@ -40,7 +40,6 @@ public class ModelTest extends AbstractKeycloakServerTest { @Test public void importExportRealm() { RealmModel realm = manager.createRealm("original"); - realm.setCookieLoginAllowed(true); realm.setRegistrationAllowed(true); realm.setResetPasswordAllowed(true); realm.setSocial(true); @@ -74,7 +73,6 @@ public class ModelTest extends AbstractKeycloakServerTest { public static void assertEquals(RealmModel expected, RealmModel actual) { Assert.assertEquals(expected.isAutomaticRegistrationAfterSocialLogin(), actual.isAutomaticRegistrationAfterSocialLogin()); - Assert.assertEquals(expected.isCookieLoginAllowed(), actual.isCookieLoginAllowed()); Assert.assertEquals(expected.isRegistrationAllowed(), actual.isRegistrationAllowed()); Assert.assertEquals(expected.isResetPasswordAllowed(), actual.isResetPasswordAllowed()); Assert.assertEquals(expected.isSocial(), actual.isSocial()); diff --git a/services/src/test/resources/testrealm-demo.json b/services/src/test/resources/testrealm-demo.json index 295c70ed1b..fab9e9d364 100755 --- a/services/src/test/resources/testrealm-demo.json +++ b/services/src/test/resources/testrealm-demo.json @@ -5,7 +5,6 @@ "accessCodeLifespan": 10, "accessCodeLifespanUserAction": 600, "sslNotRequired": true, - "cookieLoginAllowed": true, "automaticRegistrationAfterSocialLogin": true, "privateKey": "MIICXAIBAAKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQABAoGAfmO8gVhyBxdqlxmIuglbz8bcjQbhXJLR2EoS8ngTXmN1bo2L90M0mUKSdc7qF10LgETBzqL8jYlQIbt+e6TH8fcEpKCjUlyq0Mf/vVbfZSNaVycY13nTzo27iPyWQHK5NLuJzn1xvxxrUeXI6A2WFpGEBLbHjwpx5WQG9A+2scECQQDvdn9NE75HPTVPxBqsEd2z10TKkl9CZxu10Qby3iQQmWLEJ9LNmy3acvKrE3gMiYNWb6xHPKiIqOR1as7L24aTAkEAtyvQOlCvr5kAjVqrEKXalj0Tzewjweuxc0pskvArTI2Oo070h65GpoIKLc9jf+UA69cRtquwP93aZKtW06U8dQJAF2Y44ks/mK5+eyDqik3koCI08qaC8HYq2wVl7G2QkJ6sbAaILtcvD92ToOvyGyeE0flvmDZxMYlvaZnaQ0lcSQJBAKZU6umJi3/xeEbkJqMfeLclD27XGEFoPeNrmdx0q10Azp4NfJAY+Z8KRyQCR2BEG+oNitBOZ+YXF9KCpH3cdmECQHEigJhYg+ykOvr1aiZUMFT72HU0jnmQe2FVekuG+LJUt2Tm7GtMjTFoGpf0JwrVuZN39fOYAlo+nTixgeW7X8Y=", "publicKey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB", diff --git a/testsuite/integration/src/test/resources/testrealm.json b/testsuite/integration/src/test/resources/testrealm.json index cf8d8aefaa..c25ece4f1c 100755 --- a/testsuite/integration/src/test/resources/testrealm.json +++ b/testsuite/integration/src/test/resources/testrealm.json @@ -6,7 +6,6 @@ "accessCodeLifespan": 600, "accessCodeLifespanUserAction": 600, "sslNotRequired": true, - "cookieLoginAllowed": true, "registrationAllowed": true, "accountManagement": true, "resetPasswordAllowed": true, From 41974795ce558d6f46448304a4f5c8ab684eda58 Mon Sep 17 00:00:00 2001 From: Bill Burke Date: Wed, 15 Jan 2014 21:10:57 -0500 Subject: [PATCH 2/2] KEYCLOAK-262 --- .../resources/forms/theme/default/login-oauth-grant.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms/src/main/resources/META-INF/resources/forms/theme/default/login-oauth-grant.ftl b/forms/src/main/resources/META-INF/resources/forms/theme/default/login-oauth-grant.ftl index 8ff76db207..bacf277e41 100755 --- a/forms/src/main/resources/META-INF/resources/forms/theme/default/login-oauth-grant.ftl +++ b/forms/src/main/resources/META-INF/resources/forms/theme/default/login-oauth-grant.ftl @@ -15,7 +15,7 @@
    <#list oauth.realmRolesRequested as role>
  • - ${role.description} + <#if role.description??>${role.description}<#else>${role.name}