author
int64 658
755k
| date
stringlengths 19
19
| timezone
int64 -46,800
43.2k
| hash
stringlengths 40
40
| message
stringlengths 5
490
| mods
list | language
stringclasses 20
values | license
stringclasses 3
values | repo
stringlengths 5
68
| original_message
stringlengths 12
491
|
---|---|---|---|---|---|---|---|---|---|
339,465 | 21.11.2018 13:06:16 | -3,600 | 6e93ca36af70bd17e845fe7ffbad873721bb8634 | OIDCScopeTest.testClientDisplayedOnConsentScreenWithEmptyConsentText failing on Oracle | [
{
"change_type": "MODIFY",
"old_path": "model/jpa/src/main/java/org/keycloak/models/jpa/ClientAdapter.java",
"new_path": "model/jpa/src/main/java/org/keycloak/models/jpa/ClientAdapter.java",
"diff": "@@ -21,20 +21,17 @@ import org.keycloak.models.ClientModel;\nimport org.keycloak.models.ClientScopeModel;\nimport org.keycloak.models.KeycloakSession;\nimport org.keycloak.models.ModelDuplicateException;\n-import org.keycloak.models.ModelException;\nimport org.keycloak.models.ProtocolMapperModel;\nimport org.keycloak.models.RealmModel;\nimport org.keycloak.models.RoleContainerModel;\nimport org.keycloak.models.RoleModel;\n+import org.keycloak.models.jpa.entities.ClientAttributeEntity;\nimport org.keycloak.models.jpa.entities.ClientEntity;\nimport org.keycloak.models.jpa.entities.ClientScopeClientMappingEntity;\n-import org.keycloak.models.jpa.entities.ClientScopeEntity;\n-import org.keycloak.models.jpa.entities.ClientScopeRoleMappingEntity;\nimport org.keycloak.models.jpa.entities.ProtocolMapperEntity;\nimport org.keycloak.models.jpa.entities.RoleEntity;\nimport org.keycloak.models.utils.KeycloakModelUtils;\nimport org.keycloak.protocol.oidc.OIDCLoginProtocol;\n-import org.keycloak.protocol.oidc.OIDCLoginProtocolFactory;\nimport javax.persistence.EntityManager;\nimport javax.persistence.TypedQuery;\n@@ -44,6 +41,7 @@ import java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.HashSet;\n+import java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Objects;\n@@ -302,25 +300,45 @@ public class ClientAdapter implements ClientModel, JpaModel<ClientEntity> {\n@Override\npublic void setAttribute(String name, String value) {\n- entity.getAttributes().put(name, value);\n+ for (ClientAttributeEntity attr : entity.getAttributes()) {\n+ if (attr.getName().equals(name)) {\n+ attr.setValue(value);\n+ return;\n+ }\n+ }\n+ ClientAttributeEntity attr = new ClientAttributeEntity();\n+ attr.setName(name);\n+ attr.setValue(value);\n+ attr.setClient(entity);\n+ em.persist(attr);\n+ entity.getAttributes().add(attr);\n}\n@Override\npublic void removeAttribute(String name) {\n- entity.getAttributes().remove(name);\n+ Iterator<ClientAttributeEntity> it = entity.getAttributes().iterator();\n+ while (it.hasNext()) {\n+ ClientAttributeEntity attr = it.next();\n+ if (attr.getName().equals(name)) {\n+ it.remove();\n+ em.remove(attr);\n+ }\n+ }\n}\n@Override\npublic String getAttribute(String name) {\n- return entity.getAttributes().get(name);\n+ return getAttributes().get(name);\n}\n@Override\npublic Map<String, String> getAttributes() {\n- Map<String, String> copy = new HashMap<>();\n- copy.putAll(entity.getAttributes());\n- return copy;\n+ Map<String, String> attrs = new HashMap<>();\n+ for (ClientAttributeEntity attr : entity.getAttributes()) {\n+ attrs.put(attr.getName(), attr.getValue());\n+ }\n+ return attrs;\n}\n@Override\n"
},
{
"change_type": "MODIFY",
"old_path": "model/jpa/src/main/java/org/keycloak/models/jpa/ClientScopeAdapter.java",
"new_path": "model/jpa/src/main/java/org/keycloak/models/jpa/ClientScopeAdapter.java",
"diff": "@@ -24,6 +24,7 @@ import org.keycloak.models.ProtocolMapperModel;\nimport org.keycloak.models.RealmModel;\nimport org.keycloak.models.RoleContainerModel;\nimport org.keycloak.models.RoleModel;\n+import org.keycloak.models.jpa.entities.ClientScopeAttributeEntity;\nimport org.keycloak.models.jpa.entities.ClientScopeEntity;\nimport org.keycloak.models.jpa.entities.ClientScopeRoleMappingEntity;\nimport org.keycloak.models.jpa.entities.ProtocolMapperEntity;\n@@ -34,6 +35,7 @@ import javax.persistence.EntityManager;\nimport javax.persistence.TypedQuery;\nimport java.util.HashMap;\nimport java.util.HashSet;\n+import java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n@@ -282,18 +284,37 @@ public class ClientScopeAdapter implements ClientScopeModel, JpaModel<ClientScop\n@Override\npublic void setAttribute(String name, String value) {\n- entity.getAttributes().put(name, value);\n+ for (ClientScopeAttributeEntity attr : entity.getAttributes()) {\n+ if (attr.getName().equals(name)) {\n+ attr.setValue(value);\n+ return;\n+ }\n+ }\n+\n+ ClientScopeAttributeEntity attr = new ClientScopeAttributeEntity();\n+ attr.setName(name);\n+ attr.setValue(value);\n+ attr.setClientScope(entity);\n+ em.persist(attr);\n+ entity.getAttributes().add(attr);\n}\n@Override\npublic void removeAttribute(String name) {\n- entity.getAttributes().remove(name);\n+ Iterator<ClientScopeAttributeEntity> it = entity.getAttributes().iterator();\n+ while (it.hasNext()) {\n+ ClientScopeAttributeEntity attr = it.next();\n+ if (attr.getName().equals(name)) {\n+ it.remove();\n+ em.remove(attr);\n+ }\n+ }\n}\n@Override\npublic String getAttribute(String name) {\n- return entity.getAttributes().get(name);\n+ return getAttributes().get(name);\n}\npublic static ClientScopeEntity toClientScopeEntity(ClientScopeModel model, EntityManager em) {\n@@ -305,9 +326,11 @@ public class ClientScopeAdapter implements ClientScopeModel, JpaModel<ClientScop\n@Override\npublic Map<String, String> getAttributes() {\n- Map<String, String> copy = new HashMap<>();\n- copy.putAll(entity.getAttributes());\n- return copy;\n+ Map<String, String> attrs = new HashMap<>();\n+ for (ClientScopeAttributeEntity attr : entity.getAttributes()) {\n+ attrs.put(attr.getName(), attr.getValue());\n+ }\n+ return attrs;\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "model/jpa/src/main/java/org/keycloak/models/jpa/entities/ClientAttributeEntity.java",
"diff": "+/*\n+ * Copyright 2017 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.models.jpa.entities;\n+\n+import java.io.Serializable;\n+\n+import javax.persistence.Column;\n+import javax.persistence.Entity;\n+import javax.persistence.FetchType;\n+import javax.persistence.Id;\n+import javax.persistence.IdClass;\n+import javax.persistence.JoinColumn;\n+import javax.persistence.ManyToOne;\n+import javax.persistence.Table;\n+\n+\n+/**\n+ * @author <a href=\"mailto:[email protected]\">Marek Posolda</a>\n+ */\n+@Table(name=\"CLIENT_ATTRIBUTES\")\n+@Entity\n+@IdClass(ClientAttributeEntity.Key.class)\n+public class ClientAttributeEntity {\n+\n+ @Id\n+ @ManyToOne(fetch= FetchType.LAZY)\n+ @JoinColumn(name = \"CLIENT_ID\")\n+ protected ClientEntity client;\n+\n+ @Id\n+ @Column(name=\"NAME\")\n+ protected String name;\n+\n+ @Column(name = \"VALUE\", length = 4000)\n+ protected String value;\n+\n+ public ClientEntity getClient() {\n+ return client;\n+ }\n+\n+ public void setClient(ClientEntity client) {\n+ this.client = client;\n+ }\n+\n+ public String getName() {\n+ return name;\n+ }\n+\n+ public void setName(String name) {\n+ this.name = name;\n+ }\n+\n+ public String getValue() {\n+ return value;\n+ }\n+\n+ public void setValue(String value) {\n+ this.value = value;\n+ }\n+\n+\n+ public static class Key implements Serializable {\n+\n+ protected ClientEntity client;\n+\n+ protected String name;\n+\n+ public Key() {\n+ }\n+\n+ public Key(ClientEntity client, String name) {\n+ this.client = client;\n+ this.name = name;\n+ }\n+\n+ public ClientEntity getClient() {\n+ return client;\n+ }\n+\n+ public String getName() {\n+ return name;\n+ }\n+\n+ @Override\n+ public boolean equals(Object o) {\n+ if (this == o) return true;\n+ if (o == null || getClass() != o.getClass()) return false;\n+\n+ ClientAttributeEntity.Key key = (ClientAttributeEntity.Key) o;\n+\n+ if (client != null ? !client.getId().equals(key.client != null ? key.client.getId() : null) : key.client != null) return false;\n+ if (name != null ? !name.equals(key.name != null ? key.name : null) : key.name != null) return false;\n+\n+ return true;\n+ }\n+\n+ @Override\n+ public int hashCode() {\n+ int result = client != null ? client.getId().hashCode() : 0;\n+ result = 31 * result + (name != null ? name.hashCode() : 0);\n+ return result;\n+ }\n+ }\n+\n+\n+ @Override\n+ public boolean equals(Object o) {\n+ if (this == o) return true;\n+ if (o == null || getClass() != o.getClass()) return false;\n+ if (!(o instanceof ClientAttributeEntity)) return false;\n+\n+ ClientAttributeEntity key = (ClientAttributeEntity) o;\n+\n+ if (client != null ? !client.getId().equals(key.client != null ? key.client.getId() : null) : key.client != null) return false;\n+ if (name != null ? !name.equals(key.name != null ? key.name : null) : key.name != null) return false;\n+\n+ return true;\n+ }\n+\n+ @Override\n+ public int hashCode() {\n+ int result = client != null ? client.getId().hashCode() : 0;\n+ result = 31 * result + (name != null ? name.hashCode() : 0);\n+ return result;\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "model/jpa/src/main/java/org/keycloak/models/jpa/entities/ClientEntity.java",
"new_path": "model/jpa/src/main/java/org/keycloak/models/jpa/entities/ClientEntity.java",
"diff": "@@ -104,11 +104,8 @@ public class ClientEntity {\n@CollectionTable(name = \"REDIRECT_URIS\", joinColumns={ @JoinColumn(name=\"CLIENT_ID\") })\nprotected Set<String> redirectUris = new HashSet<String>();\n- @ElementCollection\n- @MapKeyColumn(name=\"NAME\")\n- @Column(name=\"VALUE\", length = 4000)\n- @CollectionTable(name=\"CLIENT_ATTRIBUTES\", joinColumns={ @JoinColumn(name=\"CLIENT_ID\") })\n- protected Map<String, String> attributes = new HashMap<String, String>();\n+ @OneToMany(cascade ={CascadeType.REMOVE}, orphanRemoval = true, mappedBy = \"client\")\n+ protected Collection<ClientAttributeEntity> attributes = new ArrayList<>();\n@ElementCollection\n@MapKeyColumn(name=\"BINDING_NAME\")\n@@ -278,11 +275,11 @@ public class ClientEntity {\nthis.fullScopeAllowed = fullScopeAllowed;\n}\n- public Map<String, String> getAttributes() {\n+ public Collection<ClientAttributeEntity> getAttributes() {\nreturn attributes;\n}\n- public void setAttributes(Map<String, String> attributes) {\n+ public void setAttributes(Collection<ClientAttributeEntity> attributes) {\nthis.attributes = attributes;\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "model/jpa/src/main/java/org/keycloak/models/jpa/entities/ClientScopeAttributeEntity.java",
"diff": "+/*\n+ * Copyright 2017 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.models.jpa.entities;\n+\n+import java.io.Serializable;\n+\n+import javax.persistence.Column;\n+import javax.persistence.Entity;\n+import javax.persistence.FetchType;\n+import javax.persistence.Id;\n+import javax.persistence.IdClass;\n+import javax.persistence.JoinColumn;\n+import javax.persistence.ManyToOne;\n+import javax.persistence.Table;\n+\n+/**\n+ * @author <a href=\"mailto:[email protected]\">Marek Posolda</a>\n+ */\n+@Table(name=\"CLIENT_SCOPE_ATTRIBUTES\")\n+@Entity\n+@IdClass(ClientScopeAttributeEntity.Key.class)\n+public class ClientScopeAttributeEntity {\n+\n+ @Id\n+ @ManyToOne(fetch= FetchType.LAZY)\n+ @JoinColumn(name = \"SCOPE_ID\")\n+ protected ClientScopeEntity clientScope;\n+\n+ @Id\n+ @Column(name=\"NAME\")\n+ protected String name;\n+\n+ @Column(name = \"VALUE\", length = 2048)\n+ protected String value;\n+\n+ public ClientScopeEntity getClientScope() {\n+ return clientScope;\n+ }\n+\n+ public void setClientScope(ClientScopeEntity clientScope) {\n+ this.clientScope = clientScope;\n+ }\n+\n+ public String getName() {\n+ return name;\n+ }\n+\n+ public void setName(String name) {\n+ this.name = name;\n+ }\n+\n+ public String getValue() {\n+ return value;\n+ }\n+\n+ public void setValue(String value) {\n+ this.value = value;\n+ }\n+\n+\n+ public static class Key implements Serializable {\n+\n+ protected ClientScopeEntity clientScope;\n+\n+ protected String name;\n+\n+ public Key() {\n+ }\n+\n+ public Key(ClientScopeEntity clientScope, String name) {\n+ this.clientScope = clientScope;\n+ this.name = name;\n+ }\n+\n+ public ClientScopeEntity getClientScope() {\n+ return clientScope;\n+ }\n+\n+ public String getName() {\n+ return name;\n+ }\n+\n+ @Override\n+ public boolean equals(Object o) {\n+ if (this == o) return true;\n+ if (o == null || getClass() != o.getClass()) return false;\n+\n+ ClientScopeAttributeEntity.Key key = (ClientScopeAttributeEntity.Key) o;\n+\n+ if (clientScope != null ? !clientScope.getId().equals(key.clientScope != null ? key.clientScope.getId() : null) : key.clientScope != null) return false;\n+ if (name != null ? !name.equals(key.name != null ? key.name : null) : key.name != null) return false;\n+\n+ return true;\n+ }\n+\n+ @Override\n+ public int hashCode() {\n+ int result = clientScope != null ? clientScope.getId().hashCode() : 0;\n+ result = 31 * result + (name != null ? name.hashCode() : 0);\n+ return result;\n+ }\n+ }\n+\n+\n+ @Override\n+ public boolean equals(Object o) {\n+ if (this == o) return true;\n+ if (o == null || getClass() != o.getClass()) return false;\n+ if (!(o instanceof ClientScopeAttributeEntity)) return false;\n+\n+ ClientScopeAttributeEntity key = (ClientScopeAttributeEntity) o;\n+\n+ if (clientScope != null ? !clientScope.getId().equals(key.clientScope != null ? key.clientScope.getId() : null) : key.clientScope != null) return false;\n+ if (name != null ? !name.equals(key.name != null ? key.name : null) : key.name != null) return false;\n+\n+ return true;\n+ }\n+\n+ @Override\n+ public int hashCode() {\n+ int result = clientScope != null ? clientScope.getId().hashCode() : 0;\n+ result = 31 * result + (name != null ? name.hashCode() : 0);\n+ return result;\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "model/jpa/src/main/java/org/keycloak/models/jpa/entities/ClientScopeEntity.java",
"new_path": "model/jpa/src/main/java/org/keycloak/models/jpa/entities/ClientScopeEntity.java",
"diff": "@@ -22,22 +22,17 @@ import org.hibernate.annotations.Nationalized;\nimport javax.persistence.Access;\nimport javax.persistence.AccessType;\nimport javax.persistence.CascadeType;\n-import javax.persistence.CollectionTable;\nimport javax.persistence.Column;\n-import javax.persistence.ElementCollection;\nimport javax.persistence.Entity;\nimport javax.persistence.FetchType;\nimport javax.persistence.Id;\nimport javax.persistence.JoinColumn;\nimport javax.persistence.ManyToOne;\n-import javax.persistence.MapKeyColumn;\nimport javax.persistence.OneToMany;\nimport javax.persistence.Table;\nimport javax.persistence.UniqueConstraint;\nimport java.util.ArrayList;\nimport java.util.Collection;\n-import java.util.HashMap;\n-import java.util.Map;\n/**\n* @author <a href=\"mailto:[email protected]\">Bill Burke</a>\n@@ -66,11 +61,8 @@ public class ClientScopeEntity {\nprivate String protocol;\n- @ElementCollection\n- @MapKeyColumn(name=\"NAME\")\n- @Column(name=\"VALUE\", length = 2048)\n- @CollectionTable(name=\"CLIENT_SCOPE_ATTRIBUTES\", joinColumns={ @JoinColumn(name=\"SCOPE_ID\") })\n- protected Map<String, String> attributes = new HashMap<String, String>();\n+ @OneToMany(cascade ={CascadeType.REMOVE}, orphanRemoval = true, mappedBy = \"clientScope\")\n+ protected Collection<ClientScopeAttributeEntity> attributes = new ArrayList<>();\npublic RealmEntity getRealm() {\nreturn realm;\n@@ -120,11 +112,11 @@ public class ClientScopeEntity {\nthis.protocol = protocol;\n}\n- public Map<String, String> getAttributes() {\n+ public Collection<ClientScopeAttributeEntity> getAttributes() {\nreturn attributes;\n}\n- public void setAttributes(Map<String, String> attributes) {\n+ public void setAttributes(Collection<ClientScopeAttributeEntity> attributes) {\nthis.attributes = attributes;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model/jpa/src/main/resources/META-INF/persistence.xml",
"new_path": "model/jpa/src/main/resources/META-INF/persistence.xml",
"diff": "version=\"1.0\">\n<persistence-unit name=\"keycloak-default\" transaction-type=\"RESOURCE_LOCAL\">\n<class>org.keycloak.models.jpa.entities.ClientEntity</class>\n+ <class>org.keycloak.models.jpa.entities.ClientAttributeEntity</class>\n<class>org.keycloak.models.jpa.entities.CredentialEntity</class>\n<class>org.keycloak.models.jpa.entities.CredentialAttributeEntity</class>\n<class>org.keycloak.models.jpa.entities.RealmEntity</class>\n<class>org.keycloak.models.jpa.entities.GroupRoleMappingEntity</class>\n<class>org.keycloak.models.jpa.entities.UserGroupMembershipEntity</class>\n<class>org.keycloak.models.jpa.entities.ClientScopeEntity</class>\n+ <class>org.keycloak.models.jpa.entities.ClientScopeAttributeEntity</class>\n<class>org.keycloak.models.jpa.entities.ClientScopeRoleMappingEntity</class>\n<class>org.keycloak.models.jpa.entities.ClientScopeClientMappingEntity</class>\n<class>org.keycloak.models.jpa.entities.DefaultClientScopeRealmMappingEntity</class>\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/ClientScopeTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/ClientScopeTest.java",
"diff": "@@ -22,6 +22,7 @@ import org.junit.Test;\nimport org.keycloak.admin.client.resource.ClientScopesResource;\nimport org.keycloak.admin.client.resource.ProtocolMappersResource;\nimport org.keycloak.admin.client.resource.RoleMappingResource;\n+import org.keycloak.common.util.ObjectUtil;\nimport org.keycloak.events.admin.OperationType;\nimport org.keycloak.events.admin.ResourceType;\nimport org.keycloak.models.AccountRoles;\n@@ -135,12 +136,19 @@ public class ClientScopeTest extends AbstractClientTest {\nscopeRep.setName(\"scope1\");\nscopeRep.setDescription(\"scope1-desc\");\nscopeRep.setProtocol(OIDCLoginProtocol.LOGIN_PROTOCOL);\n+\n+ Map<String, String> attrs = new HashMap<>();\n+ attrs.put(\"someAttr\", \"someAttrValue\");\n+ attrs.put(\"emptyAttr\", \"\");\n+ scopeRep.setAttributes(attrs);\nString scope1Id = createClientScope(scopeRep);\n// Assert created attributes\nscopeRep = clientScopes().get(scope1Id).toRepresentation();\nAssert.assertEquals(\"scope1\", scopeRep.getName());\nAssert.assertEquals(\"scope1-desc\", scopeRep.getDescription());\n+ Assert.assertEquals(\"someAttrValue\", scopeRep.getAttributes().get(\"someAttr\"));\n+ Assert.assertTrue(ObjectUtil.isBlank(scopeRep.getAttributes().get(\"emptyAttr\")));\nAssert.assertEquals(OIDCLoginProtocol.LOGIN_PROTOCOL, scopeRep.getProtocol());\n@@ -149,6 +157,9 @@ public class ClientScopeTest extends AbstractClientTest {\nscopeRep.setDescription(\"scope1-desc-updated\");\nscopeRep.setProtocol(SamlProtocol.LOGIN_PROTOCOL);\n+ // Test update attribute to some non-blank value\n+ scopeRep.getAttributes().put(\"emptyAttr\", \"someValue\");\n+\nclientScopes().get(scope1Id).update(scopeRep);\nassertAdminEvents.assertEvent(getRealmId(), OperationType.UPDATE, AdminEventPaths.clientScopeResourcePath(scope1Id), scopeRep, ResourceType.CLIENT_SCOPE);\n@@ -158,6 +169,8 @@ public class ClientScopeTest extends AbstractClientTest {\nAssert.assertEquals(\"scope1-updated\", scopeRep.getName());\nAssert.assertEquals(\"scope1-desc-updated\", scopeRep.getDescription());\nAssert.assertEquals(SamlProtocol.LOGIN_PROTOCOL, scopeRep.getProtocol());\n+ Assert.assertEquals(\"someAttrValue\", scopeRep.getAttributes().get(\"someAttr\"));\n+ Assert.assertEquals(\"someValue\", scopeRep.getAttributes().get(\"emptyAttr\"));\n// Remove scope1\nclientScopes().get(scope1Id).remove();\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8519 OIDCScopeTest.testClientDisplayedOnConsentScreenWithEmptyConsentText failing on Oracle |
339,185 | 22.11.2018 11:27:25 | -3,600 | c9cd060417d9623d7c113e88163a797d010a554c | Fix servlet filter versions | [
{
"change_type": "MODIFY",
"old_path": "adapters/oidc/servlet-filter/pom.xml",
"new_path": "adapters/oidc/servlet-filter/pom.xml",
"diff": "<description/>\n<properties>\n+ <maven.compiler.target>1.7</maven.compiler.target>\n+ <maven.compiler.source>1.7</maven.compiler.source>\n+\n<keycloak.osgi.export>\norg.keycloak.adapters.servlet.*\n</keycloak.osgi.export>\n"
},
{
"change_type": "MODIFY",
"old_path": "adapters/spi/servlet-adapter-spi/pom.xml",
"new_path": "adapters/spi/servlet-adapter-spi/pom.xml",
"diff": "<description/>\n<properties>\n+ <maven.compiler.target>1.7</maven.compiler.target>\n+ <maven.compiler.source>1.7</maven.compiler.source>\n+\n<keycloak.osgi.export>\norg.keycloak.adapters.servlet.*\n</keycloak.osgi.export>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8824 Fix servlet filter versions |
339,185 | 19.11.2018 16:02:39 | -3,600 | d395043fc75f8949430b5cdb0d8047e6f179a706 | Fix client template to scope migration | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/JpaUpdate4_0_0_DefaultClientScopes.java",
"diff": "+/*\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.keycloak.connections.jpa.updater.liquibase.custom;\n+\n+import java.sql.PreparedStatement;\n+import java.sql.ResultSet;\n+import liquibase.exception.CustomChangeException;\n+import liquibase.statement.core.InsertStatement;\n+import liquibase.structure.core.Table;\n+\n+/**\n+ *\n+ * @author hmlnarik\n+ */\n+public class JpaUpdate4_0_0_DefaultClientScopes extends CustomKeycloakTask {\n+\n+ @Override\n+ protected void generateStatementsImpl() throws CustomChangeException {\n+ String clientTableName = database.correctObjectName(\"CLIENT\", Table.class);\n+ String clientScopeClientTableName = database.correctObjectName(\"CLIENT_SCOPE_CLIENT\", Table.class);\n+\n+ try (PreparedStatement statement = jdbcConnection.prepareStatement(\"SELECT ID, CLIENT_TEMPLATE_ID FROM \" + clientTableName);\n+ ResultSet rs = statement.executeQuery()) {\n+ while (rs.next()) {\n+ String clientId = rs.getString(1);\n+ String clientTemplateId = rs.getString(2);\n+\n+ if (clientId == null || clientId.trim().isEmpty()) {\n+ continue;\n+ }\n+ if (clientTemplateId == null || clientTemplateId.trim().isEmpty()) {\n+ continue;\n+ }\n+\n+ statements.add(\n+ new InsertStatement(null, null, clientScopeClientTableName)\n+ .addColumnValue(\"CLIENT_ID\", clientId.trim())\n+ .addColumnValue(\"SCOPE_ID\", clientTemplateId.trim())\n+ .addColumnValue(\"DEFAULT_SCOPE\", Boolean.TRUE)\n+ );\n+ }\n+\n+ confirmationMessage.append(\"Updated \" + statements.size() + \" records in CLIENT_SCOPE_CLIENT table\");\n+ } catch (Exception e) {\n+ throw new CustomChangeException(getTaskId() + \": Exception when updating data from previous version\", e);\n+ }\n+ }\n+\n+ @Override\n+ protected String getTaskId() {\n+ return \"Update 4.0.0.Final (Default client scopes)\";\n+ }\n+\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "model/jpa/src/main/resources/META-INF/jpa-changelog-4.0.0.xml",
"new_path": "model/jpa/src/main/resources/META-INF/jpa-changelog-4.0.0.xml",
"diff": "</changeSet>\n- <changeSet author=\"[email protected]\" id=\"4.0.0-KEYCLOAK-5579\">\n+ <changeSet author=\"[email protected]\" id=\"4.0.0-KEYCLOAK-5579-fixed\">\n+ <preConditions onFail=\"MARK_RAN\" onSqlOutput=\"TEST\">\n+ <not>\n+ <changeSetExecuted id=\"4.0.0-KEYCLOAK-5579\" author=\"[email protected]\" changeLogFile=\"META-INF/jpa-changelog-4.0.0.xml\" />\n+ </not>\n+ </preConditions>\n<!-- 1 - Rename clientTemplate to clientScope and drop some unused things from clientTemplate -->\n<dropForeignKeyConstraint baseTableName=\"CLIENT_TEMPLATE_ATTRIBUTES\" constraintName=\"FK_CL_TEMPL_ATTR_TEMPL\" />\nconstraintName=\"FK_CL_SCOPE_ATTR_SCOPE\" referencedTableName=\"CLIENT_SCOPE\" referencedColumnNames=\"ID\" />\n<!-- 2 - Client binding to more clientScopes -->\n- <!-- Foreign key dropped above TODO:mposolda migration existing clientTemplate to default clientScope -->\n- <dropColumn tableName=\"CLIENT\" columnName=\"CLIENT_TEMPLATE_ID\" />\n- <dropDefaultValue tableName=\"CLIENT\" columnName=\"USE_TEMPLATE_CONFIG\"/>\n- <dropDefaultValue tableName=\"CLIENT\" columnName=\"USE_TEMPLATE_SCOPE\" />\n- <dropDefaultValue tableName=\"CLIENT\" columnName=\"USE_TEMPLATE_MAPPERS\" />\n- <dropColumn tableName=\"CLIENT\" columnName=\"USE_TEMPLATE_CONFIG\" />\n- <dropColumn tableName=\"CLIENT\" columnName=\"USE_TEMPLATE_SCOPE\" />\n- <dropColumn tableName=\"CLIENT\" columnName=\"USE_TEMPLATE_MAPPERS\" />\n-\n<createTable tableName=\"CLIENT_SCOPE_CLIENT\">\n<column name=\"CLIENT_ID\" type=\"VARCHAR(36)\">\n<constraints nullable=\"false\"/>\n<addForeignKeyConstraint baseColumnNames=\"CLIENT_ID\" baseTableName=\"CLIENT_SCOPE_CLIENT\" constraintName=\"FK_C_CLI_SCOPE_CLIENT\" referencedColumnNames=\"ID\" referencedTableName=\"CLIENT\"/>\n<addForeignKeyConstraint baseColumnNames=\"SCOPE_ID\" baseTableName=\"CLIENT_SCOPE_CLIENT\" constraintName=\"FK_C_CLI_SCOPE_SCOPE\" referencedColumnNames=\"ID\" referencedTableName=\"CLIENT_SCOPE\"/>\n+ <customChange class=\"org.keycloak.connections.jpa.updater.liquibase.custom.JpaUpdate4_0_0_DefaultClientScopes\" />\n+\n+ <dropColumn tableName=\"CLIENT\" columnName=\"CLIENT_TEMPLATE_ID\" />\n+ <dropDefaultValue tableName=\"CLIENT\" columnName=\"USE_TEMPLATE_CONFIG\"/>\n+ <dropDefaultValue tableName=\"CLIENT\" columnName=\"USE_TEMPLATE_SCOPE\" />\n+ <dropDefaultValue tableName=\"CLIENT\" columnName=\"USE_TEMPLATE_MAPPERS\" />\n+ <dropColumn tableName=\"CLIENT\" columnName=\"USE_TEMPLATE_CONFIG\" />\n+ <dropColumn tableName=\"CLIENT\" columnName=\"USE_TEMPLATE_SCOPE\" />\n+ <dropColumn tableName=\"CLIENT\" columnName=\"USE_TEMPLATE_MAPPERS\" />\n+\n<!-- Default client scopes (global scopes configured at realm level) -->\n<createTable tableName=\"DEFAULT_CLIENT_SCOPE\">\n<column name=\"REALM_ID\" type=\"VARCHAR(36)\">\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/exportimport/ExportImportUtil.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/exportimport/ExportImportUtil.java",
"diff": "@@ -66,10 +66,13 @@ import java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n+import java.util.function.Function;\nimport java.util.function.Predicate;\nimport java.util.stream.Collectors;\n-import org.keycloak.common.Profile;\n+import org.hamcrest.Matcher;\n+import org.hamcrest.Matchers;\n+import static org.junit.Assert.assertThat;\n/**\n*\n@@ -635,21 +638,39 @@ public class ExportImportUtil {\nAssert.assertTrue(!source.stream().filter(object -> !predicate.stream().filter(predicate1 -> predicate1.test(object)).findFirst().isPresent()).findAny().isPresent());\n}\n+ private static Matcher<Iterable<? super String>> getDefaultClientScopeNameMatcher(ClientRepresentation rep) {\n+ switch (rep.getClientId()) {\n+ case \"client-with-template\":\n+ return Matchers.hasItem(\"Default_test_template\");\n+ default:\n+ return Matchers.not(Matchers.hasItem(\"Default_test_template\"));\n+ }\n+ }\n+\n+ public static void testClientDefaultClientScopes(RealmResource realm) {\n+ for (ClientRepresentation rep : realm.clients().findAll(true)) {\n+ Matcher<Iterable<? super String>> expectedDefaultClientScopeNames = getDefaultClientScopeNameMatcher(rep);\n+\n+ assertThat(\"Default client scopes for \" + rep.getClientId(), rep.getDefaultClientScopes(), expectedDefaultClientScopeNames);\n+ }\n+ }\npublic static void testRealmDefaultClientScopes(RealmResource realm) {\n// Assert built-in scopes were created in realm\nList<ClientScopeRepresentation> clientScopes = realm.clientScopes().findAll();\n- Map<String, ClientScopeRepresentation> clientScopesMap = clientScopes\n- .stream().collect(Collectors.toMap(clientScope -> clientScope.getName(), clientScope -> clientScope));\n-\n- org.keycloak.testsuite.Assert.assertTrue(clientScopesMap.containsKey(OAuth2Constants.SCOPE_PROFILE));\n- org.keycloak.testsuite.Assert.assertTrue(clientScopesMap.containsKey(OAuth2Constants.SCOPE_EMAIL));\n- org.keycloak.testsuite.Assert.assertTrue(clientScopesMap.containsKey(OAuth2Constants.SCOPE_ADDRESS));\n- org.keycloak.testsuite.Assert.assertTrue(clientScopesMap.containsKey(OAuth2Constants.SCOPE_PHONE));\n- org.keycloak.testsuite.Assert.assertTrue(clientScopesMap.containsKey(OAuth2Constants.OFFLINE_ACCESS));\n- org.keycloak.testsuite.Assert.assertTrue(clientScopesMap.containsKey(OIDCLoginProtocolFactory.ROLES_SCOPE));\n- org.keycloak.testsuite.Assert.assertTrue(clientScopesMap.containsKey(OIDCLoginProtocolFactory.WEB_ORIGINS_SCOPE));\n- org.keycloak.testsuite.Assert.assertTrue(clientScopesMap.containsKey(SamlProtocolFactory.SCOPE_ROLE_LIST));\n+ Map<String, ClientScopeRepresentation> clientScopesMap = clientScopes.stream()\n+ .collect(Collectors.toMap(ClientScopeRepresentation::getName, Function.identity()));\n+\n+ assertThat(clientScopesMap.keySet(), Matchers.hasItems(\n+ OAuth2Constants.SCOPE_PROFILE,\n+ OAuth2Constants.SCOPE_EMAIL,\n+ OAuth2Constants.SCOPE_ADDRESS,\n+ OAuth2Constants.SCOPE_PHONE,\n+ OAuth2Constants.OFFLINE_ACCESS,\n+ OIDCLoginProtocolFactory.ROLES_SCOPE,\n+ OIDCLoginProtocolFactory.WEB_ORIGINS_SCOPE,\n+ SamlProtocolFactory.SCOPE_ROLE_LIST\n+ ));\n// Check content of some client scopes\nMap<String, ProtocolMapperRepresentation> protocolMappers = clientScopesMap.get(OAuth2Constants.SCOPE_EMAIL).getProtocolMappers()\n@@ -662,17 +683,21 @@ public class ExportImportUtil {\norg.keycloak.testsuite.Assert.assertNames(offlineRoleScopes, OAuth2Constants.OFFLINE_ACCESS);\n// Check default client scopes and optional client scopes expected\n- Map<String, ClientScopeRepresentation> defaultClientScopes = realm.getDefaultDefaultClientScopes()\n- .stream().collect(Collectors.toMap(clientScope -> clientScope.getName(), clientScope -> clientScope));\n- org.keycloak.testsuite.Assert.assertTrue(defaultClientScopes.containsKey(OAuth2Constants.SCOPE_PROFILE));\n- org.keycloak.testsuite.Assert.assertTrue(defaultClientScopes.containsKey(OAuth2Constants.SCOPE_EMAIL));\n- org.keycloak.testsuite.Assert.assertTrue(defaultClientScopes.containsKey(OIDCLoginProtocolFactory.ROLES_SCOPE));\n- org.keycloak.testsuite.Assert.assertTrue(defaultClientScopes.containsKey(OIDCLoginProtocolFactory.WEB_ORIGINS_SCOPE));\n-\n- Map<String, ClientScopeRepresentation> optionalClientScopes = realm.getDefaultOptionalClientScopes()\n- .stream().collect(Collectors.toMap(clientScope -> clientScope.getName(), clientScope -> clientScope));\n- org.keycloak.testsuite.Assert.assertTrue(optionalClientScopes.containsKey(OAuth2Constants.SCOPE_ADDRESS));\n- org.keycloak.testsuite.Assert.assertTrue(optionalClientScopes.containsKey(OAuth2Constants.SCOPE_PHONE));\n- org.keycloak.testsuite.Assert.assertTrue(optionalClientScopes.containsKey(OAuth2Constants.OFFLINE_ACCESS));\n+ Set<String> defaultClientScopes = realm.getDefaultDefaultClientScopes()\n+ .stream().map(ClientScopeRepresentation::getName).collect(Collectors.toSet());\n+ assertThat(defaultClientScopes, Matchers.hasItems(\n+ OAuth2Constants.SCOPE_PROFILE,\n+ OAuth2Constants.SCOPE_EMAIL,\n+ OIDCLoginProtocolFactory.ROLES_SCOPE,\n+ OIDCLoginProtocolFactory.WEB_ORIGINS_SCOPE\n+ ));\n+\n+ Set<String> optionalClientScopes = realm.getDefaultOptionalClientScopes()\n+ .stream().map(ClientScopeRepresentation::getName).collect(Collectors.toSet());\n+ assertThat(optionalClientScopes, Matchers.hasItems(\n+ OAuth2Constants.SCOPE_ADDRESS,\n+ OAuth2Constants.SCOPE_PHONE,\n+ OAuth2Constants.OFFLINE_ACCESS\n+ ));\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/AbstractMigrationTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/AbstractMigrationTest.java",
"diff": "@@ -106,6 +106,7 @@ public abstract class AbstractMigrationTest extends AbstractKeycloakTest {\nif (supportsAuthzService) {\nexpectedClientIds.add(\"authz-servlet\");\n+ expectedClientIds.add(\"client-with-template\");\n}\nassertNames(migrationRealm.clients().findAll(), expectedClientIds.toArray(new String[expectedClientIds.size()]));\n@@ -211,6 +212,7 @@ public abstract class AbstractMigrationTest extends AbstractKeycloakTest {\nprotected void testMigrationTo4_0_0() {\ntestRealmDefaultClientScopes(this.masterRealm);\ntestRealmDefaultClientScopes(this.migrationRealm);\n+ testClientDefaultClientScopes(this.migrationRealm);\ntestOfflineScopeAddedToClient();\n}\n@@ -493,6 +495,11 @@ public abstract class AbstractMigrationTest extends AbstractKeycloakTest {\nExportImportUtil.testRealmDefaultClientScopes(realm);\n}\n+ private void testClientDefaultClientScopes(RealmResource realm) {\n+ log.info(\"Testing default client scopes transferred from client scope in realm: \" + realm.toRepresentation().getRealm());\n+ ExportImportUtil.testClientDefaultClientScopes(realm);\n+ }\n+\nprivate void testOfflineScopeAddedToClient() {\nlog.infof(\"Testing offline_access optional scope present in realm %s for client migration-test-client\", migrationRealm.toRepresentation().getRealm());\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport255MigrationTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/migration/JsonFileImport255MigrationTest.java",
"diff": "@@ -25,7 +25,6 @@ import org.keycloak.representations.idm.RealmRepresentation;\nimport org.keycloak.testsuite.arquillian.DeploymentTargetModifier;\nimport org.keycloak.testsuite.runonserver.RunOnServerDeployment;\nimport org.keycloak.testsuite.utils.io.IOUtil;\n-import org.keycloak.testsuite.util.WaitUtils;\nimport org.keycloak.util.JsonSerialization;\nimport java.io.IOException;\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-2.5.5.Final.json",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-2.5.5.Final.json",
"diff": "}, {\n\"client\" : \"security-admin-console\",\n\"roles\" : [ \"realm-admin\" ]\n- } ]\n+ } ],\n+ \"migration-test-client\": [\n+ {\n+ \"clientTemplate\": \"Default test template\",\n+ \"roles\": [\n+ \"migration-test-client-role\"\n+ ]\n+ }\n+ ]\n},\n\"clients\" : [ {\n\"id\" : \"6f27b0c3-9fc0-4e04-b69a-2031349acf04\",\n\"useTemplateScope\" : false,\n\"useTemplateMappers\" : false\n},\n+ {\n+ \"id\": \"26519045-3cd4-4f2a-974b-e1447907834a\",\n+ \"clientId\": \"client-with-template\",\n+ \"surrogateAuthRequired\": false,\n+ \"enabled\": true,\n+ \"clientAuthenticatorType\": \"client-secret\",\n+ \"secret\": \"**********\",\n+ \"redirectUris\": [],\n+ \"webOrigins\": [],\n+ \"notBefore\": 0,\n+ \"bearerOnly\": false,\n+ \"consentRequired\": false,\n+ \"standardFlowEnabled\": true,\n+ \"implicitFlowEnabled\": false,\n+ \"directAccessGrantsEnabled\": true,\n+ \"serviceAccountsEnabled\": false,\n+ \"publicClient\": true,\n+ \"frontchannelLogout\": false,\n+ \"protocol\": \"openid-connect\",\n+ \"attributes\": {},\n+ \"fullScopeAllowed\": false,\n+ \"nodeReRegistrationTimeout\": -1,\n+ \"clientTemplate\": \"Default test template\",\n+ \"useTemplateConfig\": false,\n+ \"useTemplateScope\": true,\n+ \"useTemplateMappers\": true\n+ },\n{\n\"id\": \"70e8e897-82d4-49ab-82c9-c37e1a48b6bb\",\n\"clientId\": \"authz-servlet\",\n]\n}\n}],\n- \"clientTemplates\" : [ ],\n+ \"clientTemplates\": [\n+ {\n+ \"id\": \"d43ae38d-80a1-471a-9a80-5f9a0d34d7a4\",\n+ \"name\": \"Default test template\",\n+ \"description\": \"Test client template\",\n+ \"protocol\": \"openid-connect\",\n+ \"fullScopeAllowed\": false\n+ }\n+ ],\n\"browserSecurityHeaders\" : {\n\"xContentTypeOptions\" : \"nosniff\",\n\"xFrameOptions\" : \"SAMEORIGIN\",\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-3.4.3.Final.json",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/resources/migration-test/migration-realm-3.4.3.Final.json",
"diff": "\"notBefore\" : 0,\n\"groups\" : [ ]\n} ],\n+ \"clientScopeMappings\" : {\n+ \"migration-test-client\": [\n+ {\n+ \"clientTemplate\": \"Default test template\",\n+ \"roles\": [\n+ \"migration-test-client-role\"\n+ ]\n+ }\n+ ]\n+ },\n\"clients\" : [ {\n\"id\" : \"6b9ba4ca-fb7c-4e17-a3e6-88f3a17397cc\",\n\"clientId\" : \"account\",\n\"useTemplateScope\" : false,\n\"useTemplateMappers\" : false\n},\n+ {\n+ \"id\": \"26519045-3cd4-4f2a-974b-e1447907834a\",\n+ \"clientId\": \"client-with-template\",\n+ \"surrogateAuthRequired\": false,\n+ \"enabled\": true,\n+ \"clientAuthenticatorType\": \"client-secret\",\n+ \"secret\": \"**********\",\n+ \"redirectUris\": [],\n+ \"webOrigins\": [],\n+ \"notBefore\": 0,\n+ \"bearerOnly\": false,\n+ \"consentRequired\": false,\n+ \"standardFlowEnabled\": true,\n+ \"implicitFlowEnabled\": false,\n+ \"directAccessGrantsEnabled\": true,\n+ \"serviceAccountsEnabled\": false,\n+ \"publicClient\": true,\n+ \"frontchannelLogout\": false,\n+ \"protocol\": \"openid-connect\",\n+ \"attributes\": {},\n+ \"fullScopeAllowed\": false,\n+ \"nodeReRegistrationTimeout\": -1,\n+ \"clientTemplate\": \"Default test template\",\n+ \"useTemplateConfig\": false,\n+ \"useTemplateScope\": true,\n+ \"useTemplateMappers\": true\n+ },\n{\n\"id\": \"70e8e897-82d4-49ab-82c9-c37e1a48b6bb\",\n\"clientId\": \"authz-servlet\",\n]\n}\n}],\n- \"clientTemplates\" : [ ],\n+ \"clientTemplates\": [\n+ {\n+ \"id\": \"d43ae38d-80a1-471a-9a80-5f9a0d34d7a4\",\n+ \"name\": \"Default test template\",\n+ \"description\": \"Test client template\",\n+ \"protocol\": \"openid-connect\",\n+ \"fullScopeAllowed\": false\n+ }\n+ ],\n\"browserSecurityHeaders\" : {\n\"xContentTypeOptions\" : \"nosniff\",\n\"xRobotsTag\" : \"none\",\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8707 Fix client template to scope migration |
339,185 | 22.11.2018 12:55:47 | -3,600 | d90a5d136738a8045ce2eb156722882763388570 | Fix missing option to Base64 encoder | [
{
"change_type": "MODIFY",
"old_path": "saml-core/src/main/java/org/keycloak/saml/processing/web/util/RedirectBindingUtil.java",
"new_path": "saml-core/src/main/java/org/keycloak/saml/processing/web/util/RedirectBindingUtil.java",
"diff": "@@ -139,7 +139,7 @@ public class RedirectBindingUtil {\n*/\npublic static String deflateBase64Encode(byte[] stringToEncode) throws IOException {\nbyte[] deflatedMsg = DeflateUtil.encode(stringToEncode);\n- return Base64.encodeBytes(deflatedMsg);\n+ return Base64.encodeBytes(deflatedMsg, Base64.DONT_BREAK_LINES);\n}\n/**\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/saml/SamlRedirectBindingTest.java",
"diff": "+/*\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.keycloak.testsuite.saml;\n+\n+import org.keycloak.dom.saml.v2.protocol.AuthnRequestType;\n+import org.keycloak.saml.common.exceptions.ProcessingException;\n+import org.keycloak.saml.common.util.DocumentUtil;\n+import org.keycloak.saml.processing.api.saml.v2.request.SAML2Request;\n+import org.keycloak.testsuite.util.SamlClient;\n+import org.keycloak.testsuite.util.SamlClient.Binding;\n+import org.keycloak.testsuite.util.SamlClientBuilder;\n+import org.apache.http.client.methods.HttpUriRequest;\n+import org.apache.http.util.EntityUtils;\n+import org.junit.Test;\n+import static org.hamcrest.Matchers.containsString;\n+import static org.hamcrest.Matchers.not;\n+import static org.junit.Assert.assertThat;\n+import static org.keycloak.testsuite.saml.AbstractSamlTest.REALM_NAME;\n+import static org.keycloak.testsuite.saml.AbstractSamlTest.SAML_ASSERTION_CONSUMER_URL_SALES_POST;\n+import static org.keycloak.testsuite.saml.AbstractSamlTest.SAML_CLIENT_ID_SALES_POST;\n+\n+/**\n+ *\n+ * @author hmlnarik\n+ */\n+public class SamlRedirectBindingTest extends AbstractSamlTest {\n+\n+ @Test\n+ public void testNoWhitespaceInLoginRequest() throws Exception {\n+ AuthnRequestType authnRequest = SamlClient.createLoginRequestDocument(SAML_CLIENT_ID_SALES_POST, SAML_ASSERTION_CONSUMER_URL_SALES_POST, getAuthServerSamlEndpoint(REALM_NAME));\n+ HttpUriRequest req = SamlClient.Binding.REDIRECT.createSamlUnsignedRequest(getAuthServerSamlEndpoint(REALM_NAME), null, SAML2Request.convert(authnRequest));\n+ String url = req.getURI().getQuery();\n+\n+ assertThat(url, not(containsString(\" \")));\n+ assertThat(url, not(containsString(\"\\n\")));\n+ assertThat(url, not(containsString(\"\\r\")));\n+ assertThat(url, not(containsString(\"\\t\")));\n+ }\n+}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8594 Fix missing option to Base64 encoder |
339,487 | 14.11.2018 22:50:30 | 7,200 | 311e84846041e4037425974c9973d72e550d06ec | Ensure the authenticationFlowBindingOverrides client configuration references a valid authentication flow id when a realm is imported | [
{
"change_type": "MODIFY",
"old_path": "server-spi-private/src/main/java/org/keycloak/models/utils/RepresentationToModel.java",
"new_path": "server-spi-private/src/main/java/org/keycloak/models/utils/RepresentationToModel.java",
"diff": "@@ -258,7 +258,7 @@ public class RepresentationToModel {\nif (rep.getOtpPolicyType() != null) newRealm.setOTPPolicy(toPolicy(rep));\nelse newRealm.setOTPPolicy(OTPPolicy.DEFAULT_POLICY);\n- importAuthenticationFlows(newRealm, rep);\n+ Map<String, String> mappedFlows = importAuthenticationFlows(newRealm, rep);\nif (rep.getRequiredActions() != null) {\nfor (RequiredActionProviderRepresentation action : rep.getRequiredActions()) {\nRequiredActionProviderModel model = toModel(action);\n@@ -300,7 +300,7 @@ public class RepresentationToModel {\n}\nif (rep.getClients() != null) {\n- createClients(session, rep, newRealm);\n+ createClients(session, rep, newRealm, mappedFlows);\n}\nimportRoles(rep.getRoles(), newRealm);\n@@ -584,7 +584,8 @@ public class RepresentationToModel {\n}\n}\n- public static void importAuthenticationFlows(RealmModel newRealm, RealmRepresentation rep) {\n+ public static Map<String, String> importAuthenticationFlows(RealmModel newRealm, RealmRepresentation rep) {\n+ Map<String, String> mappedFlows = new HashMap<>();\nif (rep.getAuthenticationFlows() == null) {\n// assume this is an old version being imported\nDefaultAuthenticationFlows.migrateFlows(newRealm);\n@@ -596,8 +597,11 @@ public class RepresentationToModel {\nfor (AuthenticationFlowRepresentation flowRep : rep.getAuthenticationFlows()) {\nAuthenticationFlowModel model = toModel(flowRep);\n// make sure new id is generated for new AuthenticationFlowModel instance\n+ String previousId = model.getId();\nmodel.setId(null);\nmodel = newRealm.addAuthenticationFlow(model);\n+ // store the mapped ids so that clients can reference the correct flow when importing the authenticationFlowBindingOverrides\n+ mappedFlows.put(previousId, model.getId());\n}\nfor (AuthenticationFlowRepresentation flowRep : rep.getAuthenticationFlows()) {\nAuthenticationFlowModel model = newRealm.getFlowByAlias(flowRep.getAlias());\n@@ -675,6 +679,8 @@ public class RepresentationToModel {\n}\nDefaultAuthenticationFlows.addIdentityProviderAuthenticator(newRealm, defaultProvider);\n+\n+ return mappedFlows;\n}\nprivate static void convertDeprecatedSocialProviders(RealmRepresentation rep) {\n@@ -1073,10 +1079,10 @@ public class RepresentationToModel {\n// CLIENTS\n- private static Map<String, ClientModel> createClients(KeycloakSession session, RealmRepresentation rep, RealmModel realm) {\n+ private static Map<String, ClientModel> createClients(KeycloakSession session, RealmRepresentation rep, RealmModel realm, Map<String, String> mappedFlows) {\nMap<String, ClientModel> appMap = new HashMap<String, ClientModel>();\nfor (ClientRepresentation resourceRep : rep.getClients()) {\n- ClientModel app = createClient(session, realm, resourceRep, false);\n+ ClientModel app = createClient(session, realm, resourceRep, false, mappedFlows);\nappMap.put(app.getClientId(), app);\n}\nreturn appMap;\n@@ -1090,6 +1096,10 @@ public class RepresentationToModel {\n* @return\n*/\npublic static ClientModel createClient(KeycloakSession session, RealmModel realm, ClientRepresentation resourceRep, boolean addDefaultRoles) {\n+ return createClient(session, realm, resourceRep, addDefaultRoles, null);\n+ }\n+\n+ private static ClientModel createClient(KeycloakSession session, RealmModel realm, ClientRepresentation resourceRep, boolean addDefaultRoles, Map<String, String> mappedFlows) {\nlogger.debugv(\"Create client: {0}\", resourceRep.getClientId());\nClientModel client = resourceRep.getId() != null ? realm.addClient(resourceRep.getId(), resourceRep.getClientId()) : realm.addClient(resourceRep.getClientId());\n@@ -1164,10 +1174,14 @@ public class RepresentationToModel {\ncontinue;\n} else {\nString flowId = entry.getValue();\n+ // check if flow id was mapped when the flows were imported\n+ if (mappedFlows != null && mappedFlows.containsKey(flowId)) {\n+ flowId = mappedFlows.get(flowId);\n+ }\nif (client.getRealm().getAuthenticationFlowById(flowId) == null) {\nthrow new RuntimeException(\"Unable to resolve auth flow binding override for: \" + entry.getKey());\n}\n- client.setAuthenticationFlowBindingOverride(entry.getKey(), entry.getValue());\n+ client.setAuthenticationFlowBindingOverride(entry.getKey(), flowId);\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/exportimport/ExportImportUtil.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/exportimport/ExportImportUtil.java",
"diff": "@@ -25,6 +25,7 @@ import org.keycloak.admin.client.resource.ClientResource;\nimport org.keycloak.admin.client.resource.ClientScopeResource;\nimport org.keycloak.admin.client.resource.RealmResource;\nimport org.keycloak.admin.client.resource.UserResource;\n+import org.keycloak.authentication.AuthenticationFlow;\nimport org.keycloak.common.constants.KerberosConstants;\nimport org.keycloak.models.Constants;\nimport org.keycloak.models.LDAPConstants;\n@@ -137,6 +138,16 @@ public class ExportImportUtil {\nAssert.assertEquals(\"client-secret\", application.getClientAuthenticatorType());\nAssert.assertEquals(\"client-jwt\", otherApp.getClientAuthenticatorType());\n+ // test authenticationFlowBindingOverrides\n+ Map<String, String> flowMap = otherApp.getAuthenticationFlowBindingOverrides();\n+ Assert.assertNotNull(flowMap);\n+ Assert.assertEquals(1, flowMap.size());\n+ Assert.assertTrue(flowMap.containsKey(\"browser\"));\n+ // if the authentication flows were correctly imported there must be a flow whose id matches the one in the authenticationFlowBindingOverrides\n+ AuthenticationFlowRepresentation flowRep = realmRsc.flows().getFlow(flowMap.get(\"browser\"));\n+ Assert.assertNotNull(flowRep);\n+ Assert.assertEquals(\"browser\", flowRep.getAlias());\n+\n// Test finding applications by ID\nAssert.assertNull(ApiUtil.findClientResourceById(realmRsc, \"982734\"));\nAssert.assertEquals(application.getId(), ApiUtil.findClientResourceById(realmRsc, application.getId()).toRepresentation().getId());\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/resources/model/testrealm.json",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/resources/model/testrealm.json",
"diff": "\"directAccessGrantsEnabled\": false,\n\"serviceAccountsEnabled\": true,\n\"clientAuthenticatorType\": \"client-jwt\",\n+ \"authenticationFlowBindingOverrides\": {\n+ \"browser\": \"73dcb1e4-2c7c-4494-825d-f2677cbc114c\"\n+ },\n\"protocolMappers\" : [\n{\n\"name\" : \"gss delegation credential\",\n}\n]\n+ },\n+ \"authenticationFlows\": [\n+ {\n+ \"id\": \"aed29d4f-aba7-4992-a600-18c0a28c1fc3\",\n+ \"alias\": \"Handle Existing Account\",\n+ \"description\": \"Handle what to do if there is existing account with same email/username like authenticated identity provider\",\n+ \"providerId\": \"basic-flow\",\n+ \"topLevel\": false,\n+ \"builtIn\": true,\n+ \"authenticationExecutions\": [\n+ {\n+ \"authenticator\": \"idp-confirm-link\",\n+ \"requirement\": \"REQUIRED\",\n+ \"priority\": 10,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"authenticator\": \"idp-email-verification\",\n+ \"requirement\": \"ALTERNATIVE\",\n+ \"priority\": 20,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"requirement\": \"ALTERNATIVE\",\n+ \"priority\": 30,\n+ \"flowAlias\": \"Verify Existing Account by Re-authentication\",\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": true\n+ }\n+ ]\n+ },\n+ {\n+ \"id\": \"d8b8f564-6d56-4171-ba36-a8922c6eae49\",\n+ \"alias\": \"Verify Existing Account by Re-authentication\",\n+ \"description\": \"Reauthentication of existing account\",\n+ \"providerId\": \"basic-flow\",\n+ \"topLevel\": false,\n+ \"builtIn\": true,\n+ \"authenticationExecutions\": [\n+ {\n+ \"authenticator\": \"idp-username-password-form\",\n+ \"requirement\": \"REQUIRED\",\n+ \"priority\": 10,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"authenticator\": \"auth-otp-form\",\n+ \"requirement\": \"OPTIONAL\",\n+ \"priority\": 20,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ }\n+ ]\n+ },\n+ {\n+ \"id\": \"73dcb1e4-2c7c-4494-825d-f2677cbc114c\",\n+ \"alias\": \"browser\",\n+ \"description\": \"browser based authentication\",\n+ \"providerId\": \"basic-flow\",\n+ \"topLevel\": true,\n+ \"builtIn\": true,\n+ \"authenticationExecutions\": [\n+ {\n+ \"authenticator\": \"auth-cookie\",\n+ \"requirement\": \"ALTERNATIVE\",\n+ \"priority\": 10,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"authenticator\": \"auth-spnego\",\n+ \"requirement\": \"DISABLED\",\n+ \"priority\": 20,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"authenticator\": \"identity-provider-redirector\",\n+ \"requirement\": \"ALTERNATIVE\",\n+ \"priority\": 25,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"requirement\": \"ALTERNATIVE\",\n+ \"priority\": 30,\n+ \"flowAlias\": \"forms\",\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": true\n}\n+ ]\n+ },\n+ {\n+ \"id\": \"a0a80dc3-d473-468e-b6e8-f1d306c21360\",\n+ \"alias\": \"clients\",\n+ \"description\": \"Base authentication for clients\",\n+ \"providerId\": \"client-flow\",\n+ \"topLevel\": true,\n+ \"builtIn\": true,\n+ \"authenticationExecutions\": [\n+ {\n+ \"authenticator\": \"client-secret\",\n+ \"requirement\": \"ALTERNATIVE\",\n+ \"priority\": 10,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"authenticator\": \"client-jwt\",\n+ \"requirement\": \"ALTERNATIVE\",\n+ \"priority\": 20,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"authenticator\": \"client-secret-jwt\",\n+ \"requirement\": \"ALTERNATIVE\",\n+ \"priority\": 30,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ }\n+ ]\n+ },\n+ {\n+ \"id\": \"91882f46-54be-4738-847a-32e849d53240\",\n+ \"alias\": \"direct grant\",\n+ \"description\": \"OpenID Connect Resource Owner Grant\",\n+ \"providerId\": \"basic-flow\",\n+ \"topLevel\": true,\n+ \"builtIn\": true,\n+ \"authenticationExecutions\": [\n+ {\n+ \"authenticator\": \"direct-grant-validate-username\",\n+ \"requirement\": \"REQUIRED\",\n+ \"priority\": 10,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"authenticator\": \"direct-grant-validate-password\",\n+ \"requirement\": \"REQUIRED\",\n+ \"priority\": 20,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"authenticator\": \"direct-grant-validate-otp\",\n+ \"requirement\": \"OPTIONAL\",\n+ \"priority\": 30,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ }\n+ ]\n+ },\n+ {\n+ \"id\": \"b727a208-587c-4f27-8f48-ba2a0d4effdd\",\n+ \"alias\": \"docker auth\",\n+ \"description\": \"Used by Docker clients to authenticate against the IDP\",\n+ \"providerId\": \"basic-flow\",\n+ \"topLevel\": true,\n+ \"builtIn\": true,\n+ \"authenticationExecutions\": [\n+ {\n+ \"authenticator\": \"docker-http-basic-authenticator\",\n+ \"requirement\": \"REQUIRED\",\n+ \"priority\": 10,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ }\n+ ]\n+ },\n+ {\n+ \"id\": \"5a6ac775-4000-4ccf-9271-6cb599297d4b\",\n+ \"alias\": \"first broker login\",\n+ \"description\": \"Actions taken after first broker login with identity provider account, which is not yet linked to any Keycloak account\",\n+ \"providerId\": \"basic-flow\",\n+ \"topLevel\": true,\n+ \"builtIn\": true,\n+ \"authenticationExecutions\": [\n+ {\n+ \"authenticatorConfig\": \"review profile config\",\n+ \"authenticator\": \"idp-review-profile\",\n+ \"requirement\": \"REQUIRED\",\n+ \"priority\": 10,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"authenticatorConfig\": \"create unique user config\",\n+ \"authenticator\": \"idp-create-user-if-unique\",\n+ \"requirement\": \"ALTERNATIVE\",\n+ \"priority\": 20,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"requirement\": \"ALTERNATIVE\",\n+ \"priority\": 30,\n+ \"flowAlias\": \"Handle Existing Account\",\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": true\n+ }\n+ ]\n+ },\n+ {\n+ \"id\": \"1a84808d-e0c7-4759-aee8-cf9229542429\",\n+ \"alias\": \"forms\",\n+ \"description\": \"Username, password, otp and other auth forms.\",\n+ \"providerId\": \"basic-flow\",\n+ \"topLevel\": false,\n+ \"builtIn\": true,\n+ \"authenticationExecutions\": [\n+ {\n+ \"authenticator\": \"auth-username-password-form\",\n+ \"requirement\": \"REQUIRED\",\n+ \"priority\": 10,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"authenticator\": \"auth-otp-form\",\n+ \"requirement\": \"OPTIONAL\",\n+ \"priority\": 20,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ }\n+ ]\n+ },\n+ {\n+ \"id\": \"717f990a-1c46-464c-9051-5e0ae39d63db\",\n+ \"alias\": \"registration\",\n+ \"description\": \"registration flow\",\n+ \"providerId\": \"basic-flow\",\n+ \"topLevel\": true,\n+ \"builtIn\": true,\n+ \"authenticationExecutions\": [\n+ {\n+ \"authenticator\": \"registration-page-form\",\n+ \"requirement\": \"REQUIRED\",\n+ \"priority\": 10,\n+ \"flowAlias\": \"registration form\",\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": true\n+ }\n+ ]\n+ },\n+ {\n+ \"id\": \"166fca50-7b69-4cd4-80eb-a569e87ff8a2\",\n+ \"alias\": \"registration form\",\n+ \"description\": \"registration form\",\n+ \"providerId\": \"form-flow\",\n+ \"topLevel\": false,\n+ \"builtIn\": true,\n+ \"authenticationExecutions\": [\n+ {\n+ \"authenticator\": \"registration-user-creation\",\n+ \"requirement\": \"REQUIRED\",\n+ \"priority\": 20,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"authenticator\": \"registration-profile-action\",\n+ \"requirement\": \"REQUIRED\",\n+ \"priority\": 40,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"authenticator\": \"registration-password-action\",\n+ \"requirement\": \"REQUIRED\",\n+ \"priority\": 50,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"authenticator\": \"registration-recaptcha-action\",\n+ \"requirement\": \"DISABLED\",\n+ \"priority\": 60,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ }\n+ ]\n+ },\n+ {\n+ \"id\": \"a516cb39-8f6d-4d08-ac82-236377be6500\",\n+ \"alias\": \"reset credentials\",\n+ \"description\": \"Reset credentials for a user if they forgot their password or something\",\n+ \"providerId\": \"basic-flow\",\n+ \"topLevel\": true,\n+ \"builtIn\": true,\n+ \"authenticationExecutions\": [\n+ {\n+ \"authenticator\": \"reset-credentials-choose-user\",\n+ \"requirement\": \"REQUIRED\",\n+ \"priority\": 10,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"authenticator\": \"reset-credential-email\",\n+ \"requirement\": \"REQUIRED\",\n+ \"priority\": 20,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"authenticator\": \"reset-password\",\n+ \"requirement\": \"REQUIRED\",\n+ \"priority\": 30,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ },\n+ {\n+ \"authenticator\": \"reset-otp\",\n+ \"requirement\": \"OPTIONAL\",\n+ \"priority\": 40,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ }\n+ ]\n+ },\n+ {\n+ \"id\": \"8b9ae730-11e0-451f-b693-e32f09415e42\",\n+ \"alias\": \"saml ecp\",\n+ \"description\": \"SAML ECP Profile Authentication Flow\",\n+ \"providerId\": \"basic-flow\",\n+ \"topLevel\": true,\n+ \"builtIn\": true,\n+ \"authenticationExecutions\": [\n+ {\n+ \"authenticator\": \"http-basic-authenticator\",\n+ \"requirement\": \"REQUIRED\",\n+ \"priority\": 10,\n+ \"userSetupAllowed\": false,\n+ \"autheticatorFlow\": false\n+ }\n+ ]\n+ }\n+ ],\n+ \"authenticatorConfig\": [\n+ {\n+ \"id\": \"a6d38dcd-7b53-4991-b4eb-c866ce3c5e70\",\n+ \"alias\": \"create unique user config\",\n+ \"config\": {\n+ \"require.password.update.after.registration\": \"false\"\n+ }\n+ },\n+ {\n+ \"id\": \"7408f503-b929-422f-b52b-277cebda44ba\",\n+ \"alias\": \"review profile config\",\n+ \"config\": {\n+ \"update.profile.on.first.login\": \"missing\"\n+ }\n+ }\n+ ]\n}\n\\ No newline at end of file\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8504 Ensure the authenticationFlowBindingOverrides client configuration references a valid authentication flow id when a realm is imported |
339,364 | 23.11.2018 11:41:48 | -3,600 | 7d75377813f5a914fa2b359b380770b55019601e | Fix ProfileAssume for backward adapter compat. testing | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/ProfileAssume.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/ProfileAssume.java",
"diff": "@@ -39,10 +39,11 @@ public class ProfileAssume {\nstatic {\nString host = System.getProperty(\"auth.server.host\", \"localhost\");\nString port = System.getProperty(\"auth.server.http.port\", \"8180\");\n+ boolean adapterCompatTesting = Boolean.parseBoolean(System.getProperty(\"testsuite.adapter.compat.testing\"));\nString authServerContextRoot = \"http://\" + host + \":\" + port;\ntry {\n- Keycloak adminClient = AdminClientUtil.createAdminClient(false, authServerContextRoot);\n+ Keycloak adminClient = AdminClientUtil.createAdminClient(adapterCompatTesting, authServerContextRoot);\nProfileInfoRepresentation profileInfo = adminClient.serverInfo().getInfo().getProfileInfo();\nprofile = profileInfo.getName();\nList<String> disabled = profileInfo.getDisabledFeatures();\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8944 Fix ProfileAssume for backward adapter compat. testing |
339,281 | 26.11.2018 14:44:07 | -3,600 | 8b122de4250aeb57af04890c45db2d3c6450f198 | Update HOW-TO-RUN.md regarding fuse7 testing | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/HOW-TO-RUN.md",
"new_path": "testsuite/integration-arquillian/HOW-TO-RUN.md",
"diff": "@@ -148,9 +148,9 @@ Assumed you downloaded `jboss-fuse-karaf-6.3.0.redhat-229.zip`\n-Dtest=Fuse*AdapterTest\n-### JBoss Fuse 7.0\n+### JBoss Fuse 7.X\n-1) Download JBoss Fuse 7.0 to your filesystem. It can be downloaded from http://origin-repository.jboss.org/nexus/content/groups/m2-proxy/org/jboss/fuse/fuse-karaf\n+1) Download JBoss Fuse 7 to your filesystem. It can be downloaded from http://origin-repository.jboss.org/nexus/content/groups/m2-proxy/org/jboss/fuse/fuse-karaf\nAssumed you downloaded `fuse-karaf-7.0.0.fuse-000202.zip`\n2) Install to your local maven repository and change the properties according to your env (This step can be likely avoided if you somehow configure your local maven settings to point directly to Fuse repo):\n@@ -180,7 +180,7 @@ Assumed you downloaded `fuse-karaf-7.0.0.fuse-000202.zip`\n# Run the Fuse adapter tests\nmvn -f testsuite/integration-arquillian/tests/base/pom.xml \\\nclean test \\\n- -Papp-server-fuse70 \\\n+ -Papp-server-fuse7x \\\n-Dtest=Fuse*AdapterTest\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8951 Update HOW-TO-RUN.md regarding fuse7 testing |
339,373 | 15.11.2018 11:10:30 | -3,600 | 2b9b1ba45f7c5267cf8569edeab87d41d89e6e89 | PathMatcher doesn't prefer overloaded templated resources | [
{
"change_type": "MODIFY",
"old_path": "common/src/main/java/org/keycloak/common/util/PathMatcher.java",
"new_path": "common/src/main/java/org/keycloak/common/util/PathMatcher.java",
"diff": "@@ -28,6 +28,7 @@ public abstract class PathMatcher<P> {\npublic P matches(final String targetUri) {\nint patternCount = 0;\n+ int bracketsPatternCount = 0;\nP matchingPath = null;\nP matchingAnyPath = null;\nP matchingAnySuffixPath = null;\n@@ -50,8 +51,9 @@ public abstract class PathMatcher<P> {\nif (templateUri != null) {\nint length = expectedUri.split(\"\\\\/\").length;\n+ int bracketsLength = expectedUri.split(\"\\\\{\").length;\n- if (exactMatch(expectedUri, targetUri, templateUri) && (patternCount == 0 || length > patternCount)) {\n+ if (exactMatch(expectedUri, targetUri, templateUri) && (patternCount == 0 || length > patternCount || bracketsLength < bracketsPatternCount)) {\nmatchingUri = templateUri;\nP resolved = resolvePathConfig(entry, targetUri);\n@@ -60,6 +62,7 @@ public abstract class PathMatcher<P> {\n}\npatternCount = length;\n+ bracketsPatternCount = bracketsLength;\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/test-apps/servlet-policy-enforcer/servlet-policy-enforcer-authz-realm.json",
"new_path": "testsuite/integration-arquillian/test-apps/servlet-policy-enforcer/servlet-policy-enforcer-authz-realm.json",
"diff": "{\n\"name\": \"Pattern 16\",\n\"uris\": [\"/keycloak-7269/sub-resource1\", \"/keycloak-7269/sub-resource2/*\", \"/keycloak-7269/sub-resource1/{test-pattern}/specialSuffix\"]\n+ },\n+ {\n+ \"name\": \"Pattern 17\",\n+ \"uris\": [\"/keycloak-8823/resource/{version}/subresource/{id}/{other}\"]\n+ },\n+ {\n+ \"name\": \"Pattern 17 Entities\",\n+ \"uris\": [\"/keycloak-8823/resource/{version}/subresource/{id}/entities\"]\n}\n],\n\"policies\": [\n\"resources\": \"[\\\"Pattern 16\\\"]\",\n\"applyPolicies\": \"[\\\"Default Policy\\\"]\"\n}\n+ },\n+ {\n+ \"name\": \"Pattern 17 Permission\",\n+ \"type\": \"resource\",\n+ \"logic\": \"POSITIVE\",\n+ \"decisionStrategy\": \"UNANIMOUS\",\n+ \"config\": {\n+ \"resources\": \"[\\\"Pattern 17\\\"]\",\n+ \"applyPolicies\": \"[\\\"Default Policy\\\"]\"\n+ }\n+ },\n+ {\n+ \"name\": \"Pattern 17 Entities Permission\",\n+ \"type\": \"resource\",\n+ \"logic\": \"POSITIVE\",\n+ \"decisionStrategy\": \"UNANIMOUS\",\n+ \"config\": {\n+ \"resources\": \"[\\\"Pattern 17 Entities\\\"]\",\n+ \"applyPolicies\": \"[\\\"Default Policy\\\"]\"\n+ }\n}\n],\n\"scopes\": []\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/test-apps/servlet-policy-enforcer/src/main/webapp/WEB-INF/keycloak.json",
"new_path": "testsuite/integration-arquillian/test-apps/servlet-policy-enforcer/src/main/webapp/WEB-INF/keycloak.json",
"diff": "{\n\"name\": \"Pattern 16\",\n\"path\": \"/keycloak-7269/sub-resource1/{test-pattern}/specialSuffix\"\n+ },\n+ {\n+ \"name\": \"Pattern 17\",\n+ \"path\": \"/keycloak-8823/resource/{version}/subresource/{id}/{other}\"\n+ },\n+ {\n+ \"name\": \"Pattern 17 Entities\",\n+ \"path\": \"/keycloak-8823/resource/{version}/subresource/{id}/entities\"\n}\n]\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/authorization/ServletPolicyEnforcerTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/authorization/ServletPolicyEnforcerTest.java",
"diff": "@@ -487,6 +487,41 @@ public class ServletPolicyEnforcerTest extends AbstractExampleAdapterTest {\n});\n}\n+ @Test\n+ public void testOverloadedTemplateUri() {\n+ performTests(() -> {\n+ login(\"alice\", \"alice\");\n+ navigateTo(\"/keycloak-8823/resource/v1/subresource/123/entities\");\n+ assertFalse(wasDenied());\n+ navigateTo(\"/keycloak-8823/resource/v1/subresource/123/someother\");\n+ assertFalse(wasDenied());\n+\n+ updatePermissionPolicies(\"Pattern 17 Entities Permission\", \"Deny Policy\");\n+\n+ login(\"alice\", \"alice\");\n+ navigateTo(\"/keycloak-8823/resource/v1/subresource/123/entities\");\n+ assertTrue(wasDenied());\n+ navigateTo(\"/keycloak-8823/resource/v1/subresource/123/someother\");\n+ assertFalse(wasDenied());\n+\n+ updatePermissionPolicies(\"Pattern 17 Entities Permission\", \"Default Policy\");\n+ updatePermissionPolicies(\"Pattern 17 Permission\", \"Deny Policy\");\n+ login(\"alice\", \"alice\");\n+ navigateTo(\"/keycloak-8823/resource/v1/subresource/123/entities\");\n+ assertFalse(wasDenied());\n+ navigateTo(\"/keycloak-8823/resource/v1/subresource/123/someother\");\n+ assertTrue(wasDenied());\n+\n+ updatePermissionPolicies(\"Pattern 17 Entities Permission\", \"Default Policy\");\n+ updatePermissionPolicies(\"Pattern 17 Permission\", \"Default Policy\");\n+ login(\"alice\", \"alice\");\n+ navigateTo(\"/keycloak-8823/resource/v1/subresource/123/entities\");\n+ assertFalse(wasDenied());\n+ navigateTo(\"/keycloak-8823/resource/v1/subresource/123/someother\");\n+ assertFalse(wasDenied());\n+ });\n+ }\n+\nprivate void navigateTo(String path) {\nthis.driver.navigate().to(getResourceServerUrl() + path);\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | [KEYCLOAK-8823] - PathMatcher doesn't prefer overloaded templated resources |
339,281 | 28.11.2018 19:00:51 | -3,600 | 5ad929b9ee26a9ff3356b94cc79647ede2b703c5 | adapter installation fails on windows - eap7 | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/servers/app-server/jboss/common/win/run-jboss-cli.bat",
"diff": "+set \"NOPAUSE=true\"\n+set cli_file=%2\n+set working_dir=%3\n+\n+cd %working_dir%\n+\n+if \"%4\"==\"-Dserver.config\" (\n+ set server_config=%5\n+) else (\n+ set server_config=standalone.xml\n+)\n+\n+if \"%4\"==\"-Djboss.server.config.dir\" (\n+ jboss-cli.bat --file=%cli_file% -Dserver.config=%server_config% -Djboss.server.config.dir=%5\n+) else (\n+ jboss-cli.bat --file=%cli_file% -Dserver.config=%server_config%\n+)\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/servers/app-server/jboss/pom.xml",
"new_path": "testsuite/integration-arquillian/servers/app-server/jboss/pom.xml",
"diff": "<saml-adapter.version>${project.version}</saml-adapter.version>\n<skip.elytron.adapter.installation>true</skip.elytron.adapter.installation>\n<skip.adapter.offline.installation>true</skip.adapter.offline.installation>\n+\n+ <cli.executable>./jboss-cli.${script.suffix}</cli.executable>\n+ <cli.working.dir>${app.server.jboss.home}/bin</cli.working.dir>\n+ <cli.win.working.dir/>\n</properties>\n<profiles>\n+ <profile>\n+ <id>windows-properties-cli</id>\n+ <activation>\n+ <os>\n+ <family>Windows</family>\n+ </os>\n+ </activation>\n+ <properties>\n+ <cli.executable>run-jboss-cli.bat</cli.executable>\n+ <cli.working.dir>${common.resources}/win</cli.working.dir>\n+ <cli.win.working.dir>${app.server.jboss.home}/bin</cli.win.working.dir>\n+ </properties>\n+ </profile>\n<profile>\n<id>app-server-jboss-submodules</id>\n<activation>\n</goals>\n<configuration>\n<skip>${skip.apply.offline.cli}</skip><!--eap6-->\n- <executable>./jboss-cli.${script.suffix}</executable>\n- <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n+ <executable>${cli.executable}</executable>\n+ <workingDirectory>${cli.working.dir}</workingDirectory>\n<arguments>\n<argument>--file=${common.resources}/cli/add-adapter-log-level.cli</argument>\n+ <!--\n+ following attribute is required just for windows\n+ see ${common.resources}/win/run-jboss-cli.bat\n+ !! the ordering is important, if you need to change it edit run-jboss-cli.bat !!\n+ -->\n+ <argument>${cli.win.working.dir}</argument>\n</arguments>\n</configuration>\n</execution>\n</goals>\n<configuration>\n<skip>${skip.apply.offline.cli}</skip><!--eap6-->\n- <executable>./jboss-cli.${script.suffix}</executable>\n- <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n+ <executable>${cli.executable}</executable>\n+ <workingDirectory>${cli.working.dir}</workingDirectory>\n<arguments>\n<argument>--file=${common.resources}/cli/add-adapter-log-level.cli</argument>\n+ <!--\n+ following attribute is required just for windows\n+ see ${common.resources}/win/run-jboss-cli.bat\n+ !! the ordering is important, if you need to change it edit run-jboss-cli.bat !!\n+ -->\n+ <argument>${cli.win.working.dir}</argument>\n<argument>-Dserver.config=standalone-ha.xml</argument>\n</arguments>\n</configuration>\n</goals>\n<configuration>\n<skip>${skip.elytron.adapter.installation}</skip>\n- <executable>./jboss-cli.${script.suffix}</executable>\n- <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n+ <executable>${cli.executable}</executable>\n+ <workingDirectory>${cli.working.dir}</workingDirectory>\n<arguments>\n<argument>--file=${app.server.jboss.home}/bin/adapter-elytron-install-offline.cli</argument>\n+ <!--\n+ following attribute is required just for windows\n+ see ${common.resources}/win/run-jboss-cli.bat\n+ !! the ordering is important, if you need to change it edit run-jboss-cli.bat !!\n+ -->\n+ <argument>${cli.win.working.dir}</argument>\n</arguments>\n</configuration>\n</execution>\n</goals>\n<configuration>\n<skip>${skip.elytron.adapter.installation}</skip>\n- <executable>./jboss-cli.${script.suffix}</executable>\n- <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n+ <executable>${cli.executable}</executable>\n+ <workingDirectory>${cli.working.dir}</workingDirectory>\n<arguments>\n<argument>--file=${app.server.jboss.home}/bin/adapter-elytron-install-offline.cli</argument>\n+ <!--\n+ following attribute is required just for windows\n+ see ${common.resources}/win/run-jboss-cli.bat\n+ !! the ordering is important, if you need to change it edit run-jboss-cli.bat !!\n+ -->\n+ <argument>${cli.win.working.dir}</argument>\n<argument>-Dserver.config=standalone-ha.xml</argument>\n</arguments>\n</configuration>\n</goals>\n<configuration>\n<skip>${skip.elytron.adapter.installation}</skip>\n- <executable>./jboss-cli.${script.suffix}</executable>\n- <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n+ <executable>${cli.executable}</executable>\n+ <workingDirectory>${cli.working.dir}</workingDirectory>\n<arguments>\n<argument>--file=${app.server.jboss.home}/bin/adapter-elytron-install-saml-offline.cli</argument>\n+ <!--\n+ following attribute is required just for windows\n+ see ${common.resources}/win/run-jboss-cli.bat\n+ !! the ordering is important, if you need to change it edit run-jboss-cli.bat !!\n+ -->\n+ <argument>${cli.win.working.dir}</argument>\n</arguments>\n</configuration>\n</execution>\n</goals>\n<configuration>\n<skip>${skip.elytron.adapter.installation}</skip>\n- <executable>./jboss-cli.${script.suffix}</executable>\n- <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n+ <executable>${cli.executable}</executable>\n+ <workingDirectory>${cli.working.dir}</workingDirectory>\n<arguments>\n<argument>--file=${app.server.jboss.home}/bin/adapter-elytron-install-saml-offline.cli</argument>\n+ <!--\n+ following attribute is required just for windows\n+ see ${common.resources}/win/run-jboss-cli.bat\n+ !! the ordering is important, if you need to change it edit run-jboss-cli.bat !!\n+ -->\n+ <argument>${cli.win.working.dir}</argument>\n<argument>-Dserver.config=standalone-ha.xml</argument>\n</arguments>\n</configuration>\n</goals>\n<configuration>\n<skip>${skip.adapter.offline.installation}</skip>\n- <executable>./jboss-cli.${script.suffix}</executable>\n- <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n+ <executable>${cli.executable}</executable>\n+ <workingDirectory>${cli.working.dir}</workingDirectory>\n<arguments>\n<argument>--file=${app.server.jboss.home}/bin/adapter-install-offline.cli</argument>\n+ <!--\n+ following attribute is required just for windows\n+ see ${common.resources}/win/run-jboss-cli.bat\n+ !! the ordering is important, if you need to change it edit run-jboss-cli.bat !!\n+ -->\n+ <argument>${cli.win.working.dir}</argument>\n</arguments>\n</configuration>\n</execution>\n</goals>\n<configuration>\n<skip>${skip.adapter.offline.installation}</skip>\n- <executable>./jboss-cli.${script.suffix}</executable>\n- <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n+ <executable>${cli.executable}</executable>\n+ <workingDirectory>${cli.working.dir}</workingDirectory>\n<arguments>\n<argument>--file=${app.server.jboss.home}/bin/adapter-install-offline.cli</argument>\n+ <!--\n+ following attribute is required just for windows\n+ see ${common.resources}/win/run-jboss-cli.bat\n+ !! the ordering is important, if you need to change it edit run-jboss-cli.bat !!\n+ -->\n+ <argument>${cli.win.working.dir}</argument>\n<argument>-Dserver.config=standalone-ha.xml</argument>\n</arguments>\n</configuration>\n</goals>\n<configuration>\n<skip>${skip.adapter.offline.installation}</skip>\n- <executable>./jboss-cli.${script.suffix}</executable>\n- <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n+ <executable>${cli.executable}</executable>\n+ <workingDirectory>${cli.working.dir}</workingDirectory>\n<arguments>\n<argument>--file=${app.server.jboss.home}/bin/adapter-install-saml-offline.cli</argument>\n+ <!--\n+ following attribute is required just for windows\n+ see ${common.resources}/win/run-jboss-cli.bat\n+ !! the ordering is important, if you need to change it edit run-jboss-cli.bat !!\n+ -->\n+ <argument>${cli.win.working.dir}</argument>\n</arguments>\n</configuration>\n</execution>\n</goals>\n<configuration>\n<skip>${skip.adapter.offline.installation}</skip>\n- <executable>./jboss-cli.${script.suffix}</executable>\n- <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n+ <executable>${cli.executable}</executable>\n+ <workingDirectory>${cli.working.dir}</workingDirectory>\n<arguments>\n<argument>--file=${app.server.jboss.home}/bin/adapter-install-saml-offline.cli</argument>\n+ <!--\n+ following attribute is required just for windows\n+ see ${common.resources}/win/run-jboss-cli.bat\n+ !! the ordering is important, if you need to change it edit run-jboss-cli.bat !!\n+ -->\n+ <argument>${cli.win.working.dir}</argument>\n<argument>-Dserver.config=standalone-ha.xml</argument>\n</arguments>\n</configuration>\n</goals>\n<configuration>\n<skip>${skip.apply.offline.cli}</skip><!--eap6-->\n- <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n- <executable>./jboss-cli.sh</executable>\n+ <executable>${cli.executable}</executable>\n+ <workingDirectory>${cli.working.dir}</workingDirectory>\n<arguments>\n<argument>--file=${common.resources}/cli/add-secured-deployments.cli</argument>\n+ <!--\n+ following attribute is required just for windows\n+ see ${common.resources}/win/run-jboss-cli.bat\n+ !! the ordering is important, if you need to change it edit run-jboss-cli.bat !!\n+ -->\n+ <argument>${cli.win.working.dir}</argument>\n<argument>-Djboss.server.config.dir=${app.server.jboss.home}/standalone-secured-deployments/configuration</argument>\n</arguments>\n</configuration>\n</goals>\n<configuration>\n<skip>${skip.configure.clustered.scenario}</skip><!--eap6, wildfly9-->\n- <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n- <executable>./jboss-cli.sh</executable>\n+ <executable>${cli.executable}</executable>\n+ <workingDirectory>${cli.working.dir}</workingDirectory>\n<arguments>\n<argument>--file=${common.resources}/cli/configure-cluster-config.cli</argument>\n+ <!--\n+ following attribute is required just for windows\n+ see ${common.resources}/win/run-jboss-cli.bat\n+ !! the ordering is important, if you need to change it edit run-jboss-cli.bat !!\n+ -->\n+ <argument>${cli.win.working.dir}</argument>\n<argument>-Djboss.server.config.dir=${app.server.jboss.home}/standalone-cluster/configuration</argument>\n</arguments>\n</configuration>\n</goals>\n<configuration>\n<skip>${skip.configure.clustered.scenario}</skip><!--eap6, wildfly9-->\n- <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n- <executable>./jboss-cli.sh</executable>\n+ <executable>${cli.executable}</executable>\n+ <workingDirectory>${cli.working.dir}</workingDirectory>\n<arguments>\n<argument>--file=${common.resources}/cli/configure-crossdc-config.cli</argument>\n+ <!--\n+ following attribute is required just for windows\n+ see ${common.resources}/win/run-jboss-cli.bat\n+ !! the ordering is important, if you need to change it edit run-jboss-cli.bat !!\n+ -->\n+ <argument>${cli.win.working.dir}</argument>\n<argument>-Djboss.server.config.dir=${app.server.jboss.home}/standalone-crossdc/configuration</argument>\n</arguments>\n</configuration>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8955 adapter installation fails on windows - eap7 |
339,185 | 23.11.2018 10:14:47 | -3,600 | ded82fff3dabd2414a09d003cfacc7f7ee1052c3 | Fix order of stopping test servers | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/CrossDCTestEnricher.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/CrossDCTestEnricher.java",
"diff": "@@ -31,7 +31,6 @@ import org.jboss.arquillian.core.spi.Validate;\nimport org.jboss.arquillian.core.api.annotation.Inject;\nimport org.jboss.arquillian.core.api.annotation.Observes;\nimport org.jboss.arquillian.test.spi.event.suite.After;\n-import org.jboss.arquillian.test.spi.event.suite.AfterSuite;\nimport org.jboss.arquillian.test.spi.event.suite.Before;\nimport org.jboss.logging.Logger;\nimport static org.junit.Assert.assertThat;\n@@ -44,7 +43,12 @@ import org.keycloak.testsuite.crossdc.DC;\nimport org.keycloak.testsuite.crossdc.ServerSetup;\nimport java.util.Collection;\nimport java.util.function.Consumer;\n+import java.util.stream.Stream;\n+import org.jboss.arquillian.container.spi.Container;\n+import org.jboss.arquillian.container.spi.event.StopContainer;\nimport org.jboss.arquillian.container.spi.event.StopSuiteContainers;\n+import org.jboss.arquillian.core.api.Event;\n+import org.jboss.arquillian.test.spi.event.suite.AfterSuite;\n/**\n*\n@@ -58,6 +62,9 @@ public class CrossDCTestEnricher {\n@Inject\nprivate static Instance<ContainerController> containerController;\n+ @Inject\n+ private Event<StopContainer> stopContainer;\n+\nprivate static final Map<ContainerInfo, Keycloak> backendAdminClients = new HashMap<>();\nprivate static final Map<ContainerInfo, KeycloakTestingClient> backendTestingClients = new HashMap<>();\n@@ -87,6 +94,28 @@ public class CrossDCTestEnricher {\nServerSetup cacheServers = annotation.cacheServers();\nServerSetup authServers = annotation.authServers();\n+ // Stop auth servers that otherwise could be hang connecting to a cache server stopped next\n+ switch (authServers) {\n+ case ALL_NODES_IN_EVERY_DC:\n+ break;\n+ case FIRST_NODE_IN_EVERY_DC:\n+ DC.validDcsStream().forEach((DC dc) -> stopAuthServerBackendNode(dc, 1));\n+ break;\n+\n+ case FIRST_NODE_IN_FIRST_DC:\n+ stopAuthServerBackendNode(DC.FIRST, 1);\n+ forAllBackendNodesInDc(DC.SECOND, CrossDCTestEnricher::stopAuthServerBackendNode);\n+ break;\n+\n+ case ALL_NODES_IN_FIRST_DC_FIRST_NODE_IN_SECOND_DC:\n+ stopAuthServerBackendNode(DC.SECOND, 1);\n+ break;\n+\n+ case ALL_NODES_IN_FIRST_DC_NO_NODES_IN_SECOND_DC:\n+ forAllBackendNodesInDc(DC.SECOND, CrossDCTestEnricher::stopAuthServerBackendNode);\n+ break;\n+ }\n+\nswitch (cacheServers) {\ncase ALL_NODES_IN_EVERY_DC:\ncase FIRST_NODE_IN_EVERY_DC: //the same as ALL_NODES_IN_EVERY_DC as there is only one cache server per DC\n@@ -107,24 +136,19 @@ public class CrossDCTestEnricher {\nbreak;\ncase FIRST_NODE_IN_EVERY_DC:\nDC.validDcsStream().forEach((DC dc) -> startAuthServerBackendNode(dc, 0));\n- DC.validDcsStream().forEach((DC dc) -> stopAuthServerBackendNode(dc, 1));\nbreak;\ncase FIRST_NODE_IN_FIRST_DC:\nstartAuthServerBackendNode(DC.FIRST, 0);\n- stopAuthServerBackendNode(DC.FIRST, 1);\n- forAllBackendNodesInDc(DC.SECOND, CrossDCTestEnricher::stopAuthServerBackendNode);\nbreak;\ncase ALL_NODES_IN_FIRST_DC_FIRST_NODE_IN_SECOND_DC:\nforAllBackendNodesInDc(DC.FIRST, CrossDCTestEnricher::startAuthServerBackendNode);\nstartAuthServerBackendNode(DC.SECOND, 0);\n- stopAuthServerBackendNode(DC.SECOND, 1);\nbreak;\ncase ALL_NODES_IN_FIRST_DC_NO_NODES_IN_SECOND_DC:\nforAllBackendNodesInDc(DC.FIRST, CrossDCTestEnricher::startAuthServerBackendNode);\n- forAllBackendNodesInDc(DC.SECOND, CrossDCTestEnricher::stopAuthServerBackendNode);\nbreak;\n}\n@@ -137,11 +161,30 @@ public class CrossDCTestEnricher {\nrestorePeriodicTasks();\n}\n+ public void afterSuite(@Observes(precedence = 4) AfterSuite event) {\n+ if (!suiteContext.isAuthServerCrossDc()) return;\n+\n+ // Unfortunately, in AfterSuite, containerController context is already cleaned so stopAuthServerBackendNode()\n+ // and stopCacheServer cannot be used. On the other hand, Arquillian by default does not guarantee that cache\n+ // servers are terminated only after auth servers were, so the termination has to be done in this enricher.\n+\n+ forAllBackendNodesStream()\n+ .map(ContainerInfo::getArquillianContainer)\n+ .map(StopContainer::new)\n+ .forEach(stopContainer::fire);\n+\n+ DC.validDcsStream()\n+ .map(CrossDCTestEnricher::getCacheServer)\n+ .map(ContainerInfo::getArquillianContainer)\n+ .map(StopContainer::new)\n+ .forEach(stopContainer::fire);\n+ }\n+\npublic void stopSuiteContainers(@Observes(precedence = 4) StopSuiteContainers event) {\nif (!suiteContext.isAuthServerCrossDc()) return;\n- DC.validDcsStream().forEach(CrossDCTestEnricher::stopCacheServer);\nforAllBackendNodes(CrossDCTestEnricher::stopAuthServerBackendNode);\n+ DC.validDcsStream().forEach(CrossDCTestEnricher::stopCacheServer);\n}\nprivate static void createRESTClientsForNode(ContainerInfo node) {\n@@ -257,11 +300,15 @@ public class CrossDCTestEnricher {\n}\npublic static void forAllBackendNodes(Consumer<ContainerInfo> functionOnContainerInfo) {\n- suiteContext.getDcAuthServerBackendsInfo().stream()\n- .flatMap(Collection::stream)\n+ forAllBackendNodesStream()\n.forEach(functionOnContainerInfo);\n}\n+ public static Stream<ContainerInfo> forAllBackendNodesStream() {\n+ return suiteContext.getDcAuthServerBackendsInfo().stream()\n+ .flatMap(Collection::stream);\n+ }\n+\npublic static void forAllBackendNodesInDc(DC dc, Consumer<ContainerInfo> functionOnContainerInfo) {\nassertValidDc(dc);\nsuiteContext.getDcAuthServerBackendsInfo().get(dc.ordinal()).stream()\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8941 Fix order of stopping test servers |
339,281 | 26.11.2018 12:29:15 | -3,600 | 1b8dc04459c9c4f4da83f8a227f7b980339b34a0 | skip EntitlementAPITest.testOfflineRequestingPartyToken for auth-server-undertow | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/EntitlementAPITest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/EntitlementAPITest.java",
"diff": "@@ -77,6 +77,7 @@ import org.keycloak.representations.idm.authorization.ResourceRepresentation;\nimport org.keycloak.representations.idm.authorization.ScopePermissionRepresentation;\nimport org.keycloak.representations.idm.authorization.UserPolicyRepresentation;\nimport org.keycloak.testsuite.util.ClientBuilder;\n+import org.keycloak.testsuite.util.ContainerAssume;\nimport org.keycloak.testsuite.util.OAuthClient;\nimport org.keycloak.testsuite.util.RealmBuilder;\nimport org.keycloak.testsuite.util.RoleBuilder;\n@@ -1169,6 +1170,8 @@ public class EntitlementAPITest extends AbstractAuthzTest {\n@Test\npublic void testOfflineRequestingPartyToken() throws Exception {\n+ ContainerAssume.assumeNotAuthServerUndertow();\n+\nClientResource client = getClient(getRealm(), RESOURCE_SERVER_TEST);\nAuthorizationResource authorization = client.authorization();\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8817 skip EntitlementAPITest.testOfflineRequestingPartyToken for auth-server-undertow |
339,494 | 21.11.2018 15:51:52 | -3,600 | bfafe65814ae1f04358456c57ffba94a6b59a305 | SSSDTest updated error message in assert | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/other/sssd/src/test/java/org/keycloak/testsuite/sssd/SSSDTest.java",
"new_path": "testsuite/integration-arquillian/tests/other/sssd/src/test/java/org/keycloak/testsuite/sssd/SSSDTest.java",
"diff": "@@ -190,7 +190,7 @@ public class SSSDTest extends AbstractKeycloakTest {\nprofilePage.updateProfile(\"New first\", \"New last\", \"[email protected]\");\n- Assert.assertEquals(\"You can't update your account as it is read only.\", profilePage.getError());\n+ Assert.assertEquals(\"You can't update your account as it is read-only.\", profilePage.getError());\n}\n@Test\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8919 - SSSDTest updated error message in assert |
339,281 | 29.11.2018 13:32:25 | -3,600 | 4b50fdb404efa51c55fee481fd44a5e292f5b9ab | adapter installation fails on windows - edit logging | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/servers/app-server/jboss/common/win/run-jboss-cli.bat",
"new_path": "testsuite/integration-arquillian/servers/app-server/jboss/common/win/run-jboss-cli.bat",
"diff": "+@echo off\n+\nset \"NOPAUSE=true\"\nset cli_file=%2\nset working_dir=%3\ncd %working_dir%\n+echo working_dir: %cd%\nif \"%4\"==\"-Dserver.config\" (\nset server_config=%5\n) else (\nset server_config=standalone.xml\n)\n+echo server.config=%server_config%\n+echo cli_file=%cli_file%\nif \"%4\"==\"-Djboss.server.config.dir\" (\n+ echo jboss.server.config.dir=%5\njboss-cli.bat --file=%cli_file% -Dserver.config=%server_config% -Djboss.server.config.dir=%5\n) else (\njboss-cli.bat --file=%cli_file% -Dserver.config=%server_config%\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/servers/app-server/jboss/eap6/pom.xml",
"new_path": "testsuite/integration-arquillian/servers/app-server/jboss/eap6/pom.xml",
"diff": "</dependency>\n</dependencies>\n+ <build>\n+ <plugins>\n+ <plugin>\n+ <groupId>org.codehaus.mojo</groupId>\n+ <artifactId>exec-maven-plugin</artifactId>\n+ <executions>\n+ <execution>\n+ <id>install-adapters-online-standalone</id>\n+ <phase>process-resources</phase>\n+ <goals>\n+ <goal>exec</goal>\n+ </goals>\n+ <configuration>\n+ <executable>${basedir}/src/main/resources/config/install-adapters-online.${script.suffix}</executable>\n+ <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n+ <environmentVariables>\n+ <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n+ <JBOSS_HOME>${app.server.jboss.home}</JBOSS_HOME>\n+ <SAML_SUPPORTED>${app.server.saml.adapter.supported}</SAML_SUPPORTED>\n+ <CLI_PATH>${basedir}/src/main/resources/config/cli/</CLI_PATH>\n+ </environmentVariables>\n+ </configuration>\n+ </execution>\n+ <execution>\n+ <id>install-adapters-online-standalone-ha</id>\n+ <phase>process-resources</phase>\n+ <goals>\n+ <goal>exec</goal>\n+ </goals>\n+ <configuration>\n+ <executable>${basedir}/src/main/resources/config/install-adapters-online-ha.${script.suffix}</executable>\n+ <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n+ <environmentVariables>\n+ <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n+ <JBOSS_HOME>${app.server.jboss.home}</JBOSS_HOME>\n+ <CLI_PATH>${basedir}/src/main/resources/config/cli/</CLI_PATH>\n+ </environmentVariables>\n+ </configuration>\n+ </execution>\n+ <execution>\n+ <id>add-secured-deployments-eap6</id>\n+ <phase>generate-test-sources</phase>\n+ <goals>\n+ <goal>exec</goal>\n+ </goals>\n+ <configuration>\n+ <executable>${basedir}/src/main/resources/config/add-secured-deployments.${script.suffix}</executable>\n+ <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n+ <environmentVariables>\n+ <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n+ <JBOSS_HOME>${app.server.jboss.home}</JBOSS_HOME>\n+ <CLI_PATH>${basedir}/src/main/resources/config/cli/</CLI_PATH>\n+ </environmentVariables>\n+ </configuration>\n+ </execution>\n+ </executions>\n+ </plugin>\n+ </plugins>\n+ </build>\n+\n+ <profiles>\n+ <profile>\n+ <id>fuse-installer</id>\n+ <activation>\n+ <os>\n+ <family>unix</family>\n+ </os>\n+ </activation>\n<build>\n<plugins>\n<plugin>\n<artifactId>maven-enforcer-plugin</artifactId>\n<executions>\n<execution>\n- <id>enforce-auth-server-jboss-profile</id>\n+ <id>enforce-fuse63-version</id>\n<goals>\n<goal>enforce</goal>\n</goals>\n<configuration>\n<rules>\n- <requireProperty>\n- <property>eap6.version</property>\n- </requireProperty>\n<requireProperty>\n<property>fuse63.version</property>\n</requireProperty>\n<groupId>org.codehaus.mojo</groupId>\n<artifactId>exec-maven-plugin</artifactId>\n<executions>\n- <execution>\n- <id>install-adapters-online-standalone</id>\n- <phase>process-resources</phase>\n- <goals>\n- <goal>exec</goal>\n- </goals>\n- <configuration>\n- <executable>${basedir}/src/main/resources/config/install-adapters-online.${script.suffix}</executable>\n- <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n- <environmentVariables>\n- <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n- <JBOSS_HOME>${app.server.jboss.home}</JBOSS_HOME>\n- <SAML_SUPPORTED>${app.server.saml.adapter.supported}</SAML_SUPPORTED>\n- <CLI_PATH>${basedir}/src/main/resources/config/cli/</CLI_PATH>\n- </environmentVariables>\n- </configuration>\n- </execution>\n- <execution>\n- <id>install-adapters-online-standalone-ha</id>\n- <phase>process-resources</phase>\n- <goals>\n- <goal>exec</goal>\n- </goals>\n- <configuration>\n- <executable>${basedir}/src/main/resources/config/install-adapters-online-ha.${script.suffix}</executable>\n- <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n- <environmentVariables>\n- <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n- <JBOSS_HOME>${app.server.jboss.home}</JBOSS_HOME>\n- <CLI_PATH>${basedir}/src/main/resources/config/cli/</CLI_PATH>\n- </environmentVariables>\n- </configuration>\n- </execution>\n<execution>\n<id>install-fuse</id>\n<phase>generate-test-sources</phase>\n</environmentVariables>\n</configuration>\n</execution>\n- <execution>\n- <id>add-secured-deployments-eap6</id>\n- <phase>generate-test-sources</phase>\n- <goals>\n- <goal>exec</goal>\n- </goals>\n- <configuration>\n- <executable>${basedir}/src/main/resources/config/add-secured-deployments.${script.suffix}</executable>\n- <workingDirectory>${app.server.jboss.home}/bin</workingDirectory>\n- <environmentVariables>\n- <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n- <JBOSS_HOME>${app.server.jboss.home}</JBOSS_HOME>\n- <CLI_PATH>${basedir}/src/main/resources/config/cli/</CLI_PATH>\n- </environmentVariables>\n- </configuration>\n- </execution>\n</executions>\n</plugin>\n<plugin>\n</plugin>\n</plugins>\n</build>\n-\n+ </profile>\n+ </profiles>\n</project>\n"
},
{
"change_type": "DELETE",
"old_path": "testsuite/integration-arquillian/servers/app-server/jboss/eap6/src/main/resources/config/fuse/install-fuse.bat",
"new_path": null,
"diff": "-set NOPAUSE=true\n-\n-cd %JBOSS_HOME%\n-start javaw -jar %FUSE_INSTALLER_NAME%\n-ping 127.0.0.1 -n 40 > nul\n-del %FUSE_INSTALLER_NAME%\n-\n-set JBOSS_HOME=%JBOSS_HOME:/=\\%\n-ren %JBOSS_HOME%\\standalone\\deployments\\hawtio*.war hawtio.war\n-\n-exit 0\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/fuse/EAP6Fuse6HawtioAdapterTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/fuse/EAP6Fuse6HawtioAdapterTest.java",
"diff": "@@ -28,7 +28,9 @@ import org.jboss.arquillian.drone.api.annotation.Drone;\nimport org.jboss.arquillian.graphene.page.Page;\nimport org.jboss.arquillian.test.api.ArquillianResource;\nimport org.junit.After;\n+import org.junit.Assume;\nimport org.junit.Before;\n+import org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.keycloak.representations.idm.RealmRepresentation;\n@@ -71,6 +73,11 @@ public class EAP6Fuse6HawtioAdapterTest extends AbstractExampleAdapterTest imple\ntestRealms.add(loadRealm(\"/adapter-test/hawtio-realm/demorealm.json\"));\n}\n+ @BeforeClass\n+ public static void enabled() {\n+ Assume.assumeFalse(System.getProperty(\"os.name\").startsWith(\"Windows\"));\n+ }\n+\n@Before\npublic void addJSDriver() {\nDroneUtils.addWebDriver(jsDriver);\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8955 adapter installation fails on windows - edit logging |
339,494 | 29.11.2018 13:10:48 | -3,600 | bba081d3a8c00273809afb116d9a0c356614dc65 | Fix Servlet Filter tests for WLS & WAS | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/DeploymentArchiveProcessor.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/DeploymentArchiveProcessor.java",
"diff": "@@ -151,14 +151,14 @@ public class DeploymentArchiveProcessor implements ApplicationArchiveProcessor {\nmodifyDocElementAttribute(doc, \"SingleLogoutService\", \"postBindingUrl\", \"http\", \"https\");\nmodifyDocElementAttribute(doc, \"SingleLogoutService\", \"redirectBindingUrl\", \"8080\", System.getProperty(\"auth.server.https.port\"));\nmodifyDocElementAttribute(doc, \"SingleLogoutService\", \"redirectBindingUrl\", \"http\", \"https\");\n- modifyDocElementAttribute(doc, \"SP\", \"logoutPage\", \"8081\", System.getProperty(\"app.server.https.port\"));\n+ modifyDocElementAttribute(doc, \"SP\", \"logoutPage\", \"8080\", System.getProperty(\"app.server.https.port\"));\nmodifyDocElementAttribute(doc, \"SP\", \"logoutPage\", \"http\", \"https\");\n} else {\nmodifyDocElementAttribute(doc, \"SingleSignOnService\", \"bindingUrl\", \"8080\", System.getProperty(\"auth.server.http.port\"));\nmodifyDocElementAttribute(doc, \"SingleSignOnService\", \"assertionConsumerServiceUrl\", \"8080\", System.getProperty(\"app.server.http.port\"));\nmodifyDocElementAttribute(doc, \"SingleLogoutService\", \"postBindingUrl\", \"8080\", System.getProperty(\"auth.server.http.port\"));\nmodifyDocElementAttribute(doc, \"SingleLogoutService\", \"redirectBindingUrl\", \"8080\", System.getProperty(\"auth.server.http.port\"));\n- modifyDocElementAttribute(doc, \"SP\", \"logoutPage\", \"8081\", System.getProperty(\"app.server.http.port\"));\n+ modifyDocElementAttribute(doc, \"SP\", \"logoutPage\", \"8080\", System.getProperty(\"app.server.http.port\"));\n}\narchive.add(new StringAsset(IOUtil.documentToString(doc)), adapterConfigPath);\n@@ -257,9 +257,6 @@ public class DeploymentArchiveProcessor implements ApplicationArchiveProcessor {\nappendChildInDocument(webXmlDoc, \"web-app\", filter);\n- filter.appendChild(filterName);\n- filter.appendChild(filterClass);\n-\n// Limitation that all deployments of annotated class use same skipPattern. Refactor if something more flexible is needed (would require more tricky web.xml parsing though...)\nString skipPattern = testClass.getAnnotation(UseServletFilter.class).skipPattern();\nif (skipPattern != null && !skipPattern.isEmpty()) {\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8982 - Fix Servlet Filter tests for WLS & WAS |
339,185 | 23.11.2018 10:17:42 | -3,600 | 00e0ba8633b9111ed47490d2fec1691a7fca7540 | Stabilize SessionsPreloadCrossDCTest.loginFailuresPreloadTest | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/rest/resource/TestCacheResource.java",
"new_path": "testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/rest/resource/TestCacheResource.java",
"diff": "@@ -42,6 +42,7 @@ import org.keycloak.models.sessions.infinispan.entities.UserSessionEntity;\nimport org.keycloak.models.sessions.infinispan.util.InfinispanUtil;\nimport org.keycloak.testsuite.rest.representation.JGroupsStats;\nimport org.keycloak.utils.MediaType;\n+import org.infinispan.stream.CacheCollectors;\n/**\n* @author <a href=\"mailto:[email protected]\">Marek Posolda</a>\n@@ -76,11 +77,9 @@ public class TestCacheResource {\n@Path(\"/enumerate-keys\")\n@Produces(MediaType.APPLICATION_JSON)\npublic Set<String> enumerateKeys() {\n- return cache.keySet().stream().map((Object o) -> {\n-\n- return o.toString();\n-\n- }).collect(Collectors.toSet());\n+ return cache.keySet().stream()\n+ .map(Object::toString)\n+ .collect(CacheCollectors.serializableCollector(Collectors::toSet)); // See https://issues.jboss.org/browse/ISPN-7596\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/crossdc/AbstractCrossDCTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/crossdc/AbstractCrossDCTest.java",
"diff": "@@ -74,7 +74,7 @@ public abstract class AbstractCrossDCTest extends AbstractTestRealmKeycloakTest\n}\nprivate void enableOnlyFirstNodeInFirstDc() {\n- log.debug(\"--DC: Enable only first node in first datacenter\");\n+ log.debug(\"--DC: Enable only first node in first datacenter @ load balancer\");\nthis.loadBalancerCtrl.disableAllBackendNodes();\nif (!CrossDCTestEnricher.getBackendNode(DC.FIRST, 0).isStarted()) {\nthrow new IllegalStateException(\"--DC: Trying to enable not started node on load-balancer\");\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/crossdc/SessionsPreloadCrossDCTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/crossdc/SessionsPreloadCrossDCTest.java",
"diff": "@@ -31,6 +31,8 @@ import org.keycloak.testsuite.admin.ApiUtil;\nimport org.keycloak.testsuite.arquillian.CrossDCTestEnricher;\nimport org.keycloak.testsuite.arquillian.annotation.InitialDcState;\nimport org.keycloak.testsuite.util.OAuthClient;\n+import java.util.Set;\n+import org.hamcrest.Matchers;\n/**\n* Tests userSessions and offline sessions preloading at startup\n@@ -72,11 +74,10 @@ public class SessionsPreloadCrossDCTest extends AbstractAdminCrossDCTest {\nenableLoadBalancerNode(DC.SECOND, 0);\n// Ensure sessions are loaded in both 1st DC and 2nd DC\n- int sessions01 = getTestingClientForStartedNodeInDc(0).testing().cache(InfinispanConnectionProvider.USER_SESSION_CACHE_NAME).size();\n- int sessions02 = getTestingClientForStartedNodeInDc(1).testing().cache(InfinispanConnectionProvider.USER_SESSION_CACHE_NAME).size();\n- log.infof(\"sessions01: %d, sessions02: %d\", sessions01, sessions02);\n- Assert.assertEquals(sessions01, sessionsBefore + SESSIONS_COUNT);\n- Assert.assertEquals(sessions02, sessionsBefore + SESSIONS_COUNT);\n+ Set<String> sessions01keys = getTestingClientForStartedNodeInDc(0).testing().cache(InfinispanConnectionProvider.USER_SESSION_CACHE_NAME).enumerateKeys();\n+ Set<String> sessions02keys = getTestingClientForStartedNodeInDc(1).testing().cache(InfinispanConnectionProvider.USER_SESSION_CACHE_NAME).enumerateKeys();\n+ log.infof(\"sessions01keys: %s, sessions02keys: %s\", sessions01keys, sessions02keys);\n+ Assert.assertThat(sessions01keys, Matchers.equalTo(sessions02keys));\n// On DC2 sessions were preloaded from remoteCache\nAssert.assertTrue(getTestingClientForStartedNodeInDc(1).testing().cache(InfinispanConnectionProvider.WORK_CACHE_NAME).contains(\"distributed::remoteCacheLoad::sessions\"));\n@@ -117,11 +118,10 @@ public class SessionsPreloadCrossDCTest extends AbstractAdminCrossDCTest {\nenableLoadBalancerNode(DC.SECOND, 0);\n// Ensure sessions are loaded in both 1st DC and 2nd DC\n- int offlineSessions11 = getTestingClientForStartedNodeInDc(0).testing().cache(InfinispanConnectionProvider.OFFLINE_USER_SESSION_CACHE_NAME).size();\n- int offlineSessions12 = getTestingClientForStartedNodeInDc(1).testing().cache(InfinispanConnectionProvider.OFFLINE_USER_SESSION_CACHE_NAME).size();\n- log.infof(\"offlineSessions11: %d, offlineSessions12: %d\", offlineSessions11, offlineSessions12);\n- Assert.assertEquals(offlineSessions11, offlineSessionsBefore + SESSIONS_COUNT);\n- Assert.assertEquals(offlineSessions12, offlineSessionsBefore + SESSIONS_COUNT);\n+ Set<String> offlineSessions11keys = getTestingClientForStartedNodeInDc(0).testing().cache(InfinispanConnectionProvider.OFFLINE_USER_SESSION_CACHE_NAME).enumerateKeys();\n+ Set<String> offlineSessions12keys = getTestingClientForStartedNodeInDc(1).testing().cache(InfinispanConnectionProvider.OFFLINE_USER_SESSION_CACHE_NAME).enumerateKeys();\n+ log.infof(\"offlineSessions11keys: %s, offlineSessions12keys: %s\", offlineSessions11keys, offlineSessions12keys);\n+ Assert.assertThat(offlineSessions11keys, Matchers.equalTo(offlineSessions12keys));\n// On DC1 sessions were preloaded from DB. On DC2 sessions were preloaded from remoteCache\nAssert.assertTrue(getTestingClientForStartedNodeInDc(0).testing().cache(InfinispanConnectionProvider.WORK_CACHE_NAME).contains(\"distributed::offlineUserSessions\"));\n@@ -164,18 +164,17 @@ public class SessionsPreloadCrossDCTest extends AbstractAdminCrossDCTest {\nRetry.execute(() -> {\n// Ensure loginFailures are loaded in both 1st DC and 2nd DC\n- int size1 = getTestingClientForStartedNodeInDc(0).testing().cache(InfinispanConnectionProvider.LOGIN_FAILURE_CACHE_NAME).size();\n- int size2 = getTestingClientForStartedNodeInDc(1).testing().cache(InfinispanConnectionProvider.LOGIN_FAILURE_CACHE_NAME).size();\n+ Set<String> keys1 = getTestingClientForStartedNodeInDc(0).testing().cache(InfinispanConnectionProvider.LOGIN_FAILURE_CACHE_NAME).enumerateKeys();\n+ Set<String> keys2 = getTestingClientForStartedNodeInDc(1).testing().cache(InfinispanConnectionProvider.LOGIN_FAILURE_CACHE_NAME).enumerateKeys();\nint loginFailures1 = (Integer) getAdminClientForStartedNodeInDc(0).realm(\"test\").attackDetection().bruteForceUserStatus(userId).get(\"numFailures\");\nint loginFailures2 = (Integer) getAdminClientForStartedNodeInDc(1).realm(\"test\").attackDetection().bruteForceUserStatus(userId).get(\"numFailures\");\n- log.infof(\"size1: %d, size2: %d, loginFailures1: %d, loginFailures2: %d\", size1, size2, loginFailures1, loginFailures2);\n- Assert.assertEquals(size1, 1);\n- Assert.assertEquals(size2, 1);\n- Assert.assertEquals(loginFailures1, loginFailuresBefore + SESSIONS_COUNT);\n- Assert.assertEquals(loginFailures2, loginFailuresBefore + SESSIONS_COUNT);\n+ log.infof(\"keys1: %d, keys2: %d, loginFailures1: %d, loginFailures2: %d\", keys1, keys2, loginFailures1, loginFailures2);\n+ Assert.assertThat(keys1, Matchers.equalTo(keys2));\n+ Assert.assertEquals(loginFailuresBefore + SESSIONS_COUNT, loginFailures1);\n+ Assert.assertEquals(loginFailuresBefore + SESSIONS_COUNT, loginFailures2);\n}, 3, 400);\n- // On DC2 sessions were preloaded from from remoteCache\n+ // On DC2 sessions were preloaded from remoteCache\nAssert.assertTrue(getTestingClientForStartedNodeInDc(1).testing().cache(InfinispanConnectionProvider.WORK_CACHE_NAME).contains(\"distributed::remoteCacheLoad::loginFailures\"));\n// Disable brute force protector\n@@ -202,7 +201,4 @@ public class SessionsPreloadCrossDCTest extends AbstractAdminCrossDCTest {\nreturn responses;\n}\n-\n-\n-\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8940 Stabilize SessionsPreloadCrossDCTest.loginFailuresPreloadTest |
339,500 | 05.12.2018 13:34:56 | -3,600 | e609c928bedcd20f74b4a18ab80c04497f667bb1 | Split versions for sisu.inject and sisu.plexus | [
{
"change_type": "MODIFY",
"old_path": "dependencies/drools-bom/pom.xml",
"new_path": "dependencies/drools-bom/pom.xml",
"diff": "<plexus-interpolation.version>1.21</plexus-interpolation.version>\n<plexus-utils.version>3.0.22</plexus-utils.version>\n<aether.version>1.1.0</aether.version>\n- <org.eclipse.sisu>0.3.2</org.eclipse.sisu>\n+ <org.eclipse.sisu.inject>0.3.2</org.eclipse.sisu.inject>\n+ <org.eclipse.sisu.plexus>0.3.2</org.eclipse.sisu.plexus>\n<mvel2.version>2.4.0.Final</mvel2.version>\n<plexus-cipher.version>1.7</plexus-cipher.version>\n<plexus-sec-dispatcher.version>1.3</plexus-sec-dispatcher.version>\n<dependency>\n<groupId>org.eclipse.sisu</groupId>\n<artifactId>org.eclipse.sisu.inject</artifactId>\n- <version>${org.eclipse.sisu}</version>\n+ <version>${org.eclipse.sisu.inject}</version>\n</dependency>\n<dependency>\n<groupId>org.eclipse.sisu</groupId>\n<artifactId>org.eclipse.sisu.plexus</artifactId>\n- <version>${org.eclipse.sisu}</version>\n+ <version>${org.eclipse.sisu.plexus}</version>\n</dependency>\n<dependency>\n<groupId>org.mvel</groupId>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9013 Split versions for sisu.inject and sisu.plexus |
339,364 | 05.12.2018 15:41:00 | -3,600 | f52d7bef76e0809e2dce920fe0e5b08c5378535c | Respect app.server.java.home while installing adapters | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/servers/app-server/jboss/pom.xml",
"new_path": "testsuite/integration-arquillian/servers/app-server/jboss/pom.xml",
"diff": "<skip>${skip.apply.offline.cli}</skip><!--eap6-->\n<executable>${cli.executable}</executable>\n<workingDirectory>${cli.working.dir}</workingDirectory>\n+ <environmentVariables>\n+ <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n+ </environmentVariables>\n<arguments>\n<argument>--file=${common.resources}/cli/add-adapter-log-level.cli</argument>\n<!--\n<skip>${skip.apply.offline.cli}</skip><!--eap6-->\n<executable>${cli.executable}</executable>\n<workingDirectory>${cli.working.dir}</workingDirectory>\n+ <environmentVariables>\n+ <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n+ </environmentVariables>\n<arguments>\n<argument>--file=${common.resources}/cli/add-adapter-log-level.cli</argument>\n<!--\n<skip>${skip.elytron.adapter.installation}</skip>\n<executable>${cli.executable}</executable>\n<workingDirectory>${cli.working.dir}</workingDirectory>\n+ <environmentVariables>\n+ <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n+ </environmentVariables>\n<arguments>\n<argument>--file=${app.server.jboss.home}/bin/adapter-elytron-install-offline.cli</argument>\n<!--\n<skip>${skip.elytron.adapter.installation}</skip>\n<executable>${cli.executable}</executable>\n<workingDirectory>${cli.working.dir}</workingDirectory>\n+ <environmentVariables>\n+ <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n+ </environmentVariables>\n<arguments>\n<argument>--file=${app.server.jboss.home}/bin/adapter-elytron-install-offline.cli</argument>\n<!--\n<skip>${skip.elytron.adapter.installation}</skip>\n<executable>${cli.executable}</executable>\n<workingDirectory>${cli.working.dir}</workingDirectory>\n+ <environmentVariables>\n+ <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n+ </environmentVariables>\n<arguments>\n<argument>--file=${app.server.jboss.home}/bin/adapter-elytron-install-saml-offline.cli</argument>\n<!--\n<skip>${skip.elytron.adapter.installation}</skip>\n<executable>${cli.executable}</executable>\n<workingDirectory>${cli.working.dir}</workingDirectory>\n+ <environmentVariables>\n+ <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n+ </environmentVariables>\n<arguments>\n<argument>--file=${app.server.jboss.home}/bin/adapter-elytron-install-saml-offline.cli</argument>\n<!--\n<skip>${skip.adapter.offline.installation}</skip>\n<executable>${cli.executable}</executable>\n<workingDirectory>${cli.working.dir}</workingDirectory>\n+ <environmentVariables>\n+ <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n+ </environmentVariables>\n<arguments>\n<argument>--file=${app.server.jboss.home}/bin/adapter-install-offline.cli</argument>\n<!--\n<skip>${skip.adapter.offline.installation}</skip>\n<executable>${cli.executable}</executable>\n<workingDirectory>${cli.working.dir}</workingDirectory>\n+ <environmentVariables>\n+ <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n+ </environmentVariables>\n<arguments>\n<argument>--file=${app.server.jboss.home}/bin/adapter-install-offline.cli</argument>\n<!--\n<skip>${skip.adapter.offline.installation}</skip>\n<executable>${cli.executable}</executable>\n<workingDirectory>${cli.working.dir}</workingDirectory>\n+ <environmentVariables>\n+ <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n+ </environmentVariables>\n<arguments>\n<argument>--file=${app.server.jboss.home}/bin/adapter-install-saml-offline.cli</argument>\n<!--\n<skip>${skip.adapter.offline.installation}</skip>\n<executable>${cli.executable}</executable>\n<workingDirectory>${cli.working.dir}</workingDirectory>\n+ <environmentVariables>\n+ <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n+ </environmentVariables>\n<arguments>\n<argument>--file=${app.server.jboss.home}/bin/adapter-install-saml-offline.cli</argument>\n<!--\n<skip>${skip.apply.offline.cli}</skip><!--eap6-->\n<executable>${cli.executable}</executable>\n<workingDirectory>${cli.working.dir}</workingDirectory>\n+ <environmentVariables>\n+ <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n+ </environmentVariables>\n<arguments>\n<argument>--file=${common.resources}/cli/add-secured-deployments.cli</argument>\n<!--\n<skip>${skip.configure.clustered.scenario}</skip><!--eap6, wildfly9-->\n<executable>${cli.executable}</executable>\n<workingDirectory>${cli.working.dir}</workingDirectory>\n+ <environmentVariables>\n+ <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n+ </environmentVariables>\n<arguments>\n<argument>--file=${common.resources}/cli/configure-cluster-config.cli</argument>\n<!--\n<skip>${skip.configure.clustered.scenario}</skip><!--eap6, wildfly9-->\n<executable>${cli.executable}</executable>\n<workingDirectory>${cli.working.dir}</workingDirectory>\n+ <environmentVariables>\n+ <JAVA_HOME>${app.server.java.home}</JAVA_HOME>\n+ </environmentVariables>\n<arguments>\n<argument>--file=${common.resources}/cli/configure-crossdc-config.cli</argument>\n<!--\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9025 Respect app.server.java.home while installing adapters |
339,364 | 06.12.2018 08:25:01 | -3,600 | 3e48fa1dbc475fc278cd8d915a2385763350f95e | Add support for Java 11 to the testsuite | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/HOW-TO-RUN.md",
"new_path": "testsuite/integration-arquillian/HOW-TO-RUN.md",
"diff": "@@ -800,3 +800,7 @@ Then, before running the test, setup Keycloak Server distribution for the tests:\nWhen running the test, add the following arguments to the command line:\n-Pauth-server-wildfly -Pauth-server-enable-disable-feature -Dfeature.name=docker -Dfeature.value=enabled\n+\n+## Java 11 support\n+Java 11 requires some arguments to be passed to JVM. Those can be activated using `-Pjava11-auth-server` and\n+`-Pjava11-app-server` profiles, respectively.\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/servers/app-server/jboss/eap/src/main/java/org/keycloak/testsuite/arquillian/eap/container/EAPAppServerProvider.java",
"new_path": "testsuite/integration-arquillian/servers/app-server/jboss/eap/src/main/java/org/keycloak/testsuite/arquillian/eap/container/EAPAppServerProvider.java",
"diff": "@@ -97,7 +97,8 @@ public class EAPAppServerProvider implements AppServerContainerProvider {\ncreateChild(\"javaVmArguments\",\nSystem.getProperty(\"app.server.jboss.jvm.debug.args\", \"\") + \" \" +\nSystem.getProperty(\"app.server.memory.settings\", \"\") + \" \" +\n- \"-Djava.net.preferIPv4Stack=true\"\n+ \"-Djava.net.preferIPv4Stack=true\" + \" \" +\n+ System.getProperty(\"app.server.jvm.args.extra\")\n);\ncreateChild(\"managementProtocol\", managementProtocol);\ncreateChild(\"managementPort\", managementPort);\n@@ -144,7 +145,8 @@ public class EAPAppServerProvider implements AppServerContainerProvider {\ncreateChild(\"javaVmArguments\",\n\"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=790\" + number + \" \" +\nSystem.getProperty(\"app.server.memory.settings\", \"\") + \" \" +\n- \"-Djava.net.preferIPv4Stack=true\"\n+ \"-Djava.net.preferIPv4Stack=true\" + \" \" +\n+ System.getProperty(\"app.server.jvm.args.extra\")\n);\ncreateChild(\"managementProtocol\", managementProtocol);\ncreateChild(\"managementPort\", managementPort);\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/servers/app-server/jboss/wildfly/src/main/java/org/keycloak/testsuite/arquillian/wildfly/container/WildflyAppServerProvider.java",
"new_path": "testsuite/integration-arquillian/servers/app-server/jboss/wildfly/src/main/java/org/keycloak/testsuite/arquillian/wildfly/container/WildflyAppServerProvider.java",
"diff": "@@ -95,7 +95,8 @@ public class WildflyAppServerProvider implements AppServerContainerProvider {\ncreateChild(\"javaVmArguments\",\nSystem.getProperty(\"app.server.jboss.jvm.debug.args\", \"\") + \" \" +\nSystem.getProperty(\"app.server.memory.settings\", \"\") + \" \" +\n- \"-Djava.net.preferIPv4Stack=true\"\n+ \"-Djava.net.preferIPv4Stack=true\" + \" \" +\n+ System.getProperty(\"app.server.jvm.args.extra\")\n);\ncreateChild(\"managementProtocol\", managementProtocol);\ncreateChild(\"managementPort\", managementPort);\n@@ -142,7 +143,8 @@ public class WildflyAppServerProvider implements AppServerContainerProvider {\ncreateChild(\"javaVmArguments\",\n\"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=790\" + number + \" \" +\nSystem.getProperty(\"app.server.memory.settings\", \"\") + \" \" +\n- \"-Djava.net.preferIPv4Stack=true\"\n+ \"-Djava.net.preferIPv4Stack=true\" + \" \" +\n+ System.getProperty(\"app.server.jvm.args.extra\")\n);\ncreateChild(\"managementProtocol\", managementProtocol);\ncreateChild(\"managementPort\", managementPort);\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml",
"diff": "${auth.server.jboss.jvm.debug.args}\n${auth.server.memory.settings}\n-Djava.net.preferIPv4Stack=true\n+ ${auth.server.jvm.args.extra}\n</property>\n<property name=\"managementPort\">${auth.server.management.port}</property>\n<property name=\"startupTimeoutInSeconds\">${auth.server.jboss.startup.timeout}</property>\n<property name=\"javaVmArguments\">\n${auth.server.memory.settings}\n-Djava.net.preferIPv4Stack=true\n+ ${auth.server.jvm.args.extra}\n</property>\n<property name=\"outputToConsole\">${backends.console.output}</property>\n<property name=\"managementPort\">${auth.server.backend1.management.port}</property>\n<property name=\"javaVmArguments\">\n${auth.server.memory.settings}\n-Djava.net.preferIPv4Stack=true\n+ ${auth.server.jvm.args.extra}\n</property>\n<property name=\"outputToConsole\">${backends.console.output}</property>\n<property name=\"managementPort\">${auth.server.backend2.management.port}</property>\n${auth.server.memory.settings}\n-Djava.net.preferIPv4Stack=true\n${cache.server.crossdc1.jvm.debug.args}\n+ ${auth.server.jvm.args.extra}\n</property>\n<property name=\"outputToConsole\">${cache.server.console.output}</property>\n<property name=\"managementPort\">${cache.server.management.port}</property>\n${auth.server.memory.settings}\n-Djava.net.preferIPv4Stack=true\n${cache.server.crossdc2.jvm.debug.args}\n+ ${auth.server.jvm.args.extra}\n</property>\n<property name=\"outputToConsole\">${cache.server.console.output}</property>\n<property name=\"managementPort\">${cache.server.2.management.port}</property>\n${auth.server.memory.settings}\n-Djava.net.preferIPv4Stack=true\n${auth.server.crossdc01.jvm.debug.args}\n+ ${auth.server.jvm.args.extra}\n</property>\n<property name=\"managementPort\">${auth.server.crossdc01.management.port}</property>\n<property name=\"bindHttpPortOffset\">-79</property>\n${auth.server.memory.settings}\n-Djava.net.preferIPv4Stack=true\n${auth.server.crossdc02.jvm.debug.args}\n+ ${auth.server.jvm.args.extra}\n</property>\n<property name=\"managementPort\">${auth.server.crossdc02.management.port}</property>\n<property name=\"bindHttpPortOffset\">-78</property>\n${auth.server.memory.settings}\n-Djava.net.preferIPv4Stack=true\n${auth.server.crossdc11.jvm.debug.args}\n+ ${auth.server.jvm.args.extra}\n</property>\n<property name=\"managementPort\">${auth.server.crossdc11.management.port}</property>\n<property name=\"bindHttpPortOffset\">-69</property>\n${auth.server.memory.settings}\n-Djava.net.preferIPv4Stack=true\n${auth.server.crossdc12.jvm.debug.args}\n+ ${auth.server.jvm.args.extra}\n</property>\n<property name=\"managementPort\">${auth.server.crossdc12.management.port}</property>\n<property name=\"bindHttpPortOffset\">-68</property>\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/pom.xml",
"new_path": "testsuite/integration-arquillian/tests/pom.xml",
"diff": "<auth.server.adapter.impl.class>org.jboss.as.arquillian.container.managed.ManagedDeployableContainer</auth.server.adapter.impl.class>\n<auth.server.truststore>${jboss.home.dir}/standalone/configuration/keycloak.truststore</auth.server.truststore>\n<auth.server.truststore.password>secret</auth.server.truststore.password>\n+ <auth.server.jvm.args.extra/>\n<auth.server.jboss.artifactId>integration-arquillian-servers-auth-server-${auth.server}</auth.server.jboss.artifactId>\n<auth.server.jboss.skip.unpack>${auth.server.undertow}</auth.server.jboss.skip.unpack>\n<!-- Cluster tests are failing with -Xmx512 for insufficient physical memory -->\n<app.server.memory.settings>-Xms64m -Xmx384m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m</app.server.memory.settings>\n<app.server.ssl.required>false</app.server.ssl.required>\n+ <app.server.jvm.args.extra/>\n<cache.server>undefined</cache.server>\n<cache.server.container>cache-server-${cache.server}</cache.server.container>\n<auth.server.jboss.jvm.debug.args>${auth.server.jboss.jvm.debug.args}</auth.server.jboss.jvm.debug.args>\n<auth.server.truststore>${auth.server.truststore}</auth.server.truststore>\n<auth.server.truststore.password>${auth.server.truststore.password}</auth.server.truststore.password>\n+ <auth.server.jvm.args.extra>${auth.server.jvm.args.extra}</auth.server.jvm.args.extra>\n<auth.server.profile>${auth.server.profile}</auth.server.profile>\n<auth.server.feature>${auth.server.feature}</auth.server.feature>\n<app.server.2.port.offset>${app.server.2.port.offset}</app.server.2.port.offset>\n<app.server.2.management.port>${app.server.2.management.port}</app.server.2.management.port>\n<app.server.jboss.jvm.debug.args>${app.server.jboss.jvm.debug.args}</app.server.jboss.jvm.debug.args>\n+ <app.server.jvm.args.extra>${app.server.jvm.args.extra}</app.server.jvm.args.extra>\n<frontend.console.output>${frontend.console.output}</frontend.console.output>\n<backends.console.output>${backend.console.output}</backends.console.output>\n</properties>\n</profile>\n+ <profile>\n+ <id>java11-auth-server</id> <!-- a temporary workaround; TODO remove this once Java 11 is officially supported by Arquillian -->\n+ <properties>\n+ <auth.server.jvm.args.extra>--add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED --add-modules=java.se</auth.server.jvm.args.extra>\n+ </properties>\n+ </profile>\n+\n+ <profile>\n+ <id>java11-app-server</id> <!-- a temporary workaround; TODO remove this once Java 11 is officially supported by Arquillian -->\n+ <properties>\n+ <app.server.jvm.args.extra>--add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED --add-modules=java.se</app.server.jvm.args.extra>\n+ </properties>\n+ </profile>\n+\n</profiles>\n</project>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9023 Add support for Java 11 to the testsuite |
339,167 | 03.12.2018 16:00:51 | -3,600 | 99a5656f0fceda6d1a26e9f5e58a6a19c0948f79 | Migrate ModelClass: UserSessionInitializerTest | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/model/UserSessionInitializerTest.java",
"diff": "+/*\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.testsuite.model;\n+\n+import org.jboss.arquillian.container.test.api.Deployment;\n+import org.jboss.arquillian.container.test.api.TargetsContainer;\n+import org.jboss.shrinkwrap.api.spec.WebArchive;\n+import org.junit.After;\n+import org.junit.Assert;\n+import org.junit.Before;\n+import org.junit.Test;\n+import org.keycloak.admin.client.Keycloak;\n+import org.keycloak.admin.client.resource.UserResource;\n+import org.keycloak.common.util.Time;\n+import org.keycloak.connections.infinispan.InfinispanConnectionProvider;\n+import org.keycloak.models.*;\n+import org.keycloak.models.utils.KeycloakModelUtils;\n+import org.keycloak.protocol.oidc.OIDCLoginProtocol;\n+import org.keycloak.representations.idm.RealmRepresentation;\n+import org.keycloak.services.managers.UserSessionManager;\n+import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;\n+import org.keycloak.testsuite.arquillian.annotation.ModelTest;\n+import org.keycloak.testsuite.runonserver.RunOnServerDeployment;\n+\n+import java.util.List;\n+import java.util.concurrent.atomic.AtomicReference;\n+\n+import static org.hamcrest.core.Is.is;\n+import static org.junit.Assert.assertThat;\n+import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;\n+\n+/**\n+ * @author <a href=\"mailto:[email protected]\">Marek Posolda</a>\n+ * @author <a href=\"mailto:[email protected]\">Martin Bartos</a>\n+ */\n+public class UserSessionInitializerTest extends AbstractTestRealmKeycloakTest {\n+ private final String realmName = \"test\";\n+\n+ @Deployment\n+ @TargetsContainer(AUTH_SERVER_CURRENT)\n+ public static WebArchive deploy() {\n+ return RunOnServerDeployment.create(UserResource.class, org.keycloak.testsuite.model.UserSessionInitializerTest.class)\n+ .addPackages(true,\n+ \"org.keycloak.testsuite\",\n+ \"org.keycloak.testsuite.model\");\n+ }\n+\n+ @Before\n+ public void before() {\n+ testingClient.server().run(session -> {\n+ RealmModel realm = session.realms().getRealm(\"test\");\n+ session.users().addUser(realm, \"user1\").setEmail(\"user1@localhost\");\n+ session.users().addUser(realm, \"user2\").setEmail(\"user2@localhost\");\n+ });\n+ }\n+\n+ @After\n+ public void after() {\n+ testingClient.server().run(session -> {\n+ RealmModel realm = session.realms().getRealmByName(\"test\");\n+ session.sessions().removeUserSessions(realm);\n+\n+ UserModel user1 = session.users().getUserByUsername(\"user1\", realm);\n+ UserModel user2 = session.users().getUserByUsername(\"user2\", realm);\n+\n+ UserManager um = new UserManager(session);\n+ if (user1 != null)\n+ um.removeUser(realm, user1);\n+ if (user2 != null)\n+ um.removeUser(realm, user2);\n+ });\n+ }\n+\n+ @Test\n+ @ModelTest\n+ public void testUserSessionInitializer(KeycloakSession session) {\n+ AtomicReference<Integer> startedAtomic = new AtomicReference<>();\n+ AtomicReference<UserSessionModel[]> origSessionsAtomic = new AtomicReference<>();\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession SessionInit1) -> {\n+ KeycloakSession currentSession = SessionInit1;\n+ UserSessionManager sessionManager = new UserSessionManager(currentSession);\n+\n+ int started = Time.currentTime();\n+ startedAtomic.set(started);\n+\n+ UserSessionModel[] origSessions = createSessionsInPersisterOnly(currentSession);\n+ origSessionsAtomic.set(origSessions);\n+\n+ // Load sessions from persister into infinispan/memory\n+ UserSessionProviderFactory userSessionFactory = (UserSessionProviderFactory) currentSession.getKeycloakSessionFactory().getProviderFactory(UserSessionProvider.class);\n+ userSessionFactory.loadPersistentSessions(currentSession.getKeycloakSessionFactory(), 1, 2);\n+ });\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession SessionInit2) -> {\n+ KeycloakSession currentSession = SessionInit2;\n+ RealmModel realm = currentSession.realms().getRealmByName(realmName);\n+\n+ int started = startedAtomic.get();\n+\n+ UserSessionModel[] origSessions = origSessionsAtomic.get();\n+\n+ // Assert sessions are in\n+ ClientModel testApp = realm.getClientByClientId(\"test-app\");\n+ ClientModel thirdparty = realm.getClientByClientId(\"third-party\");\n+\n+ assertThat(\"Count of offline sesions for client 'test-app'\", currentSession.sessions().getOfflineSessionsCount(realm, testApp), is((long) 3));\n+ assertThat(\"Count of offline sesions for client 'third-party'\", currentSession.sessions().getOfflineSessionsCount(realm, thirdparty), is((long) 1));\n+\n+ List<UserSessionModel> loadedSessions = currentSession.sessions().getOfflineUserSessions(realm, testApp, 0, 10);\n+ UserSessionProviderTest.assertSessions(loadedSessions, origSessions);\n+\n+ assertSessionLoaded(loadedSessions, origSessions[0].getId(), currentSession.users().getUserByUsername(\"user1\", realm), \"127.0.0.1\", started, started, \"test-app\", \"third-party\");\n+ assertSessionLoaded(loadedSessions, origSessions[1].getId(), currentSession.users().getUserByUsername(\"user1\", realm), \"127.0.0.2\", started, started, \"test-app\");\n+ assertSessionLoaded(loadedSessions, origSessions[2].getId(), currentSession.users().getUserByUsername(\"user2\", realm), \"127.0.0.3\", started, started, \"test-app\");\n+ });\n+ }\n+\n+ @Test\n+ @ModelTest\n+ public void testUserSessionInitializerWithDeletingClient(KeycloakSession session) {\n+ AtomicReference<Integer> startedAtomic = new AtomicReference<>();\n+ AtomicReference<UserSessionModel[]> origSessionsAtomic = new AtomicReference<>();\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession SessionInitWithDeleting1) -> {\n+ KeycloakSession currentSession = SessionInitWithDeleting1;\n+ UserSessionManager sessionManager = new UserSessionManager(currentSession);\n+\n+ RealmModel realm = currentSession.realms().getRealmByName(realmName);\n+\n+ int started = Time.currentTime();\n+ startedAtomic.set(started);\n+\n+ origSessionsAtomic.set(createSessionsInPersisterOnly(currentSession));\n+\n+ // Delete one of the clients now. Delete it directly in DB just for the purpose of simulating the issue (normally clients should be removed through ClientManager)\n+ ClientModel testApp = realm.getClientByClientId(\"test-app\");\n+ realm.removeClient(testApp.getId());\n+ });\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession SessionInitWithDeleting2) -> {\n+ KeycloakSession currentSession = SessionInitWithDeleting2;\n+\n+ // Load sessions from persister into infinispan/memory\n+ UserSessionProviderFactory userSessionFactory = (UserSessionProviderFactory) currentSession.getKeycloakSessionFactory().getProviderFactory(UserSessionProvider.class);\n+ userSessionFactory.loadPersistentSessions(currentSession.getKeycloakSessionFactory(), 1, 2);\n+ });\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession SessionInitWithDeleting3) -> {\n+ KeycloakSession currentSession = SessionInitWithDeleting3;\n+ RealmModel realm = currentSession.realms().getRealmByName(realmName);\n+\n+ int started = startedAtomic.get();\n+\n+ UserSessionModel[] origSessions = origSessionsAtomic.get();\n+\n+ // Assert sessions are in\n+ ClientModel thirdparty = realm.getClientByClientId(\"third-party\");\n+\n+ assertThat(\"Count of offline sesions for client 'third-party'\", currentSession.sessions().getOfflineSessionsCount(realm, thirdparty), is((long) 1));\n+ List<UserSessionModel> loadedSessions = currentSession.sessions().getOfflineUserSessions(realm, thirdparty, 0, 10);\n+\n+ assertThat(\"Size of loaded Sessions\", loadedSessions.size(), is(1));\n+ assertSessionLoaded(loadedSessions, origSessions[0].getId(), currentSession.users().getUserByUsername(\"user1\", realm), \"127.0.0.1\", started, started, \"third-party\");\n+\n+ // Revert client\n+ realm.addClient(\"test-app\");\n+ });\n+\n+ }\n+\n+ // Create sessions in persister + infinispan, but then delete them from infinispan cache. This is to allow later testing of initializer. Return the list of \"origSessions\"\n+ private UserSessionModel[] createSessionsInPersisterOnly(KeycloakSession session) {\n+ AtomicReference<UserSessionModel[]> origSessionsAtomic = new AtomicReference<>();\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession createSessionPersister1) -> {\n+ KeycloakSession currentSession = createSessionPersister1;\n+\n+ UserSessionModel[] origSessions = createSessions(currentSession);\n+ origSessionsAtomic.set(origSessions);\n+ });\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession createSessionPersister2) -> {\n+ KeycloakSession currentSession = createSessionPersister2;\n+ RealmModel realm = currentSession.realms().getRealmByName(realmName);\n+ UserSessionManager sessionManager = new UserSessionManager(currentSession);\n+\n+ UserSessionModel[] origSessions = origSessionsAtomic.get();\n+\n+ for (UserSessionModel origSession : origSessions) {\n+ UserSessionModel userSession = currentSession.sessions().getUserSession(realm, origSession.getId());\n+ for (AuthenticatedClientSessionModel clientSession : userSession.getAuthenticatedClientSessions().values()) {\n+ sessionManager.createOrUpdateOfflineSession(clientSession, userSession);\n+ }\n+ }\n+ });\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession createSessionPersister3) -> {\n+ KeycloakSession currentSession = createSessionPersister3;\n+ RealmModel realm = currentSession.realms().getRealmByName(realmName);\n+\n+ // Delete cache (persisted sessions are still kept)\n+ currentSession.sessions().onRealmRemoved(realm);\n+\n+ // Clear ispn cache to ensure initializerState is removed as well\n+ InfinispanConnectionProvider infinispan = currentSession.getProvider(InfinispanConnectionProvider.class);\n+ infinispan.getCache(InfinispanConnectionProvider.WORK_CACHE_NAME).clear();\n+\n+ });\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession createSessionPersister4) -> {\n+ KeycloakSession currentSession = createSessionPersister4;\n+ RealmModel realm = currentSession.realms().getRealmByName(realmName);\n+\n+ ClientModel testApp = realm.getClientByClientId(\"test-app\");\n+ ClientModel thirdparty = realm.getClientByClientId(\"third-party\");\n+ assertThat(\"Count of offline sessions for client 'test-app'\", currentSession.sessions().getOfflineSessionsCount(realm, testApp), is((long) 0));\n+ assertThat(\"Count of offline sessions for client 'third-party'\", currentSession.sessions().getOfflineSessionsCount(realm, thirdparty), is((long) 0));\n+ });\n+\n+ return origSessionsAtomic.get();\n+ }\n+\n+ private AuthenticatedClientSessionModel createClientSession(KeycloakSession session, ClientModel client, UserSessionModel userSession, String redirect, String state) {\n+ RealmModel realm = session.realms().getRealmByName(realmName);\n+\n+ AuthenticatedClientSessionModel clientSession = session.sessions().createClientSession(realm, client, userSession);\n+ clientSession.setRedirectUri(redirect);\n+ if (state != null)\n+ clientSession.setNote(OIDCLoginProtocol.STATE_PARAM, state);\n+ return clientSession;\n+ }\n+\n+ private UserSessionModel[] createSessions(KeycloakSession session) {\n+ RealmModel realm = session.realms().getRealmByName(realmName);\n+\n+ UserSessionModel[] sessions = new UserSessionModel[3];\n+ sessions[0] = session.sessions().createUserSession(realm, session.users().getUserByUsername(\"user1\", realm), \"user1\", \"127.0.0.1\", \"form\", true, null, null);\n+\n+ createClientSession(session, realm.getClientByClientId(\"test-app\"), sessions[0], \"http://redirect\", \"state\");\n+ createClientSession(session, realm.getClientByClientId(\"third-party\"), sessions[0], \"http://redirect\", \"state\");\n+\n+ sessions[1] = session.sessions().createUserSession(realm, session.users().getUserByUsername(\"user1\", realm), \"user1\", \"127.0.0.2\", \"form\", true, null, null);\n+ createClientSession(session, realm.getClientByClientId(\"test-app\"), sessions[1], \"http://redirect\", \"state\");\n+\n+ sessions[2] = session.sessions().createUserSession(realm, session.users().getUserByUsername(\"user2\", realm), \"user2\", \"127.0.0.3\", \"form\", true, null, null);\n+ createClientSession(session, realm.getClientByClientId(\"test-app\"), sessions[2], \"http://redirect\", \"state\");\n+\n+ return sessions;\n+ }\n+\n+ private void assertSessionLoaded(List<UserSessionModel> sessions, String id, UserModel user, String ipAddress, int started, int lastRefresh, String... clients) {\n+ for (UserSessionModel session : sessions) {\n+ if (session.getId().equals(id)) {\n+ UserSessionProviderTest.assertSession(session, user, ipAddress, started, lastRefresh, clients);\n+ return;\n+ }\n+ }\n+ Assert.fail(\"Session with ID \" + id + \" not found in the list\");\n+ }\n+\n+ @Override\n+ public void configureTestRealm(RealmRepresentation testRealm) {\n+ }\n+}\n+\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/resources/run-on-server-jboss-deployment-structure.xml",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/resources/run-on-server-jboss-deployment-structure.xml",
"diff": "<module name=\"org.keycloak.keycloak-model-jpa\"/>\n<module name=\"org.keycloak.keycloak-kerberos-federation\"/>\n<module name=\"org.keycloak.keycloak-ldap-federation\"/>\n+ <module name=\"org.infinispan\"/>\n</dependencies>\n</deployment>\n</jboss-deployment-structure>\n"
},
{
"change_type": "DELETE",
"old_path": "testsuite/integration-deprecated/src/test/java/org/keycloak/testsuite/model/UserSessionInitializerTest.java",
"new_path": null,
"diff": "-/*\n- * Copyright 2016 Red Hat, Inc. and/or its affiliates\n- * and other contributors as indicated by the @author tags.\n- *\n- * Licensed under the Apache License, Version 2.0 (the \"License\");\n- * you may not use this file except in compliance with the License.\n- * You may obtain a copy of the License at\n- *\n- * http://www.apache.org/licenses/LICENSE-2.0\n- *\n- * Unless required by applicable law or agreed to in writing, software\n- * distributed under the License is distributed on an \"AS IS\" BASIS,\n- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n- * See the License for the specific language governing permissions and\n- * limitations under the License.\n- */\n-\n-package org.keycloak.testsuite.model;\n-\n-import org.junit.After;\n-import org.junit.Assert;\n-import org.junit.Before;\n-import org.junit.ClassRule;\n-import org.junit.Test;\n-import org.keycloak.cluster.ClusterProvider;\n-import org.keycloak.common.util.Time;\n-import org.keycloak.connections.infinispan.InfinispanConnectionProvider;\n-import org.keycloak.models.AuthenticatedClientSessionModel;\n-import org.keycloak.models.ClientModel;\n-import org.keycloak.models.KeycloakSession;\n-import org.keycloak.models.RealmModel;\n-import org.keycloak.models.UserModel;\n-import org.keycloak.models.UserSessionModel;\n-import org.keycloak.models.UserSessionProvider;\n-import org.keycloak.models.UserSessionProviderFactory;\n-import org.keycloak.protocol.oidc.OIDCLoginProtocol;\n-import org.keycloak.models.UserManager;\n-import org.keycloak.services.managers.UserSessionManager;\n-import org.keycloak.testsuite.rule.KeycloakRule;\n-\n-import java.util.List;\n-\n-/**\n- * @author <a href=\"mailto:[email protected]\">Marek Posolda</a>\n- */\n-public class UserSessionInitializerTest {\n-\n-\n- @ClassRule\n- public static KeycloakRule kc = new KeycloakRule();\n-\n- private KeycloakSession session;\n- private RealmModel realm;\n- private UserSessionManager sessionManager;\n-\n- @Before\n- public void before() {\n- session = kc.startSession();\n- realm = session.realms().getRealm(\"test\");\n- session.users().addUser(realm, \"user1\").setEmail(\"user1@localhost\");\n- session.users().addUser(realm, \"user2\").setEmail(\"user2@localhost\");\n- sessionManager = new UserSessionManager(session);\n- }\n-\n- @After\n- public void after() {\n- resetSession();\n- session.sessions().removeUserSessions(realm);\n- UserModel user1 = session.users().getUserByUsername(\"user1\", realm);\n- UserModel user2 = session.users().getUserByUsername(\"user2\", realm);\n-\n- UserManager um = new UserManager(session);\n- um.removeUser(realm, user1);\n- um.removeUser(realm, user2);\n- kc.stopSession(session, true);\n- }\n-\n- @Test\n- public void testUserSessionInitializer() {\n- int started = Time.currentTime();\n- int serverStartTime = session.getProvider(ClusterProvider.class).getClusterStartupTime();\n-\n- UserSessionModel[] origSessions = createSessionsInPersisterOnly();\n-\n- // Load sessions from persister into infinispan/memory\n- UserSessionProviderFactory userSessionFactory = (UserSessionProviderFactory) session.getKeycloakSessionFactory().getProviderFactory(UserSessionProvider.class);\n- userSessionFactory.loadPersistentSessions(session.getKeycloakSessionFactory(), 1, 2);\n-\n- resetSession();\n-\n- // Assert sessions are in\n- ClientModel testApp = realm.getClientByClientId(\"test-app\");\n- ClientModel thirdparty = realm.getClientByClientId(\"third-party\");\n- Assert.assertEquals(3, session.sessions().getOfflineSessionsCount(realm, testApp));\n- Assert.assertEquals(1, session.sessions().getOfflineSessionsCount(realm, thirdparty));\n-\n- List<UserSessionModel> loadedSessions = session.sessions().getOfflineUserSessions(realm, testApp, 0, 10);\n- UserSessionProviderTest.assertSessions(loadedSessions, origSessions);\n-\n- UserSessionPersisterProviderTest.assertSessionLoaded(loadedSessions, origSessions[0].getId(), session.users().getUserByUsername(\"user1\", realm), \"127.0.0.1\", started, started, \"test-app\", \"third-party\");\n- UserSessionPersisterProviderTest.assertSessionLoaded(loadedSessions, origSessions[1].getId(), session.users().getUserByUsername(\"user1\", realm), \"127.0.0.2\", started, started, \"test-app\");\n- UserSessionPersisterProviderTest.assertSessionLoaded(loadedSessions, origSessions[2].getId(), session.users().getUserByUsername(\"user2\", realm), \"127.0.0.3\", started, started, \"test-app\");\n- }\n-\n-\n- // KEYCLOAK-5245\n- @Test\n- public void testUserSessionInitializerWithDeletingClient() {\n- int started = Time.currentTime();\n- int serverStartTime = session.getProvider(ClusterProvider.class).getClusterStartupTime();\n-\n- UserSessionModel[] origSessions = createSessionsInPersisterOnly();\n-\n- // Delete one of the clients now. Delete it directly in DB just for the purpose of simulating the issue (normally clients should be removed through ClientManager)\n- ClientModel testApp = realm.getClientByClientId(\"test-app\");\n- realm.removeClient(testApp.getId());\n-\n- resetSession();\n-\n- // Load sessions from persister into infinispan/memory\n- UserSessionProviderFactory userSessionFactory = (UserSessionProviderFactory) session.getKeycloakSessionFactory().getProviderFactory(UserSessionProvider.class);\n- userSessionFactory.loadPersistentSessions(session.getKeycloakSessionFactory(), 1, 2);\n-\n- resetSession();\n-\n- // Assert sessions are in\n- ClientModel thirdparty = realm.getClientByClientId(\"third-party\");\n- Assert.assertEquals(1, session.sessions().getOfflineSessionsCount(realm, thirdparty));\n-\n- List<UserSessionModel> loadedSessions = session.sessions().getOfflineUserSessions(realm, thirdparty, 0, 10);\n- Assert.assertEquals(1, loadedSessions.size());\n-\n- UserSessionPersisterProviderTest.assertSessionLoaded(loadedSessions, origSessions[0].getId(), session.users().getUserByUsername(\"user1\", realm), \"127.0.0.1\", started, started, \"third-party\");\n-\n- // Revert client\n- realm.addClient(\"test-app\");\n- }\n-\n-\n- // Create sessions in persister+infinispan, but then delete them from infinispan cache. This is to allow later testing of initializer. Return the list of \"origSessions\"\n- private UserSessionModel[] createSessionsInPersisterOnly() {\n- UserSessionModel[] origSessions = createSessions();\n-\n- resetSession();\n-\n- for (UserSessionModel origSession : origSessions) {\n- UserSessionModel userSession = session.sessions().getUserSession(realm, origSession.getId());\n- for (AuthenticatedClientSessionModel clientSession : userSession.getAuthenticatedClientSessions().values()) {\n- sessionManager.createOrUpdateOfflineSession(clientSession, userSession);\n- }\n- }\n-\n- resetSession();\n-\n- // Delete cache (persisted sessions are still kept)\n- session.sessions().onRealmRemoved(realm);\n-\n- // Clear ispn cache to ensure initializerState is removed as well\n- InfinispanConnectionProvider infinispan = session.getProvider(InfinispanConnectionProvider.class);\n- infinispan.getCache(InfinispanConnectionProvider.WORK_CACHE_NAME).clear();\n-\n- resetSession();\n-\n- ClientModel testApp = realm.getClientByClientId(\"test-app\");\n- ClientModel thirdparty = realm.getClientByClientId(\"third-party\");\n- Assert.assertEquals(0, session.sessions().getOfflineSessionsCount(realm, testApp));\n- Assert.assertEquals(0, session.sessions().getOfflineSessionsCount(realm, thirdparty));\n-\n- return origSessions;\n- }\n-\n-\n- private AuthenticatedClientSessionModel createClientSession(ClientModel client, UserSessionModel userSession, String redirect, String state) {\n- AuthenticatedClientSessionModel clientSession = session.sessions().createClientSession(realm, client, userSession);\n- clientSession.setRedirectUri(redirect);\n- if (state != null) clientSession.setNote(OIDCLoginProtocol.STATE_PARAM, state);\n- return clientSession;\n- }\n-\n- private UserSessionModel[] createSessions() {\n- UserSessionModel[] sessions = new UserSessionModel[3];\n- sessions[0] = session.sessions().createUserSession(realm, session.users().getUserByUsername(\"user1\", realm), \"user1\", \"127.0.0.1\", \"form\", true, null, null);\n-\n- createClientSession(realm.getClientByClientId(\"test-app\"), sessions[0], \"http://redirect\", \"state\");\n- createClientSession(realm.getClientByClientId(\"third-party\"), sessions[0], \"http://redirect\", \"state\");\n-\n- sessions[1] = session.sessions().createUserSession(realm, session.users().getUserByUsername(\"user1\", realm), \"user1\", \"127.0.0.2\", \"form\", true, null, null);\n- createClientSession(realm.getClientByClientId(\"test-app\"), sessions[1], \"http://redirect\", \"state\");\n-\n- sessions[2] = session.sessions().createUserSession(realm, session.users().getUserByUsername(\"user2\", realm), \"user2\", \"127.0.0.3\", \"form\", true, null, null);\n- createClientSession(realm.getClientByClientId(\"test-app\"), sessions[2], \"http://redirect\", \"state\");\n-\n- resetSession();\n-\n- return sessions;\n- }\n-\n- private void resetSession() {\n- kc.stopSession(session, true);\n- session = kc.startSession();\n- realm = session.realms().getRealm(\"test\");\n- sessionManager = new UserSessionManager(session);\n- }\n-\n-}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | [KEYCLOAK-8389] Migrate ModelClass: UserSessionInitializerTest |
339,281 | 06.12.2018 13:48:31 | -3,600 | 6616e4a0110114d6e2c80ce3dc7bae4dde69e395 | fix package name of Album class | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/authorization/AbstractPhotozExampleAdapterTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/authorization/AbstractPhotozExampleAdapterTest.java",
"diff": "@@ -148,7 +148,7 @@ public abstract class AbstractPhotozExampleAdapterTest extends AbstractPhotozJav\nOnlineManagementClient client = AppServerTestEnricher.getManagementClient();\nAdministration administration = new Administration(client);\n- client.execute(\"/system-property=jackson.deserialization.whitelist.packages:add(value=org.keycloak.testsuite.photoz)\");\n+ client.execute(\"/system-property=jackson.deserialization.whitelist.packages:add(value=org.keycloak.example.photoz)\");\nadministration.reloadIfRequired();\n}\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8660 fix package name of Album class |
339,281 | 06.12.2018 10:24:26 | -3,600 | 59bbd82a1a421eec6ba1b10e6ceeb2d52c949017 | add namespaces to add-hawtio.xsl to fix EAP6Fuse6HawtioAdapterTest | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/servers/app-server/jboss/eap6/src/main/resources/config/fuse/add-hawtio.xsl",
"new_path": "testsuite/integration-arquillian/servers/app-server/jboss/eap6/src/main/resources/config/fuse/add-hawtio.xsl",
"diff": "</xsl:template>\n<xsl:template match=\"//*[local-name()='system-properties']\">\n- <system-properties>\n+ <!--namespaces can be hadcoded here as no other releases of eap6 are planned-->\n+ <system-properties xmlns=\"urn:jboss:domain:1.8\">\n<property name=\"hawtio.authenticationEnabled\" value=\"true\" />\n<property name=\"hawtio.realm\" value=\"hawtio\" />\n<property name=\"hawtio.roles\" value=\"admin,viewer\" />\n</xsl:template>\n<xsl:template match=\"//*[local-name()='security-domain' and @name = 'hawtio-domain']\">\n- <security-domain name=\"hawtio\" cache-type=\"default\">\n+ <security-domain name=\"hawtio\" cache-type=\"default\" xmlns=\"urn:jboss:domain:security:1.2\">\n<authentication>\n<login-module code=\"org.keycloak.adapters.jaas.BearerTokenLoginModule\" flag=\"required\">\n<module-option name=\"keycloak-config-file\" value=\"${{hawtio.keycloakServerConfig}}\"/>\n<xsl:template match=\"//*[local-name()='subsystem' and starts-with(namespace-uri(), $keycloakNamespace)]\">\n<xsl:copy>\n- <secure-deployment name=\"hawtio.war\" />\n+ <secure-deployment name=\"hawtio.war\" xmlns=\"urn:jboss:domain:keycloak:1.1\"/>\n</xsl:copy>\n</xsl:template>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9018 add namespaces to add-hawtio.xsl to fix EAP6Fuse6HawtioAdapterTest |
339,641 | 04.12.2018 13:50:56 | -3,600 | b35bcbf626f1f11e8a28cd5dc3d9efe6240f919d | spring boot 2.1.0 testing | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/test-apps/spring-boot-2-adapter/pom.xml",
"new_path": "testsuite/integration-arquillian/test-apps/spring-boot-2-adapter/pom.xml",
"diff": "</profile>\n<profile>\n- <id>jetty-version-81</id>\n+ <id>jetty-version-94</id>\n<activation>\n<property>\n<name>jetty.adapter.version</name>\n- <value>81</value>\n+ <value>94</value>\n</property>\n</activation>\n<properties>\n- <jetty.version>8.1.22.v20160922</jetty.version>\n+ <jetty.version>9.4.14.v20181114</jetty.version>\n</properties>\n<dependencies>\n<dependency>\n<groupId>org.keycloak</groupId>\n- <artifactId>keycloak-jetty81-adapter</artifactId>\n- <version>${keycloak.version}</version>\n- </dependency>\n- <dependency>\n- <groupId>org.springframework.boot</groupId>\n- <artifactId>spring-boot-starter-jetty</artifactId>\n- <exclusions>\n- <exclusion>\n- <groupId>org.eclipse.jetty.websocket</groupId>\n- <artifactId>*</artifactId>\n- </exclusion>\n- </exclusions>\n- </dependency>\n- </dependencies>\n- </profile>\n-\n- <profile>\n- <id>jetty-version-92</id>\n- <activation>\n- <property>\n- <name>jetty.adapter.version</name>\n- <value>92</value>\n- </property>\n- </activation>\n- <properties>\n- <jetty.version>9.2.23.v20171218</jetty.version>\n- </properties>\n- <dependencies>\n- <dependency>\n- <groupId>org.keycloak</groupId>\n- <artifactId>keycloak-jetty92-adapter</artifactId>\n+ <artifactId>keycloak-jetty94-adapter</artifactId>\n<version>${keycloak.version}</version>\n</dependency>\n<dependency>\n</dependency>\n</dependencies>\n</profile>\n-\n- <profile>\n- <id>jetty-version-93</id>\n- <activation>\n- <property>\n- <name>jetty.adapter.version</name>\n- <value>93</value>\n- </property>\n- </activation>\n- <properties>\n- <jetty.version>9.3.22.v20171030</jetty.version>\n- </properties>\n- <dependencies>\n- <dependency>\n- <groupId>org.keycloak</groupId>\n- <artifactId>keycloak-jetty93-adapter</artifactId>\n- <version>${keycloak.version}</version>\n- </dependency>\n- <dependency>\n- <groupId>org.springframework.boot</groupId>\n- <artifactId>spring-boot-starter-jetty</artifactId>\n- </dependency>\n- </dependencies>\n- </profile>\n-\n</profiles>\n<groupId>org.springframework.boot</groupId>\n<artifactId>spring-boot-maven-plugin</artifactId>\n</plugin>\n+ <plugin>\n+ <groupId>org.apache.maven.plugins</groupId>\n+ <artifactId>maven-antrun-plugin</artifactId>\n+ <version>1.8</version>\n+ <executions>\n+ <execution>\n+ <id>copy-source-file</id>\n+ <phase>process-sources</phase>\n+ <configuration>\n+ <tasks>\n+ <copy file=\"../spring-boot-adapter/src/main/java/org/keycloak/AdminController.java\"\n+ tofile=\"src/main/java/org/keycloak/AdminController.java\"/>\n+ <copy file=\"../spring-boot-adapter/src/main/java/org/keycloak/SpringBootAdapterApplication.java\"\n+ tofile=\"src/main/java/org/keycloak/SpringBootAdapterApplication.java\"/>\n+ </tasks>\n+ </configuration>\n+ <goals>\n+ <goal>run</goal>\n+ </goals>\n+ </execution>\n+ <execution>\n+ <id>remove-source-file</id>\n+ <phase>process-classes</phase>\n+ <configuration>\n+ <tasks>\n+ <delete file=\"src/main/java/org/keycloak/AdminController.java\"/>\n+ <delete file=\"src/main/java/org/keycloak/SpringBootAdapterApplication.java\"/>\n+ </tasks>\n+ </configuration>\n+ <goals>\n+ <goal>run</goal>\n+ </goals>\n+ </execution>\n+ </executions>\n+ </plugin>\n</plugins>\n</build>\n"
},
{
"change_type": "DELETE",
"old_path": "testsuite/integration-arquillian/test-apps/spring-boot-2-adapter/src/main/java/org/keycloak/AdminController.java",
"new_path": null,
"diff": "-package org.keycloak;\n-\n-import org.keycloak.adapters.RefreshableKeycloakSecurityContext;\n-import org.keycloak.common.util.Base64Url;\n-import org.keycloak.common.util.KeycloakUriBuilder;\n-import org.keycloak.common.util.Time;\n-import org.keycloak.jose.jws.JWSInput;\n-import org.keycloak.jose.jws.JWSInputException;\n-import org.keycloak.representations.AccessToken;\n-import org.keycloak.representations.RefreshToken;\n-import org.keycloak.util.JsonSerialization;\n-import org.slf4j.Logger;\n-import org.slf4j.LoggerFactory;\n-import org.springframework.stereotype.Controller;\n-import org.springframework.ui.Model;\n-import org.springframework.util.StringUtils;\n-import org.springframework.web.bind.annotation.RequestMapping;\n-import org.springframework.web.bind.annotation.RequestMethod;\n-import org.springframework.web.bind.annotation.RequestParam;\n-import org.springframework.web.context.request.RequestAttributes;\n-import org.springframework.web.context.request.RequestContextHolder;\n-import org.springframework.web.context.request.ServletRequestAttributes;\n-import org.springframework.web.context.request.WebRequest;\n-\n-import javax.servlet.http.HttpServletResponse;\n-import javax.servlet.http.HttpSession;\n-import java.io.IOException;\n-import java.nio.charset.StandardCharsets;\n-import java.security.MessageDigest;\n-import java.security.NoSuchAlgorithmException;\n-import java.util.Map;\n-import java.util.UUID;\n-\n-@Controller\n-@RequestMapping(path = \"/admin\")\n-public class AdminController {\n-\n- private static Logger logger = LoggerFactory.getLogger(AdminController.class);\n-\n- @RequestMapping(path = \"/TokenServlet\", method = RequestMethod.GET)\n- public String showTokens(WebRequest req, Model model, @RequestParam Map<String, String> attributes) throws IOException {\n- String timeOffset = attributes.get(\"timeOffset\");\n- if (!StringUtils.isEmpty(timeOffset)) {\n- int offset;\n- try {\n- offset = Integer.parseInt(timeOffset, 10);\n- }\n- catch (NumberFormatException e) {\n- offset = 0;\n- }\n-\n- Time.setOffset(offset);\n- }\n-\n- RefreshableKeycloakSecurityContext ctx =\n- (RefreshableKeycloakSecurityContext) req.getAttribute(KeycloakSecurityContext.class.getName(), WebRequest.SCOPE_REQUEST);\n- String accessTokenPretty = JsonSerialization.writeValueAsPrettyString(ctx.getToken());\n- RefreshToken refreshToken;\n- try {\n- refreshToken = new JWSInput(ctx.getRefreshToken()).readJsonContent(RefreshToken.class);\n- } catch (JWSInputException e) {\n- throw new IOException(e);\n- }\n- String refreshTokenPretty = JsonSerialization.writeValueAsPrettyString(refreshToken);\n-\n- model.addAttribute(\"accessToken\", accessTokenPretty);\n- model.addAttribute(\"refreshToken\", refreshTokenPretty);\n- model.addAttribute(\"accessTokenString\", ctx.getTokenString());\n-\n- return \"tokens\";\n- }\n-\n- @RequestMapping(path = \"/SessionServlet\", method = RequestMethod.GET)\n- public String sessionServlet(WebRequest webRequest, Model model) {\n- String counterString = (String) webRequest.getAttribute(\"counter\", RequestAttributes.SCOPE_SESSION);\n- int counter = 0;\n- try {\n- counter = Integer.parseInt(counterString, 10);\n- }\n- catch (NumberFormatException ignored) {\n- }\n-\n- model.addAttribute(\"counter\", counter);\n-\n- webRequest.setAttribute(\"counter\", Integer.toString(counter+1), RequestAttributes.SCOPE_SESSION);\n-\n- return \"session\";\n- }\n-\n- @RequestMapping(path = \"/LinkServlet\", method = RequestMethod.GET)\n- public String tokenController(WebRequest webRequest,\n- @RequestParam Map<String, String> attributes,\n- Model model) {\n-\n- ServletRequestAttributes attr = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();\n- HttpSession httpSession = attr.getRequest().getSession(true);\n-\n-// response.addHeader(\"Cache-Control\", \"no-cache\");\n-\n- String responseAttr = attributes.get(\"response\");\n-\n- if (StringUtils.isEmpty(responseAttr)) {\n- String provider = attributes.get(\"provider\");\n- String realm = attributes.get(\"realm\");\n- KeycloakSecurityContext keycloakSession =\n- (KeycloakSecurityContext) webRequest.getAttribute(\n- KeycloakSecurityContext.class.getName(),\n- RequestAttributes.SCOPE_REQUEST);\n- AccessToken token = keycloakSession.getToken();\n- String clientId = token.getAudience()[0];\n- String nonce = UUID.randomUUID().toString();\n- MessageDigest md;\n- try {\n- md = MessageDigest.getInstance(\"SHA-256\");\n- } catch (NoSuchAlgorithmException e) {\n- throw new RuntimeException(e);\n- }\n- String input = nonce + token.getSessionState() + clientId + provider;\n- byte[] check = md.digest(input.getBytes(StandardCharsets.UTF_8));\n- String hash = Base64Url.encode(check);\n- httpSession.setAttribute(\"hash\", hash);\n- String redirectUri = KeycloakUriBuilder.fromUri(\"http://localhost:8280/admin/LinkServlet\")\n- .queryParam(\"response\", \"true\").build().toString();\n- String accountLinkUrl = KeycloakUriBuilder.fromUri(\"http://localhost:8180/\")\n- .path(\"/auth/realms/{realm}/broker/{provider}/link\")\n- .queryParam(\"nonce\", nonce)\n- .queryParam(\"hash\", hash)\n- .queryParam(\"client_id\", token.getIssuedFor())\n- .queryParam(\"redirect_uri\", redirectUri).build(realm, provider).toString();\n-\n- return \"redirect:\" + accountLinkUrl;\n- } else {\n- String error = attributes.get(\"link_error\");\n- if (StringUtils.isEmpty(error))\n- model.addAttribute(\"error\", \"Account linked\");\n- else\n- model.addAttribute(\"error\", error);\n-\n- return \"linking\";\n- }\n- }\n-}\n"
},
{
"change_type": "DELETE",
"old_path": "testsuite/integration-arquillian/test-apps/spring-boot-2-adapter/src/main/java/org/keycloak/SpringBootAdapterApplication.java",
"new_path": null,
"diff": "-package org.keycloak;\n-\n-import org.springframework.boot.SpringApplication;\n-import org.springframework.boot.autoconfigure.SpringBootApplication;\n-\n-@SpringBootApplication\n-public class SpringBootAdapterApplication {\n-\n- public static void main(String[] args) {\n- SpringApplication.run(SpringBootAdapterApplication.class, args);\n- }\n-}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/test-apps/spring-boot-21-adapter/mvnw",
"diff": "+#!/bin/sh\n+# ----------------------------------------------------------------------------\n+# Licensed to the Apache Software Foundation (ASF) under one\n+# or more contributor license agreements. See the NOTICE file\n+# distributed with this work for additional information\n+# regarding copyright ownership. The ASF licenses this file\n+# to you under the Apache License, Version 2.0 (the\n+# \"License\"); you may not use this file except in compliance\n+# with the License. You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing,\n+# software distributed under the License is distributed on an\n+# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+# KIND, either express or implied. See the License for the\n+# specific language governing permissions and limitations\n+# under the License.\n+# ----------------------------------------------------------------------------\n+\n+# ----------------------------------------------------------------------------\n+# Maven2 Start Up Batch script\n+#\n+# Required ENV vars:\n+# ------------------\n+# JAVA_HOME - location of a JDK home dir\n+#\n+# Optional ENV vars\n+# -----------------\n+# M2_HOME - location of maven2's installed home dir\n+# MAVEN_OPTS - parameters passed to the Java VM when running Maven\n+# e.g. to debug Maven itself, use\n+# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000\n+# MAVEN_SKIP_RC - flag to disable loading of mavenrc files\n+# ----------------------------------------------------------------------------\n+\n+if [ -z \"$MAVEN_SKIP_RC\" ] ; then\n+\n+ if [ -f /etc/mavenrc ] ; then\n+ . /etc/mavenrc\n+ fi\n+\n+ if [ -f \"$HOME/.mavenrc\" ] ; then\n+ . \"$HOME/.mavenrc\"\n+ fi\n+\n+fi\n+\n+# OS specific support. $var _must_ be set to either true or false.\n+cygwin=false;\n+darwin=false;\n+mingw=false\n+case \"`uname`\" in\n+ CYGWIN*) cygwin=true ;;\n+ MINGW*) mingw=true;;\n+ Darwin*) darwin=true\n+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home\n+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html\n+ if [ -z \"$JAVA_HOME\" ]; then\n+ if [ -x \"/usr/libexec/java_home\" ]; then\n+ export JAVA_HOME=\"`/usr/libexec/java_home`\"\n+ else\n+ export JAVA_HOME=\"/Library/Java/Home\"\n+ fi\n+ fi\n+ ;;\n+esac\n+\n+if [ -z \"$JAVA_HOME\" ] ; then\n+ if [ -r /etc/gentoo-release ] ; then\n+ JAVA_HOME=`java-config --jre-home`\n+ fi\n+fi\n+\n+if [ -z \"$M2_HOME\" ] ; then\n+ ## resolve links - $0 may be a link to maven's home\n+ PRG=\"$0\"\n+\n+ # need this for relative symlinks\n+ while [ -h \"$PRG\" ] ; do\n+ ls=`ls -ld \"$PRG\"`\n+ link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n+ if expr \"$link\" : '/.*' > /dev/null; then\n+ PRG=\"$link\"\n+ else\n+ PRG=\"`dirname \"$PRG\"`/$link\"\n+ fi\n+ done\n+\n+ saveddir=`pwd`\n+\n+ M2_HOME=`dirname \"$PRG\"`/..\n+\n+ # make it fully qualified\n+ M2_HOME=`cd \"$M2_HOME\" && pwd`\n+\n+ cd \"$saveddir\"\n+ # echo Using m2 at $M2_HOME\n+fi\n+\n+# For Cygwin, ensure paths are in UNIX format before anything is touched\n+if $cygwin ; then\n+ [ -n \"$M2_HOME\" ] &&\n+ M2_HOME=`cygpath --unix \"$M2_HOME\"`\n+ [ -n \"$JAVA_HOME\" ] &&\n+ JAVA_HOME=`cygpath --unix \"$JAVA_HOME\"`\n+ [ -n \"$CLASSPATH\" ] &&\n+ CLASSPATH=`cygpath --path --unix \"$CLASSPATH\"`\n+fi\n+\n+# For Migwn, ensure paths are in UNIX format before anything is touched\n+if $mingw ; then\n+ [ -n \"$M2_HOME\" ] &&\n+ M2_HOME=\"`(cd \"$M2_HOME\"; pwd)`\"\n+ [ -n \"$JAVA_HOME\" ] &&\n+ JAVA_HOME=\"`(cd \"$JAVA_HOME\"; pwd)`\"\n+ # TODO classpath?\n+fi\n+\n+if [ -z \"$JAVA_HOME\" ]; then\n+ javaExecutable=\"`which javac`\"\n+ if [ -n \"$javaExecutable\" ] && ! [ \"`expr \\\"$javaExecutable\\\" : '\\([^ ]*\\)'`\" = \"no\" ]; then\n+ # readlink(1) is not available as standard on Solaris 10.\n+ readLink=`which readlink`\n+ if [ ! `expr \"$readLink\" : '\\([^ ]*\\)'` = \"no\" ]; then\n+ if $darwin ; then\n+ javaHome=\"`dirname \\\"$javaExecutable\\\"`\"\n+ javaExecutable=\"`cd \\\"$javaHome\\\" && pwd -P`/javac\"\n+ else\n+ javaExecutable=\"`readlink -f \\\"$javaExecutable\\\"`\"\n+ fi\n+ javaHome=\"`dirname \\\"$javaExecutable\\\"`\"\n+ javaHome=`expr \"$javaHome\" : '\\(.*\\)/bin'`\n+ JAVA_HOME=\"$javaHome\"\n+ export JAVA_HOME\n+ fi\n+ fi\n+fi\n+\n+if [ -z \"$JAVACMD\" ] ; then\n+ if [ -n \"$JAVA_HOME\" ] ; then\n+ if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n+ # IBM's JDK on AIX uses strange locations for the executables\n+ JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n+ else\n+ JAVACMD=\"$JAVA_HOME/bin/java\"\n+ fi\n+ else\n+ JAVACMD=\"`which java`\"\n+ fi\n+fi\n+\n+if [ ! -x \"$JAVACMD\" ] ; then\n+ echo \"Error: JAVA_HOME is not defined correctly.\" >&2\n+ echo \" We cannot execute $JAVACMD\" >&2\n+ exit 1\n+fi\n+\n+if [ -z \"$JAVA_HOME\" ] ; then\n+ echo \"Warning: JAVA_HOME environment variable is not set.\"\n+fi\n+\n+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher\n+\n+# traverses directory structure from process work directory to filesystem root\n+# first directory with .mvn subdirectory is considered project base directory\n+find_maven_basedir() {\n+\n+ if [ -z \"$1\" ]\n+ then\n+ echo \"Path not specified to find_maven_basedir\"\n+ return 1\n+ fi\n+\n+ basedir=\"$1\"\n+ wdir=\"$1\"\n+ while [ \"$wdir\" != '/' ] ; do\n+ if [ -d \"$wdir\"/.mvn ] ; then\n+ basedir=$wdir\n+ break\n+ fi\n+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)\n+ if [ -d \"${wdir}\" ]; then\n+ wdir=`cd \"$wdir/..\"; pwd`\n+ fi\n+ # end of workaround\n+ done\n+ echo \"${basedir}\"\n+}\n+\n+# concatenates all lines of a file\n+concat_lines() {\n+ if [ -f \"$1\" ]; then\n+ echo \"$(tr -s '\\n' ' ' < \"$1\")\"\n+ fi\n+}\n+\n+BASE_DIR=`find_maven_basedir \"$(pwd)\"`\n+if [ -z \"$BASE_DIR\" ]; then\n+ exit 1;\n+fi\n+\n+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-\"$BASE_DIR\"}\n+echo $MAVEN_PROJECTBASEDIR\n+MAVEN_OPTS=\"$(concat_lines \"$MAVEN_PROJECTBASEDIR/.mvn/jvm.config\") $MAVEN_OPTS\"\n+\n+# For Cygwin, switch paths to Windows format before running java\n+if $cygwin; then\n+ [ -n \"$M2_HOME\" ] &&\n+ M2_HOME=`cygpath --path --windows \"$M2_HOME\"`\n+ [ -n \"$JAVA_HOME\" ] &&\n+ JAVA_HOME=`cygpath --path --windows \"$JAVA_HOME\"`\n+ [ -n \"$CLASSPATH\" ] &&\n+ CLASSPATH=`cygpath --path --windows \"$CLASSPATH\"`\n+ [ -n \"$MAVEN_PROJECTBASEDIR\" ] &&\n+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows \"$MAVEN_PROJECTBASEDIR\"`\n+fi\n+\n+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain\n+\n+exec \"$JAVACMD\" \\\n+ $MAVEN_OPTS \\\n+ -classpath \"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar\" \\\n+ \"-Dmaven.home=${M2_HOME}\" \"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}\" \\\n+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG \"$@\"\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/test-apps/spring-boot-21-adapter/mvnw.cmd",
"diff": "+@REM ----------------------------------------------------------------------------\n+@REM Licensed to the Apache Software Foundation (ASF) under one\n+@REM or more contributor license agreements. See the NOTICE file\n+@REM distributed with this work for additional information\n+@REM regarding copyright ownership. The ASF licenses this file\n+@REM to you under the Apache License, Version 2.0 (the\n+@REM \"License\"); you may not use this file except in compliance\n+@REM with the License. You may obtain a copy of the License at\n+@REM\n+@REM http://www.apache.org/licenses/LICENSE-2.0\n+@REM\n+@REM Unless required by applicable law or agreed to in writing,\n+@REM software distributed under the License is distributed on an\n+@REM \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+@REM KIND, either express or implied. See the License for the\n+@REM specific language governing permissions and limitations\n+@REM under the License.\n+@REM ----------------------------------------------------------------------------\n+\n+@REM ----------------------------------------------------------------------------\n+@REM Maven2 Start Up Batch script\n+@REM\n+@REM Required ENV vars:\n+@REM JAVA_HOME - location of a JDK home dir\n+@REM\n+@REM Optional ENV vars\n+@REM M2_HOME - location of maven2's installed home dir\n+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands\n+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending\n+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven\n+@REM e.g. to debug Maven itself, use\n+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000\n+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files\n+@REM ----------------------------------------------------------------------------\n+\n+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'\n+@echo off\n+@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'\n+@if \"%MAVEN_BATCH_ECHO%\" == \"on\" echo %MAVEN_BATCH_ECHO%\n+\n+@REM set %HOME% to equivalent of $HOME\n+if \"%HOME%\" == \"\" (set \"HOME=%HOMEDRIVE%%HOMEPATH%\")\n+\n+@REM Execute a user defined script before this one\n+if not \"%MAVEN_SKIP_RC%\" == \"\" goto skipRcPre\n+@REM check for pre script, once with legacy .bat ending and once with .cmd ending\n+if exist \"%HOME%\\mavenrc_pre.bat\" call \"%HOME%\\mavenrc_pre.bat\"\n+if exist \"%HOME%\\mavenrc_pre.cmd\" call \"%HOME%\\mavenrc_pre.cmd\"\n+:skipRcPre\n+\n+@setlocal\n+\n+set ERROR_CODE=0\n+\n+@REM To isolate internal variables from possible post scripts, we use another setlocal\n+@setlocal\n+\n+@REM ==== START VALIDATION ====\n+if not \"%JAVA_HOME%\" == \"\" goto OkJHome\n+\n+echo.\n+echo Error: JAVA_HOME not found in your environment. >&2\n+echo Please set the JAVA_HOME variable in your environment to match the >&2\n+echo location of your Java installation. >&2\n+echo.\n+goto error\n+\n+:OkJHome\n+if exist \"%JAVA_HOME%\\bin\\java.exe\" goto init\n+\n+echo.\n+echo Error: JAVA_HOME is set to an invalid directory. >&2\n+echo JAVA_HOME = \"%JAVA_HOME%\" >&2\n+echo Please set the JAVA_HOME variable in your environment to match the >&2\n+echo location of your Java installation. >&2\n+echo.\n+goto error\n+\n+@REM ==== END VALIDATION ====\n+\n+:init\n+\n+@REM Find the project base dir, i.e. the directory that contains the folder \".mvn\".\n+@REM Fallback to current working directory if not found.\n+\n+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%\n+IF NOT \"%MAVEN_PROJECTBASEDIR%\"==\"\" goto endDetectBaseDir\n+\n+set EXEC_DIR=%CD%\n+set WDIR=%EXEC_DIR%\n+:findBaseDir\n+IF EXIST \"%WDIR%\"\\.mvn goto baseDirFound\n+cd ..\n+IF \"%WDIR%\"==\"%CD%\" goto baseDirNotFound\n+set WDIR=%CD%\n+goto findBaseDir\n+\n+:baseDirFound\n+set MAVEN_PROJECTBASEDIR=%WDIR%\n+cd \"%EXEC_DIR%\"\n+goto endDetectBaseDir\n+\n+:baseDirNotFound\n+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%\n+cd \"%EXEC_DIR%\"\n+\n+:endDetectBaseDir\n+\n+IF NOT EXIST \"%MAVEN_PROJECTBASEDIR%\\.mvn\\jvm.config\" goto endReadAdditionalConfig\n+\n+@setlocal EnableExtensions EnableDelayedExpansion\n+for /F \"usebackq delims=\" %%a in (\"%MAVEN_PROJECTBASEDIR%\\.mvn\\jvm.config\") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a\n+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%\n+\n+:endReadAdditionalConfig\n+\n+SET MAVEN_JAVA_EXE=\"%JAVA_HOME%\\bin\\java.exe\"\n+\n+set WRAPPER_JAR=\"%MAVEN_PROJECTBASEDIR%\\.mvn\\wrapper\\maven-wrapper.jar\"\n+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain\n+\n+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% \"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%\" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*\n+if ERRORLEVEL 1 goto error\n+goto end\n+\n+:error\n+set ERROR_CODE=1\n+\n+:end\n+@endlocal & set ERROR_CODE=%ERROR_CODE%\n+\n+if not \"%MAVEN_SKIP_RC%\" == \"\" goto skipRcPost\n+@REM check for post script, once with legacy .bat ending and once with .cmd ending\n+if exist \"%HOME%\\mavenrc_post.bat\" call \"%HOME%\\mavenrc_post.bat\"\n+if exist \"%HOME%\\mavenrc_post.cmd\" call \"%HOME%\\mavenrc_post.cmd\"\n+:skipRcPost\n+\n+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'\n+if \"%MAVEN_BATCH_PAUSE%\" == \"on\" pause\n+\n+if \"%MAVEN_TERMINATE_CMD%\" == \"on\" exit %ERROR_CODE%\n+\n+exit /B %ERROR_CODE%\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/test-apps/spring-boot-21-adapter/pom.xml",
"diff": "+<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n+<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n+ xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n+ <modelVersion>4.0.0</modelVersion>\n+\n+ <groupId>org.keycloak</groupId>\n+ <artifactId>spring-boot-21-adapter</artifactId>\n+ <version>0.0.1-SNAPSHOT</version>\n+ <packaging>jar</packaging>\n+\n+ <name>spring-boot-adapter</name>\n+ <description>Spring boot adapter test application</description>\n+\n+ <parent>\n+ <groupId>org.springframework.boot</groupId>\n+ <artifactId>spring-boot-starter-parent</artifactId>\n+ <version>2.1.0.RELEASE</version>\n+ <relativePath/> <!-- lookup parent from repository -->\n+ </parent>\n+\n+ <properties>\n+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>\n+ <java.version>1.8</java.version>\n+\n+ <keycloak.version>4.0.0.Beta2-SNAPSHOT</keycloak.version>\n+\n+ <repo.url />\n+\n+\n+ <jetty.adapter.version />\n+ </properties>\n+\n+ <dependencies>\n+\n+ <dependency>\n+ <groupId>org.springframework.boot</groupId>\n+ <artifactId>spring-boot-starter-thymeleaf</artifactId>\n+ </dependency>\n+\n+ <dependency>\n+ <groupId>org.springframework.boot</groupId>\n+ <artifactId>spring-boot-starter-test</artifactId>\n+ <scope>test</scope>\n+ </dependency>\n+\n+ <dependency>\n+ <groupId>org.springframework.boot</groupId>\n+ <artifactId>spring-boot-starter-web</artifactId>\n+ </dependency>\n+\n+ <dependency>\n+ <groupId>org.keycloak</groupId>\n+ <artifactId>keycloak-spring-boot-2-adapter</artifactId>\n+ <version>${keycloak.version}</version>\n+ </dependency>\n+\n+ </dependencies>\n+\n+ <profiles>\n+ <profile>\n+ <id>spring-boot-adapter-tomcat</id>\n+ <dependencies>\n+ <dependency>\n+ <groupId>org.springframework.boot</groupId>\n+ <artifactId>spring-boot-starter-web</artifactId>\n+ </dependency>\n+ <dependency>\n+ <groupId>org.keycloak</groupId>\n+ <artifactId>keycloak-tomcat8-adapter</artifactId>\n+ <version>${keycloak.version}</version>\n+ </dependency>\n+ </dependencies>\n+ </profile>\n+\n+ <profile>\n+ <id>spring-boot-adapter-jetty</id>\n+ <dependencies>\n+ <dependency>\n+ <groupId>org.springframework.boot</groupId>\n+ <artifactId>spring-boot-starter-web</artifactId>\n+ <exclusions>\n+ <exclusion>\n+ <groupId>org.springframework.boot</groupId>\n+ <artifactId>spring-boot-starter-tomcat</artifactId>\n+ </exclusion>\n+ </exclusions>\n+ </dependency>\n+ </dependencies>\n+ </profile>\n+\n+ <profile>\n+ <id>spring-boot-adapter-undertow</id>\n+ <dependencies>\n+ <dependency>\n+ <groupId>org.springframework.boot</groupId>\n+ <artifactId>spring-boot-starter-web</artifactId>\n+ <exclusions>\n+ <exclusion>\n+ <groupId>org.springframework.boot</groupId>\n+ <artifactId>spring-boot-starter-tomcat</artifactId>\n+ </exclusion>\n+ </exclusions>\n+ </dependency>\n+ <dependency>\n+ <groupId>org.springframework.boot</groupId>\n+ <artifactId>spring-boot-starter-undertow</artifactId>\n+ </dependency>\n+\n+ <dependency>\n+ <groupId>org.keycloak</groupId>\n+ <artifactId>keycloak-undertow-adapter</artifactId>\n+ <version>${keycloak.version}</version>\n+ </dependency>\n+ </dependencies>\n+ </profile>\n+\n+ <profile>\n+ <id>repo-url</id>\n+ <activation>\n+ <property>\n+ <name>repo.url</name>\n+ </property>\n+ </activation>\n+ <repositories>\n+ <repository>\n+ <id>custom-repo</id>\n+ <name>custom repo</name>\n+ <url>${repo.url}</url>\n+ </repository>\n+ </repositories>\n+ </profile>\n+\n+ <profile>\n+ <id>jetty-version-94</id>\n+ <activation>\n+ <property>\n+ <name>jetty.adapter.version</name>\n+ <value>94</value>\n+ </property>\n+ </activation>\n+ <properties>\n+ <jetty.version>9.4.14.v20181114</jetty.version>\n+ </properties>\n+ <dependencies>\n+ <dependency>\n+ <groupId>org.keycloak</groupId>\n+ <artifactId>keycloak-jetty94-adapter</artifactId>\n+ <version>${keycloak.version}</version>\n+ </dependency>\n+ <dependency>\n+ <groupId>org.springframework.boot</groupId>\n+ <artifactId>spring-boot-starter-jetty</artifactId>\n+ </dependency>\n+ </dependencies>\n+ </profile>\n+ </profiles>\n+\n+\n+ <build>\n+ <plugins>\n+ <plugin>\n+ <groupId>org.springframework.boot</groupId>\n+ <artifactId>spring-boot-maven-plugin</artifactId>\n+ </plugin>\n+ <plugin>\n+ <groupId>org.apache.maven.plugins</groupId>\n+ <artifactId>maven-antrun-plugin</artifactId>\n+ <version>1.8</version>\n+ <executions>\n+ <execution>\n+ <id>copy-source-file</id>\n+ <phase>process-sources</phase>\n+ <configuration>\n+ <tasks>\n+ <copy file=\"../spring-boot-adapter/src/main/java/org/keycloak/AdminController.java\"\n+ tofile=\"src/main/java/org/keycloak/AdminController.java\"/>\n+ <copy file=\"../spring-boot-adapter/src/main/java/org/keycloak/SpringBootAdapterApplication.java\"\n+ tofile=\"src/main/java/org/keycloak/SpringBootAdapterApplication.java\"/>\n+ </tasks>\n+ </configuration>\n+ <goals>\n+ <goal>run</goal>\n+ </goals>\n+ </execution>\n+ <execution>\n+ <id>remove-source-file</id>\n+ <phase>process-classes</phase>\n+ <configuration>\n+ <tasks>\n+ <delete file=\"src/main/java/org/keycloak/AdminController.java\"/>\n+ <delete file=\"src/main/java/org/keycloak/SpringBootAdapterApplication.java\"/>\n+ </tasks>\n+ </configuration>\n+ <goals>\n+ <goal>run</goal>\n+ </goals>\n+ </execution>\n+ </executions>\n+ </plugin>\n+ </plugins>\n+ </build>\n+\n+</project>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/test-apps/spring-boot-21-adapter/src/main/resources/application.properties",
"diff": "+server.port=8280\n+\n+keycloak.realm=test\n+keycloak.auth-server-url=http://localhost:8180/auth\n+keycloak.ssl-required=external\n+keycloak.resource=spring-boot-app\n+keycloak.credentials.secret=e3789ac5-bde6-4957-a7b0-612823dac101\n+keycloak.realm-key=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB\n+\n+keycloak.security-constraints[0].authRoles[0]=admin\n+keycloak.security-constraints[0].securityCollections[0].name=Admin zone\n+keycloak.security-constraints[0].securityCollections[0].patterns[0]=/admin/*\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/test-apps/spring-boot-21-adapter/src/main/resources/static/admin/index.html",
"diff": "+<!DOCTYPE html>\n+<html lang=\"en\">\n+<head>\n+ <meta charset=\"UTF-8\">\n+ <title>springboot admin page</title>\n+</head>\n+<body>\n+\n+ <div class=\"test\">You are now admin</div>\n+\n+</body>\n+</html>\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/test-apps/spring-boot-21-adapter/src/main/resources/static/index.html",
"diff": "+<!DOCTYPE html>\n+<html lang=\"en\">\n+<head>\n+ <meta charset=\"UTF-8\">\n+ <title>springboot test page</title>\n+</head>\n+<body>\n+\n+ <div class=\"test\">Click <a href=\"admin/index.html\" class=\"adminlink\">here</a> to go admin</div>\n+\n+</body>\n+</html>\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/test-apps/spring-boot-21-adapter/src/main/resources/templates/linking.html",
"diff": "+<!DOCTYPE html>\n+<html lang=\"en\" xmlns:th=\"http://www.thymeleaf.org/\">\n+<head>\n+ <title>Linking page result</title>\n+</head>\n+<body>\n+ <span id=\"error\" th:text=\"${error}\"/>\n+</body>\n+</html>\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/test-apps/spring-boot-21-adapter/src/main/resources/templates/session.html",
"diff": "+<!DOCTYPE HTML>\n+<html xmlns:th=\"http://www.thymeleaf.org/\">\n+<head>\n+ <title>session counter page</title>\n+</head>\n+ <body>\n+ <span id=\"counter\" th:text=\"${counter}\"></span>\n+ </body>\n+</html>\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/test-apps/spring-boot-21-adapter/src/main/resources/templates/tokens.html",
"diff": "+<!DOCTYPE HTML>\n+<html xmlns:th=\"http://www.thymeleaf.org/\">\n+ <head>\n+ <title>Tokens from spring boot</title>\n+ </head>\n+ <body>\n+ <span id=\"accessToken\" th:text=\"${accessToken}\"></span>\n+ <span id=\"refreshToken\" th:text=\"${refreshToken}\"></span>\n+ <span id=\"accessTokenString\" th:text=\"${accessTokenString}\"></span>\n+ </body>\n+</html>\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/test-apps/spring-boot-21-adapter/src/test/java/org/keycloak/SpringBootAdapterApplicationTests.java",
"diff": "+package org.keycloak;\n+\n+import org.junit.Test;\n+import org.junit.runner.RunWith;\n+import org.springframework.boot.test.context.SpringBootTest;\n+import org.springframework.test.context.junit4.SpringRunner;\n+\n+@RunWith(SpringRunner.class)\n+@SpringBootTest\n+public class SpringBootAdapterApplicationTests {\n+\n+ @Test\n+ public void contextLoads() {\n+ }\n+\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/test-apps/spring-boot-adapter/src/main/java/org/keycloak/AdminController.java",
"new_path": "testsuite/integration-arquillian/test-apps/spring-boot-adapter/src/main/java/org/keycloak/AdminController.java",
"diff": "@@ -107,7 +107,7 @@ public class AdminController {\nKeycloakSecurityContext.class.getName(),\nRequestAttributes.SCOPE_REQUEST);\nAccessToken token = keycloakSession.getToken();\n- String clientId = token.getAudience()[0];\n+ String clientId = token.getIssuedFor();\nString nonce = UUID.randomUUID().toString();\nMessageDigest md;\ntry {\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/other/springboot-tests/pom.xml",
"new_path": "testsuite/integration-arquillian/tests/other/springboot-tests/pom.xml",
"diff": "<name>springboot</name>\n<workingDir>../../../../test-apps/spring-boot-adapter</workingDir>\n<healthcheckUrl>http://localhost:8280/index.html</healthcheckUrl>\n- <waitAfterLaunch>360</waitAfterLaunch>\n+ <waitAfterLaunch>900</waitAfterLaunch>\n<arguments>\n<argument>mvn</argument>\n<argument>spring-boot:run</argument>\n<name>springboot</name>\n<workingDir>../../../../test-apps/spring-boot-adapter</workingDir>\n<healthcheckUrl>http://localhost:8280/index.html</healthcheckUrl>\n- <waitAfterLaunch>360</waitAfterLaunch>\n+ <waitAfterLaunch>900</waitAfterLaunch>\n+ <arguments>\n+ <argument>mvn</argument>\n+ <argument>spring-boot:run</argument>\n+ <argument>-B</argument>\n+ <argument>-s</argument>\n+ <argument>${maven.settings.file}</argument>\n+ <argument>-Dkeycloak.version=${project.version}</argument>\n+ <argument>-Pspring-boot-adapter-${adapter.container}</argument>\n+ <argument>-Dmaven.repo.local=${settings.localRepository}</argument>\n+ <argument>-Djetty.adapter.version=${jetty.adapter.version}</argument>\n+ </arguments>\n+ </configuration>\n+ </execution>\n+\n+ <execution>\n+ <id>kill-processes</id>\n+ <phase>post-integration-test</phase>\n+ <goals>\n+ <goal>stop-all</goal>\n+ </goals>\n+ </execution>\n+ </executions>\n+ </plugin>\n+ </plugins>\n+ </build>\n+ </profile>\n+ <profile>\n+ <id>test-springboot-2-prod</id>\n+ <properties>\n+ <exclude.springboot>-</exclude.springboot>\n+ </properties>\n+\n+ <build>\n+ <plugins>\n+ <plugin>\n+ <groupId>com.bazaarvoice.maven.plugins</groupId>\n+ <artifactId>process-exec-maven-plugin</artifactId>\n+ <version>0.7</version>\n+ <executions>\n+ <execution>\n+ <id>spring-boot-application-process</id>\n+ <phase>generate-test-resources</phase>\n+ <goals>\n+ <goal>start</goal>\n+ </goals>\n+ <configuration>\n+ <name>springboot</name>\n+ <workingDir>../../../../test-apps/spring-boot-2-adapter</workingDir>\n+ <healthcheckUrl>http://localhost:8280/index.html</healthcheckUrl>\n+ <waitAfterLaunch>900</waitAfterLaunch>\n+ <arguments>\n+ <argument>mvn</argument>\n+ <argument>spring-boot:run</argument>\n+ <argument>-B</argument>\n+ <argument>-s</argument>\n+ <argument>${maven.settings.file}</argument>\n+ <argument>-Dkeycloak.version=${project.version}</argument>\n+ <argument>-Pspring-boot-adapter-${adapter.container}</argument>\n+ <argument>-Dmaven.repo.local=${settings.localRepository}</argument>\n+ <argument>-Djetty.adapter.version=${jetty.adapter.version}</argument>\n+ </arguments>\n+ </configuration>\n+ </execution>\n+\n+ <execution>\n+ <id>kill-processes</id>\n+ <phase>post-integration-test</phase>\n+ <goals>\n+ <goal>stop-all</goal>\n+ </goals>\n+ </execution>\n+ </executions>\n+ </plugin>\n+ </plugins>\n+ </build>\n+ </profile>\n+ <profile>\n+ <id>test-springboot-21-prod</id>\n+ <properties>\n+ <exclude.springboot>-</exclude.springboot>\n+ </properties>\n+\n+ <build>\n+ <plugins>\n+ <plugin>\n+ <groupId>com.bazaarvoice.maven.plugins</groupId>\n+ <artifactId>process-exec-maven-plugin</artifactId>\n+ <version>0.7</version>\n+ <executions>\n+ <execution>\n+ <id>spring-boot-application-process</id>\n+ <phase>generate-test-resources</phase>\n+ <goals>\n+ <goal>start</goal>\n+ </goals>\n+ <configuration>\n+ <name>springboot</name>\n+ <workingDir>../../../../test-apps/spring-boot-21-adapter</workingDir>\n+ <healthcheckUrl>http://localhost:8280/index.html</healthcheckUrl>\n+ <waitAfterLaunch>900</waitAfterLaunch>\n<arguments>\n<argument>mvn</argument>\n<argument>spring-boot:run</argument>\n<name>springboot</name>\n<workingDir>../../../../test-apps/spring-boot-2-adapter</workingDir>\n<healthcheckUrl>http://localhost:8280/index.html</healthcheckUrl>\n- <waitAfterLaunch>360</waitAfterLaunch>\n+ <waitAfterLaunch>900</waitAfterLaunch>\n<arguments>\n<argument>mvn</argument>\n<argument>spring-boot:run</argument>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | [KEYCLOAK-8965] spring boot 2.1.0 testing |
339,487 | 04.12.2018 13:54:07 | 7,200 | 3462be857bc8fc3656dfb67f84387a872ad6bb61 | Add missing not-null constraint to the new remember-me columns in the realm table | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "model/jpa/src/main/resources/META-INF/jpa-changelog-4.8.0.xml",
"diff": "+<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n+<!--\n+ ~ * Copyright 2018 Red Hat, Inc. and/or its affiliates\n+ ~ * and other contributors as indicated by the @author tags.\n+ ~ *\n+ ~ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ ~ * you may not use this file except in compliance with the License.\n+ ~ * You may obtain a copy of the License at\n+ ~ *\n+ ~ * http://www.apache.org/licenses/LICENSE-2.0\n+ ~ *\n+ ~ * Unless required by applicable law or agreed to in writing, software\n+ ~ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ ~ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ ~ * See the License for the specific language governing permissions and\n+ ~ * limitations under the License.\n+ -->\n+<databaseChangeLog xmlns=\"http://www.liquibase.org/xml/ns/dbchangelog\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd\">\n+\n+ <changeSet author=\"[email protected]\" id=\"4.8.0-KEYCLOAK-8835\">\n+ <addNotNullConstraint tableName=\"REALM\" columnName=\"SSO_MAX_LIFESPAN_REMEMBER_ME\" columnDataType=\"INT\" defaultNullValue=\"0\"/>\n+ <addNotNullConstraint tableName=\"REALM\" columnName=\"SSO_IDLE_TIMEOUT_REMEMBER_ME\" columnDataType=\"INT\" defaultNullValue=\"0\"/>\n+ </changeSet>\n+\n+</databaseChangeLog>\n"
},
{
"change_type": "MODIFY",
"old_path": "model/jpa/src/main/resources/META-INF/jpa-changelog-master.xml",
"new_path": "model/jpa/src/main/resources/META-INF/jpa-changelog-master.xml",
"diff": "<include file=\"META-INF/jpa-changelog-4.3.0.xml\"/>\n<include file=\"META-INF/jpa-changelog-4.6.0.xml\"/>\n<include file=\"META-INF/jpa-changelog-4.7.0.xml\"/>\n+ <include file=\"META-INF/jpa-changelog-4.8.0.xml\"/>\n</databaseChangeLog>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | [KEYCLOAK-8835] Add missing not-null constraint to the new remember-me columns in the realm table |
339,465 | 06.12.2018 17:17:40 | -3,600 | 88141320acc82a842aa6c17fde9c249aab854b08 | StackOverflowError when reading LDAP-backed users via REST API | [
{
"change_type": "MODIFY",
"old_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPStorageProvider.java",
"new_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPStorageProvider.java",
"diff": "@@ -39,6 +39,7 @@ import org.keycloak.credential.CredentialModel;\nimport org.keycloak.federation.kerberos.impl.KerberosUsernamePasswordAuthenticator;\nimport org.keycloak.federation.kerberos.impl.SPNEGOAuthenticator;\nimport org.keycloak.models.*;\n+import org.keycloak.models.cache.CachedUserModel;\nimport org.keycloak.models.utils.DefaultRoles;\nimport org.keycloak.models.utils.ReadOnlyUserModelDelegate;\nimport org.keycloak.policy.PasswordPolicyManagerProvider;\n@@ -160,6 +161,16 @@ public class LDAPStorageProvider implements UserStorageProvider,\nreturn existing;\n}\n+ // We need to avoid having CachedUserModel as cache is upper-layer then LDAP. Hence having CachedUserModel here may cause StackOverflowError\n+ if (local instanceof CachedUserModel) {\n+ local = session.userStorageManager().getUserById(local.getId(), realm);\n+\n+ existing = userManager.getManagedProxiedUser(local.getId());\n+ if (existing != null) {\n+ return existing;\n+ }\n+ }\n+\nUserModel proxied = local;\ncheckDNChanged(realm, local, ldapObject);\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/ldap/LDAPProvidersIntegrationTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/ldap/LDAPProvidersIntegrationTest.java",
"diff": "@@ -985,6 +985,34 @@ public class LDAPProvidersIntegrationTest extends AbstractLDAPTest {\n});\n}\n+\n+ // KEYCLOAK-9002\n+ @Test\n+ public void testSearchWithPartiallyCachedUser() {\n+ testingClient.server().run(session -> {\n+ session.userCache().clear();\n+ });\n+\n+\n+ // This will load user from LDAP and partially cache him (including attributes)\n+ testingClient.server().run(session -> {\n+ LDAPTestContext ctx = LDAPTestContext.init(session);\n+ RealmModel appRealm = ctx.getRealm();\n+ UserModel user = session.users().getUserByUsername(\"johnkeycloak\", appRealm);\n+ Assert.assertNotNull(user);\n+\n+ user.getAttributes();\n+ });\n+\n+\n+ // Assert search without arguments won't blow up with StackOverflowError\n+ adminClient.realm(\"test\").users().search(null, 0, 10, false);\n+\n+ List<UserRepresentation> users = adminClient.realm(\"test\").users().search(\"johnkeycloak\", 0, 10, false);\n+ Assert.assertTrue(users.stream().anyMatch(userRepresentation -> \"johnkeycloak\".equals(userRepresentation.getUsername())));\n+ }\n+\n+\n@Test\npublic void testLDAPUserRefreshCache() {\ntestingClient.server().run(session -> {\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9002 StackOverflowError when reading LDAP-backed users via REST API |
339,185 | 05.12.2018 22:01:48 | -3,600 | dad12635f67e77b94127d1a7343a68b11972f54b | Fix displayed applications | [
{
"change_type": "MODIFY",
"old_path": "server-spi/src/main/java/org/keycloak/models/OrderedModel.java",
"new_path": "server-spi/src/main/java/org/keycloak/models/OrderedModel.java",
"diff": "@@ -29,6 +29,13 @@ public interface OrderedModel {\nclass OrderedModelComparator<OM extends OrderedModel> implements Comparator<OM> {\n+ public static final OrderedModelComparator INSTANCE = new OrderedModelComparator();\n+\n+ @SuppressWarnings(\"unchecked\")\n+ public static <T extends OrderedModel> OrderedModelComparator<T> getInstance() {\n+ return INSTANCE;\n+ }\n+\n@Override\npublic int compare(OM o1, OM o2) {\nint o1order = parseOrder(o1);\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/forms/account/freemarker/model/ApplicationsBean.java",
"new_path": "services/src/main/java/org/keycloak/forms/account/freemarker/model/ApplicationsBean.java",
"diff": "package org.keycloak.forms.account.freemarker.model;\nimport org.keycloak.common.util.MultivaluedHashMap;\n-import org.keycloak.forms.login.freemarker.model.OAuthGrantBean;\nimport org.keycloak.models.ClientModel;\nimport org.keycloak.models.ClientScopeModel;\nimport org.keycloak.models.Constants;\nimport org.keycloak.models.KeycloakSession;\nimport org.keycloak.models.OrderedModel;\n-import org.keycloak.models.ProtocolMapperModel;\nimport org.keycloak.models.RealmModel;\nimport org.keycloak.models.RoleModel;\nimport org.keycloak.models.UserConsentModel;\n@@ -39,7 +37,6 @@ import java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Set;\n-import java.util.TreeSet;\nimport java.util.stream.Collectors;\n/**\n@@ -47,36 +44,44 @@ import java.util.stream.Collectors;\n*/\npublic class ApplicationsBean {\n- private List<ApplicationEntry> applications = new LinkedList<ApplicationEntry>();\n+ private List<ApplicationEntry> applications = new LinkedList<>();\npublic ApplicationsBean(KeycloakSession session, RealmModel realm, UserModel user) {\nSet<ClientModel> offlineClients = new UserSessionManager(session).findClientsWithOfflineToken(realm, user);\nfor (ClientModel client : getApplications(session, realm, user)) {\n- Set<RoleModel> availableRoles = new HashSet<>();\n+ if (isAdminClient(client) && ! AdminPermissions.realms(session, realm, user).isAdmin()) {\n+ continue;\n+ }\n// Construct scope parameter with all optional scopes to see all potentially available roles\nSet<ClientScopeModel> allClientScopes = new HashSet<>(client.getClientScopes(true, true).values());\nallClientScopes.addAll(client.getClientScopes(false, true).values());\nallClientScopes.add(client);\n- availableRoles = TokenManager.getAccess(user, client, allClientScopes);\n+ Set<RoleModel> availableRoles = TokenManager.getAccess(user, client, allClientScopes);\n+\n+ // Don't show applications, which user doesn't have access into (any available roles)\n+ // unless this is can be changed by approving/revoking consent\n+ if (! isAdminClient(client) && availableRoles.isEmpty() && ! client.isConsentRequired()) {\n+ continue;\n+ }\nList<RoleModel> realmRolesAvailable = new LinkedList<>();\nMultivaluedHashMap<String, ClientRoleEntry> resourceRolesAvailable = new MultivaluedHashMap<>();\nprocessRoles(availableRoles, realmRolesAvailable, resourceRolesAvailable);\n- List<ClientScopeModel> orderedScopes = new ArrayList<>();\n+ List<ClientScopeModel> orderedScopes = new LinkedList<>();\nif (client.isConsentRequired()) {\nUserConsentModel consent = session.users().getConsentByClient(realm, user.getId(), client.getId());\nif (consent != null) {\norderedScopes.addAll(consent.getGrantedClientScopes());\n- orderedScopes.sort(new OrderedModel.OrderedModelComparator<>());\n}\n}\nList<String> clientScopesGranted = orderedScopes.stream()\n+ .sorted(OrderedModel.OrderedModelComparator.getInstance())\n.map(ClientScopeModel::getConsentScreenText)\n.collect(Collectors.toList());\n@@ -89,6 +94,11 @@ public class ApplicationsBean {\n}\n}\n+ public static boolean isAdminClient(ClientModel client) {\n+ return client.getClientId().equals(Constants.ADMIN_CLI_CLIENT_ID)\n+ || client.getClientId().equals(Constants.ADMIN_CONSOLE_CLIENT_ID);\n+ }\n+\nprivate Set<ClientModel> getApplications(KeycloakSession session, RealmModel realm, UserModel user) {\nSet<ClientModel> clients = new HashSet<>();\n@@ -98,11 +108,6 @@ public class ApplicationsBean {\ncontinue;\n}\n- if (client.getClientId().equals(Constants.ADMIN_CLI_CLIENT_ID)\n- || client.getClientId().equals(Constants.ADMIN_CONSOLE_CLIENT_ID)) {\n- if (!AdminPermissions.realms(session, realm, user).isAdmin()) continue;\n- }\n-\nclients.add(client);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/updaters/ClientAttributeUpdater.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/updaters/ClientAttributeUpdater.java",
"diff": "@@ -3,10 +3,14 @@ package org.keycloak.testsuite.updaters;\nimport org.keycloak.admin.client.Keycloak;\nimport org.keycloak.admin.client.resource.ClientResource;\nimport org.keycloak.admin.client.resource.ClientsResource;\n+import org.keycloak.admin.client.resource.RealmResource;\nimport org.keycloak.representations.idm.ClientRepresentation;\n-import java.io.Closeable;\n+import org.keycloak.representations.idm.ClientScopeRepresentation;\nimport java.util.HashMap;\nimport java.util.List;\n+import java.util.Map;\n+import java.util.function.Function;\n+import java.util.stream.Collectors;\nimport static org.hamcrest.Matchers.hasSize;\nimport static org.junit.Assert.assertThat;\n@@ -14,29 +18,40 @@ import static org.junit.Assert.assertThat;\n*\n* @author hmlnarik\n*/\n-public class ClientAttributeUpdater {\n+public class ClientAttributeUpdater extends ServerResourceUpdater<ClientAttributeUpdater, ClientResource, ClientRepresentation> {\n- private final ClientResource clientResource;\n-\n- private final ClientRepresentation rep;\n- private final ClientRepresentation origRep;\n+ private final RealmResource realmResource;\npublic static ClientAttributeUpdater forClient(Keycloak adminClient, String realm, String clientId) {\n- ClientsResource clients = adminClient.realm(realm).clients();\n+ RealmResource realmRes = adminClient.realm(realm);\n+ ClientsResource clients = realmRes.clients();\nList<ClientRepresentation> foundClients = clients.findByClientId(clientId);\nassertThat(foundClients, hasSize(1));\nClientResource clientRes = clients.get(foundClients.get(0).getId());\n- return new ClientAttributeUpdater(clientRes);\n+ return new ClientAttributeUpdater(clientRes, realmRes);\n}\n- public ClientAttributeUpdater(ClientResource clientResource) {\n- this.clientResource = clientResource;\n- this.origRep = clientResource.toRepresentation();\n- this.rep = clientResource.toRepresentation();\n+ private ClientAttributeUpdater(ClientResource resource, RealmResource realmResource) {\n+ super(resource, resource::toRepresentation, resource::update);\nif (this.rep.getAttributes() == null) {\nthis.rep.setAttributes(new HashMap<>());\n}\n+ this.realmResource = realmResource;\n+ }\n+\n+ @Override\n+ protected void performUpdate(ClientRepresentation from, ClientRepresentation to) {\n+ super.performUpdate(from, to);\n+ updateViaAddRemove(from.getDefaultClientScopes(), to.getDefaultClientScopes(), this::getConversionForScopeNameToId, resource::addDefaultClientScope, resource::removeDefaultClientScope);\n+ updateViaAddRemove(from.getOptionalClientScopes(), to.getOptionalClientScopes(), this::getConversionForScopeNameToId, resource::addOptionalClientScope, resource::removeOptionalClientScope);\n+ }\n+\n+ private Function<String, String> getConversionForScopeNameToId() {\n+ Map<String, String> scopeNameToIdMap = realmResource.clientScopes().findAll().stream()\n+ .collect(Collectors.toMap(ClientScopeRepresentation::getName, ClientScopeRepresentation::getId));\n+\n+ return scopeNameToIdMap::get;\n}\npublic ClientAttributeUpdater setClientId(String clientId) {\n@@ -64,9 +79,27 @@ public class ClientAttributeUpdater {\nreturn this;\n}\n- public Closeable update() {\n- clientResource.update(rep);\n+ public ClientAttributeUpdater setFullScopeAllowed(Boolean fullScopeAllowed) {\n+ rep.setFullScopeAllowed(fullScopeAllowed);\n+ return this;\n+ }\n- return () -> clientResource.update(origRep);\n+ public ClientAttributeUpdater setDefaultClientScopes(List<String> defaultClientScopes) {\n+ rep.setDefaultClientScopes(defaultClientScopes);\n+ return this;\n}\n+\n+ public ClientAttributeUpdater setOptionalClientScopes(List<String> optionalClientScopes) {\n+ rep.setOptionalClientScopes(optionalClientScopes);\n+ return this;\n+ }\n+\n+ public RoleScopeUpdater realmRoleScope() {\n+ return new RoleScopeUpdater(resource.getScopeMappings().realmLevel());\n+ }\n+\n+ public RoleScopeUpdater clientRoleScope(String clientUUID) {\n+ return new RoleScopeUpdater(resource.getScopeMappings().clientLevel(clientUUID));\n+ }\n+\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/updaters/RealmAttributeUpdater.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/updaters/RealmAttributeUpdater.java",
"diff": "@@ -2,35 +2,22 @@ package org.keycloak.testsuite.updaters;\nimport org.keycloak.admin.client.resource.RealmResource;\nimport org.keycloak.representations.idm.RealmRepresentation;\n-import java.io.Closeable;\nimport java.util.HashMap;\n-import java.util.function.Consumer;\n+import java.util.List;\n/**\n*\n* @author hmlnarik\n*/\n-public class RealmAttributeUpdater {\n+public class RealmAttributeUpdater extends ServerResourceUpdater<ServerResourceUpdater, RealmResource, RealmRepresentation> {\n- private final RealmResource realmResource;\n-\n- private final RealmRepresentation rep;\n- private final RealmRepresentation origRep;\n-\n- public RealmAttributeUpdater(RealmResource realmResource) {\n- this.realmResource = realmResource;\n- this.origRep = realmResource.toRepresentation();\n- this.rep = realmResource.toRepresentation();\n+ public RealmAttributeUpdater(RealmResource resource) {\n+ super(resource, resource::toRepresentation, resource::update);\nif (this.rep.getAttributes() == null) {\nthis.rep.setAttributes(new HashMap<>());\n}\n}\n- public RealmAttributeUpdater updateWith(Consumer<RealmRepresentation> updater) {\n- updater.accept(this.rep);\n- return this;\n- }\n-\npublic RealmAttributeUpdater setAttribute(String name, String value) {\nthis.rep.getAttributes().put(name, value);\nreturn this;\n@@ -51,9 +38,9 @@ public class RealmAttributeUpdater {\nreturn this;\n}\n- public Closeable update() {\n- realmResource.update(rep);\n-\n- return () -> realmResource.update(origRep);\n+ public RealmAttributeUpdater setDefaultDefaultClientScopes(List<String> defaultClientScopes) {\n+ rep.setDefaultDefaultClientScopes(defaultClientScopes);\n+ return this;\n}\n+\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/updaters/RoleScopeUpdater.java",
"diff": "+/*\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.keycloak.testsuite.updaters;\n+\n+import org.keycloak.admin.client.resource.RoleScopeResource;\n+import org.keycloak.representations.idm.RoleRepresentation;\n+import java.util.List;\n+import java.util.Set;\n+import java.util.stream.Collectors;\n+\n+/**\n+ *\n+ * @author hmlnarik\n+ */\n+public class RoleScopeUpdater extends ServerResourceUpdater<RoleScopeUpdater, RoleScopeResource, List<RoleRepresentation>> {\n+\n+ public RoleScopeUpdater(RoleScopeResource resource) {\n+ super(resource, resource::listAll, null);\n+ this.updater = this::update;\n+ }\n+\n+ public RoleScopeUpdater add(RoleRepresentation representation) {\n+ rep.add(representation);\n+ return this;\n+ }\n+\n+ public RoleScopeUpdater remove(RoleRepresentation representation) {\n+ rep.add(representation);\n+ return this;\n+ }\n+\n+ private void update(List<RoleRepresentation> expectedRoles) {\n+ List<RoleRepresentation> currentRoles = resource.listAll();\n+\n+ Set<String> currentRoleIds = currentRoles.stream().map(RoleRepresentation::getId).collect(Collectors.toSet());\n+ Set<String> expectedRoleIds = expectedRoles.stream().map(RoleRepresentation::getId).collect(Collectors.toSet());\n+\n+ List<RoleRepresentation> toAdd = expectedRoles.stream()\n+ .filter(role -> ! currentRoleIds.contains(role.getId()))\n+ .collect(Collectors.toList());\n+ List<RoleRepresentation> toRemove = currentRoles.stream()\n+ .filter(role -> ! expectedRoleIds.contains(role.getId()))\n+ .collect(Collectors.toList());\n+\n+ resource.add(toAdd);\n+ resource.remove(toRemove);\n+ }\n+\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/updaters/ServerResourceUpdater.java",
"diff": "+/*\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.keycloak.testsuite.updaters;\n+\n+import java.io.Closeable;\n+import java.io.IOException;\n+import java.util.Collection;\n+import java.util.Collections;\n+import java.util.Objects;\n+import java.util.Set;\n+import java.util.function.Consumer;\n+import java.util.function.Function;\n+import java.util.function.Supplier;\n+import java.util.stream.Collectors;\n+\n+/**\n+ *\n+ * @author hmlnarik\n+ */\n+public abstract class ServerResourceUpdater<T extends ServerResourceUpdater, Res, Rep> implements Closeable {\n+\n+ protected final Res resource;\n+ protected final Rep rep;\n+ protected final Rep origRep;\n+ protected Consumer<Rep> updater;\n+ protected boolean updated = false;\n+\n+ public ServerResourceUpdater(Res resource, Supplier<Rep> representationGenerator, Consumer<Rep> updater) {\n+ this.resource = resource;\n+ this.updater = updater;\n+\n+ // origRep and rep need to be two different instances\n+ this.origRep = representationGenerator.get();\n+ this.rep = representationGenerator.get();\n+ }\n+\n+ public Res getResource() {\n+ return resource;\n+ }\n+\n+ public T update() {\n+ performUpdate(origRep, rep);\n+ this.updated = true;\n+ return (T) this;\n+ }\n+\n+ protected void performUpdate(Rep from, Rep to) {\n+ updater.accept(to);\n+ }\n+\n+ public T updateWith(Consumer<Rep> representationUpdater) {\n+ representationUpdater.accept(this.rep);\n+ return (T) this;\n+ }\n+\n+ @Override\n+ public void close() throws IOException {\n+ if (! this.updated) {\n+ throw new IOException(\"Attempt to revert changes that were never applied - have you called \" + this.getClass().getName() + \".update()?\");\n+ }\n+ performUpdate(rep, origRep);\n+ }\n+\n+ /**\n+ * This function performs a set of single {@code add} and {@code remove} operations that represent the changes needed to\n+ * get collection {@code from} to the state of collection {@code to}. Since this is intended to work on collections of\n+ * names of objects but the {@code add} and {@code remove} functions operate on IDs of those objects, a conversion\n+ * is performed.\n+ *\n+ * @param <T> Type of the objects in the collections (e.g. names)\n+ * @param <V> Type of the objects required by add/remove functions (e.g. IDs)\n+ * @param from Initial collection\n+ * @param to Target collection\n+ * @param client2ServerConvertorGenerator Producer of the convertor. If not needed, just use {@code () -> Functions::identity}.\n+ * This is intentionally a lazy-evaluated function variable because the conversion map often needs to be obtained from the\n+ * server which can be slow operation. This function is called only if the two collections differ.\n+ * @param add Function to add\n+ * @param remove Function to remove\n+ */\n+ public static <T, V> void updateViaAddRemove(Collection<T> from, Collection<T> to, Supplier<Function<T, V>> client2ServerConvertorGenerator, Consumer<V> add, Consumer<V> remove) {\n+ if (Objects.equals(from, to)) {\n+ return;\n+ }\n+\n+ Function<T, V> client2ServerConvertor = client2ServerConvertorGenerator.get();\n+\n+ Set<V> current = from == null ? Collections.EMPTY_SET : from.stream().map(client2ServerConvertor).collect(Collectors.toSet());\n+ Set<V> expected = to == null ? Collections.EMPTY_SET : to.stream().map(client2ServerConvertor).collect(Collectors.toSet());\n+\n+ expected.stream()\n+ .filter(role -> ! current.contains(role))\n+ .forEach(add);\n+ current.stream()\n+ .filter(role -> ! expected.contains(role))\n+ .forEach(remove);\n+ }\n+\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/updaters/UserAttributeUpdater.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/updaters/UserAttributeUpdater.java",
"diff": "package org.keycloak.testsuite.updaters;\n+import org.keycloak.admin.client.Keycloak;\n+import org.keycloak.admin.client.resource.ClientResource;\n+import org.keycloak.admin.client.resource.ClientsResource;\nimport org.keycloak.admin.client.resource.UserResource;\n+import org.keycloak.admin.client.resource.UsersResource;\nimport org.keycloak.models.UserModel;\n+import org.keycloak.representations.idm.ClientRepresentation;\nimport org.keycloak.representations.idm.UserRepresentation;\n-import java.io.Closeable;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.stream.Collectors;\n+import static org.hamcrest.Matchers.hasSize;\n+import static org.junit.Assert.assertThat;\n/**\n*\n* @author hmlnarik\n*/\n-public class UserAttributeUpdater {\n+public class UserAttributeUpdater extends ServerResourceUpdater<UserAttributeUpdater, UserResource, UserRepresentation> {\n- private final UserResource userResource;\n+ public static UserAttributeUpdater forUserByUsername(Keycloak adminClient, String realm, String userName) {\n+ UsersResource users = adminClient.realm(realm).users();\n+ List<UserRepresentation> foundUsers = users.search(userName);\n+ assertThat(foundUsers, hasSize(1));\n+ UserResource userRes = users.get(foundUsers.get(0).getId());\n- private final UserRepresentation rep;\n- private final UserRepresentation origRep;\n+ return new UserAttributeUpdater(userRes);\n+ }\n- public UserAttributeUpdater(UserResource userResource) {\n- this.userResource = userResource;\n- this.origRep = userResource.toRepresentation();\n- this.rep = userResource.toRepresentation();\n+ public UserAttributeUpdater(UserResource resource) {\n+ super(resource, resource::toRepresentation, resource::update);\nif (this.rep.getAttributes() == null) {\nthis.rep.setAttributes(new HashMap<>());\n}\n@@ -49,12 +57,6 @@ public class UserAttributeUpdater {\nreturn this;\n}\n- public Closeable update() {\n- userResource.update(rep);\n-\n- return () -> userResource.update(origRep);\n- }\n-\npublic UserAttributeUpdater setRequiredActions(UserModel.RequiredAction... requiredAction) {\nrep.setRequiredActions(Arrays.stream(requiredAction)\n.map(action -> action.name())\n@@ -62,4 +64,12 @@ public class UserAttributeUpdater {\n);\nreturn this;\n}\n+\n+ public RoleScopeUpdater realmRoleScope() {\n+ return new RoleScopeUpdater(resource.roles().realmLevel());\n+ }\n+\n+ public RoleScopeUpdater clientRoleScope(String clientUUID) {\n+ return new RoleScopeUpdater(resource.roles().clientLevel(clientUUID));\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/account/AccountFormServiceTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/account/AccountFormServiceTest.java",
"diff": "@@ -57,11 +57,16 @@ import org.keycloak.testsuite.pages.AppPage.RequestType;\nimport org.keycloak.testsuite.pages.ErrorPage;\nimport org.keycloak.testsuite.pages.LoginPage;\nimport org.keycloak.testsuite.pages.RegisterPage;\n+import org.keycloak.testsuite.updaters.ClientAttributeUpdater;\n+import org.keycloak.testsuite.updaters.RoleScopeUpdater;\nimport org.keycloak.testsuite.util.IdentityProviderBuilder;\nimport org.keycloak.testsuite.util.OAuthClient;\nimport org.keycloak.testsuite.util.RealmBuilder;\nimport org.keycloak.testsuite.util.UIUtils;\nimport org.keycloak.testsuite.util.UserBuilder;\n+import java.io.Closeable;\n+import java.io.IOException;\n+import java.util.Collections;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.WebDriver;\n@@ -86,6 +91,9 @@ import static org.junit.Assert.assertTrue;\n*/\npublic class AccountFormServiceTest extends AbstractTestRealmKeycloakTest {\n+ public static final String ROOT_URL_CLIENT = \"root-url-client\";\n+ public static final String REALM_NAME = \"test\";\n+\n@Override\npublic void configureTestRealm(RealmRepresentation testRealm) {\n//UserRepresentation user = findUserInRealmRep(testRealm, \"test-user@localhost\");\n@@ -1067,7 +1075,50 @@ public class AccountFormServiceTest extends AbstractTestRealmKeycloakTest {\nevents.clear();\n}\n+ @Test\n+ public void applicationsVisibilityNoScopesNoConsent() throws Exception {\n+ try (ClientAttributeUpdater cau = ClientAttributeUpdater.forClient(adminClient, REALM_NAME, ROOT_URL_CLIENT)\n+ .setConsentRequired(false)\n+ .setFullScopeAllowed(false)\n+ .setDefaultClientScopes(Collections.EMPTY_LIST)\n+ .setOptionalClientScopes(Collections.EMPTY_LIST)\n+ .update();\n+ RoleScopeUpdater rsu = cau.realmRoleScope().update()) {\n+ applicationsPage.open();\n+ loginPage.login(\"john-doh@localhost\", \"password\");\n+ applicationsPage.assertCurrent();\n+\n+ Map<String, AccountApplicationsPage.AppEntry> apps = applicationsPage.getApplications();\n+ Assert.assertThat(apps.keySet(), containsInAnyOrder(\n+ /* \"root-url-client\", */ \"Account\", \"test-app\", \"test-app-scope\", \"third-party\", \"test-app-authz\", \"My Named Test App\", \"Test App Named - ${client_account}\", \"direct-grant\"));\n+\n+ rsu.add(testRealm().roles().get(\"user\").toRepresentation())\n+ .update();\n+\n+ driver.navigate().refresh();\n+ apps = applicationsPage.getApplications();\n+ Assert.assertThat(apps.keySet(), containsInAnyOrder(\n+ \"root-url-client\", \"Account\", \"test-app\", \"test-app-scope\", \"third-party\", \"test-app-authz\", \"My Named Test App\", \"Test App Named - ${client_account}\", \"direct-grant\"));\n+ }\n+ }\n+\n+ @Test\n+ public void applicationsVisibilityNoScopesAndConsent() throws Exception {\n+ try (ClientAttributeUpdater cau = ClientAttributeUpdater.forClient(adminClient, REALM_NAME, ROOT_URL_CLIENT)\n+ .setConsentRequired(true)\n+ .setFullScopeAllowed(false)\n+ .setDefaultClientScopes(Collections.EMPTY_LIST)\n+ .setOptionalClientScopes(Collections.EMPTY_LIST)\n+ .update()) {\n+ applicationsPage.open();\n+ loginPage.login(\"john-doh@localhost\", \"password\");\n+ applicationsPage.assertCurrent();\n+ Map<String, AccountApplicationsPage.AppEntry> apps = applicationsPage.getApplications();\n+ Assert.assertThat(apps.keySet(), containsInAnyOrder(\n+ \"root-url-client\", \"Account\", \"test-app\", \"test-app-scope\", \"third-party\", \"test-app-authz\", \"My Named Test App\", \"Test App Named - ${client_account}\", \"direct-grant\"));\n+ }\n+ }\n// More tests (including revoke) are in OAuthGrantTest and OfflineTokenTest\n@Test\n@@ -1076,19 +1127,19 @@ public class AccountFormServiceTest extends AbstractTestRealmKeycloakTest {\nloginPage.login(\"test-user@localhost\", \"password\");\nevents.expectLogin().client(\"account\").detail(Details.REDIRECT_URI, ACCOUNT_REDIRECT + \"?path=applications\").assertEvent();\n- Assert.assertTrue(applicationsPage.isCurrent());\n+ applicationsPage.assertCurrent();\nMap<String, AccountApplicationsPage.AppEntry> apps = applicationsPage.getApplications();\nAssert.assertThat(apps.keySet(), containsInAnyOrder(\"root-url-client\", \"Account\", \"Broker\", \"test-app\", \"test-app-scope\", \"third-party\", \"test-app-authz\", \"My Named Test App\", \"Test App Named - ${client_account}\", \"direct-grant\"));\nAccountApplicationsPage.AppEntry accountEntry = apps.get(\"Account\");\n- Assert.assertEquals(4, accountEntry.getRolesAvailable().size());\n- Assert.assertTrue(accountEntry.getRolesAvailable().contains(\"Manage account links in Account\"));\n- Assert.assertTrue(accountEntry.getRolesAvailable().contains(\"Manage account in Account\"));\n- Assert.assertTrue(accountEntry.getRolesAvailable().contains(\"View profile in Account\"));\n- Assert.assertTrue(accountEntry.getRolesAvailable().contains(\"Offline access\"));\n- Assert.assertEquals(1, accountEntry.getClientScopesGranted().size());\n- Assert.assertTrue(accountEntry.getClientScopesGranted().contains(\"Full Access\"));\n+ Assert.assertThat(accountEntry.getRolesAvailable(), containsInAnyOrder(\n+ \"Manage account links in Account\",\n+ \"Manage account in Account\",\n+ \"View profile in Account\",\n+ \"Offline access\"\n+ ));\n+ Assert.assertThat(accountEntry.getClientScopesGranted(), containsInAnyOrder(\"Full Access\"));\nAssert.assertEquals(\"http://localhost:8180/auth/realms/test/account\", accountEntry.getHref());\nAccountApplicationsPage.AppEntry testAppEntry = apps.get(\"test-app\");\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/OfflineServletsAdapterTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/OfflineServletsAdapterTest.java",
"diff": "@@ -24,6 +24,7 @@ import org.keycloak.testsuite.pages.OAuthGrantPage;\nimport org.keycloak.testsuite.util.ClientManager;\nimport org.keycloak.testsuite.utils.io.IOUtil;\nimport org.keycloak.util.TokenUtil;\n+import org.hamcrest.Matchers;\nimport org.openqa.selenium.By;\nimport static org.keycloak.testsuite.auth.page.AuthRealm.TEST;\n@@ -181,8 +182,8 @@ public class OfflineServletsAdapterTest extends AbstractServletsAdapterTest {\naccountAppPage.open();\nAccountApplicationsPage.AppEntry offlineClient = accountAppPage.getApplications().get(\"offline-client\");\n- Assert.assertTrue(offlineClient.getClientScopesGranted().contains(OAuthGrantPage.OFFLINE_ACCESS_CONSENT_TEXT));\n- Assert.assertTrue(offlineClient.getAdditionalGrants().contains(\"Offline Token\"));\n+ Assert.assertThat(offlineClient.getClientScopesGranted(), Matchers.hasItem(OAuthGrantPage.OFFLINE_ACCESS_CONSENT_TEXT));\n+ Assert.assertThat(offlineClient.getAdditionalGrants(), Matchers.hasItem(\"Offline Token\"));\n//This was necessary to be introduced, otherwise other testcases will fail\nofflineTokenPage.logout();\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/SAMLServletAdapterTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/SAMLServletAdapterTest.java",
"diff": "@@ -818,8 +818,7 @@ public class SAMLServletAdapterTest extends AbstractServletsAdapterTest {\n@Test\npublic void salesPostEncSignedAssertionsAndDocumentTest() throws Exception {\n- ClientRepresentation salesPostEncClient = testRealmResource().clients().findByClientId(SalesPostEncServlet.CLIENT_NAME).get(0);\n- try (Closeable client = new ClientAttributeUpdater(testRealmResource().clients().get(salesPostEncClient.getId()))\n+ try (Closeable client = ClientAttributeUpdater.forClient(adminClient, testRealmPage.getAuthRealm(), SalesPostEncServlet.CLIENT_NAME)\n.setAttribute(SamlConfigAttributes.SAML_ASSERTION_SIGNATURE, \"true\")\n.setAttribute(SamlConfigAttributes.SAML_SERVER_SIGNATURE, \"true\")\n.update()) {\n@@ -831,8 +830,7 @@ public class SAMLServletAdapterTest extends AbstractServletsAdapterTest {\n@Test\npublic void salesPostEncRejectConsent() throws Exception {\n- ClientRepresentation salesPostEncClient = testRealmResource().clients().findByClientId(SalesPostEncServlet.CLIENT_NAME).get(0);\n- try (Closeable client = new ClientAttributeUpdater(testRealmResource().clients().get(salesPostEncClient.getId()))\n+ try (Closeable client = ClientAttributeUpdater.forClient(adminClient, testRealmPage.getAuthRealm(), SalesPostEncServlet.CLIENT_NAME)\n.setConsentRequired(true)\n.update()) {\nnew SamlClientBuilder()\n@@ -853,8 +851,7 @@ public class SAMLServletAdapterTest extends AbstractServletsAdapterTest {\n@Test\npublic void salesPostRejectConsent() throws Exception {\n- ClientRepresentation salesPostClient = testRealmResource().clients().findByClientId(SalesPostServlet.CLIENT_NAME).get(0);\n- try (Closeable client = new ClientAttributeUpdater(testRealmResource().clients().get(salesPostClient.getId()))\n+ try (Closeable client = ClientAttributeUpdater.forClient(adminClient, testRealmPage.getAuthRealm(), SalesPostServlet.CLIENT_NAME)\n.setConsentRequired(true)\n.update()) {\nnew SamlClientBuilder()\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/KcSamlSignedBrokerTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/KcSamlSignedBrokerTest.java",
"diff": "@@ -117,14 +117,6 @@ public class KcSamlSignedBrokerTest extends KcSamlBrokerTest {\n}\npublic void withSignedEncryptedAssertions(Runnable testBody, boolean signedAssertion, boolean encryptedAssertion) throws Exception {\n- ClientRepresentation client = adminClient.realm(bc.providerRealmName())\n- .clients()\n- .findByClientId(bc.getIDPClientIdInProviderRealm(suiteContext))\n- .get(0);\n-\n- final ClientResource clientResource = realmsResouce().realm(bc.providerRealmName()).clients().get(client.getId());\n- Assert.assertThat(clientResource, Matchers.notNullValue());\n-\nString providerCert = KeyUtils.getActiveKey(adminClient.realm(bc.providerRealmName()).keys().getKeyMetadata(), Algorithm.RS256).getCertificate();\nAssert.assertThat(providerCert, Matchers.notNullValue());\n@@ -138,7 +130,7 @@ public class KcSamlSignedBrokerTest extends KcSamlBrokerTest {\n.setAttribute(SAMLIdentityProviderConfig.WANT_AUTHN_REQUESTS_SIGNED, \"false\")\n.setAttribute(SAMLIdentityProviderConfig.SIGNING_CERTIFICATE_KEY, providerCert)\n.update();\n- Closeable clientUpdater = new ClientAttributeUpdater(clientResource)\n+ Closeable clientUpdater = ClientAttributeUpdater.forClient(adminClient, bc.providerRealmName(), bc.getIDPClientIdInProviderRealm(suiteContext))\n.setAttribute(SamlConfigAttributes.SAML_ENCRYPT, Boolean.toString(encryptedAssertion))\n.setAttribute(SamlConfigAttributes.SAML_ENCRYPTION_CERTIFICATE_ATTRIBUTE, consumerCert)\n.setAttribute(SamlConfigAttributes.SAML_SERVER_SIGNATURE, \"false\") // only sign assertions\n@@ -269,14 +261,6 @@ public class KcSamlSignedBrokerTest extends KcSamlBrokerTest {\n@Test\npublic void testWithExpiredBrokerCertificate() throws Exception {\n- ClientRepresentation client = adminClient.realm(bc.providerRealmName())\n- .clients()\n- .findByClientId(bc.getIDPClientIdInProviderRealm(suiteContext))\n- .get(0);\n-\n- final ClientResource clientResource = realmsResouce().realm(bc.providerRealmName()).clients().get(client.getId());\n- Assert.assertThat(clientResource, Matchers.notNullValue());\n-\ntry (Closeable idpUpdater = new IdentityProviderAttributeUpdater(identityProviderResource)\n.setAttribute(SAMLIdentityProviderConfig.VALIDATE_SIGNATURE, Boolean.toString(true))\n.setAttribute(SAMLIdentityProviderConfig.WANT_ASSERTIONS_SIGNED, Boolean.toString(true))\n@@ -284,7 +268,7 @@ public class KcSamlSignedBrokerTest extends KcSamlBrokerTest {\n.setAttribute(SAMLIdentityProviderConfig.WANT_AUTHN_REQUESTS_SIGNED, \"true\")\n.setAttribute(SAMLIdentityProviderConfig.SIGNING_CERTIFICATE_KEY, AbstractSamlTest.SAML_CLIENT_SALES_POST_SIG_EXPIRED_CERTIFICATE)\n.update();\n- Closeable clientUpdater = new ClientAttributeUpdater(clientResource)\n+ Closeable clientUpdater = ClientAttributeUpdater.forClient(adminClient, bc.providerRealmName(), bc.getIDPClientIdInProviderRealm(suiteContext))\n.setAttribute(SamlConfigAttributes.SAML_ENCRYPT, Boolean.toString(false))\n.setAttribute(SamlConfigAttributes.SAML_SERVER_SIGNATURE, \"true\")\n.setAttribute(SamlConfigAttributes.SAML_ASSERTION_SIGNATURE, Boolean.toString(true))\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/LogoutTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/LogoutTest.java",
"diff": "@@ -244,11 +244,8 @@ public class LogoutTest extends AbstractTestRealmKeycloakTest {\n// KEYCLOAK-5982\n@Test\npublic void testLogoutWhenAccountClientRenamed() throws IOException {\n- // Rename client \"account\"\n- ClientResource accountClient = ApiUtil.findClientByClientId(adminClient.realm(\"test\"), Constants.ACCOUNT_MANAGEMENT_CLIENT_ID);\n-\n// Temporarily rename client \"account\" . Revert it back after the test\n- try (Closeable accountClientUpdater = new ClientAttributeUpdater(accountClient)\n+ try (Closeable accountClientUpdater = ClientAttributeUpdater.forClient(adminClient, \"test\", Constants.ACCOUNT_MANAGEMENT_CLIENT_ID)\n.setClientId(\"account-changed\")\n.update()) {\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/ResetPasswordTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/ResetPasswordTest.java",
"diff": "@@ -1011,10 +1011,8 @@ public class ResetPasswordTest extends AbstractTestRealmKeycloakTest {\n// KEYCLOAK-5982\n@Test\npublic void resetPasswordLinkOpenedInNewBrowserAndAccountClientRenamed() throws IOException, MessagingException {\n- ClientResource accountClient = ApiUtil.findClientByClientId(adminClient.realm(\"test\"), Constants.ACCOUNT_MANAGEMENT_CLIENT_ID);\n-\n// Temporarily rename client \"account\" . Revert it back after the test\n- try (Closeable accountClientUpdater = new ClientAttributeUpdater(accountClient)\n+ try (Closeable accountClientUpdater = ClientAttributeUpdater.forClient(adminClient, \"test\", Constants.ACCOUNT_MANAGEMENT_CLIENT_ID)\n.setClientId(\"account-changed\")\n.update()) {\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/saml/IncludeOneTimeUseConditionTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/saml/IncludeOneTimeUseConditionTest.java",
"diff": "@@ -59,12 +59,7 @@ public class IncludeOneTimeUseConditionTest extends AbstractSamlTest\nprivate void testOneTimeUseConditionIncluded(Boolean oneTimeUseConditionShouldBeIncluded) throws IOException\n{\n- ClientsResource clients = adminClient.realm(REALM_NAME).clients();\n- List<ClientRepresentation> foundClients = clients.findByClientId(SAML_CLIENT_ID_SALES_POST);\n- assertThat(foundClients, hasSize(1));\n- ClientResource clientRes = clients.get(foundClients.get(0).getId());\n-\n- try (Closeable c = new ClientAttributeUpdater(clientRes)\n+ try (Closeable c = ClientAttributeUpdater.forClient(adminClient, REALM_NAME, SAML_CLIENT_ID_SALES_POST)\n.setAttribute(SamlConfigAttributes.SAML_ONETIMEUSE_CONDITION, oneTimeUseConditionShouldBeIncluded.toString())\n.update()) {\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/saml/LogoutTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/saml/LogoutTest.java",
"diff": "*/\npackage org.keycloak.testsuite.saml;\n-import org.keycloak.admin.client.resource.ClientsResource;\nimport org.keycloak.admin.client.resource.RealmResource;\nimport org.keycloak.broker.saml.SAMLIdentityProviderConfig;\nimport org.keycloak.broker.saml.SAMLIdentityProviderFactory;\n@@ -361,10 +360,9 @@ public class LogoutTest extends AbstractSamlTest {\n@Test\npublic void testLogoutPropagatesToSamlIdentityProvider() throws IOException {\nfinal RealmResource realm = adminClient.realm(REALM_NAME);\n- final ClientsResource clients = realm.clients();\ntry (\n- Closeable sales = new ClientAttributeUpdater(clients.get(salesRep.getId()))\n+ Closeable sales = ClientAttributeUpdater.forClient(adminClient, REALM_NAME, SAML_CLIENT_ID_SALES_POST)\n.setFrontchannelLogout(true)\n.removeAttribute(SamlProtocol.SAML_SINGLE_LOGOUT_SERVICE_URL_POST_ATTRIBUTE)\n.setAttribute(SamlProtocol.SAML_SINGLE_LOGOUT_SERVICE_URL_REDIRECT_ATTRIBUTE, \"http://url\")\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9014 Fix displayed applications |
339,465 | 10.12.2018 14:38:12 | -3,600 | 04445c8a23a86edb4756588fe3e540c1ac362576 | Backpressure in RemoteCacheSessionsLoader | [
{
"change_type": "MODIFY",
"old_path": "model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/remotestore/RemoteCacheSessionsLoader.java",
"new_path": "model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/remotestore/RemoteCacheSessionsLoader.java",
"diff": "package org.keycloak.models.sessions.infinispan.remotestore;\nimport java.io.Serializable;\n+import java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\n@@ -114,6 +115,7 @@ public class RemoteCacheSessionsLoader implements SessionLoader<RemoteCacheSessi\nlog.debugf(\"Will do bulk load of sessions from remote cache '%s' . Segment: %d\", cache.getName(), ctx.getSegment());\n+ Map<Object, Object> remoteEntries = new HashMap<>();\nCloseableIterator<Map.Entry> iterator = null;\nint countLoaded = 0;\ntry {\n@@ -121,7 +123,7 @@ public class RemoteCacheSessionsLoader implements SessionLoader<RemoteCacheSessi\nwhile (iterator.hasNext()) {\ncountLoaded++;\nMap.Entry entry = iterator.next();\n- decoratedCache.putAsync(entry.getKey(), entry.getValue());\n+ remoteEntries.put(entry.getKey(), entry.getValue());\n}\n} catch (RuntimeException e) {\nlog.warnf(e, \"Error loading sessions from remote cache '%s' for segment '%d'\", remoteCache.getName(), ctx.getSegment());\n@@ -132,6 +134,8 @@ public class RemoteCacheSessionsLoader implements SessionLoader<RemoteCacheSessi\n}\n}\n+ decoratedCache.putAll(remoteEntries);\n+\nlog.debugf(\"Successfully finished loading sessions from cache '%s' . Segment: %d, Count of sessions loaded: %d\", cache.getName(), ctx.getSegment(), countLoaded);\nreturn new WorkerResult(true, ctx.getSegment(), ctx.getWorkerId());\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8904 Backpressure in RemoteCacheSessionsLoader |
339,582 | 08.10.2018 11:43:42 | -7,200 | aa89ae96a9072909739d39212063ca3e0a148d11 | update and align Spring Boot versions | [
{
"change_type": "MODIFY",
"old_path": "adapters/oidc/spring-boot-adapter-core/pom.xml",
"new_path": "adapters/oidc/spring-boot-adapter-core/pom.xml",
"diff": "<description/>\n<properties>\n- <spring-boot.version>1.3.0.RELEASE</spring-boot.version>\n+ <spring-boot.version>1.5.16.RELEASE</spring-boot.version>\n</properties>\n<dependencies>\n"
},
{
"change_type": "MODIFY",
"old_path": "adapters/oidc/spring-boot/pom.xml",
"new_path": "adapters/oidc/spring-boot/pom.xml",
"diff": "<properties>\n<maven.compiler.target>1.7</maven.compiler.target>\n<maven.compiler.source>1.7</maven.compiler.source>\n- <spring-boot.version>1.4.0.RELEASE</spring-boot.version>\n+ <spring-boot.version>1.5.16.RELEASE</spring-boot.version>\n<spring.version>4.1.6.RELEASE</spring.version>\n<mockito.version>1.9.5</mockito.version>\n</properties>\n"
},
{
"change_type": "MODIFY",
"old_path": "adapters/oidc/spring-boot2/pom.xml",
"new_path": "adapters/oidc/spring-boot2/pom.xml",
"diff": "<description/>\n<properties>\n- <spring-boot.version>2.0.3.RELEASE</spring-boot.version>\n+ <spring-boot.version>2.0.5.RELEASE</spring-boot.version>\n<spring.version>5.0.2.RELEASE</spring.version>\n<mockito.version>1.9.5</mockito.version>\n</properties>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | update and align Spring Boot versions |
339,465 | 11.12.2018 15:39:48 | -3,600 | 10eb13854e161d243dfa661272644f609c52d363 | Fix another NPE in Cors debug logging | [
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/services/resources/Cors.java",
"new_path": "services/src/main/java/org/keycloak/services/resources/Cors.java",
"diff": "@@ -190,7 +190,7 @@ public class Cors {\nif (!preflight && (allowedOrigins == null || (!allowedOrigins.contains(origin) && !allowedOrigins.contains(ACCESS_CONTROL_ALLOW_ORIGIN_WILDCARD)))) {\nif (logger.isDebugEnabled()) {\n- logger.debugv(\"Invalid CORS request: origin {0} not in allowed origins {1}\", origin, Arrays.toString(allowedOrigins.toArray()));\n+ logger.debugv(\"Invalid CORS request: origin {0} not in allowed origins {1}\", origin, allowedOrigins);\n}\nreturn;\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9028 Fix another NPE in Cors debug logging |
339,465 | 11.12.2018 18:49:29 | -3,600 | c51c492996275e27e02af9425642b411230edbdf | Change LoginProtocol.authenticated to read most of the values from authenticationSession | [
{
"change_type": "MODIFY",
"old_path": "server-spi-private/src/main/java/org/keycloak/protocol/LoginProtocol.java",
"new_path": "server-spi-private/src/main/java/org/keycloak/protocol/LoginProtocol.java",
"diff": "@@ -68,7 +68,7 @@ public interface LoginProtocol extends Provider {\nLoginProtocol setEventBuilder(EventBuilder event);\n- Response authenticated(UserSessionModel userSession, ClientSessionContext clientSessionCtx);\n+ Response authenticated(AuthenticationSessionModel authSession, UserSessionModel userSession, ClientSessionContext clientSessionCtx);\nResponse sendError(AuthenticationSessionModel authSession, Error error);\n"
},
{
"change_type": "MODIFY",
"old_path": "server-spi/src/main/java/org/keycloak/models/ClientSessionContext.java",
"new_path": "server-spi/src/main/java/org/keycloak/models/ClientSessionContext.java",
"diff": "@@ -45,6 +45,4 @@ public interface ClientSessionContext {\n<T> T getAttribute(String attribute, Class<T> clazz);\n-\n- String AUTHENTICATION_SESSION_ATTR = \"AUTH_SESSION_ATTR\";\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/authentication/AuthenticationProcessor.java",
"new_path": "services/src/main/java/org/keycloak/authentication/AuthenticationProcessor.java",
"diff": "@@ -979,7 +979,7 @@ public class AuthenticationProcessor {\nevent.success();\nRealmModel realm = authenticationSession.getRealm();\nClientSessionContext clientSessionCtx = attachSession();\n- return AuthenticationManager.redirectAfterSuccessfulFlow(session, realm, userSession, clientSessionCtx, request, uriInfo, connection, event, protocol);\n+ return AuthenticationManager.redirectAfterSuccessfulFlow(session, realm, userSession, clientSessionCtx, request, uriInfo, connection, event, authenticationSession, protocol);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/protocol/docker/DockerAuthV2Protocol.java",
"new_path": "services/src/main/java/org/keycloak/protocol/docker/DockerAuthV2Protocol.java",
"diff": "@@ -92,7 +92,7 @@ public class DockerAuthV2Protocol implements LoginProtocol {\n}\n@Override\n- public Response authenticated(final UserSessionModel userSession, final ClientSessionContext clientSessionCtx) {\n+ public Response authenticated(final AuthenticationSessionModel authSession, final UserSessionModel userSession, final ClientSessionContext clientSessionCtx) {\n// First, create a base response token with realm + user values populated\nfinal AuthenticatedClientSessionModel clientSession = clientSessionCtx.getClientSession();\nfinal ClientModel client = clientSession.getClient();\n@@ -100,7 +100,7 @@ public class DockerAuthV2Protocol implements LoginProtocol {\nDockerResponseToken responseToken = new DockerResponseToken()\n.id(KeycloakModelUtils.generateId())\n.type(TokenUtil.TOKEN_TYPE_BEARER)\n- .issuer(clientSession.getNote(DockerAuthV2Protocol.ISSUER))\n+ .issuer(authSession.getClientNote(DockerAuthV2Protocol.ISSUER))\n.subject(userSession.getUser().getUsername())\n.issuedNow()\n.audience(client.getClientId())\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/protocol/oidc/OIDCLoginProtocol.java",
"new_path": "services/src/main/java/org/keycloak/protocol/oidc/OIDCLoginProtocol.java",
"diff": "@@ -181,16 +181,16 @@ public class OIDCLoginProtocol implements LoginProtocol {\n@Override\n- public Response authenticated(UserSessionModel userSession, ClientSessionContext clientSessionCtx) {\n+ public Response authenticated(AuthenticationSessionModel authSession, UserSessionModel userSession, ClientSessionContext clientSessionCtx) {\nAuthenticatedClientSessionModel clientSession= clientSessionCtx.getClientSession();\n- String responseTypeParam = clientSession.getNote(OIDCLoginProtocol.RESPONSE_TYPE_PARAM);\n- String responseModeParam = clientSession.getNote(OIDCLoginProtocol.RESPONSE_MODE_PARAM);\n+ String responseTypeParam = authSession.getClientNote(OIDCLoginProtocol.RESPONSE_TYPE_PARAM);\n+ String responseModeParam = authSession.getClientNote(OIDCLoginProtocol.RESPONSE_MODE_PARAM);\nsetupResponseTypeAndMode(responseTypeParam, responseModeParam);\n- String redirect = clientSession.getRedirectUri();\n+ String redirect = authSession.getRedirectUri();\nOIDCRedirectUriBuilder redirectUri = OIDCRedirectUriBuilder.fromUri(redirect, responseMode);\n- String state = clientSession.getNote(OIDCLoginProtocol.STATE_PARAM);\n+ String state = authSession.getClientNote(OIDCLoginProtocol.STATE_PARAM);\nlogger.debugv(\"redirectAccessCode: state: {0}\", state);\nif (state != null)\nredirectUri.addParam(OAuth2Constants.STATE, state);\n@@ -200,12 +200,6 @@ public class OIDCLoginProtocol implements LoginProtocol {\nredirectUri.addParam(OAuth2Constants.SESSION_STATE, userSession.getId());\n}\n- AuthenticationSessionModel authSession = clientSessionCtx.getAttribute(ClientSessionContext.AUTHENTICATION_SESSION_ATTR, AuthenticationSessionModel.class);\n- if (authSession == null) {\n- // Shouldn't happen if correctly used\n- throw new IllegalStateException(\"AuthenticationSession attachement not set in the ClientSessionContext\");\n- }\n-\nString nonce = authSession.getClientNote(OIDCLoginProtocol.NONCE_PARAM);\nclientSessionCtx.setAttribute(OIDCLoginProtocol.NONCE_PARAM, nonce);\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/protocol/oidc/TokenManager.java",
"new_path": "services/src/main/java/org/keycloak/protocol/oidc/TokenManager.java",
"diff": "@@ -431,8 +431,6 @@ public class TokenManager {\nnew AuthenticationSessionManager(session).removeAuthenticationSession(userSession.getRealm(), authSession, true);\nClientSessionContext clientSessionCtx = DefaultClientSessionContext.fromClientSessionAndClientScopeIds(clientSession, clientScopeIds);\n- clientSessionCtx.setAttribute(ClientSessionContext.AUTHENTICATION_SESSION_ATTR, authSession);\n-\nreturn clientSessionCtx;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/protocol/saml/SamlProtocol.java",
"new_path": "services/src/main/java/org/keycloak/protocol/saml/SamlProtocol.java",
"diff": "@@ -297,8 +297,8 @@ public class SamlProtocol implements LoginProtocol {\nreturn (logoutRedirectUrl == null || logoutRedirectUrl.trim().isEmpty());\n}\n- protected String getNameIdFormat(SamlClient samlClient, AuthenticatedClientSessionModel clientSession) {\n- String nameIdFormat = clientSession.getNote(GeneralConstants.NAMEID_FORMAT);\n+ protected String getNameIdFormat(SamlClient samlClient, AuthenticationSessionModel authSession) {\n+ String nameIdFormat = authSession.getClientNote(GeneralConstants.NAMEID_FORMAT);\nboolean forceFormat = samlClient.forceNameIDFormat();\nString configuredNameIdFormat = samlClient.getNameIDFormat();\n@@ -368,20 +368,20 @@ public class SamlProtocol implements LoginProtocol {\n}\n@Override\n- public Response authenticated(UserSessionModel userSession, ClientSessionContext clientSessionCtx) {\n+ public Response authenticated(AuthenticationSessionModel authSession, UserSessionModel userSession, ClientSessionContext clientSessionCtx) {\nAuthenticatedClientSessionModel clientSession = clientSessionCtx.getClientSession();\nClientModel client = clientSession.getClient();\nSamlClient samlClient = new SamlClient(client);\n- String requestID = clientSession.getNote(SAML_REQUEST_ID);\n- String relayState = clientSession.getNote(GeneralConstants.RELAY_STATE);\n- String redirectUri = clientSession.getRedirectUri();\n+ String requestID = authSession.getClientNote(SAML_REQUEST_ID);\n+ String relayState = authSession.getClientNote(GeneralConstants.RELAY_STATE);\n+ String redirectUri = authSession.getRedirectUri();\nString responseIssuer = getResponseIssuer(realm);\n- String nameIdFormat = getNameIdFormat(samlClient, clientSession);\n- String nameId = getNameId(nameIdFormat, clientSession, userSession);\n+ String nameIdFormat = getNameIdFormat(samlClient, authSession);\n+ String nameId = getNameId(nameIdFormat, authSession, userSession);\nif (nameId == null) {\nreturn samlErrorMessage(\n- null, samlClient, isPostBinding(clientSession),\n+ null, samlClient, isPostBinding(authSession),\nredirectUri, JBossSAMLURIConstants.STATUS_INVALID_NAMEIDPOLICY, relayState\n);\n}\n@@ -426,7 +426,7 @@ public class SamlProtocol implements LoginProtocol {\nDocument samlDocument = null;\nKeyManager keyManager = session.keys();\nKeyManager.ActiveRsaKey keys = keyManager.getActiveRsaKey(realm);\n- boolean postBinding = isPostBinding(clientSession);\n+ boolean postBinding = isPostBinding(authSession);\nString keyName = samlClient.getXmlSigKeyInfoKeyNameTransformer().getKeyName(keys.getKid(), keys.getCertificate());\ntry {\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/services/managers/AuthenticationManager.java",
"new_path": "services/src/main/java/org/keycloak/services/managers/AuthenticationManager.java",
"diff": "@@ -733,20 +733,20 @@ public class AuthenticationManager {\npublic static Response redirectAfterSuccessfulFlow(KeycloakSession session, RealmModel realm, UserSessionModel userSession,\nClientSessionContext clientSessionCtx,\nHttpRequest request, UriInfo uriInfo, ClientConnection clientConnection,\n- EventBuilder event, String protocol) {\n- LoginProtocol protocolImpl = session.getProvider(LoginProtocol.class, protocol);\n+ EventBuilder event, AuthenticationSessionModel authSession) {\n+ LoginProtocol protocolImpl = session.getProvider(LoginProtocol.class, authSession.getProtocol());\nprotocolImpl.setRealm(realm)\n.setHttpHeaders(request.getHttpHeaders())\n.setUriInfo(uriInfo)\n.setEventBuilder(event);\n- return redirectAfterSuccessfulFlow(session, realm, userSession, clientSessionCtx, request, uriInfo, clientConnection, event, protocolImpl);\n+ return redirectAfterSuccessfulFlow(session, realm, userSession, clientSessionCtx, request, uriInfo, clientConnection, event, authSession, protocolImpl);\n}\npublic static Response redirectAfterSuccessfulFlow(KeycloakSession session, RealmModel realm, UserSessionModel userSession,\nClientSessionContext clientSessionCtx,\nHttpRequest request, UriInfo uriInfo, ClientConnection clientConnection,\n- EventBuilder event, LoginProtocol protocol) {\n+ EventBuilder event, AuthenticationSessionModel authSession, LoginProtocol protocol) {\nCookie sessionCookie = request.getHttpHeaders().getCookies().get(AuthenticationManager.KEYCLOAK_SESSION_COOKIE);\nif (sessionCookie != null) {\n@@ -787,7 +787,7 @@ public class AuthenticationManager {\nclientSession.removeNote(SSO_AUTH);\n}\n- return protocol.authenticated(userSession, clientSessionCtx);\n+ return protocol.authenticated(authSession, userSession, clientSessionCtx);\n}\n@@ -873,7 +873,7 @@ public class AuthenticationManager {\nevent.event(EventType.LOGIN);\nevent.session(userSession);\nevent.success();\n- return redirectAfterSuccessfulFlow(session, realm, userSession, clientSessionCtx, request, uriInfo, clientConnection, event, authSession.getProtocol());\n+ return redirectAfterSuccessfulFlow(session, realm, userSession, clientSessionCtx, request, uriInfo, clientConnection, event, authSession);\n}\n// Return null if action is not required. Or the name of the requiredAction in case it is required.\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/services/resources/LoginActionsService.java",
"new_path": "services/src/main/java/org/keycloak/services/resources/LoginActionsService.java",
"diff": "@@ -864,7 +864,7 @@ public class LoginActionsService {\nevent.success();\nClientSessionContext clientSessionCtx = AuthenticationProcessor.attachSession(authSession, null, session, realm, clientConnection, event);\n- return AuthenticationManager.redirectAfterSuccessfulFlow(session, realm, clientSessionCtx.getClientSession().getUserSession(), clientSessionCtx, request, session.getContext().getUri(), clientConnection, event, authSession.getProtocol());\n+ return AuthenticationManager.redirectAfterSuccessfulFlow(session, realm, clientSessionCtx.getClientSession().getUserSession(), clientSessionCtx, request, session.getContext().getUri(), clientConnection, event, authSession);\n}\nprivate void initLoginEvent(AuthenticationSessionModel authSession) {\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/OAuthClient.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/OAuthClient.java",
"diff": "@@ -760,6 +760,10 @@ public class OAuthClient {\nreturn redirectUri;\n}\n+ public String getState() {\n+ return state.getState();\n+ }\n+\npublic String getNonce() {\nreturn nonce;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/concurrency/ConcurrentLoginTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/concurrency/ConcurrentLoginTest.java",
"diff": "@@ -326,7 +326,8 @@ public class ConcurrentLoginTest extends AbstractConcurrencyTest {\nOAuthClient oauth1 = new OAuthClient();\noauth1.init(driver);\n- // Add some randomness to nonce and redirectUri. Verify that login is successful and nonce will match\n+ // Add some randomness to state, nonce and redirectUri. Verify that login is successful and \"state\" and \"nonce\" will match\n+ oauth1.stateParamHardcoded(KeycloakModelUtils.generateId());\noauth1.nonce(KeycloakModelUtils.generateId());\noauth1.redirectUri(oauth.getRedirectUri() + \"?some=\" + new Random().nextInt(1024));\nreturn oauth1;\n@@ -371,7 +372,12 @@ public class ConcurrentLoginTest extends AbstractConcurrencyTest {\nAssert.assertThat(context.getRedirectLocations(), Matchers.notNullValue());\nAssert.assertThat(context.getRedirectLocations(), Matchers.not(Matchers.empty()));\nString currentUrl = context.getRedirectLocations().get(0).toString();\n- String code = getQueryFromUrl(currentUrl).get(OAuth2Constants.CODE);\n+\n+ Map<String, String> query = getQueryFromUrl(currentUrl);\n+ String code = query.get(OAuth2Constants.CODE);\n+ String state = query.get(OAuth2Constants.STATE);\n+\n+ Assert.assertEquals(\"Invalid state.\", state, oauth1.getState());\nAtomicReference<OAuthClient.AccessTokenResponse> accessResRef = new AtomicReference<>();\ntotalInvocations.incrementAndGet();\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/oauth/AuthorizationCodeTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/oauth/AuthorizationCodeTest.java",
"diff": "@@ -37,6 +37,7 @@ import org.openqa.selenium.By;\nimport javax.ws.rs.core.UriBuilder;\nimport java.io.IOException;\n+import java.net.URI;\nimport java.util.List;\nimport static org.junit.Assert.assertEquals;\n@@ -169,4 +170,31 @@ public class AuthorizationCodeTest extends AbstractKeycloakTest {\nString codeId = events.expectLogin().assertEvent().getDetails().get(Details.CODE_ID);\n}\n+\n+ @Test\n+ public void authorizationRequestFragmentResponseModeNotKept() throws Exception {\n+ // Set response_mode=fragment and login\n+ oauth.responseMode(OIDCResponseMode.FRAGMENT.toString().toLowerCase());\n+ OAuthClient.AuthorizationEndpointResponse response = oauth.doLogin(\"test-user@localhost\", \"password\");\n+\n+ Assert.assertNotNull(response.getCode());\n+ Assert.assertNotNull(response.getState());\n+\n+ URI currentUri = new URI(driver.getCurrentUrl());\n+ Assert.assertNull(currentUri.getRawQuery());\n+ Assert.assertNotNull(currentUri.getRawFragment());\n+\n+ // Unset response_mode. The initial OIDC AuthenticationRequest won't contain \"response_mode\" parameter now and hence it should fallback to \"query\".\n+ oauth.responseMode(null);\n+ oauth.openLoginForm();\n+ response = new OAuthClient.AuthorizationEndpointResponse(oauth);\n+\n+ Assert.assertNotNull(response.getCode());\n+ Assert.assertNotNull(response.getState());\n+\n+ currentUri = new URI(driver.getCurrentUrl());\n+ Assert.assertNotNull(currentUri.getRawQuery());\n+ Assert.assertNull(currentUri.getRawFragment());\n+ }\n+\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9050 Change LoginProtocol.authenticated to read most of the values from authenticationSession |
339,383 | 14.11.2018 12:14:09 | 7,200 | 0d9964c185cda87a1af32a37c5b520e83d56f0d0 | Use attribute name from config on LDAP group creation
Use CommonLDAPGroupMapperConfig.getMembershipLdapAttribute() instead of
constant LDAPConstants.MEMBER to honor the "membership.ldap.attribute"
config key when creating a LDAP group. This fixes an error when trying
to create a group on a DS server configured with a different member
attribute than the standard "member" (eg. 389ds). | [
{
"change_type": "MODIFY",
"old_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPUtils.java",
"new_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPUtils.java",
"diff": "@@ -128,13 +128,24 @@ public class LDAPUtils {\n// roles & groups\npublic static LDAPObject createLDAPGroup(LDAPStorageProvider ldapProvider, String groupName, String groupNameAttribute, Collection<String> objectClasses,\n- String parentDn, Map<String, Set<String>> additionalAttributes) {\n+ String parentDn, Map<String, Set<String>> additionalAttributes, String membershipLdapAttribute) {\nLDAPObject ldapObject = new LDAPObject();\nldapObject.setRdnAttributeName(groupNameAttribute);\nldapObject.setObjectClasses(objectClasses);\nldapObject.setSingleAttribute(groupNameAttribute, groupName);\n+ for (String objectClassValue : objectClasses) {\n+ // On MSAD with object class \"group\", empty member must not be added. Specified object classes typically\n+ // require empty member attribute if no members have joined yet\n+ if ((objectClassValue.equalsIgnoreCase(LDAPConstants.GROUP_OF_NAMES)\n+ || objectClassValue.equalsIgnoreCase(LDAPConstants.GROUP_OF_ENTRIES)\n+ || objectClassValue.equalsIgnoreCase(LDAPConstants.GROUP_OF_UNIQUE_NAMES)) &&\n+ additionalAttributes.get(membershipLdapAttribute) == null) {\n+ ldapObject.setSingleAttribute(membershipLdapAttribute, LDAPConstants.EMPTY_MEMBER_ATTRIBUTE_VALUE);\n+ }\n+ }\n+\nLDAPDn roleDn = LDAPDn.fromString(parentDn);\nroleDn.addFirst(groupNameAttribute, groupName);\nldapObject.setDn(roleDn);\n"
},
{
"change_type": "MODIFY",
"old_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/idm/store/ldap/LDAPIdentityStore.java",
"new_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/idm/store/ldap/LDAPIdentityStore.java",
"diff": "@@ -92,7 +92,7 @@ public class LDAPIdentityStore implements IdentityStore {\n}\nString entryDN = ldapObject.getDn().toString();\n- BasicAttributes ldapAttributes = extractAttributes(ldapObject, true);\n+ BasicAttributes ldapAttributes = extractAttributesForSaving(ldapObject, true);\nthis.operationManager.createSubContext(entryDN, ldapAttributes);\nldapObject.setUuid(getEntryIdentifier(ldapObject));\n@@ -105,7 +105,7 @@ public class LDAPIdentityStore implements IdentityStore {\npublic void update(LDAPObject ldapObject) {\ncheckRename(ldapObject);\n- BasicAttributes updatedAttributes = extractAttributes(ldapObject, false);\n+ BasicAttributes updatedAttributes = extractAttributesForSaving(ldapObject, false);\nNamingEnumeration<Attribute> attributes = updatedAttributes.getAll();\nString entryDn = ldapObject.getDn().toString();\n@@ -396,47 +396,36 @@ public class LDAPIdentityStore implements IdentityStore {\n}\n- protected BasicAttributes extractAttributes(LDAPObject ldapObject, boolean isCreate) {\n+ protected BasicAttributes extractAttributesForSaving(LDAPObject ldapObject, boolean isCreate) {\nBasicAttributes entryAttributes = new BasicAttributes();\nfor (Map.Entry<String, Set<String>> attrEntry : ldapObject.getAttributes().entrySet()) {\nString attrName = attrEntry.getKey();\nSet<String> attrValue = attrEntry.getValue();\n- // ldapObject.getReadOnlyAttributeNames() are lower-cased\n- if (!ldapObject.getReadOnlyAttributeNames().contains(attrName.toLowerCase()) && (isCreate || !ldapObject.getRdnAttributeName().equalsIgnoreCase(attrName))) {\n-\nif (attrValue == null) {\n// Shouldn't happen\nlogger.warnf(\"Attribute '%s' is null on LDAP object '%s' . Using empty value to be saved to LDAP\", attrName, ldapObject.getDn().toString());\nattrValue = Collections.emptySet();\n}\n- // Ignore empty attributes during create\n- if (isCreate && attrValue.isEmpty()) {\n- continue;\n- }\n+ if (\n+ // Ignore empty attributes on create (changetype: add)\n+ !(isCreate && attrValue.isEmpty()) &&\n- BasicAttribute attr = new BasicAttribute(attrName);\n- for (String val : attrValue) {\n- if (val == null || val.toString().trim().length() == 0) {\n- val = LDAPConstants.EMPTY_ATTRIBUTE_VALUE;\n- }\n+ // Since we're extracting for saving, skip read-only attributes. ldapObject.getReadOnlyAttributeNames() are lower-cased\n+ !ldapObject.getReadOnlyAttributeNames().contains(attrName.toLowerCase()) &&\n+ // Only extract RDN for create since it can't be changed on update\n+ (isCreate || !ldapObject.getRdnAttributeName().equalsIgnoreCase(attrName))\n+ ) {\nif (getConfig().getBinaryAttributeNames().contains(attrName)) {\n// Binary attribute\n- try {\n- byte[] bytes = Base64.decode(val);\n- attr.add(bytes);\n- } catch (IOException ioe) {\n- logger.warnf(\"Wasn't able to Base64 decode the attribute value. Ignoring attribute update. LDAP DN: %s, Attribute: %s, Attribute value: %s\" + ldapObject.getDn(), attrName, attrValue);\n- }\n+ entryAttributes.put(createBinaryBasicAttribute(attrName, attrValue));\n} else {\n- attr.add(val);\n- }\n+ // Text attribute\n+ entryAttributes.put(createBasicAttribute(attrName, attrValue));\n}\n-\n- entryAttributes.put(attr);\n}\n}\n@@ -446,13 +435,6 @@ public class LDAPIdentityStore implements IdentityStore {\nfor (String objectClassValue : ldapObject.getObjectClasses()) {\nobjectClassAttribute.add(objectClassValue);\n-\n- if ((objectClassValue.equalsIgnoreCase(LDAPConstants.GROUP_OF_NAMES)\n- || objectClassValue.equalsIgnoreCase(LDAPConstants.GROUP_OF_ENTRIES)\n- || objectClassValue.equalsIgnoreCase(LDAPConstants.GROUP_OF_UNIQUE_NAMES)) &&\n- (entryAttributes.get(LDAPConstants.MEMBER) == null)) {\n- entryAttributes.put(LDAPConstants.MEMBER, LDAPConstants.EMPTY_MEMBER_ATTRIBUTE_VALUE);\n- }\n}\nentryAttributes.put(objectClassAttribute);\n@@ -461,6 +443,38 @@ public class LDAPIdentityStore implements IdentityStore {\nreturn entryAttributes;\n}\n+ private BasicAttribute createBasicAttribute(String attrName, Set<String> attrValue) {\n+ BasicAttribute attr = new BasicAttribute(attrName);\n+\n+ for (String value : attrValue) {\n+ if (value == null || value.trim().length() == 0) {\n+ value = LDAPConstants.EMPTY_ATTRIBUTE_VALUE;\n+ }\n+\n+ attr.add(value);\n+ }\n+\n+ return attr;\n+ }\n+\n+ private BasicAttribute createBinaryBasicAttribute(String attrName, Set<String> attrValue) {\n+ BasicAttribute attr = new BasicAttribute(attrName);\n+\n+ for (String value : attrValue) {\n+ if (value == null || value.trim().length() == 0) {\n+ value = LDAPConstants.EMPTY_ATTRIBUTE_VALUE;\n+ }\n+\n+ try {\n+ byte[] bytes = Base64.decode(value);\n+ attr.add(bytes);\n+ } catch (IOException ioe) {\n+ logger.warnf(\"Wasn't able to Base64 decode the attribute value. Ignoring attribute update. Attribute: %s, Attribute value: %s\", attrName, attrValue);\n+ }\n+ }\n+\n+ return attr;\n+ }\nprotected String getEntryIdentifier(final LDAPObject ldapObject) {\ntry {\n"
},
{
"change_type": "MODIFY",
"old_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/mappers/membership/group/GroupLDAPStorageMapper.java",
"new_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/mappers/membership/group/GroupLDAPStorageMapper.java",
"diff": "@@ -122,7 +122,7 @@ public class GroupLDAPStorageMapper extends AbstractLDAPStorageMapper implements\npublic LDAPObject createLDAPGroup(String groupName, Map<String, Set<String>> additionalAttributes) {\nLDAPObject ldapGroup = LDAPUtils.createLDAPGroup(ldapProvider, groupName, config.getGroupNameLdapAttribute(), config.getGroupObjectClasses(ldapProvider),\n- config.getGroupsDn(), additionalAttributes);\n+ config.getGroupsDn(), additionalAttributes, config.getMembershipLdapAttribute());\nlogger.debugf(\"Creating group [%s] to LDAP with DN [%s]\", groupName, ldapGroup.getDn().toString());\nreturn ldapGroup;\n"
},
{
"change_type": "MODIFY",
"old_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/mappers/membership/role/RoleLDAPStorageMapper.java",
"new_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/mappers/membership/role/RoleLDAPStorageMapper.java",
"diff": "@@ -245,7 +245,7 @@ public class RoleLDAPStorageMapper extends AbstractLDAPStorageMapper implements\npublic LDAPObject createLDAPRole(String roleName) {\nLDAPObject ldapRole = LDAPUtils.createLDAPGroup(ldapProvider, roleName, config.getRoleNameLdapAttribute(), config.getRoleObjectClasses(ldapProvider),\n- config.getRolesDn(), Collections.<String, Set<String>>emptyMap());\n+ config.getRolesDn(), Collections.<String, Set<String>>emptyMap(), config.getMembershipLdapAttribute());\nlogger.debugf(\"Creating role [%s] to LDAP with DN [%s]\", roleName, ldapRole.getDn().toString());\nreturn ldapRole;\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-7990 Use attribute name from config on LDAP group creation
Use CommonLDAPGroupMapperConfig.getMembershipLdapAttribute() instead of
constant LDAPConstants.MEMBER to honor the "membership.ldap.attribute"
config key when creating a LDAP group. This fixes an error when trying
to create a group on a DS server configured with a different member
attribute than the standard "member" (eg. 389ds). |
339,179 | 11.12.2018 13:43:20 | -3,600 | 81d4908c1d461abd3c1b8d6c6b26c28c30f2fff3 | Fix issue with cyclic object on firefox | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/javascript/XMLHttpRequest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/javascript/XMLHttpRequest.java",
"diff": "@@ -67,7 +67,7 @@ public class XMLHttpRequest {\ngetHeadersString() +\n\" req.onreadystatechange = function () {\" +\n\" if (req.readyState == 4) {\" +\n- \" callback({\\\"status\\\" : req.status, \\\"responseHeaders\\\" : req.getAllResponseHeaders(), \\\"res\\\" : req.response, \\\"req\\\" : req})\" +\n+ \" callback({\\\"status\\\" : req.status, \\\"responseHeaders\\\" : req.getAllResponseHeaders(), \\\"res\\\" : req.response})\" +\n\" }\" +\n\" };\" +\n\" req.send(\" + content + \");\";\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9058 Fix issue with cyclic object on firefox |
339,417 | 29.11.2018 11:59:08 | -3,600 | 5354e88f605323cc274946e4eb1a99de66956484 | Change error logging to debug for normal flow outcomes | [
{
"change_type": "MODIFY",
"old_path": "adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/BearerTokenRequestAuthenticator.java",
"new_path": "adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/BearerTokenRequestAuthenticator.java",
"diff": "@@ -27,8 +27,8 @@ import org.keycloak.jose.jws.JWSInput;\nimport org.keycloak.jose.jws.JWSInputException;\nimport org.keycloak.representations.AccessToken;\n-import javax.security.cert.X509Certificate;\nimport java.util.List;\n+import javax.security.cert.X509Certificate;\n/**\n* @author <a href=\"mailto:[email protected]\">Bill Burke</a>\n* @version $Revision: 1 $\n@@ -102,12 +102,12 @@ public class BearerTokenRequestAuthenticator {\ntry {\ntoken = AdapterTokenVerifier.verifyToken(tokenString, deployment);\n} catch (VerificationException e) {\n- log.error(\"Failed to verify token\", e);\n+ log.debug(\"Failed to verify token\");\nchallenge = challengeResponse(exchange, OIDCAuthenticationError.Reason.INVALID_TOKEN, \"invalid_token\", e.getMessage());\nreturn AuthOutcome.FAILED;\n}\nif (token.getIssuedAt() < deployment.getNotBefore()) {\n- log.error(\"Stale token\");\n+ log.debug(\"Stale token\");\nchallenge = challengeResponse(exchange, OIDCAuthenticationError.Reason.STALE_TOKEN, \"invalid_token\", \"Stale token\");\nreturn AuthOutcome.FAILED;\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8243 Change error logging to debug for normal flow outcomes |
339,465 | 12.12.2018 13:33:00 | -3,600 | 1237986fd0c652ac6957d8d0bde52ba7742b08ab | Incorrect resource_access in accessToken when clientId contains dots | [
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/protocol/oidc/mappers/AbstractUserRoleMappingMapper.java",
"new_path": "services/src/main/java/org/keycloak/protocol/oidc/mappers/AbstractUserRoleMappingMapper.java",
"diff": "@@ -82,6 +82,9 @@ abstract class AbstractUserRoleMappingMapper extends AbstractOIDCProtocolMapper\nprivate static final Pattern CLIENT_ID_PATTERN = Pattern.compile(\"\\\\$\\\\{client_id\\\\}\");\n+ private static final Pattern DOT_PATTERN = Pattern.compile(\"\\\\.\");\n+ private static final String DOT_REPLACEMENT = \"\\\\\\\\\\\\\\\\.\";\n+\nprivate static void mapClaim(IDToken token, ProtocolMapperModel mappingModel, Object attributeValue, String clientId) {\nattributeValue = OIDCAttributeMapperHelper.mapAttributeValue(mappingModel, attributeValue);\nif (attributeValue == null) return;\n@@ -92,6 +95,8 @@ abstract class AbstractUserRoleMappingMapper extends AbstractOIDCProtocolMapper\n}\nif (clientId != null) {\n+ // case when clientId contains dots\n+ clientId = DOT_PATTERN.matcher(clientId).replaceAll(DOT_REPLACEMENT);\nprotocolClaim = CLIENT_ID_PATTERN.matcher(protocolClaim).replaceAll(clientId);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/oidc/UserInfoTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/oidc/UserInfoTest.java",
"diff": "@@ -22,6 +22,8 @@ import org.junit.Rule;\nimport org.junit.Test;\nimport org.keycloak.OAuth2Constants;\nimport org.keycloak.admin.client.resource.ClientResource;\n+import org.keycloak.admin.client.resource.RealmResource;\n+import org.keycloak.admin.client.resource.UserResource;\nimport org.keycloak.common.util.PemUtils;\nimport org.keycloak.events.Details;\nimport org.keycloak.events.Errors;\n@@ -29,6 +31,8 @@ import org.keycloak.events.EventType;\nimport org.keycloak.jose.jws.Algorithm;\nimport org.keycloak.jose.jws.JWSInput;\nimport org.keycloak.jose.jws.crypto.RSAProvider;\n+import org.keycloak.representations.AccessToken;\n+import org.keycloak.representations.idm.RoleRepresentation;\nimport org.keycloak.testsuite.util.KeycloakModelUtils;\nimport org.keycloak.protocol.oidc.OIDCAdvancedConfigWrapper;\nimport org.keycloak.protocol.oidc.OIDCLoginProtocolService;\n@@ -42,6 +46,7 @@ import org.keycloak.testsuite.Assert;\nimport org.keycloak.testsuite.AssertEvents;\nimport org.keycloak.testsuite.admin.ApiUtil;\nimport org.keycloak.testsuite.util.ClientManager;\n+import org.keycloak.testsuite.util.OAuthClient;\nimport org.keycloak.testsuite.util.RealmBuilder;\nimport org.keycloak.testsuite.util.TokenSignatureUtil;\nimport org.keycloak.testsuite.util.UserInfoClientUtil;\n@@ -60,6 +65,7 @@ import javax.ws.rs.core.Response.Status;\nimport javax.ws.rs.core.UriBuilder;\nimport java.net.URI;\nimport java.security.PublicKey;\n+import java.util.Collections;\nimport java.util.List;\nimport static org.junit.Assert.assertEquals;\n@@ -152,6 +158,51 @@ public class UserInfoTest extends AbstractKeycloakTest {\n}\n}\n+\n+ // KEYCLOAK-8838\n+ @Test\n+ public void testSuccess_dotsInClientId() throws Exception {\n+ // Create client with dot in the name and with some role\n+ ClientRepresentation clientRep = org.keycloak.testsuite.util.ClientBuilder.create()\n+ .clientId(\"my.foo.client\")\n+ .addRedirectUri(\"http://foo.host\")\n+ .secret(\"password\")\n+ .directAccessGrants()\n+ .defaultRoles(\"my.foo.role\")\n+ .build();\n+\n+ RealmResource realm = adminClient.realm(\"test\");\n+\n+ Response resp = realm.clients().create(clientRep);\n+ String clientUUID = ApiUtil.getCreatedId(resp);\n+ resp.close();\n+ getCleanup().addClientUuid(clientUUID);\n+\n+ // Assign role to the user\n+ RoleRepresentation fooRole = realm.clients().get(clientUUID).roles().get(\"my.foo.role\").toRepresentation();\n+ UserResource userResource = ApiUtil.findUserByUsernameId(realm, \"test-user@localhost\");\n+ userResource.roles().clientLevel(clientUUID).add(Collections.singletonList(fooRole));\n+\n+ // Login to the new client\n+ OAuthClient.AccessTokenResponse accessTokenResponse = oauth.clientId(\"my.foo.client\")\n+ .doGrantAccessTokenRequest(\"password\", \"test-user@localhost\", \"password\");\n+\n+ AccessToken accessToken = oauth.verifyToken(accessTokenResponse.getAccessToken());\n+ Assert.assertNames(accessToken.getResourceAccess(\"my.foo.client\").getRoles(), \"my.foo.role\");\n+\n+ events.clear();\n+\n+ // Send UserInfo request and ensure it is correct\n+ Client client = ClientBuilder.newClient();\n+ try {\n+ Response response = UserInfoClientUtil.executeUserInfoRequest_getMethod(client, accessTokenResponse.getAccessToken());\n+\n+ testSuccessfulUserInfoResponse(response, \"my.foo.client\");\n+ } finally {\n+ client.close();\n+ }\n+ }\n+\n@Test\npublic void testSuccess_postMethod_header_textEntity() throws Exception {\nClient client = ClientBuilder.newClient();\n@@ -418,11 +469,16 @@ public class UserInfoTest extends AbstractKeycloakTest {\n}\nprivate void testSuccessfulUserInfoResponse(Response response) {\n+ testSuccessfulUserInfoResponse(response, \"test-app\");\n+ }\n+\n+ private void testSuccessfulUserInfoResponse(Response response, String expectedClientId) {\nevents.expect(EventType.USER_INFO_REQUEST)\n.session(Matchers.notNullValue(String.class))\n.detail(Details.AUTH_METHOD, Details.VALIDATE_ACCESS_TOKEN)\n.detail(Details.USERNAME, \"test-user@localhost\")\n.detail(Details.SIGNATURE_REQUIRED, \"false\")\n+ .client(expectedClientId)\n.assertEvent();\nUserInfoClientUtil.testSuccessfulUserInfoResponse(response, \"test-user@localhost\", \"test-user@localhost\");\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8838 Incorrect resource_access in accessToken when clientId contains dots |
339,179 | 02.11.2018 21:01:15 | -3,600 | 26c8af5369dffa84d088dfe7824af69fdc4e859e | Add tests for native promises | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/javascript/JSObjectBuilder.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/javascript/JSObjectBuilder.java",
"diff": "@@ -55,6 +55,10 @@ public class JSObjectBuilder {\nreturn this;\n}\n+ public boolean contains(String key, Object value) {\n+ return arguments.containsKey(key) && arguments.get(key).equals(value);\n+ }\n+\npublic JSObjectBuilder add(String key, Object value) {\narguments.put(key, value);\nreturn this;\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/javascript/JavascriptTestExecutor.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/javascript/JavascriptTestExecutor.java",
"diff": "@@ -130,13 +130,27 @@ public class JavascriptTestExecutor {\nString arguments = argumentsBuilder.build();\n- Object output = jsExecutor.executeAsyncScript(\n- \"var callback = arguments[arguments.length - 1];\" +\n+ String script;\n+\n+ // phantomjs do not support Native promises\n+ if (argumentsBuilder.contains(\"promiseType\", \"native\") && !\"phantomjs\".equals(System.getProperty(\"js.browser\"))) {\n+ script = \"var callback = arguments[arguments.length - 1];\" +\n+ \" window.keycloak.init(\" + arguments + \").then(function (authenticated) {\" +\n+ \" callback(\\\"Init Success (\\\" + (authenticated ? \\\"Authenticated\\\" : \\\"Not Authenticated\\\") + \\\")\\\");\" +\n+ \" }, function () {\" +\n+ \" callback(\\\"Init Error\\\");\" +\n+ \" });\";\n+ } else {\n+ script = \"var callback = arguments[arguments.length - 1];\" +\n\" window.keycloak.init(\" + arguments + \").success(function (authenticated) {\" +\n\" callback(\\\"Init Success (\\\" + (authenticated ? \\\"Authenticated\\\" : \\\"Not Authenticated\\\") + \\\")\\\");\" +\n\" }).error(function () {\" +\n\" callback(\\\"Init Error\\\");\" +\n- \" });\");\n+ \" });\";\n+ }\n+\n+\n+ Object output = jsExecutor.executeAsyncScript(script);\nif (validator != null) {\nvalidator.validate(jsDriver, output, events);\n@@ -159,8 +173,20 @@ public class JavascriptTestExecutor {\n}\npublic JavascriptTestExecutor refreshToken(int value, JavascriptStateValidator validator) {\n- Object output = jsExecutor.executeAsyncScript(\n- \"var callback = arguments[arguments.length - 1];\" +\n+ String script;\n+ if (useNativePromises()) {\n+ script = \"var callback = arguments[arguments.length - 1];\" +\n+ \" window.keycloak.updateToken(\" + Integer.toString(value) + \").then(function (refreshed) {\" +\n+ \" if (refreshed) {\" +\n+ \" callback(window.keycloak.tokenParsed);\" +\n+ \" } else {\" +\n+ \" callback('Token not refreshed, valid for ' + Math.round(window.keycloak.tokenParsed.exp + window.keycloak.timeSkew - new Date().getTime() / 1000) + ' seconds');\" +\n+ \" }\" +\n+ \" }, function () {\" +\n+ \" callback('Failed to refresh token');\" +\n+ \" });\";\n+ } else {\n+ script = \"var callback = arguments[arguments.length - 1];\" +\n\" window.keycloak.updateToken(\" + Integer.toString(value) + \").success(function (refreshed) {\" +\n\" if (refreshed) {\" +\n\" callback(window.keycloak.tokenParsed);\" +\n@@ -169,7 +195,10 @@ public class JavascriptTestExecutor {\n\" }\" +\n\" }).error(function () {\" +\n\" callback('Failed to refresh token');\" +\n- \" });\");\n+ \" });\";\n+ }\n+\n+ Object output = jsExecutor.executeAsyncScript(script);\nif(validator != null) {\nvalidator.validate(jsDriver, output, events);\n@@ -178,6 +207,12 @@ public class JavascriptTestExecutor {\nreturn this;\n}\n+ public boolean useNativePromises() {\n+ return (boolean) jsExecutor.executeScript(\"if (typeof window.keycloak !== 'undefined') {\" +\n+ \"return window.keycloak.useNativePromise\" +\n+ \"} else { return false}\");\n+ }\n+\npublic JavascriptTestExecutor openAccountPage(JavascriptStateValidator validator) {\njsExecutor.executeScript(\"window.keycloak.accountManagement()\");\nwaitForPageToLoad();\n@@ -198,13 +233,24 @@ public class JavascriptTestExecutor {\npublic JavascriptTestExecutor getProfile(JavascriptStateValidator validator) {\n- Object output = jsExecutor.executeAsyncScript(\n- \"var callback = arguments[arguments.length - 1];\" +\n+ String script;\n+ if (useNativePromises()) {\n+ script = \"var callback = arguments[arguments.length - 1];\" +\n+ \" window.keycloak.loadUserProfile().then(function (profile) {\" +\n+ \" callback(profile);\" +\n+ \" }, function () {\" +\n+ \" callback('Failed to load profile');\" +\n+ \" });\";\n+ } else {\n+ script = \"var callback = arguments[arguments.length - 1];\" +\n\" window.keycloak.loadUserProfile().success(function (profile) {\" +\n\" callback(profile);\" +\n\" }).error(function () {\" +\n\" callback('Failed to load profile');\" +\n- \" });\");\n+ \" });\";\n+ }\n+\n+ Object output = jsExecutor.executeAsyncScript(script);\nif(validator != null) {\nvalidator.validate(jsDriver, output, events);\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/javascript/JavascriptAdapterTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/javascript/JavascriptAdapterTest.java",
"diff": "@@ -58,7 +58,7 @@ import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;\npublic class JavascriptAdapterTest extends AbstractJavascriptTest {\nprivate String testAppUrl;\n- private JavascriptTestExecutor testExecutor;\n+ protected JavascriptTestExecutor testExecutor;\nprivate static int TIME_SKEW_TOLERANCE = 3;\n@Rule\n@@ -96,7 +96,7 @@ public class JavascriptAdapterTest extends AbstractJavascriptTest {\nsetStandardFlowForClient();\n}\n- private JSObjectBuilder defaultArguments() {\n+ protected JSObjectBuilder defaultArguments() {\nreturn JSObjectBuilder.create().defaultSettings();\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/javascript/JavascriptAdapterWithNativePromisesTest.java",
"diff": "+package org.keycloak.testsuite.adapter.javascript;\n+\n+import org.junit.Assume;\n+import org.junit.Before;\n+import org.junit.Test;\n+import org.keycloak.testsuite.util.javascript.JSObjectBuilder;\n+\n+import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;\n+\n+public class JavascriptAdapterWithNativePromisesTest extends JavascriptAdapterTest {\n+ @Override\n+ protected JSObjectBuilder defaultArguments() {\n+ return super.defaultArguments().add(\"promiseType\", \"native\");\n+ }\n+\n+ @Before\n+ public void skipOnPhantomJS() {\n+ Assume.assumeTrue(\"Native promises are not supported on PhantomJS\", !\"phantomjs\".equals(System.getProperty(\"js.browser\")));\n+ }\n+\n+ @Test\n+ @Override\n+ public void reentrancyCallbackTest() {\n+ testExecutor.logInAndInit(defaultArguments(), testUser, this::assertSuccessfullyLoggedIn)\n+ .executeAsyncScript(\n+ \"var callback = arguments[arguments.length - 1];\" +\n+ \"keycloak.updateToken(60).then(function () {\" +\n+ \" event(\\\"First callback\\\");\" +\n+ \" keycloak.updateToken(60).then(function () {\" +\n+ \" event(\\\"Second callback\\\");\" +\n+ \" callback(\\\"Success\\\");\" +\n+ \" });\" +\n+ \" }\" +\n+ \");\"\n+ , (driver1, output, events) -> {\n+ waitUntilElement(events).text().contains(\"First callback\");\n+ waitUntilElement(events).text().contains(\"Second callback\");\n+ waitUntilElement(events).text().not().contains(\"Auth Logout\");\n+ }\n+ );\n+ }\n+}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8533 Add tests for native promises |
339,179 | 11.12.2018 16:01:32 | -3,600 | 27fc481069b501b72beedbe44b2888a1be661f6c | Added / to policy enforcer config
EAP6 does not add index.jsp to requested url | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/test-apps/servlet-policy-enforcer/src/main/webapp/WEB-INF/keycloak.json",
"new_path": "testsuite/integration-arquillian/test-apps/servlet-policy-enforcer/src/main/webapp/WEB-INF/keycloak.json",
"diff": "\"name\": \"Welcome Resource\",\n\"path\": \"/index.jsp\"\n},\n+ {\n+ \"name\": \"Welcome Resource\",\n+ \"path\": \"/\"\n+ },\n{\n\"name\": \"Pattern 1\",\n\"path\": \"/resource/{pattern}/{sub-resource}\"\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8825 Added / to policy enforcer config
EAP6 does not add index.jsp to requested url |
339,520 | 15.11.2018 18:40:13 | -3,600 | 044926225f891e787e010e24a97098c714d4a91a | Fix wrong 'for' attribute on input label | [
{
"change_type": "MODIFY",
"old_path": "themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html",
"new_path": "themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html",
"diff": "</div>\n<div class=\"form-group\">\n- <label class=\"col-md-2 control-label\" for=\"enabled\">{{:: 'userManagedAccess' | translate}}</label>\n+ <label class=\"col-md-2 control-label\" for=\"userManagedAccessAllowed\">{{:: 'userManagedAccess' | translate}}</label>\n<div class=\"col-md-6\">\n<input ng-model=\"realm.userManagedAccessAllowed\" name=\"userManagedAccessAllowed\" id=\"userManagedAccessAllowed\" onoffswitch on-text=\"{{:: 'onText' | translate}}\" off-text=\"{{:: 'offText' | translate}}\" />\n</div>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | Fix wrong 'for' attribute on input label |
339,331 | 14.09.2018 14:34:14 | -7,200 | 68873c29b7bd3927e12a74730c48c27a3aee3063 | Fix on type for KeycloakInstance.realmAccess and KeycloakInstance.ressourceAccess | [
{
"change_type": "MODIFY",
"old_path": "adapters/oidc/js/src/main/resources/keycloak.d.ts",
"new_path": "adapters/oidc/js/src/main/resources/keycloak.d.ts",
"diff": "@@ -226,6 +226,14 @@ declare namespace Keycloak {\nresource_access?: string[];\n}\n+ interface KeycloakResourceAccess {\n+ [key: string]: KeycloakRoles\n+ }\n+\n+ interface KeycloakRoles {\n+ roles: string[];\n+ }\n+\n// export interface KeycloakUserInfo {}\n/**\n@@ -263,12 +271,12 @@ declare namespace Keycloak {\n/**\n* The realm roles associated with the token.\n*/\n- realmAccess?: { roles: string[] };\n+ realmAccess?: KeycloakRoles;\n/**\n* The resource roles associated with the token.\n*/\n- resourceAccess?: string[];\n+ resourceAccess?: KeycloakResourceAccess;\n/**\n* The base64 encoded token that can be sent in the Authorization header in\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | Fix on type for KeycloakInstance.realmAccess and KeycloakInstance.ressourceAccess |
339,187 | 14.12.2018 03:07:07 | -3,600 | 4150daa9cb62d5bdc38fa591778bda31209248a5 | Change wrong params passed to /groups endpoint in groups and user panel | [
{
"change_type": "MODIFY",
"old_path": "themes/src/main/resources/theme/base/admin/resources/js/controllers/groups.js",
"new_path": "themes/src/main/resources/theme/base/admin/resources/js/controllers/groups.js",
"diff": "@@ -469,12 +469,12 @@ module.controller('DefaultGroupsCtrl', function($scope, $q, realm, Groups, Group\nvar refreshAvailableGroups = function (search) {\nvar first = ($scope.currentPage * $scope.pageSize) - $scope.pageSize;\nvar queryParams = {\n- realm : realm.id,\n+ realm : realm.realm,\nfirst : first,\nmax : $scope.pageSize\n};\nvar countParams = {\n- realm : realm.id,\n+ realm : realm.realm,\ntop : 'true'\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js",
"new_path": "themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js",
"diff": "@@ -1026,13 +1026,13 @@ module.controller('UserGroupMembershipCtrl', function($scope, $q, realm, user, U\nvar refreshAvailableGroups = function (search) {\nvar first = ($scope.currentPage * $scope.pageSize) - $scope.pageSize;\nvar queryParams = {\n- realm : realm.id,\n+ realm : realm.realm,\nfirst : first,\nmax : $scope.pageSize\n};\nvar countParams = {\n- realm : realm.id,\n+ realm : realm.realm,\ntop : 'true'\n};\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9056 Change wrong params passed to /groups endpoint in groups and user panel |
339,343 | 14.12.2018 10:29:18 | -3,600 | 4d8b3424d13d76f6a469c8c65d1509d0369f6729 | update licenses.xml files | [
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/licenses/keycloak/licenses.xml",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/licenses/keycloak/licenses.xml",
"diff": "<dependency>\n<groupId>org.codehaus.plexus</groupId>\n<artifactId>plexus-utils</artifactId>\n- <version>3.0.20</version>\n+ <version>3.0.22</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.codehaus.plexus</groupId>\n<artifactId>plexus-component-annotations</artifactId>\n- <version>1.5.5</version>\n+ <version>1.6.0</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.apache.ant</groupId>\n<artifactId>ant-launcher</artifactId>\n- <version>1.8.3</version>\n+ <version>1.8.4</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=ant.git;a=blob_plain;f=LICENSE;hb=rel/1.8.3</url>\n+ <url>https://git-wip-us.apache.org/repos/asf?p=ant.git;a=blob_plain;f=LICENSE;hb=rel/1.8.4</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.apache.ant</groupId>\n<artifactId>ant</artifactId>\n- <version>1.8.3</version>\n+ <version>1.8.4</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=ant.git;a=blob_plain;f=LICENSE;hb=rel/1.8.3</url>\n+ <url>https://git-wip-us.apache.org/repos/asf?p=ant.git;a=blob_plain;f=LICENSE;hb=rel/1.8.4</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.apache.maven.wagon</groupId>\n<artifactId>wagon-http-shared</artifactId>\n- <version>2.6</version>\n+ <version>3.0</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.apache.maven.wagon</groupId>\n<artifactId>wagon-provider-api</artifactId>\n- <version>2.6</version>\n+ <version>3.0</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.apache.maven.wagon</groupId>\n<artifactId>wagon-http</artifactId>\n- <version>2.6</version>\n+ <version>3.0</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-compat</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-model-builder</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-core</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-model</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-artifact</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-plugin-api</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-settings</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-repository-metadata</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-aether-provider</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-settings-builder</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.mvel</groupId>\n<artifactId>mvel2</artifactId>\n- <version>2.2.8.Final</version>\n+ <version>2.4.0.Final</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://raw.githubusercontent.com/mvel/mvel/mvel2-2.2.8.Final/LICENSE.txt</url>\n+ <url>https://raw.githubusercontent.com/mvel/mvel/mvel2-2.4.0.Final/LICENSE.txt</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n- <groupId>org.sonatype.sisu.inject</groupId>\n+ <groupId>com.google.inject.extensions</groupId>\n<artifactId>guice-servlet</artifactId>\n- <version>3.2.3</version>\n+ <version>4.0</version>\n<licenses>\n<license>\n- <name>Eclipse Public License 1.0</name>\n- <url>http://git.eclipse.org/c/sisu/org.eclipse.sisu.inject.git/plain/LICENSE.txt?h=releases/0.3.2</url>\n+ <name>Apache Software License 2.0</name>\n+ <url>https://raw.githubusercontent.com/google/guice/4.0/COPYING</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.sisu</groupId>\n<artifactId>org.eclipse.sisu.plexus</artifactId>\n- <version>0.3.0.M1</version>\n+ <version>0.3.2</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>http://git.eclipse.org/c/sisu/org.eclipse.sisu.inject.git/plain/LICENSE.txt?h=milestones/0.3.0.M1</url>\n+ <url>http://git.eclipse.org/c/sisu/org.eclipse.sisu.inject.git/tree/LICENSE.txt?h=releases/0.3.2</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.sisu</groupId>\n<artifactId>org.eclipse.sisu.inject</artifactId>\n- <version>0.3.0.M1</version>\n+ <version>0.3.2</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>http://git.eclipse.org/c/sisu/org.eclipse.sisu.inject.git/plain/LICENSE.txt?h=milestones/0.3.0.M1</url>\n+ <url>http://git.eclipse.org/c/sisu/org.eclipse.sisu.inject.git/tree/LICENSE.txt?h=releases/0.3.2</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.aether</groupId>\n<artifactId>aether-util</artifactId>\n- <version>1.0.0.v20140518</version>\n+ <version>1.1.0</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>https://raw.githubusercontent.com/jvanzyl/aether-core/aether-1.0.0.v20140518/epl-v10.html</url>\n+ <url>https://www.eclipse.org/legal/epl-v10.html</url> <!-- Archived project: https://wiki.eclipse.org/Development_Resources/HOWTO/Archived_Phase -->\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.aether</groupId>\n<artifactId>aether-impl</artifactId>\n- <version>1.0.0.v20140518</version>\n+ <version>1.1.0</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>https://raw.githubusercontent.com/jvanzyl/aether-core/aether-1.0.0.v20140518/epl-v10.html</url>\n+ <url>https://www.eclipse.org/legal/epl-v10.html</url> <!-- Archived project: https://wiki.eclipse.org/Development_Resources/HOWTO/Archived_Phase -->\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.aether</groupId>\n<artifactId>aether-transport-wagon</artifactId>\n- <version>1.0.0.v20140518</version>\n+ <version>1.1.0</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>https://raw.githubusercontent.com/jvanzyl/aether-core/aether-1.0.0.v20140518/epl-v10.html</url>\n+ <url>https://www.eclipse.org/legal/epl-v10.html</url> <!-- Archived project: https://wiki.eclipse.org/Development_Resources/HOWTO/Archived_Phase -->\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.aether</groupId>\n<artifactId>aether-connector-basic</artifactId>\n- <version>1.0.0.v20140518</version>\n+ <version>1.1.0</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>https://raw.githubusercontent.com/jvanzyl/aether-core/aether-1.0.0.v20140518/epl-v10.html</url>\n+ <url>https://www.eclipse.org/legal/epl-v10.html</url> <!-- Archived project: https://wiki.eclipse.org/Development_Resources/HOWTO/Archived_Phase -->\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.aether</groupId>\n<artifactId>aether-transport-file</artifactId>\n- <version>1.0.0.v20140518</version>\n+ <version>1.1.0</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>https://raw.githubusercontent.com/jvanzyl/aether-core/aether-1.0.0.v20140518/epl-v10.html</url>\n+ <url>https://www.eclipse.org/legal/epl-v10.html</url> <!-- Archived project: https://wiki.eclipse.org/Development_Resources/HOWTO/Archived_Phase -->\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.aether</groupId>\n<artifactId>aether-api</artifactId>\n- <version>1.0.0.v20140518</version>\n+ <version>1.1.0</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>https://raw.githubusercontent.com/jvanzyl/aether-core/aether-1.0.0.v20140518/epl-v10.html</url>\n+ <url>https://www.eclipse.org/legal/epl-v10.html</url> <!-- Archived project: https://wiki.eclipse.org/Development_Resources/HOWTO/Archived_Phase -->\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.aether</groupId>\n<artifactId>aether-spi</artifactId>\n- <version>1.0.0.v20140518</version>\n+ <version>1.1.0</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>https://raw.githubusercontent.com/jvanzyl/aether-core/aether-1.0.0.v20140518/epl-v10.html</url>\n+ <url>https://www.eclipse.org/legal/epl-v10.html</url> <!-- Archived project: https://wiki.eclipse.org/Development_Resources/HOWTO/Archived_Phase -->\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.aether</groupId>\n<artifactId>aether-transport-http</artifactId>\n- <version>1.0.0.v20140518</version>\n+ <version>1.1.0</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>https://raw.githubusercontent.com/jvanzyl/aether-core/aether-1.0.0.v20140518/epl-v10.html</url>\n+ <url>https://www.eclipse.org/legal/epl-v10.html</url> <!-- Archived project: https://wiki.eclipse.org/Development_Resources/HOWTO/Archived_Phase -->\n</license>\n</licenses>\n</dependency>\n</license>\n</licenses>\n</dependency>\n- <dependency>\n- <groupId>org.sonatype.sisu</groupId>\n- <artifactId>sisu-guice</artifactId>\n- <version>3.2.3</version>\n- <licenses>\n- <license>\n- <name>Eclipse Public License 1.0</name>\n- <url>http://git.eclipse.org/c/sisu/org.eclipse.sisu.inject.git/plain/LICENSE.txt?h=releases/0.3.2</url>\n- </license>\n- </licenses>\n- </dependency>\n<dependency>\n<groupId>org.sonatype.plexus</groupId>\n<artifactId>plexus-cipher</artifactId>\n<dependency>\n<groupId>org.antlr</groupId>\n<artifactId>antlr-runtime</artifactId>\n- <version>3.5</version>\n+ <version>3.5.2</version>\n<licenses>\n<license>\n<name>BSD 3-clause New or Revised License</name>\n- <url>https://raw.githubusercontent.com/antlr/antlr3/antlr-3.5/runtime/Python/LICENSE</url>\n+ <url>https://raw.githubusercontent.com/antlr/antlr3/3.5.2/runtime/Python/LICENSE</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>com.thoughtworks.xstream</groupId>\n<artifactId>xstream</artifactId>\n- <version>1.4.9</version>\n+ <version>1.4.10</version>\n<licenses>\n<license>\n<name>BSD 3-clause New or Revised License</name>\n- <url>https://raw.githubusercontent.com/x-stream/xstream/XSTREAM_1_4_9/LICENSE.txt</url>\n+ <url>https://raw.githubusercontent.com/x-stream/xstream/XSTREAM_1_4_10/LICENSE.txt</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.kie</groupId>\n<artifactId>kie-api</artifactId>\n- <version>6.5.0.Final</version>\n+ <version>7.11.0.Final</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://raw.githubusercontent.com/kiegroup/drools/6.5.0.Final/LICENSE-ASL-2.0.txt</url>\n+ <url>https://raw.githubusercontent.com/kiegroup/drools/7.11.0.Final/LICENSE-ASL-2.0.txt</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.kie</groupId>\n<artifactId>kie-ci</artifactId>\n- <version>6.5.0.Final</version>\n+ <version>7.11.0.Final</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://raw.githubusercontent.com/kiegroup/droolsjbpm-knowledge/6.5.0.Final/LICENSE-ASL-2.0.txt</url>\n+ <url>https://raw.githubusercontent.com/kiegroup/droolsjbpm-knowledge/7.11.0.Final/LICENSE-ASL-2.0.txt</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.kie</groupId>\n<artifactId>kie-internal</artifactId>\n- <version>6.5.0.Final</version>\n+ <version>7.11.0.Final</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://raw.githubusercontent.com/kiegroup/droolsjbpm-knowledge/6.5.0.Final/LICENSE-ASL-2.0.txt</url>\n+ <url>https://raw.githubusercontent.com/kiegroup/droolsjbpm-knowledge/7.11.0.Final/LICENSE-ASL-2.0.txt</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.drools</groupId>\n<artifactId>drools-compiler</artifactId>\n- <version>6.5.0.Final</version>\n+ <version>7.11.0.Final</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://raw.githubusercontent.com/kiegroup/drools/6.5.0.Final/LICENSE-ASL-2.0.txt</url>\n+ <url>https://raw.githubusercontent.com/kiegroup/drools/7.11.0.Final/LICENSE-ASL-2.0.txt</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.drools</groupId>\n<artifactId>drools-core</artifactId>\n- <version>6.5.0.Final</version>\n+ <version>7.11.0.Final</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://raw.githubusercontent.com/kiegroup/drools/6.5.0.Final/LICENSE-ASL-2.0.txt</url>\n+ <url>https://raw.githubusercontent.com/kiegroup/drools/7.11.0.Final/LICENSE-ASL-2.0.txt</url>\n</license>\n</licenses>\n</dependency>\n<other>\n<description>jQuery</description>\n<locations>\n- <file>themes/keycloak/common/resources/lib/jquery/jquery-1.10.2.js</file>\n+ <directory>themes/keycloak/common/resources/node_modules/jquery/dist</directory>\n</locations>\n<licenses>\n<license>\n<name>MIT License</name>\n- <url>https://raw.githubusercontent.com/jquery/jquery/1.10.2/MIT-LICENSE.txt</url>\n+ <url>https://raw.githubusercontent.com/jquery/jquery/3.2.1/LICENSE.txt</url>\n</license>\n</licenses>\n</other>\n<other>\n<description>angular-translate</description>\n<locations>\n- <file>themes/keycloak/common/resources/lib/angular/angular-translate.js</file>\n- <file>themes/keycloak/common/resources/lib/angular/angular-translate-loader-url.js</file>\n+ <directory>themes/keycloak/common/resources/node_modules/angular-translate/dist</directory>\n+ <directory>themes/keycloak/common/resources/node_modules/angular-translate-loader-url</directory>\n+ <directory>themes/keycloak/common/resources/node_modules/angular-translate/dist/angular-translate-loader-partial</directory>\n</locations>\n<licenses>\n<license>\n<name>MIT License</name>\n- <url>https://raw.githubusercontent.com/angular-translate/angular-translate/2.7.2/LICENSE</url>\n+ <url>https://raw.githubusercontent.com/angular-translate/angular-translate/2.15.1/LICENSE</url>\n</license>\n</licenses>\n</other>\n<other>\n<description>ui-select2</description>\n<locations>\n- <file>themes/keycloak/common/resources/lib/angular/select2.js</file>\n+ <directory>themes/keycloak/common/resources/node_modules/angular-ui-select2</directory>\n</locations>\n<licenses>\n<license>\n<other>\n<description>Select2</description>\n<locations>\n- <directory>themes/keycloak/common/resources/lib/select2-3.4.1</directory>\n+ <directory>themes/keycloak/common/resources/node_modules/select2</directory>\n</locations>\n<licenses>\n<license>\n"
},
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/licenses/rh-sso/licenses.xml",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/licenses/rh-sso/licenses.xml",
"diff": "<dependency>\n<groupId>org.codehaus.plexus</groupId>\n<artifactId>plexus-utils</artifactId>\n- <version>3.0.20</version>\n+ <version>3.0.22</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.codehaus.plexus</groupId>\n<artifactId>plexus-component-annotations</artifactId>\n- <version>1.5.5</version>\n+ <version>1.6.0</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.apache.ant</groupId>\n<artifactId>ant-launcher</artifactId>\n- <version>1.8.3</version>\n+ <version>1.8.4</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=ant.git;a=blob_plain;f=LICENSE;hb=rel/1.8.3</url>\n+ <url>https://git-wip-us.apache.org/repos/asf?p=ant.git;a=blob_plain;f=LICENSE;hb=rel/1.8.4</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.apache.ant</groupId>\n<artifactId>ant</artifactId>\n- <version>1.8.3</version>\n+ <version>1.8.4</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=ant.git;a=blob_plain;f=LICENSE;hb=rel/1.8.3</url>\n+ <url>https://git-wip-us.apache.org/repos/asf?p=ant.git;a=blob_plain;f=LICENSE;hb=rel/1.8.4</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.apache.maven.wagon</groupId>\n<artifactId>wagon-http-shared</artifactId>\n- <version>2.6</version>\n+ <version>3.0</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.apache.maven.wagon</groupId>\n<artifactId>wagon-provider-api</artifactId>\n- <version>2.6</version>\n+ <version>3.0</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.apache.maven.wagon</groupId>\n<artifactId>wagon-http</artifactId>\n- <version>2.6</version>\n+ <version>3.0</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-compat</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-model-builder</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-core</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-model</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-artifact</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-plugin-api</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-settings</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-repository-metadata</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-aether-provider</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.apache.maven</groupId>\n<artifactId>maven-settings-builder</artifactId>\n- <version>3.2.5</version>\n+ <version>3.3.9</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.mvel</groupId>\n<artifactId>mvel2</artifactId>\n- <version>2.2.8.Final</version>\n+ <version>2.4.0.Final</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://raw.githubusercontent.com/mvel/mvel/mvel2-2.2.8.Final/LICENSE.txt</url>\n+ <url>https://raw.githubusercontent.com/mvel/mvel/mvel2-2.4.0.Final/LICENSE.txt</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n- <groupId>org.sonatype.sisu.inject</groupId>\n+ <groupId>com.google.inject.extensions</groupId>\n<artifactId>guice-servlet</artifactId>\n- <version>3.2.3</version>\n+ <version>4.0</version>\n<licenses>\n<license>\n- <name>Eclipse Public License 1.0</name>\n- <url>http://git.eclipse.org/c/sisu/org.eclipse.sisu.inject.git/plain/LICENSE.txt?h=releases/0.3.2</url>\n+ <name>Apache Software License 2.0</name>\n+ <url>https://raw.githubusercontent.com/google/guice/4.0/COPYING</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.sisu</groupId>\n<artifactId>org.eclipse.sisu.plexus</artifactId>\n- <version>0.3.0.M1</version>\n+ <version>0.3.2</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>http://git.eclipse.org/c/sisu/org.eclipse.sisu.inject.git/plain/LICENSE.txt?h=milestones/0.3.0.M1</url>\n+ <url>http://git.eclipse.org/c/sisu/org.eclipse.sisu.inject.git/tree/LICENSE.txt?h=releases/0.3.2</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.sisu</groupId>\n<artifactId>org.eclipse.sisu.inject</artifactId>\n- <version>0.3.0.M1</version>\n+ <version>0.3.2</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>http://git.eclipse.org/c/sisu/org.eclipse.sisu.inject.git/plain/LICENSE.txt?h=milestones/0.3.0.M1</url>\n+ <url>http://git.eclipse.org/c/sisu/org.eclipse.sisu.inject.git/tree/LICENSE.txt?h=releases/0.3.2</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.aether</groupId>\n<artifactId>aether-util</artifactId>\n- <version>1.0.0.v20140518</version>\n+ <version>1.1.0</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>https://raw.githubusercontent.com/jvanzyl/aether-core/aether-1.0.0.v20140518/epl-v10.html</url>\n+ <url>https://www.eclipse.org/legal/epl-v10.html</url> <!-- Archived project: https://wiki.eclipse.org/Development_Resources/HOWTO/Archived_Phase -->\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.aether</groupId>\n<artifactId>aether-impl</artifactId>\n- <version>1.0.0.v20140518</version>\n+ <version>1.1.0</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>https://raw.githubusercontent.com/jvanzyl/aether-core/aether-1.0.0.v20140518/epl-v10.html</url>\n+ <url>https://www.eclipse.org/legal/epl-v10.html</url> <!-- Archived project: https://wiki.eclipse.org/Development_Resources/HOWTO/Archived_Phase -->\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.aether</groupId>\n<artifactId>aether-transport-wagon</artifactId>\n- <version>1.0.0.v20140518</version>\n+ <version>1.1.0</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>https://raw.githubusercontent.com/jvanzyl/aether-core/aether-1.0.0.v20140518/epl-v10.html</url>\n+ <url>https://www.eclipse.org/legal/epl-v10.html</url> <!-- Archived project: https://wiki.eclipse.org/Development_Resources/HOWTO/Archived_Phase -->\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.aether</groupId>\n<artifactId>aether-connector-basic</artifactId>\n- <version>1.0.0.v20140518</version>\n+ <version>1.1.0</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>https://raw.githubusercontent.com/jvanzyl/aether-core/aether-1.0.0.v20140518/epl-v10.html</url>\n+ <url>https://www.eclipse.org/legal/epl-v10.html</url> <!-- Archived project: https://wiki.eclipse.org/Development_Resources/HOWTO/Archived_Phase -->\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.aether</groupId>\n<artifactId>aether-transport-file</artifactId>\n- <version>1.0.0.v20140518</version>\n+ <version>1.1.0</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>https://raw.githubusercontent.com/jvanzyl/aether-core/aether-1.0.0.v20140518/epl-v10.html</url>\n+ <url>https://www.eclipse.org/legal/epl-v10.html</url> <!-- Archived project: https://wiki.eclipse.org/Development_Resources/HOWTO/Archived_Phase -->\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.aether</groupId>\n<artifactId>aether-api</artifactId>\n- <version>1.0.0.v20140518</version>\n+ <version>1.1.0</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>https://raw.githubusercontent.com/jvanzyl/aether-core/aether-1.0.0.v20140518/epl-v10.html</url>\n+ <url>https://www.eclipse.org/legal/epl-v10.html</url> <!-- Archived project: https://wiki.eclipse.org/Development_Resources/HOWTO/Archived_Phase -->\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.aether</groupId>\n<artifactId>aether-spi</artifactId>\n- <version>1.0.0.v20140518</version>\n+ <version>1.1.0</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>https://raw.githubusercontent.com/jvanzyl/aether-core/aether-1.0.0.v20140518/epl-v10.html</url>\n+ <url>https://www.eclipse.org/legal/epl-v10.html</url> <!-- Archived project: https://wiki.eclipse.org/Development_Resources/HOWTO/Archived_Phase -->\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.eclipse.aether</groupId>\n<artifactId>aether-transport-http</artifactId>\n- <version>1.0.0.v20140518</version>\n+ <version>1.1.0</version>\n<licenses>\n<license>\n<name>Eclipse Public License 1.0</name>\n- <url>https://raw.githubusercontent.com/jvanzyl/aether-core/aether-1.0.0.v20140518/epl-v10.html</url>\n+ <url>https://www.eclipse.org/legal/epl-v10.html</url> <!-- Archived project: https://wiki.eclipse.org/Development_Resources/HOWTO/Archived_Phase -->\n</license>\n</licenses>\n</dependency>\n</license>\n</licenses>\n</dependency>\n- <dependency>\n- <groupId>org.sonatype.sisu</groupId>\n- <artifactId>sisu-guice</artifactId>\n- <version>3.2.3</version>\n- <licenses>\n- <license>\n- <name>Eclipse Public License 1.0</name>\n- <url>http://git.eclipse.org/c/sisu/org.eclipse.sisu.inject.git/plain/LICENSE.txt?h=releases/0.3.2</url>\n- </license>\n- </licenses>\n- </dependency>\n<dependency>\n<groupId>org.sonatype.plexus</groupId>\n<artifactId>plexus-cipher</artifactId>\n<dependency>\n<groupId>org.antlr</groupId>\n<artifactId>antlr-runtime</artifactId>\n- <version>3.5</version>\n+ <version>3.5.2</version>\n<licenses>\n<license>\n<name>BSD 3-clause New or Revised License</name>\n- <url>https://raw.githubusercontent.com/antlr/antlr3/antlr-3.5/runtime/Python/LICENSE</url>\n+ <url>https://raw.githubusercontent.com/antlr/antlr3/3.5.2/runtime/Python/LICENSE</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>com.thoughtworks.xstream</groupId>\n<artifactId>xstream</artifactId>\n- <version>1.4.9</version>\n+ <version>1.4.10</version>\n<licenses>\n<license>\n<name>BSD 3-clause New or Revised License</name>\n- <url>https://raw.githubusercontent.com/x-stream/xstream/XSTREAM_1_4_9/LICENSE.txt</url>\n+ <url>https://raw.githubusercontent.com/x-stream/xstream/XSTREAM_1_4_10/LICENSE.txt</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.kie</groupId>\n<artifactId>kie-api</artifactId>\n- <version>6.5.0.Final-redhat-17</version>\n+ <version>7.11.0.Final</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://raw.githubusercontent.com/kiegroup/drools/6.5.0.Final/LICENSE-ASL-2.0.txt</url>\n+ <url>https://raw.githubusercontent.com/kiegroup/drools/7.11.0.Final/LICENSE-ASL-2.0.txt</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.kie</groupId>\n<artifactId>kie-ci</artifactId>\n- <version>6.5.0.Final-redhat-17</version>\n+ <version>7.11.0.Final</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://raw.githubusercontent.com/kiegroup/droolsjbpm-knowledge/6.5.0.Final/LICENSE-ASL-2.0.txt</url>\n+ <url>https://raw.githubusercontent.com/kiegroup/droolsjbpm-knowledge/7.11.0.Final/LICENSE-ASL-2.0.txt</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.kie</groupId>\n<artifactId>kie-internal</artifactId>\n- <version>6.5.0.Final-redhat-17</version>\n+ <version>7.11.0.Final</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://raw.githubusercontent.com/kiegroup/droolsjbpm-knowledge/6.5.0.Final/LICENSE-ASL-2.0.txt</url>\n+ <url>https://raw.githubusercontent.com/kiegroup/droolsjbpm-knowledge/7.11.0.Final/LICENSE-ASL-2.0.txt</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.drools</groupId>\n<artifactId>drools-compiler</artifactId>\n- <version>6.5.0.Final-redhat-17</version>\n+ <version>7.11.0.Final</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://raw.githubusercontent.com/kiegroup/drools/6.5.0.Final/LICENSE-ASL-2.0.txt</url>\n+ <url>https://raw.githubusercontent.com/kiegroup/drools/7.11.0.Final/LICENSE-ASL-2.0.txt</url>\n</license>\n</licenses>\n</dependency>\n<dependency>\n<groupId>org.drools</groupId>\n<artifactId>drools-core</artifactId>\n- <version>6.5.0.Final-redhat-17</version>\n+ <version>7.11.0.Final</version>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://raw.githubusercontent.com/kiegroup/drools/6.5.0.Final/LICENSE-ASL-2.0.txt</url>\n+ <url>https://raw.githubusercontent.com/kiegroup/drools/7.11.0.Final/LICENSE-ASL-2.0.txt</url>\n</license>\n</licenses>\n</dependency>\n<other>\n<description>jQuery</description>\n<locations>\n- <file>themes/keycloak/common/resources/lib/jquery/jquery-1.10.2.js</file>\n+ <directory>themes/keycloak/common/resources/node_modules/jquery/dist</directory>\n</locations>\n<licenses>\n<license>\n<name>MIT License</name>\n- <url>https://raw.githubusercontent.com/jquery/jquery/1.10.2/MIT-LICENSE.txt</url>\n+ <url>https://raw.githubusercontent.com/jquery/jquery/3.2.1/LICENSE.txt</url>\n</license>\n</licenses>\n</other>\n<other>\n<description>angular-translate</description>\n<locations>\n- <file>themes/keycloak/common/resources/lib/angular/angular-translate.js</file>\n- <file>themes/keycloak/common/resources/lib/angular/angular-translate-loader-url.js</file>\n+ <directory>themes/keycloak/common/resources/node_modules/angular-translate/dist</directory>\n+ <directory>themes/keycloak/common/resources/node_modules/angular-translate-loader-url</directory>\n+ <directory>themes/keycloak/common/resources/node_modules/angular-translate/dist/angular-translate-loader-partial</directory>\n</locations>\n<licenses>\n<license>\n<name>MIT License</name>\n- <url>https://raw.githubusercontent.com/angular-translate/angular-translate/2.7.2/LICENSE</url>\n+ <url>https://raw.githubusercontent.com/angular-translate/angular-translate/2.15.1/LICENSE</url>\n</license>\n</licenses>\n</other>\n<other>\n<description>ui-select2</description>\n<locations>\n- <file>themes/keycloak/common/resources/lib/angular/select2.js</file>\n+ <directory>themes/keycloak/common/resources/node_modules/angular-ui-select2</directory>\n</locations>\n<licenses>\n<license>\n<other>\n<description>Select2</description>\n<locations>\n- <directory>themes/keycloak/common/resources/lib/select2-3.4.1</directory>\n+ <directory>themes/keycloak/common/resources/node_modules/select2</directory>\n</locations>\n<licenses>\n<license>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9029: update licenses.xml files |
339,343 | 14.12.2018 10:30:01 | -3,600 | 835321a0edd79c48ecd8406a656355e25a1cf8a1 | disable sym-linking | [
{
"change_type": "MODIFY",
"old_path": "distribution/maven-plugins/licenses-processor/src/main/groovy/LicenseProcessMojo.groovy",
"new_path": "distribution/maven-plugins/licenses-processor/src/main/groovy/LicenseProcessMojo.groovy",
"diff": "@@ -3,7 +3,6 @@ import java.nio.file.FileSystems\nimport java.nio.file.Files\nimport java.nio.file.Path\nimport java.nio.file.StandardCopyOption\n-import java.nio.file.attribute.PosixFilePermissions\nimport javax.xml.transform.Transformer\nimport javax.xml.transform.TransformerFactory\nimport javax.xml.transform.stream.StreamResult\n@@ -44,7 +43,6 @@ class LicenseProcessMojo extends AbstractMojo {\n// For each direct dependency, append those matching the groupId filter\nlog.info(\"Appending first party dependency license data\")\nPath licenseFileRoot = outputDirectory\n- Path licenseFile = null\ndef matched = false\nproject.dependencyArtifacts.toSorted().each { artifact ->\nif (artifact.groupId == groupId) {\n@@ -61,26 +59,9 @@ class LicenseProcessMojo extends AbstractMojo {\ndef newFilename = \"${artifact.groupId},${artifact.artifactId},${artifact.version},${licenseName}.txt\"\nPath newFile = licenseFileRoot.resolve(newFilename)\n- if (licenseFile == null) {\n+ InputStream originalLicense = this.class.getResourceAsStream(\"keycloak-licenses-common/License.html\")\nlog.info(\"==> ${newFilename}\")\n- InputStream original = this.class.getResourceAsStream(\"keycloak-licenses-common/License.html\")\n- Files.copy(original, newFile, StandardCopyOption.REPLACE_EXISTING)\n- licenseFile = newFile\n- } else {\n- log.info(\" -> ${newFilename}\")\n- try {\n- Files.createSymbolicLink(newFile, licenseFile.fileName);\n- } catch ( IOException e ) {\n- log.debug(\"Can't create symbolic link, assuming due to lack of OS support\")\n- // Assume we're on Windows and the user doesn't have\n- // SeCreateSymbolicLinkPrivilege and/or NTFS. Fallback to\n- // writing something similar to what git would with\n- // core.symlinks disabled.\n- newFile.withWriter('utf-8') { writer ->\n- writer.writeLine licenseFile.fileName.toString()\n- }\n- }\n- }\n+ Files.copy(originalLicense, newFile, StandardCopyOption.REPLACE_EXISTING)\n}\n}\nif (!matched) {\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9029: disable sym-linking |
339,343 | 14.12.2018 12:27:08 | -3,600 | 808a7436716345bc11de8fcf0a53157c2f063f72 | fixed licenses files issue per PR review
+ some wrong license file URLs fixed | [
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/licenses/keycloak/licenses.xml",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/licenses/keycloak/licenses.xml",
"diff": "<?xml version=\"1.0\"?>\n<licenseSummary>\n<dependencies>\n+ <dependency>\n+ <groupId>com.openshift</groupId>\n+ <artifactId>openshift-restclient-java</artifactId>\n+ <version>6.1.3.Final</version>\n+ <licenses>\n+ <license>\n+ <name>Eclipse Public License 1.0</name>\n+ <url>https://raw.githubusercontent.com/openshift/openshift-restclient-java/openshift-restclient-java-6.1.3.Final/license</url>\n+ </license>\n+ </licenses>\n+ </dependency>\n+ <dependency>\n+ <groupId>com.googlecode.owasp-java-html-sanitizer</groupId>\n+ <artifactId>owasp-java-html-sanitizer</artifactId>\n+ <version>20180219.1</version>\n+ <licenses>\n+ <license>\n+ <name>Apache Software License 2.0</name>\n+ <url>https://raw.githubusercontent.com/OWASP/java-html-sanitizer/release-20180219.1/COPYING</url>\n+ </license>\n+ </licenses>\n+ </dependency>\n<dependency>\n<groupId>com.google.zxing</groupId>\n<artifactId>core</artifactId>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=incubator-freemarker.git;a=blob_plain;f=LICENSE.txt;hb=v2.3.23</url>\n+ <url>https://git-wip-us.apache.org/repos/asf?p=freemarker.git;a=blob_plain;f=LICENSE;hb=v2.3.26</url>\n</license>\n</licenses>\n</dependency>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.2.5</url>\n+ <url>https://gitbox.apache.org/repos/asf?p=maven.git;a=blob_plain;f=LICENSE;hb=maven-3.3.9</url>\n</license>\n</licenses>\n</dependency>\n"
},
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/licenses/rh-sso/licenses.xml",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/licenses/rh-sso/licenses.xml",
"diff": "<?xml version=\"1.0\"?>\n<licenseSummary>\n<dependencies>\n+ <dependency>\n+ <groupId>com.openshift</groupId>\n+ <artifactId>openshift-restclient-java</artifactId>\n+ <version>6.1.3.Final</version>\n+ <licenses>\n+ <license>\n+ <name>Eclipse Public License 1.0</name>\n+ <url>https://raw.githubusercontent.com/openshift/openshift-restclient-java/openshift-restclient-java-6.1.3.Final/license</url>\n+ </license>\n+ </licenses>\n+ </dependency>\n+ <dependency>\n+ <groupId>com.googlecode.owasp-java-html-sanitizer</groupId>\n+ <artifactId>owasp-java-html-sanitizer</artifactId>\n+ <version>20180219.1</version>\n+ <licenses>\n+ <license>\n+ <name>Apache Software License 2.0</name>\n+ <url>https://raw.githubusercontent.com/OWASP/java-html-sanitizer/release-20180219.1/COPYING</url>\n+ </license>\n+ </licenses>\n+ </dependency>\n<dependency>\n<groupId>com.google.zxing</groupId>\n<artifactId>core</artifactId>\n<licenses>\n<license>\n<name>Apache Software License 2.0</name>\n- <url>https://git-wip-us.apache.org/repos/asf?p=incubator-freemarker.git;a=blob_plain;f=LICENSE.txt;hb=v2.3.23</url>\n+ <url>https://git-wip-us.apache.org/repos/asf?p=freemarker.git;a=blob_plain;f=LICENSE;hb=v2.3.26</url>\n</license>\n</licenses>\n</dependency>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9029: fixed licenses files issue per PR review
+ some wrong license file URLs fixed |
339,185 | 18.12.2018 17:38:42 | -3,600 | 2e52093ac57249b49ff1d1b66c4c4a1a73f63e3e | Fix content-type check | [
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/broker/oidc/OIDCIdentityProvider.java",
"new_path": "services/src/main/java/org/keycloak/broker/oidc/OIDCIdentityProvider.java",
"diff": "@@ -365,6 +365,7 @@ public class OIDCIdentityProvider extends AbstractOAuth2IdentityProvider<OIDCIde\n}\n}\n+ private static final MediaType APPLICATION_JWT_TYPE = MediaType.valueOf(\"application/jwt\");\nprotected BrokeredIdentityContext extractIdentity(AccessTokenResponse tokenResponse, String accessToken, JsonWebToken idToken) throws IOException {\nString id = idToken.getSubject();\n@@ -380,11 +381,20 @@ public class OIDCIdentityProvider extends AbstractOAuth2IdentityProvider<OIDCIde\nif (accessToken != null) {\nSimpleHttp.Response response = executeRequest(userInfoUrl, SimpleHttp.doGet(userInfoUrl, session).header(\"Authorization\", \"Bearer \" + accessToken));\nString contentType = response.getFirstHeader(HttpHeaders.CONTENT_TYPE);\n+ MediaType contentMediaType;\n+ try {\n+ contentMediaType = MediaType.valueOf(contentType);\n+ } catch (IllegalArgumentException ex) {\n+ contentMediaType = null;\n+ }\n+ if (contentMediaType == null || contentMediaType.isWildcardSubtype() || contentMediaType.isWildcardType()) {\n+ throw new RuntimeException(\"Unsupported content-type [\" + contentType + \"] in response from [\" + userInfoUrl + \"].\");\n+ }\nJsonNode userInfo;\n- if (MediaType.APPLICATION_JSON.equals(contentType)) {\n+ if (MediaType.APPLICATION_JSON_TYPE.isCompatible(contentMediaType)) {\nuserInfo = response.asJson();\n- } else if (\"application/jwt\".equals(contentType)) {\n+ } else if (APPLICATION_JWT_TYPE.isCompatible(contentMediaType)) {\nJWSInput jwsInput;\ntry {\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9123 Fix content-type check |
339,414 | 18.12.2018 22:59:03 | 0 | f731949c007736e1e89e5209ffe1fad087d4bce3 | Prepare for RH-SSO 7.3.0.CR1 | [
{
"change_type": "MODIFY",
"old_path": "pom.xml",
"new_path": "pom.xml",
"diff": "<packaging>pom</packaging>\n<properties>\n- <product.rhsso.version>7.3.0.ER1</product.rhsso.version>\n+ <product.rhsso.version>7.3.0.CR1</product.rhsso.version>\n<product.build-time>${timestamp}</product.build-time>\n<wildfly.version>14.0.1.Final</wildfly.version>\n<wildfly.build-tools.version>1.2.10.Final</wildfly.build-tools.version>\n- <eap.version>7.2.0.GA-redhat-00001</eap.version>\n+ <eap.version>7.2.0.GA-redhat-00003</eap.version>\n<eap.build-tools.version>1.2.10.Final</eap.build-tools.version>\n<wildfly.core.version>6.0.2.Final</wildfly.core.version>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | Prepare for RH-SSO 7.3.0.CR1 |
339,587 | 19.12.2018 13:44:38 | -3,600 | 83b2642c4e875345d288546e9bc9efaae0d27680 | Update messages_no.properties
Added translation consistent with the value in messages_en.properties, also removed HTML tags since they display as plain text. | [
{
"change_type": "MODIFY",
"old_path": "themes/src/main/resources-community/theme/base/account/messages/messages_no.properties",
"new_path": "themes/src/main/resources-community/theme/base/account/messages/messages_no.properties",
"diff": "@@ -97,7 +97,7 @@ revoke=Opphev rettighet\nconfigureAuthenticators=Konfigurerte autentikatorer\nmobile=Mobiltelefon\n-totpStep1=Installer <a href=\"https://freeotp.github.io/\" target=\"_blank\">FreeOTP</a> eller Google Authenticator p\\u00E5 din enhet. Begge applikasjoner er tilgjengelige p\\u00E5 <a href=\"https://play.google.com\">Google Play</a> og Apple App Store.\n+totpStep1=Installer ett av f\\u00F8lgende programmer p\\u00E5 mobilen din.\ntotpStep2=\\u00C5pne applikasjonen og skann strekkoden eller skriv inn koden.\ntotpStep3=Skriv inn engangskoden gitt av applikasjonen og klikk Lagre for \\u00E5 fullf\\u00F8re.\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | Update messages_no.properties
Added translation consistent with the value in messages_en.properties, also removed HTML tags since they display as plain text. |
339,500 | 19.12.2018 11:34:27 | -3,600 | 7eacb43042db614a33e10c70abb492c09907c0ab | Update versions and properties for proper alignment | [
{
"change_type": "MODIFY",
"old_path": "dependencies/drools-bom/pom.xml",
"new_path": "dependencies/drools-bom/pom.xml",
"diff": "<xstream.version>1.4.10</xstream.version>\n<antlr-runtime.version>3.5.2</antlr-runtime.version>\n<ant.version>1.8.4</ant.version>\n+ <ant-launcher.version>1.8.4</ant-launcher.version>\n<maven.version>3.3.9</maven.version>\n<wagon.version>3.0.0</wagon.version>\n<plexus-classworlds.version>2.5.2</plexus-classworlds.version>\n<dependency>\n<groupId>org.apache.ant</groupId>\n<artifactId>ant-launcher</artifactId>\n- <version>${ant.version}</version>\n+ <version>${ant-launcher.version}</version>\n</dependency>\n<dependency>\n<groupId>org.apache.maven</groupId>\n"
},
{
"change_type": "MODIFY",
"old_path": "pom.xml",
"new_path": "pom.xml",
"diff": "<h2.version>1.4.193</h2.version>\n<javax.persistence.version>2.2</javax.persistence.version>\n<hibernate.core.version>5.3.6.Final</hibernate.core.version>\n+ <hibernate.c3p0.version>5.3.6.Final</hibernate.c3p0.version>\n<infinispan.version>9.3.1.Final</infinispan.version>\n<jackson.version>2.9.5</jackson.version>\n<javax.mail.version>1.6.1</javax.mail.version>\n<jboss.spec.javax.servlet.jsp.jboss-jsp-api_2.3_spec.version>1.0.3.Final</jboss.spec.javax.servlet.jsp.jboss-jsp-api_2.3_spec.version>\n<log4j.version>1.2.17</log4j.version>\n<resteasy.version>3.6.1.Final</resteasy.version>\n+ <resteasy.undertow.version>3.6.1.Final</resteasy.undertow.version>\n<owasp.html.sanitizer.version>20180219.1</owasp.html.sanitizer.version>\n+ <slf4j-api.version>1.7.22</slf4j-api.version>\n<slf4j.version>1.7.22</slf4j.version>\n<sun.istack.version>3.0.5</sun.istack.version>\n<sun.jaxb.version>2.3.0</sun.jaxb.version>\n<dependency>\n<groupId>org.jboss.resteasy</groupId>\n<artifactId>resteasy-undertow</artifactId>\n- <version>${resteasy.version}</version>\n+ <version>${resteasy.undertow.version}</version>\n<exclusions>\n<exclusion>\n<groupId>io.undertow</groupId>\n<dependency>\n<groupId>org.hibernate</groupId>\n<artifactId>hibernate-c3p0</artifactId>\n- <version>${hibernate.core.version}</version>\n+ <version>${hibernate.c3p0.version}</version>\n<scope>test</scope>\n</dependency>\n<dependency>\n<dependency>\n<groupId>org.slf4j</groupId>\n<artifactId>slf4j-api</artifactId>\n- <version>${slf4j.version}</version>\n+ <version>${slf4j-api.version}</version>\n</dependency>\n<dependency>\n<groupId>org.slf4j</groupId>\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/pom.xml",
"new_path": "testsuite/integration-arquillian/tests/pom.xml",
"diff": "<dependency>\n<groupId>org.apache.ant</groupId>\n<artifactId>ant</artifactId>\n- <version>1.9.2</version>\n+ <version>1.8.4</version>\n<type>jar</type>\n</dependency>\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/jetty/jetty92/pom.xml",
"new_path": "testsuite/jetty/jetty92/pom.xml",
"diff": "<dependency>\n<groupId>org.slf4j</groupId>\n<artifactId>slf4j-api</artifactId>\n- <version>1.6.1</version>\n</dependency>\n<dependency>\n<groupId>org.slf4j</groupId>\n<artifactId>slf4j-log4j12</artifactId>\n- <version>1.6.1</version>\n</dependency>\n<dependency>\n<groupId>org.jboss.spec.javax.servlet</groupId>\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/jetty/jetty93/pom.xml",
"new_path": "testsuite/jetty/jetty93/pom.xml",
"diff": "<dependency>\n<groupId>org.slf4j</groupId>\n<artifactId>slf4j-api</artifactId>\n- <version>1.6.1</version>\n</dependency>\n<dependency>\n<groupId>org.slf4j</groupId>\n<artifactId>slf4j-log4j12</artifactId>\n- <version>1.6.1</version>\n</dependency>\n<dependency>\n<groupId>org.jboss.spec.javax.servlet</groupId>\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/jetty/jetty94/pom.xml",
"new_path": "testsuite/jetty/jetty94/pom.xml",
"diff": "<dependency>\n<groupId>org.slf4j</groupId>\n<artifactId>slf4j-api</artifactId>\n- <version>1.6.1</version>\n</dependency>\n<dependency>\n<groupId>org.slf4j</groupId>\n<artifactId>slf4j-log4j12</artifactId>\n- <version>1.6.1</version>\n</dependency>\n<dependency>\n<groupId>org.jboss.spec.javax.servlet</groupId>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | Update versions and properties for proper alignment
(cherry picked from commit c8be651218b736c072bc1f04e2c32cdd81b72d4e) |
339,500 | 19.12.2018 16:17:53 | -3,600 | 8ce9239f38246a0f879772d4b1bb1f3d3b39c58a | Update prod-arguments.json | [
{
"change_type": "MODIFY",
"old_path": "prod-arguments.json",
"new_path": "prod-arguments.json",
"diff": "\"pme\": {\n\"properties\": {\n\"dependencySource\": \"BOMREST\",\n+ \"strictAlignment\": \"false\",\n\"dependencyManagement\": \"org.jboss.eap:jboss-eap-parent:$EAP_VERSION\",\n\"dependencyRelocations.org.wildfly:@org.jboss.eap:\": \"$EAP_VERSION\",\n- \"dependencyExclusion.org.wildfly.core:wildfly-version@*\": \"3.0.12.Final-redhat-1\",\n- \"dependencyExclusion.org.wildfly.security:*@*\": \"1.1.8.Final-redhat-1\",\n- \"dependencyExclusion.org.jboss.as:jboss-as-server@*\": \"$EAP6SUPPORTED_ORG_JBOSS_AS_JBOSS_AS_SERVER\",\n- \"dependencyOverride.org.infinispan:[email protected]:keycloak-saml-as7-adapter\": \"5.2.23.Final-redhat-1\",\n+ \"dependencyExclusion.org.jboss.as:*@*\": \"$EAP6SUPPORTED_ORG_JBOSS_AS_JBOSS_AS_SERVER\",\n+ \"dependencyOverride.org.infinispan:*@org.keycloak:keycloak-saml-as7-adapter\": \"5.2.23.Final-redhat-1\",\n\"dependencyExclusion.org.osgi:org.osgi.core@*\": \"5.0.0\",\n\"dependencyExclusion.org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec@*\": \"$EAP6SUPPORTED_ORG_JBOSS_SPEC_JAVAX_SERVLET_JBOSS_SERVLET_API_3_0_SPEC\",\n\"dependencyExclusion.org.jboss:jboss-parent@*\": \"19.0.0.redhat-2\",\n\"dependencyExclusion.org.jboss.web:jbossweb@*\": \"$EAP6SUPPORTED_ORG_JBOSS_WEB_JBOSSWEB\",\n- \"dependencyOverride.com.google.guava:[email protected]:integration-arquillian\": \"\"\n+ \"dependencyOverride.com.google.guava:[email protected]:integration-arquillian\": \"\",\n+ \"dependencyOverride.org.apache.httpcomponents:[email protected]:integration-arquillian-tests\": \"\"\n}\n}\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | Update prod-arguments.json
(cherry picked from commit a378534d36ca65a5cd80d34a16cc71479e1c2f0f) |
339,500 | 03.01.2019 11:18:09 | -3,600 | 807e7e76e1fe523a24081c8a681980c09ec48cec | EAP6 OIDC adapter can not be installed | [
{
"change_type": "MODIFY",
"old_path": "prod-arguments.json",
"new_path": "prod-arguments.json",
"diff": "\"dependencyExclusion.org.jboss:jboss-parent@*\": \"19.0.0.redhat-2\",\n\"dependencyExclusion.org.jboss.web:jbossweb@*\": \"$EAP6SUPPORTED_ORG_JBOSS_WEB_JBOSSWEB\",\n\"dependencyOverride.com.google.guava:[email protected]:integration-arquillian\": \"\",\n- \"dependencyOverride.org.apache.httpcomponents:[email protected]:integration-arquillian-tests\": \"\"\n+ \"dependencyOverride.org.apache.httpcomponents:[email protected]:integration-arquillian-tests\": \"\",\n+ \"dependencyOverride.org.jboss.logging:[email protected]:keycloak-as7-subsystem\": \"\"\n}\n}\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9187 EAP6 OIDC adapter can not be installed |
339,185 | 03.01.2019 10:57:39 | -3,600 | ca76f943c154a0acdf8d35a5b87907a62b55ae51 | Update GoogleIdentityProvider endpoints
per | [
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/social/google/GoogleIdentityProvider.java",
"new_path": "services/src/main/java/org/keycloak/social/google/GoogleIdentityProvider.java",
"diff": "@@ -38,9 +38,9 @@ import javax.ws.rs.core.UriBuilder;\n*/\npublic class GoogleIdentityProvider extends OIDCIdentityProvider implements SocialIdentityProvider<OIDCIdentityProviderConfig> {\n- public static final String AUTH_URL = \"https://accounts.google.com/o/oauth2/auth\";\n- public static final String TOKEN_URL = \"https://www.googleapis.com/oauth2/v3/token\";\n- public static final String PROFILE_URL = \"https://www.googleapis.com/plus/v1/people/me/openIdConnect\";\n+ public static final String AUTH_URL = \"https://accounts.google.com/o/oauth2/v2/auth\";\n+ public static final String TOKEN_URL = \"https://oauth2.googleapis.com/token\";\n+ public static final String PROFILE_URL = \"https://openidconnect.googleapis.com/v1/userinfo\";\npublic static final String DEFAULT_SCOPE = \"openid profile email\";\nprivate static final String OIDC_PARAMETER_HOSTED_DOMAINS = \"hd\";\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9190 Update GoogleIdentityProvider endpoints
per https://accounts.google.com/.well-known/openid-configuration |
339,281 | 03.01.2019 22:36:16 | -3,600 | 30e538d7ef8dfe709928fd8f8f2d2ca372f40287 | fix running tests in travis | [
{
"change_type": "MODIFY",
"old_path": "travis-run-tests.sh",
"new_path": "travis-run-tests.sh",
"diff": "@@ -65,7 +65,7 @@ if [ $1 == \"unit\" ]; then\nfi\nif [ $1 == \"server-group1\" ]; then\n- run-server-tests org.keycloak.testsuite.adm.**.*Test,org.keycloak.testsuite.add.**.*Test\n+ run-server-tests org.keycloak.testsuite.adm*.**.*Test,org.keycloak.testsuite.add*.**.*Test\nfi\nif [ $1 == \"server-group2\" ]; then\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9243 fix running tests in travis |
339,281 | 03.01.2019 10:54:07 | -3,600 | b2a7d42310df4972bd8c7ca60b10e84473c74ec9 | CorsExampleAdapterTest fails on Windows | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/cors/CorsExampleAdapterTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/cors/CorsExampleAdapterTest.java",
"diff": "@@ -48,6 +48,7 @@ import java.util.regex.Matcher;\nimport java.util.regex.Pattern;\nimport static junit.framework.TestCase.assertNotNull;\n+import org.junit.Assume;\nimport static org.keycloak.testsuite.utils.io.IOUtil.loadRealm;\nimport static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;\nimport static org.keycloak.testsuite.util.WaitUtils.waitForPageToLoad;\n@@ -105,6 +106,7 @@ public class CorsExampleAdapterTest extends AbstractExampleAdapterTest {\n@Before\npublic void onBefore() {\n+ Assume.assumeFalse(System.getProperty(\"os.name\").startsWith(\"Windows\"));\ndeployer.deploy(CorsDatabaseServiceTestApp.DEPLOYMENT_NAME);\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9193 CorsExampleAdapterTest fails on Windows |
339,465 | 03.01.2019 18:09:26 | -3,600 | 692127519b8f0328ffe79005c43f4f93c188d16c | Stabilize BruteForceCrossDCTest.testBruteForceConcurrentUpdate | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/crossdc/BruteForceCrossDCTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/crossdc/BruteForceCrossDCTest.java",
"diff": "@@ -251,9 +251,9 @@ public class BruteForceCrossDCTest extends AbstractAdminCrossDCTest {\nlog.infof(\"After concurrent update entry1: dc0User1=%d, dc1user1=%d\", dc0user1, dc1user1);\n- // The numFailures can be actually bigger than 20. Conflicts can increase the numFailures number to bigger value as they may not be fully reverted (listeners etc)\n- Assert.assertThat(dc0user1, Matchers.greaterThan(20));\n- Assert.assertEquals(dc0user1, dc1user1);\n+ // TODO: The number of failures should be ideally exactly 21 in both DCs. Once we improve cross-dc, then improve this test and rather check for \"Assert.assertEquals(dc0user1, 21)\" and \"Assert.assertEquals(dc1user1, 21)\"\n+ Assert.assertThat(dc0user1, Matchers.greaterThan(11));\n+ Assert.assertThat(dc1user1, Matchers.greaterThan(11));\n}, 50, 50);\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8724 Stabilize BruteForceCrossDCTest.testBruteForceConcurrentUpdate |
339,500 | 08.01.2019 14:24:46 | -3,600 | c0c0ff59fa9692570ca0a654f4f4869b39a9706e | Error when deploying war which uses EAP6 SAML adapter | [
{
"change_type": "MODIFY",
"old_path": "prod-arguments.json",
"new_path": "prod-arguments.json",
"diff": "\"dependencyExclusion.org.jboss.web:jbossweb@*\": \"$EAP6SUPPORTED_ORG_JBOSS_WEB_JBOSSWEB\",\n\"dependencyOverride.com.google.guava:[email protected]:integration-arquillian\": \"\",\n\"dependencyOverride.org.apache.httpcomponents:[email protected]:integration-arquillian-tests\": \"\",\n- \"dependencyOverride.org.jboss.logging:[email protected]:keycloak-as7-subsystem\": \"\"\n+ \"dependencyOverride.org.jboss.logging:jboss-logging-processor@*\": \"\"\n}\n}\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9261 Error when deploying war which uses EAP6 SAML adapter |
339,281 | 08.01.2019 14:22:54 | -3,600 | 0602a88fccd00a4712e34aaf514aaaf97ed2c505 | Skip SAMLFilterServletAdapterTest for jdk7 | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/SAMLFilterServletAdapterTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/SAMLFilterServletAdapterTest.java",
"diff": "package org.keycloak.testsuite.adapter.servlet;\nimport org.junit.After;\n+import org.junit.Assume;\nimport org.junit.Before;\n+import org.junit.BeforeClass;\nimport org.junit.Ignore;\nimport org.junit.Test;\nimport org.keycloak.testsuite.arquillian.annotation.AppServerContainer;\n@@ -21,6 +23,12 @@ import org.keycloak.testsuite.arquillian.containers.ContainerConstants;\nfilterDependency = \"org.keycloak:keycloak-saml-servlet-filter-adapter\")\npublic class SAMLFilterServletAdapterTest extends SAMLServletAdapterTest {\n+ @BeforeClass\n+ public static void enabled() {\n+ String appServerJavaHome = System.getProperty(\"app.server.java.home\", \"\");\n+ Assume.assumeFalse(appServerJavaHome.contains(\"1.7\") || appServerJavaHome.contains(\"ibm-java-70\"));\n+ }\n+\n@Before\npublic void checkRoles() {\nbadClientSalesPostSigServletPage.checkRoles(true);\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9262 Skip SAMLFilterServletAdapterTest for jdk7 |
339,364 | 09.01.2019 15:22:14 | -3,600 | 1199376e372a0aaf2230e3b1a883b875d09e7ddc | Log test browser version | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/drone/KeycloakDronePostSetup.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/drone/KeycloakDronePostSetup.java",
"diff": "@@ -31,6 +31,7 @@ import org.jboss.logging.Logger;\nimport org.keycloak.testsuite.util.WaitUtils;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.htmlunit.HtmlUnitDriver;\n+import org.openqa.selenium.remote.RemoteWebDriver;\n/**\n* @author <a href=\"mailto:[email protected]\">Marek Posolda</a>\n@@ -44,6 +45,11 @@ public class KeycloakDronePostSetup {\nDronePoint<?> dronePoint = event.getDronePoint();\nObject drone = droneContext.get(dronePoint).getInstance();\n+ if (drone instanceof RemoteWebDriver) {\n+ RemoteWebDriver remoteWebDriver = (RemoteWebDriver) drone;\n+ log.infof(\"Detected browser: %s %s\", remoteWebDriver.getCapabilities().getBrowserName(), remoteWebDriver.getCapabilities().getVersion());\n+ }\n+\nif (drone instanceof WebDriver && !(drone instanceof AppiumDriver)) {\nWebDriver webDriver = (WebDriver) drone;\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9273 Log test browser version |
339,281 | 15.01.2019 11:55:52 | -3,600 | 08e258c0de736e4376051c2a4a83d46448e55ec9 | fix SAMLAdapterClusterTest for EAP6 | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/servers/app-server/jboss/eap6/src/main/java/org/keycloak/testsuite/arquillian/eap/container/EAP6DeploymentArchiveProcessor.java",
"new_path": "testsuite/integration-arquillian/servers/app-server/jboss/eap6/src/main/java/org/keycloak/testsuite/arquillian/eap/container/EAP6DeploymentArchiveProcessor.java",
"diff": "@@ -20,8 +20,10 @@ import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArch\nimport org.jboss.arquillian.test.spi.TestClass;\nimport org.jboss.logging.Logger;\nimport org.jboss.shrinkwrap.api.Archive;\n+import org.jboss.shrinkwrap.api.asset.StringAsset;\nimport org.keycloak.testsuite.utils.annotation.UseServletFilter;\nimport org.keycloak.testsuite.utils.arquillian.DeploymentArchiveProcessorUtils;\n+import static org.keycloak.testsuite.utils.arquillian.DeploymentArchiveProcessorUtils.WEBXML_PATH;\nimport org.keycloak.testsuite.utils.io.IOUtil;\nimport org.w3c.dom.Document;\n@@ -49,21 +51,23 @@ public class EAP6DeploymentArchiveProcessor implements ApplicationArchiveProcess\nprivate void modifyWebXML(Archive<?> archive, TestClass testClass) {\nif (!archive.contains(DeploymentArchiveProcessorUtils.WEBXML_PATH)) return;\n- if (!testClass.getJavaClass().isAnnotationPresent(UseServletFilter.class)) return;\n- if (!archive.contains(DeploymentArchiveProcessorUtils.JBOSS_DEPLOYMENT_XML_PATH)) return;\n-\n+ if (testClass.getJavaClass().isAnnotationPresent(UseServletFilter.class) &&\n+ archive.contains(DeploymentArchiveProcessorUtils.JBOSS_DEPLOYMENT_XML_PATH)) {\nlog.debug(\"Modifying WEB.XML in \" + archive.getName() + \" for Servlet Filter.\");\nDeploymentArchiveProcessorUtils.modifyWebXMLForServletFilter(archive, testClass);\nDeploymentArchiveProcessorUtils.addFilterDependencies(archive, testClass);\n+ }\n- Document webXmlDoc;\ntry {\n- webXmlDoc = IOUtil.loadXML(archive.get(DeploymentArchiveProcessorUtils.WEBXML_PATH).getAsset().openStream());\n+ Document webXmlDoc = IOUtil.loadXML(archive.get(DeploymentArchiveProcessorUtils.WEBXML_PATH).getAsset().openStream());\n+\n+ IOUtil.modifyDocElementValue(webXmlDoc, \"param-value\", \".*infinispan\\\\.InfinispanSessionCacheIdMapperUpdater\",\n+ \"org.keycloak.adapters.saml.jbossweb.infinispan.InfinispanSessionCacheIdMapperUpdater\");\n+\n+ archive.add(new StringAsset((IOUtil.documentToString(webXmlDoc))), WEBXML_PATH);\n} catch (IllegalArgumentException ex) {\nthrow new RuntimeException(\"Error when processing \" + archive.getName(), ex);\n}\n- IOUtil.modifyDocElementValue(webXmlDoc, \"param-value\", \"wildfly.infinispan.InfinispanSessionCacheIdMapperUpdater\",\n- \"org.keycloak.adapters.saml.jbossweb.infinispan.InfinispanSessionCacheIdMapperUpdater\");\n}\nprivate void modifyOIDCAdapterConfig(Archive<?> archive, String adapterConfigPath) {\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9269 fix SAMLAdapterClusterTest for EAP6 |
339,364 | 28.01.2019 18:36:17 | -3,600 | 191cbca7ad50046fe4d146aa65f5dcaed78b4f11 | UI and Node.js adapter tests fixes | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/HOW-TO-RUN.md",
"new_path": "testsuite/integration-arquillian/HOW-TO-RUN.md",
"diff": "@@ -434,7 +434,8 @@ Although technically they can be run with almost every test in the testsuite, th\n* **Supported test modules:** `console`, `base-ui`\n* **Supported version:** 11\n* **Driver download required:** [Internet Explorer Driver Server](http://www.seleniumhq.org/download/); recommended version [3.5.1 32-bit](http://selenium-release.storage.googleapis.com/3.5/IEDriverServer_Win32_3.5.1.zip)\n-* **Run with:** `-Dbrowser=internetExplorer -Dwebdriver.ie.driver=path/to/IEDriverServer.exe`\n+* **Run with:** `-Dbrowser=internetExplorer -Dwebdriver.ie.driver=path/to/IEDriverServer.exe -Dauth.server.ssl.required=false`\n+Note: We currently do not support SSL in IE.\n#### Apple Safari\n* **Supported test modules:** `base-ui`\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/drone/KeycloakWebDriverConfigurator.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/drone/KeycloakWebDriverConfigurator.java",
"diff": "@@ -54,13 +54,16 @@ public class KeycloakWebDriverConfigurator {\nupdateCapabilityKeys(\"htmlUnit\", webDriverCfg, capabilitiesToAdd);\nupdateCapabilityKeys(\"appium\", webDriverCfg, capabilitiesToAdd);\nconfigurePhantomJSDriver(webDriverCfg, capabilitiesToAdd);\n- acceptAllSSLCerts(capabilitiesToAdd);\n+ acceptAllSSLCerts(webDriverCfg, capabilitiesToAdd);\nBrowserCapabilities browserCap = registryInstance.get().getEntryFor(webDriverCfg.getBrowser());\nwebDriverCfg.setBrowserInternal(new KcBrowserCapabilities(capabilitiesToAdd, browserCap));\n}\n- private void acceptAllSSLCerts(DesiredCapabilities capabilitiesToAdd) {\n+ private void acceptAllSSLCerts(WebDriverConfiguration webDriverCfg, DesiredCapabilities capabilitiesToAdd) {\n+ if (webDriverCfg.getBrowser().equals(\"internetexplorer\")) {\n+ return; // IE not supported\n+ }\ncapabilitiesToAdd.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);\ncapabilitiesToAdd.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/realm/LoginSettingsTest.java",
"new_path": "testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/realm/LoginSettingsTest.java",
"diff": "@@ -30,6 +30,7 @@ import org.keycloak.testsuite.auth.page.login.VerifyEmail;\nimport org.keycloak.testsuite.console.page.realm.LoginSettings;\nimport org.keycloak.testsuite.console.page.realm.LoginSettings.RequireSSLOption;\nimport org.keycloak.testsuite.util.MailServer;\n+import org.keycloak.testsuite.util.URLUtils;\nimport org.openqa.selenium.Cookie;\nimport java.util.HashSet;\n@@ -284,7 +285,13 @@ public class LoginSettingsTest extends AbstractRealmTest {\nlog.debug(\"set\");\nlog.info(\"check HTTPS required\");\n- testAccountPage.navigateTo();\n+ String accountPageUri = testAccountPage.toString();\n+ if (AUTH_SERVER_SSL_REQUIRED) { // quick and dirty (and hopefully provisional) workaround to force HTTP\n+ accountPageUri = accountPageUri\n+ .replace(\"https\", \"http\")\n+ .replace(AUTH_SERVER_PORT, System.getProperty(\"auth.server.http.port\"));\n+ }\n+ URLUtils.navigateToUri(accountPageUri);\nAssert.assertEquals(\"HTTPS required\", testAccountPage.getErrorMessage());\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/other/nodejs_adapter/pom.xml",
"new_path": "testsuite/integration-arquillian/tests/other/nodejs_adapter/pom.xml",
"diff": "<auth.server.https.port>8443</auth.server.https.port>\n<auth.server.management.port>9990</auth.server.management.port>\n<auth.server.management.port.jmx>9999</auth.server.management.port.jmx>\n+ <auth.server.ssl.required>false</auth.server.ssl.required>\n</properties>\n<build>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | UI and Node.js adapter tests fixes |
339,185 | 31.01.2019 16:42:27 | -3,600 | 59430e7cd606480b32b63a46fd12dc1ebd779f2e | Docker support for testing with MSSQL, Oracle 11g | [
{
"change_type": "MODIFY",
"old_path": "misc/DatabaseTesting.md",
"new_path": "misc/DatabaseTesting.md",
"diff": "@@ -61,14 +61,36 @@ The project provides specific profiles to run database tests using containers. T\n* `db-mysql`\n* `db-postgres`\n* `db-mariadb`\n+* `db-mssql2017`\n+* `db-oracle11g`\n-As an example, to run tests using a MySQL docker container:\n+As an example, to run tests using a MySQL docker container on Undertow auth-server:\n- mvn -f testsuite/integration-arquillian clean verify -Pdb-mysql,jpa\n+ mvn -f testsuite/integration-arquillian clean verify -Pdb-mysql\nIf you want to run tests using a pre-configured Keycloak distribution (instead of Undertow):\nmvn -f testsuite/integration-arquillian clean verify -Pdb-mysql,jpa,auth-server-wildfly\n-Note that you must always activate the `jpa` profile.\n+Note that you must always activate the `jpa` profile when using auth-server-wildfly.\n+If the mvn command fails for any reason, it may also fail to remove the container which\n+must be then removed manually.\n+\n+For Oracle databases, neither JDBC driver nor the image are publicly available\n+due to licensing restrictions and require preparation of the environment. You\n+first need to download the JDBC driver and install it to your local maven repo\n+(feel free to specify GAV and file according to the one you would download):\n+\n+ mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0 -Dpackaging=jar -Dfile=ojdbc7.jar -DgeneratePom=true\n+\n+Then build the Docker image per instructions at\n+https://github.com/oracle/docker-images/tree/master/OracleDatabase. The last\n+step is running which might require updating the `jdbc.mvn.groupId`,\n+`jdbc.mvn.artifactId`, and `jdbc.mvn.version` according to the parameters you\n+used in the command above, and `docker.database.image` if you used a different\n+name or tag for the image.\n+\n+Note that Docker containers may occupy some space even after termination, and\n+especially with databases that might be easily a gigabyte. It is thus\n+advisable to run `docker system prune` occasionally to reclaim that space.\n"
},
{
"change_type": "MODIFY",
"old_path": "pom.xml",
"new_path": "pom.xml",
"diff": "<pax.web.version>7.1.0</pax.web.version>\n<postgresql.version>9.3-1100-jdbc41</postgresql.version>\n<mariadb.version>2.2.4</mariadb.version>\n+ <mssql.version>7.0.0.jre8</mssql.version>\n<servlet.api.30.version>1.0.2.Final</servlet.api.30.version>\n<servlet.api.40.version>1.0.0.Final</servlet.api.40.version>\n<twitter4j.version>4.0.4</twitter4j.version>\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/HOW-TO-RUN.md",
"new_path": "testsuite/integration-arquillian/HOW-TO-RUN.md",
"diff": "@@ -519,24 +519,10 @@ The setup includes:\n### Cluster tests with Keycloak on Wildfly\n-After build the sources, distribution and setup of clean shared database (replace command according your DB), you can use this command to setup servers:\n+After you build the distribution, you run this command to setup servers and run cluster tests using shared Docker database:\n- export DB_HOST=localhost\n- mvn -f testsuite/integration-arquillian/servers/pom.xml \\\n- -Pauth-server-wildfly,auth-server-cluster,jpa \\\n- -Dsession.cache.owners=2 \\\n- -Djdbc.mvn.groupId=mysql \\\n- -Djdbc.mvn.version=5.1.29 \\\n- -Djdbc.mvn.artifactId=mysql-connector-java \\\n- -Dkeycloak.connectionsJpa.url=jdbc:mysql://$DB_HOST/keycloak \\\n- -Dkeycloak.connectionsJpa.user=keycloak \\\n- -Dkeycloak.connectionsJpa.password=keycloak \\\n- clean install\n-\n-And then this to run the cluster tests:\n-\n- mvn -f testsuite/integration-arquillian/tests/base/pom.xml \\\n- -Pauth-server-wildfly,auth-server-cluster \\\n+ mvn -f testsuite/integration-arquillian/pom.xml \\\n+ -Pauth-server-wildfly,auth-server-cluster,db-mysql,jpa \\\n-Dsession.cache.owners=2 \\\n-Dbackends.console.output=true \\\n-Dauth.server.log.check=false \\\n@@ -547,15 +533,12 @@ And then this to run the cluster tests:\n### Cluster tests with Keycloak on embedded undertow\nmvn -f testsuite/integration-arquillian/tests/base/pom.xml \\\n- -Pauth-server-cluster-undertow \\\n+ -Pauth-server-cluster-undertow,db-mysql \\\n-Dsession.cache.owners=2 \\\n-Dkeycloak.connectionsInfinispan.sessionsOwners=2 \\\n-Dbackends.console.output=true \\\n-Dauth.server.log.check=false \\\n-Dfrontend.console.output=true \\\n- -Dkeycloak.connectionsJpa.url=jdbc:mysql://$DB_HOST/keycloak \\\n- -Dkeycloak.connectionsJpa.user=keycloak \\\n- -Dkeycloak.connectionsJpa.password=keycloak \\\n-Dtest=org.keycloak.testsuite.cluster.**.*Test clean install\n#### Run cluster tests from IDE on embedded undertow\n@@ -619,9 +602,9 @@ a2) If you want to use **JBoss-based** Keycloak backend containers instead of co\n*note: 'auth-server-wildfly' can be replaced by 'auth-server-eap'*\n-By default JBoss-based containers use TCP-based h2 database. It can be configured to use real DB, e.g. with following command:\n+By default JBoss-based containers use TCP-based h2 database. It can be configured to use real DB spawn in Docker, e.g. with following command:\n- `mvn -Pcache-server-infinispan,auth-servers-crossdc-jboss,auth-server-wildfly,jpa -f testsuite/integration-arquillian -DskipTests clean install -Djdbc.mvn.groupId=org.mariadb.jdbc -Djdbc.mvn.artifactId=mariadb-java-client -Djdbc.mvn.version=2.0.3 -Dkeycloak.connectionsJpa.url=jdbc:mariadb://localhost:3306/keycloak -Dkeycloak.connectionsJpa.password=keycloak -Dkeycloak.connectionsJpa.user=keycloak`\n+ `mvn -Pcache-server-infinispan,auth-servers-crossdc-jboss,auth-server-wildfly,jpa,db-mariadb -f testsuite/integration-arquillian -DskipTests clean install`\nb1) For **Undertow** Keycloak backend containers, you can run the tests using the following command (adjust the test specification according to your needs):\n@@ -644,7 +627,7 @@ b2) For **JBoss-based** Keycloak backend containers, you can run the tests like\n**note**:\nFor **JBoss-based** Keycloak backend containers on real DB, the previous commands from (a2) and (b2) can be \"squashed\" into one. E.g.:\n- `mvn -f testsuite/integration-arquillian clean install -Dtest=*.crossdc.* -Djdbc.mvn.groupId=org.mariadb.jdbc -Djdbc.mvn.artifactId=mariadb-java-client -Djdbc.mvn.version=2.0.3 -Dkeycloak.connectionsJpa.url=jdbc:mariadb://localhost:3306/keycloak -Dkeycloak.connectionsJpa.password=keycloak -Dkeycloak.connectionsJpa.user=keycloak -Pcache-server-infinispan,auth-servers-crossdc-jboss,auth-server-wildfly,jpa clean install`\n+ `mvn -f testsuite/integration-arquillian -Dtest=*.crossdc.* -Pcache-server-infinispan,auth-servers-crossdc-jboss,auth-server-wildfly,jpa,db-mariadb clean install`\n#### Run Cross-DC Tests from Intellij IDEA\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/pom.xml",
"new_path": "testsuite/integration-arquillian/pom.xml",
"diff": "<!-- By default, skip docker-maven-plugin when running base tests-->\n<docker.database.skip>true</docker.database.skip>\n+ <docker.database.postStart>/bin/true</docker.database.postStart>\n+ <docker.database.wait-for-log-regex>NEVER-MATCHING-REGEX</docker.database.wait-for-log-regex>\n+ <docker.database.shmsize>67108864</docker.database.shmsize>\n+\n+ <jdbc.mvn.groupId>com.h2database</jdbc.mvn.groupId>\n+ <jdbc.mvn.artifactId>h2</jdbc.mvn.artifactId>\n+ <jdbc.mvn.version>${h2.version}</jdbc.mvn.version>\n+\n+ <keycloak.connectionsJpa.driver>org.h2.Driver</keycloak.connectionsJpa.driver>\n+ <keycloak.connectionsJpa.database>keycloak</keycloak.connectionsJpa.database>\n+ <keycloak.connectionsJpa.user>sa</keycloak.connectionsJpa.user>\n+ <keycloak.connectionsJpa.password></keycloak.connectionsJpa.password>\n+ <keycloak.connectionsJpa.url>jdbc:h2:mem:test;MVCC=TRUE;DB_CLOSE_DELAY=-1</keycloak.connectionsJpa.url>\n</properties>\n<dependencyManagement>\n<docker.database.image>mysql:5.7.25</docker.database.image>\n<docker.database.port>3306</docker.database.port>\n<docker.database.skip>false</docker.database.skip>\n+ <docker.database.wait-for-log-regex>(?si)Ready for start up.*ready [^\\n]{0,30}connections</docker.database.wait-for-log-regex>\n</properties>\n</profile>\n<profile>\n<docker.database.image>postgres:9.6.11</docker.database.image>\n<docker.database.port>5432</docker.database.port>\n<docker.database.skip>false</docker.database.skip>\n+ <docker.database.wait-for-log-regex>(?si)Ready for start up.*ready [^\\n]{0,30}connections</docker.database.wait-for-log-regex>\n</properties>\n</profile>\n<profile>\n<docker.database.image>mariadb:10.2.21</docker.database.image>\n<docker.database.port>3306</docker.database.port>\n<docker.database.skip>false</docker.database.skip>\n+ <docker.database.wait-for-log-regex>(?si)Ready for start up.*ready [^\\n]{0,30}connections</docker.database.wait-for-log-regex>\n+ </properties>\n+ </profile>\n+ <profile>\n+ <id>db-mssql2017</id>\n+ <properties>\n+ <docker.database.image>microsoft/mssql-server-linux:2017-GA</docker.database.image>\n+ <docker.database.port>1433</docker.database.port>\n+ <docker.database.skip>false</docker.database.skip>\n+ <docker.database.postStart>/opt/mssql-tools/bin/sqlcmd -e -U sa -P vEry5tron9Pwd -d master -Q CREATE\\ DATABASE\\ ${keycloak.connectionsJpa.database}</docker.database.postStart>\n+ <docker.database.wait-for-log-regex>(?si)SQL Server is now ready for client connections.*Service Broker manager has started</docker.database.wait-for-log-regex>\n+ <keycloak.connectionsJpa.driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</keycloak.connectionsJpa.driver>\n+ <keycloak.connectionsJpa.database>keycloak</keycloak.connectionsJpa.database>\n+ <keycloak.connectionsJpa.user>sa</keycloak.connectionsJpa.user>\n+ <keycloak.connectionsJpa.password>vEry5tron9Pwd</keycloak.connectionsJpa.password>\n+ <keycloak.connectionsJpa.url>jdbc:sqlserver://${auth.server.db.host}:${docker.database.port};databaseName=${keycloak.connectionsJpa.database}</keycloak.connectionsJpa.url>\n+ <jdbc.mvn.groupId>com.microsoft.sqlserver</jdbc.mvn.groupId>\n+ <jdbc.mvn.artifactId>mssql-jdbc</jdbc.mvn.artifactId>\n+ <jdbc.mvn.version>${mssql.version}</jdbc.mvn.version>\n+ </properties>\n+ </profile>\n+ <profile>\n+ <id>db-oracle11g</id>\n+ <properties>\n+ <docker.database.image>oracle/database:11.2.0.2-xe</docker.database.image>\n+ <docker.database.port>1521</docker.database.port>\n+ <docker.database.shmsize>1073741824</docker.database.shmsize>\n+ <docker.database.skip>false</docker.database.skip>\n+ <docker.database.wait-for-log-regex>(?si)DATABASE IS READY TO USE</docker.database.wait-for-log-regex>\n+ <keycloak.connectionsJpa.driver>oracle.jdbc.OracleDriver</keycloak.connectionsJpa.driver>\n+ <keycloak.connectionsJpa.database>XE</keycloak.connectionsJpa.database>\n+ <keycloak.connectionsJpa.user>keycloak</keycloak.connectionsJpa.user>\n+ <keycloak.connectionsJpa.password>keycloak</keycloak.connectionsJpa.password>\n+ <keycloak.connectionsJpa.url>jdbc:oracle:thin:@${auth.server.db.host}:${docker.database.port}:${keycloak.connectionsJpa.database}</keycloak.connectionsJpa.url>\n+ <docker.database.postStart>bash -c while\\ !\\ sqlplus\\ -L\\ SYS/sa@localhost/XE\\ AS\\ SYSDBA\\ <<<\\ $'CREATE\\ USER\\ ${keycloak.connectionsJpa.user}\\ IDENTIFIED\\ BY\\ ${keycloak.connectionsJpa.password};\\n\\ GRANT\\ CONNECT,\\ RESOURCE,\\ DBA,\\ GRANT\\ ANY\\ PRIVILEGE,\\ UNLIMITED\\ TABLESPACE\\ TO\\ ${keycloak.connectionsJpa.user};\\n';\\ do\\ sleep\\ 5;\\ done</docker.database.postStart>\n+ <jdbc.mvn.groupId>com.oracle</jdbc.mvn.groupId>\n+ <jdbc.mvn.artifactId>ojdbc7</jdbc.mvn.artifactId>\n+ <jdbc.mvn.version>12.1.0</jdbc.mvn.version>\n</properties>\n</profile>\n</profiles>\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/pom.xml",
"new_path": "testsuite/integration-arquillian/tests/base/pom.xml",
"diff": "<alias>testdb</alias>\n<name>${docker.database.image}</name>\n<run>\n+ <shmSize>${docker.database.shmsize}</shmSize>\n<ports>\n<port>${docker.database.port}</port>\n</ports>\n<POSTGRES_DB>${keycloak.connectionsJpa.database}</POSTGRES_DB>\n<POSTGRES_USER>${keycloak.connectionsJpa.user}</POSTGRES_USER>\n<POSTGRES_PASSWORD>${keycloak.connectionsJpa.password}</POSTGRES_PASSWORD>\n+\n+ <!-- MSSQL -->\n+ <ACCEPT_EULA>Y</ACCEPT_EULA>\n+ <SA_PASSWORD>${keycloak.connectionsJpa.password}</SA_PASSWORD>\n+\n+ <!-- Oracle -->\n+ <ORACLE_SID>${keycloak.connectionsJpa.database}</ORACLE_SID>\n+ <ORACLE_PWD>sa</ORACLE_PWD>\n</env>\n<wait>\n- <tcp>\n- <ports>\n- <port>${docker.database.port}</port>\n- </ports>\n- </tcp>\n- <time>120000</time>\n+ <!-- Do not use waiting for port since that is unreliable, sometimes port is listening before DB is ready to serve -->\n+ <log>${docker.database.wait-for-log-regex}</log>\n+ <time>300000</time>\n+ <exec>\n+ <postStart>${docker.database.postStart}</postStart>\n+ </exec>\n</wait>\n</run>\n</image>\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/resources/META-INF/keycloak-server.json",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/resources/META-INF/keycloak-server.json",
"diff": "\"connectionsJpa\": {\n\"default\": {\n- \"url\": \"${keycloak.connectionsJpa.url:jdbc:h2:mem:test;MVCC=TRUE;DB_CLOSE_DELAY=-1}\",\n- \"driver\": \"${keycloak.connectionsJpa.driver:org.h2.Driver}\",\n+ \"url\": \"${keycloak.connectionsJpa.url:SET-THE-keycloak.connectionsJpa.URL-PROPERTY}\",\n+ \"driver\": \"${keycloak.connectionsJpa.driver:SET-THE-keycloak.connectionsJpa.driver-PROPERTY}\",\n\"driverDialect\": \"${keycloak.connectionsJpa.driverDialect:}\",\n- \"user\": \"${keycloak.connectionsJpa.user:sa}\",\n+ \"user\": \"${keycloak.connectionsJpa.user:}\",\n\"password\": \"${keycloak.connectionsJpa.password:}\",\n\"initializeEmpty\": true,\n\"migrationStrategy\": \"update\",\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/pom.xml",
"new_path": "testsuite/integration-arquillian/tests/pom.xml",
"diff": "</build>\n</profile>\n- <profile>\n- <id>jdbc-driver-dependency</id>\n- <activation>\n- <property>\n- <name>jdbc.mvn.artifactId</name>\n- </property>\n- </activation>\n- <dependencies>\n- <dependency>\n- <groupId>${jdbc.mvn.groupId}</groupId>\n- <artifactId>${jdbc.mvn.artifactId}</artifactId>\n- <version>${jdbc.mvn.version}</version>\n- </dependency>\n- </dependencies>\n- <build>\n- <plugins>\n- <plugin>\n- <artifactId>maven-enforcer-plugin</artifactId>\n- <executions>\n- <execution>\n- <goals>\n- <goal>enforce</goal>\n- </goals>\n- <configuration>\n- <rules>\n- <requireProperty>\n- <property>jdbc.mvn.groupId</property>\n- </requireProperty>\n- <requireProperty>\n- <property>jdbc.mvn.version</property>\n- </requireProperty>\n- </rules>\n- </configuration>\n- </execution>\n- </executions>\n- </plugin>\n- </plugins>\n- </build>\n- </profile>\n-\n<!-- Profiles for migration tests-->\n<profile>\n<dependency>\n<groupId>com.h2database</groupId>\n<artifactId>h2</artifactId>\n+ <version>${h2.version}</version>\n<scope>compile</scope>\n</dependency>\n</dependency>\n<dependency>\n- <groupId>mysql</groupId>\n- <artifactId>mysql-connector-java</artifactId>\n- </dependency>\n- <dependency>\n- <groupId>org.postgresql</groupId>\n- <artifactId>postgresql</artifactId>\n- <version>${postgresql.version}</version>\n- </dependency>\n- <dependency>\n- <groupId>org.mariadb.jdbc</groupId>\n- <artifactId>mariadb-java-client</artifactId>\n- <version>${mariadb.version}</version>\n+ <groupId>${jdbc.mvn.groupId}</groupId>\n+ <artifactId>${jdbc.mvn.artifactId}</artifactId>\n+ <version>${jdbc.mvn.version}</version>\n+ <scope>compile</scope>\n</dependency>\n<!-- CLI -->\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9456 Docker support for testing with MSSQL, Oracle 11g |
339,364 | 11.02.2019 11:58:48 | -3,600 | 16827ef64b7838b56fee8d47e55f59fe6e5ef82f | Fix broken Arquillian tests in the "other" module | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/pom.xml",
"new_path": "testsuite/integration-arquillian/tests/base/pom.xml",
"diff": "<systemPropertyVariables>\n<com.mchange.v2.c3p0.VMID>testsuiteVmId</com.mchange.v2.c3p0.VMID>\n<auth.server.db.host>${docker.container.testdb.ip}</auth.server.db.host>\n- <keycloak.connectionsJpa.driver>${keycloak.connectionsJpa.driver}</keycloak.connectionsJpa.driver>\n- <keycloak.connectionsJpa.url>${keycloak.connectionsJpa.url}</keycloak.connectionsJpa.url>\n- <keycloak.connectionsJpa.database>${keycloak.connectionsJpa.database}</keycloak.connectionsJpa.database>\n- <keycloak.connectionsJpa.user>${keycloak.connectionsJpa.user}</keycloak.connectionsJpa.user>\n- <keycloak.connectionsJpa.password>${keycloak.connectionsJpa.password}</keycloak.connectionsJpa.password>\n</systemPropertyVariables>\n</configuration>\n</plugin>\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/pom.xml",
"new_path": "testsuite/integration-arquillian/tests/pom.xml",
"diff": "<!-- used by PasswordPolicyTest.testBlacklistPasswordPolicyWithTestBlacklist, see KEYCLOAK-5244 -->\n<keycloak.password.blacklists.path>${project.build.directory}/dependency/password-blacklists</keycloak.password.blacklists.path>\n+\n+ <keycloak.connectionsJpa.driver>${keycloak.connectionsJpa.driver}</keycloak.connectionsJpa.driver>\n+ <keycloak.connectionsJpa.url>${keycloak.connectionsJpa.url}</keycloak.connectionsJpa.url>\n+ <keycloak.connectionsJpa.database>${keycloak.connectionsJpa.database}</keycloak.connectionsJpa.database>\n+ <keycloak.connectionsJpa.user>${keycloak.connectionsJpa.user}</keycloak.connectionsJpa.user>\n+ <keycloak.connectionsJpa.password>${keycloak.connectionsJpa.password}</keycloak.connectionsJpa.password>\n</systemPropertyVariables>\n<properties>\n<property>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9531 Fix broken Arquillian tests in the "other" module |
339,465 | 08.02.2019 10:26:53 | -3,600 | adc3017ff967ab561d20db65dc1244eeb56f0b20 | LDAPSyncTest is failing in some environments | [
{
"change_type": "MODIFY",
"old_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPStorageProviderFactory.java",
"new_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPStorageProviderFactory.java",
"diff": "@@ -424,7 +424,7 @@ public class LDAPStorageProviderFactory implements UserStorageProviderFactory<LD\nlogger.infof(\"Sync all users from LDAP to local store: realm: %s, federation provider: %s\", realmId, model.getName());\n- LDAPQuery userQuery = createQuery(sessionFactory, realmId, model);\n+ try (LDAPQuery userQuery = createQuery(sessionFactory, realmId, model)) {\nSynchronizationResult syncResult = syncImpl(sessionFactory, userQuery, realmId, model);\n// TODO: Remove all existing keycloak users, which have federation links, but are not in LDAP. Perhaps don't check users, which were just added or updated during this sync?\n@@ -432,6 +432,7 @@ public class LDAPStorageProviderFactory implements UserStorageProviderFactory<LD\nlogger.infof(\"Sync all users finished: %s\", syncResult.getStatus());\nreturn syncResult;\n}\n+ }\n@Override\npublic SynchronizationResult syncSince(Date lastSync, KeycloakSessionFactory sessionFactory, String realmId, UserStorageProviderModel model) {\n@@ -445,13 +446,14 @@ public class LDAPStorageProviderFactory implements UserStorageProviderFactory<LD\nCondition modifyCondition = conditionsBuilder.greaterThanOrEqualTo(LDAPConstants.MODIFY_TIMESTAMP, lastSync);\nCondition orCondition = conditionsBuilder.orCondition(createCondition, modifyCondition);\n- LDAPQuery userQuery = createQuery(sessionFactory, realmId, model);\n+ try (LDAPQuery userQuery = createQuery(sessionFactory, realmId, model)) {\nuserQuery.addWhereCondition(orCondition);\nSynchronizationResult result = syncImpl(sessionFactory, userQuery, realmId, model);\nlogger.infof(\"Sync changed users finished: %s\", result.getStatus());\nreturn result;\n}\n+ }\nprotected void syncMappers(KeycloakSessionFactory sessionFactory, final String realmId, final ComponentModel model) {\nKeycloakModelUtils.runJobInTransaction(sessionFactory, new KeycloakSessionTask() {\n@@ -486,7 +488,7 @@ public class LDAPStorageProviderFactory implements UserStorageProviderFactory<LD\nwhile (nextPage) {\nuserQuery.setLimit(pageSize);\nfinal List<LDAPObject> users = userQuery.getResultList();\n- nextPage = userQuery.getPaginationContext() != null;\n+ nextPage = userQuery.getPaginationContext().hasNextPage();\nSynchronizationResult currentPageSync = importLdapUsers(sessionFactory, realmId, fedModel, users);\nsyncResult.add(currentPageSync);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPUtils.java",
"new_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/LDAPUtils.java",
"diff": "@@ -250,7 +250,7 @@ public class LDAPUtils {\n* Load all LDAP objects corresponding to given query. We will load them paginated, so we allow to bypass the limitation of 1000\n* maximum loaded objects in single query in MSAD\n*\n- * @param ldapQuery\n+ * @param ldapQuery LDAP query to be used. The caller should close it after calling this method\n* @param ldapProvider\n* @return\n*/\n@@ -268,7 +268,7 @@ public class LDAPUtils {\nldapQuery.setLimit(pageSize);\nfinal List<LDAPObject> currentPageGroups = ldapQuery.getResultList();\nresult.addAll(currentPageGroups);\n- nextPage = ldapQuery.getPaginationContext() != null;\n+ nextPage = ldapQuery.getPaginationContext().hasNextPage();\n}\nreturn result;\n"
},
{
"change_type": "MODIFY",
"old_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/idm/query/internal/LDAPQuery.java",
"new_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/idm/query/internal/LDAPQuery.java",
"diff": "package org.keycloak.storage.ldap.idm.query.internal;\n+import org.jboss.logging.Logger;\nimport org.keycloak.component.ComponentModel;\nimport org.keycloak.models.ModelDuplicateException;\nimport org.keycloak.models.ModelException;\n@@ -26,7 +27,10 @@ import org.keycloak.storage.ldap.idm.query.Condition;\nimport org.keycloak.storage.ldap.idm.query.Sort;\nimport org.keycloak.storage.ldap.mappers.LDAPStorageMapper;\n+import javax.naming.NamingException;\nimport javax.naming.directory.SearchControls;\n+import javax.naming.ldap.LdapContext;\n+\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\n@@ -39,16 +43,19 @@ import static java.util.Collections.unmodifiableSet;\n/**\n* Default IdentityQuery implementation.\n*\n+ * LDAPQuery should be closed after use in case that pagination was used (initPagination was called)\n*\n* @author Shane Bryzak\n*/\n-public class LDAPQuery {\n+public class LDAPQuery implements AutoCloseable{\n+\n+ private static final Logger logger = Logger.getLogger(LDAPQuery.class);\nprivate final LDAPStorageProvider ldapFedProvider;\nprivate int offset;\nprivate int limit;\n- private byte[] paginationContext;\n+ private PaginationContext paginationContext;\nprivate String searchDn;\nprivate final Set<Condition> conditions = new LinkedHashSet<Condition>();\nprivate final Set<Sort> ordering = new LinkedHashSet<Sort>();\n@@ -144,7 +151,7 @@ public class LDAPQuery {\nreturn offset;\n}\n- public byte[] getPaginationContext() {\n+ public PaginationContext getPaginationContext() {\nreturn paginationContext;\n}\n@@ -197,8 +204,8 @@ public class LDAPQuery {\nreturn this;\n}\n- public LDAPQuery setPaginationContext(byte[] paginationContext) {\n- this.paginationContext = paginationContext;\n+ public LDAPQuery initPagination(LdapContext ldapContext) {\n+ this.paginationContext = new PaginationContext(ldapContext);\nreturn this;\n}\n@@ -210,4 +217,47 @@ public class LDAPQuery {\nreturn ldapFedProvider;\n}\n+\n+ @Override\n+ public void close() {\n+ if (paginationContext != null) {\n+ try {\n+ paginationContext.ldapContext.close();\n+ } catch (NamingException ne) {\n+ logger.error(\"Could not close Ldap context.\", ne);\n+ }\n+ }\n+ }\n+\n+\n+ public static class PaginationContext {\n+\n+ private final LdapContext ldapContext;\n+ private byte[] cookie;\n+\n+ private PaginationContext(LdapContext ldapContext) {\n+ if (ldapContext == null) {\n+ throw new IllegalArgumentException(\"Bad usage. Ldap context must be not null\");\n+ }\n+ this.ldapContext = ldapContext;\n+ }\n+\n+\n+ public LdapContext getLdapContext() {\n+ return ldapContext;\n+ }\n+\n+ public byte[] getCookie() {\n+ return cookie;\n+ }\n+\n+ public void setCookie(byte[] cookie) {\n+ this.cookie = cookie;\n+ }\n+\n+ public boolean hasNextPage() {\n+ return this.cookie != null;\n+ }\n+ }\n+\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/idm/store/ldap/LDAPOperationManager.java",
"new_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/idm/store/ldap/LDAPOperationManager.java",
"diff": "@@ -286,13 +286,19 @@ public class LDAPOperationManager {\nfinal List<SearchResult> result = new ArrayList<SearchResult>();\nfinal SearchControls cons = getSearchControls(identityQuery.getReturningLdapAttributes(), identityQuery.getSearchScope());\n+ // Very 1st page. Pagination context is not yet present\n+ if (identityQuery.getPaginationContext() == null) {\n+ LdapContext ldapContext = createLdapContext();\n+ identityQuery.initPagination(ldapContext);\n+ }\n+\ntry {\nreturn execute(new LdapOperation<List<SearchResult>>() {\n@Override\npublic List<SearchResult> execute(LdapContext context) throws NamingException {\ntry {\n- byte[] cookie = identityQuery.getPaginationContext();\n+ byte[] cookie = identityQuery.getPaginationContext().getCookie();\nPagedResultsControl pagedControls = new PagedResultsControl(identityQuery.getLimit(), cookie, Control.CRITICAL);\ncontext.setRequestControls(new Control[] { pagedControls });\n@@ -310,7 +316,7 @@ public class LDAPOperationManager {\nif (respControl instanceof PagedResultsResponseControl) {\nPagedResultsResponseControl prrc = (PagedResultsResponseControl)respControl;\ncookie = prrc.getCookie();\n- identityQuery.setPaginationContext(cookie);\n+ identityQuery.getPaginationContext().setCookie(cookie);\n}\n}\n}\n@@ -335,7 +341,7 @@ public class LDAPOperationManager {\n.toString();\n}\n- });\n+ }, identityQuery.getPaginationContext().getLdapContext(), null);\n} catch (NamingException e) {\nlogger.errorf(e, \"Could not query server using DN [%s] and filter [%s]\", baseDN, filter);\nthrow e;\n@@ -565,7 +571,7 @@ public class LDAPOperationManager {\n}\n- }, decorator);\n+ }, null, decorator);\n} catch (NamingException e) {\nthrow new ModelException(\"Could not modify attribute for DN [\" + dn + \"]\", e);\n}\n@@ -726,11 +732,13 @@ public class LDAPOperationManager {\n}\nprivate <R> R execute(LdapOperation<R> operation) throws NamingException {\n- return execute(operation, null);\n+ return execute(operation, null, null);\n}\n- private <R> R execute(LdapOperation<R> operation, LDAPOperationDecorator decorator) throws NamingException {\n- LdapContext context = null;\n+ private <R> R execute(LdapOperation<R> operation, LdapContext context, LDAPOperationDecorator decorator) throws NamingException {\n+ // We won't manage LDAP context (create and close) in case that existing context was passed as an argument to this method\n+ boolean manageContext = context == null;\n+\nLong start = null;\ntry {\n@@ -738,14 +746,17 @@ public class LDAPOperationManager {\nstart = Time.currentTimeMillis();\n}\n+ if (manageContext) {\ncontext = createLdapContext();\n+ }\n+\nif (decorator != null) {\ndecorator.beforeLDAPOperation(context, operation);\n}\nreturn operation.execute(context);\n} finally {\n- if (context != null) {\n+ if (context != null && manageContext) {\ntry {\ncontext.close();\n} catch (NamingException ne) {\n"
},
{
"change_type": "MODIFY",
"old_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/mappers/membership/group/GroupLDAPStorageMapper.java",
"new_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/mappers/membership/group/GroupLDAPStorageMapper.java",
"diff": "@@ -350,9 +350,10 @@ public class GroupLDAPStorageMapper extends AbstractLDAPStorageMapper implements\n// Send LDAP query to retrieve all groups\nprotected List<LDAPObject> getAllLDAPGroups(boolean includeMemberAttribute) {\n- LDAPQuery ldapGroupQuery = createGroupQuery(includeMemberAttribute);\n+ try (LDAPQuery ldapGroupQuery = createGroupQuery(includeMemberAttribute)) {\nreturn LDAPUtils.loadAllLDAPObjects(ldapGroupQuery, ldapProvider);\n}\n+ }\n// Sync from Keycloak to LDAP\n"
},
{
"change_type": "MODIFY",
"old_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/mappers/membership/role/RoleLDAPStorageMapper.java",
"new_path": "federation/ldap/src/main/java/org/keycloak/storage/ldap/mappers/membership/role/RoleLDAPStorageMapper.java",
"diff": "@@ -124,7 +124,7 @@ public class RoleLDAPStorageMapper extends AbstractLDAPStorageMapper implements\nlogger.debugf(\"Syncing roles from LDAP into Keycloak DB. Mapper is [%s], LDAP provider is [%s]\", mapperModel.getName(), ldapProvider.getModel().getName());\n// Send LDAP query to load all roles\n- LDAPQuery ldapRoleQuery = createRoleQuery(false);\n+ try (LDAPQuery ldapRoleQuery = createRoleQuery(false)) {\nList<LDAPObject> ldapRoles = LDAPUtils.loadAllLDAPObjects(ldapRoleQuery, ldapProvider);\nRoleContainerModel roleContainer = getTargetRoleContainer(realm);\n@@ -143,6 +143,7 @@ public class RoleLDAPStorageMapper extends AbstractLDAPStorageMapper implements\nreturn syncResult;\n}\n+ }\n// Sync roles from Keycloak back to LDAP\n@@ -165,7 +166,7 @@ public class RoleLDAPStorageMapper extends AbstractLDAPStorageMapper implements\nlogger.debugf(\"Syncing roles from Keycloak into LDAP. Mapper is [%s], LDAP provider is [%s]\", mapperModel.getName(), ldapProvider.getModel().getName());\n// Send LDAP query to see which roles exists there\n- LDAPQuery ldapQuery = createRoleQuery(false);\n+ try (LDAPQuery ldapQuery = createRoleQuery(false)) {\nList<LDAPObject> ldapRoles = LDAPUtils.loadAllLDAPObjects(ldapQuery, ldapProvider);\nSet<String> ldapRoleNames = new HashSet<>();\n@@ -192,6 +193,7 @@ public class RoleLDAPStorageMapper extends AbstractLDAPStorageMapper implements\nreturn syncResult;\n}\n+ }\n// TODO: Possible to merge with GroupMapper and move to common class\npublic LDAPQuery createRoleQuery(boolean includeMemberAttribute) {\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8688 LDAPSyncTest is failing in some environments |
339,185 | 11.12.2018 17:35:37 | -3,600 | 46c00f383b2f1e5b147d507a296c0cb6d0d4f742 | Generate AuthnRequest in SamlSPFacade | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/test-apps/servlets/src/main/java/org/keycloak/testsuite/adapter/servlet/SamlSPFacade.java",
"new_path": "testsuite/integration-arquillian/test-apps/servlets/src/main/java/org/keycloak/testsuite/adapter/servlet/SamlSPFacade.java",
"diff": "package org.keycloak.testsuite.adapter.servlet;\n+import org.keycloak.dom.saml.v2.protocol.AuthnRequestType;\n+import org.keycloak.saml.BaseSAML2BindingBuilder;\n+import org.keycloak.saml.common.constants.JBossSAMLURIConstants;\n+import org.keycloak.saml.common.exceptions.ConfigurationException;\n+import org.keycloak.saml.common.exceptions.ParsingException;\n+import org.keycloak.saml.common.exceptions.ProcessingException;\n+import org.keycloak.saml.processing.api.saml.v2.request.SAML2Request;\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\n@@ -24,6 +31,8 @@ import javax.servlet.http.HttpServletResponse;\nimport javax.ws.rs.core.UriBuilder;\nimport java.io.IOException;\nimport java.io.PrintWriter;\n+import java.net.URI;\n+import java.util.UUID;\n/**\n* @author <a href=\"mailto:[email protected]\">Bill Burke</a>\n@@ -50,7 +59,7 @@ public class SamlSPFacade extends HttpServlet {\nSystem.out.println(\"ParameterMap is empty, redirecting to keycloak server \");\nresp.setStatus(302);\n// Redirect\n- UriBuilder builder = UriBuilder.fromUri(ServletTestUtils.getAuthServerUrlBase() + \"/auth/realms/demo/protocol/saml?SAMLRequest=\" + getSamlRequest());\n+ UriBuilder builder = UriBuilder.fromUri(getSamlAuthnRequest(req));\nbuilder.queryParam(\"RelayState\", RELAY_STATE);\nresp.setHeader(\"Location\", builder.build().toString());\nreturn;\n@@ -85,14 +94,20 @@ public class SamlSPFacade extends HttpServlet {\n* <saml:Issuer xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\">saml-employee</saml:Issuer>\n* <samlp:NameIDPolicy AllowCreate=\"true\" Format=\"urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified\"/>\n* </samlp:AuthnRequest>\n- *\n- * It should be replaced by dynamically generated code. See KEYCLOAK-8245\n*/\n- private String getSamlRequest() {\n- if (System.getProperty(\"auth.server.ssl.required\", \"false\").equals(\"true\")) {\n- return \"jVJLbxshEL5Xyn9A3Ndg%2FNgN8lpyYkW1lDYr2%2B2hl4qw4xiJhQ3Dus2%2FD17HSqqoaQUHBN%2FM9xhmqBrbykUX924Njx1gJL8b61D2DyXtgpNeoUHpVAMoo5abxZdbKQZctsFHr72lp5KPwQoRQjTeUbI4H6%2B9w66BsIFwMBq%2BrW9Luo%2BxlYxZr5Xde4yyEAVn0LTWPwEwSpZJo3HqWH9C45%2FwyXjEVPLDAijbIKuh8ewslR1tUXLjg4bedEl3yiJQslqWdLX8Oa4LmGgQWS74NBvn4j5TxWWeiboY5fySa84nCYxV8mMO8FqO2MHKYVQullTw4STjo4xPt0LItIf5IAn7QUn1IuTKuNq4h48zuz%2BBUH7ebqusuttsKfkOAXvrCUDnZHY0JHv28GZy%2FzuL%2BT%2FinrE3%2FV%2FYWvk1dVwtK2%2BNfiILa%2F2v6xR2TGnE0EEfb6Pi3zUMB8P%2BxtTZrofKzmEL2uwM1JQlHvb%2BX84vPh3XMw%3D%3D\";\n- }\n+ private URI getSamlAuthnRequest(HttpServletRequest req) {\n+ try {\n+ BaseSAML2BindingBuilder binding = new BaseSAML2BindingBuilder();\n+ SAML2Request samlReq = new SAML2Request();\n+ String appServerUrl = ServletTestUtils.getUrlBase(req) + \"/employee/\";\n+ String authServerUrl = ServletTestUtils.getAuthServerUrlBase() + \"/auth/realms/demo/protocol/saml\";\n+ AuthnRequestType loginReq;\n+ loginReq = samlReq.createAuthnRequestType(UUID.randomUUID().toString(), appServerUrl, authServerUrl, \"http://localhost:8280/employee/\");\n+ loginReq.getNameIDPolicy().setFormat(JBossSAMLURIConstants.NAMEID_FORMAT_UNSPECIFIED.getUri());\n- return \"jZJRT9swFIX%2FiuX31I5pSbCaSoVqWiXYIlp42Asyzu1qybGDr1PWfz83LQKJAZP8YNnf9T3nXE9RtbaT8z5u3S089YCR%2FGmtQzlcVLQPTnqFBqVTLaCMWq7mN9dSjLjsgo9ee0uPJZ%2FDChFCNN5RMn%2FZXnmHfQthBWFnNNzdXld0G2MnGbNeK7v1GGUpSs6g7azfAzBKFkmjcepQ%2Fy86T7RKdlgAZVtkDbSevShlB1eUfPNBw%2BC5ohtlEShZLiq6XDyMmxImGkRWCH6ejQvxmKnyoshEU54V%2FIJrzicJxjrZMTt4LUfsYekwKhcrKng%2ByfhZxs%2FXQsi08mJUTsa%2FKKlPQi6Na4z7%2FXlkj0cI5ff1us7qn6s1JfcQcHCeADoj04MhOXQPbwb3v6OYfZH2lL15%2F9Stkz%2FSi8tF7a3RezK31j9fpbBjSiOGHoZ4WxU%2F1pCP8uHENNlmQGXvsANtNgYaylIf9v5bzv4C\";\n+ return binding.redirectBinding(SAML2Request.convert(loginReq)).requestURI(authServerUrl);\n+ } catch (IOException | ConfigurationException | ParsingException | ProcessingException ex) {\n+ throw new RuntimeException(ex);\n+ }\n}\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8245 Generate AuthnRequest in SamlSPFacade |
339,185 | 17.12.2018 16:28:02 | -3,600 | 37e6b6ffc64ef1bb78a629c779ae9100786ba91d | Add support for inspecting log messages for uncaught errors | [
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/services/error/KeycloakErrorHandler.java",
"new_path": "services/src/main/java/org/keycloak/services/error/KeycloakErrorHandler.java",
"diff": "@@ -41,6 +41,8 @@ public class KeycloakErrorHandler implements ExceptionMapper<Throwable> {\nprivate static final Pattern realmNamePattern = Pattern.compile(\".*/realms/([^/]+).*\");\n+ public static final String UNCAUGHT_SERVER_ERROR_TEXT = \"Uncaught server error\";\n+\n@Context\nprivate KeycloakSession session;\n@@ -58,7 +60,7 @@ public class KeycloakErrorHandler implements ExceptionMapper<Throwable> {\nint statusCode = getStatusCode(throwable);\nif (statusCode >= 500 && statusCode <= 599) {\n- logger.error(\"Uncaught server error\", throwable);\n+ logger.error(UNCAUGHT_SERVER_ERROR_TEXT, throwable);\n}\nif (!MediaTypeMatcher.isHtmlRequest(headers)) {\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java",
"diff": "@@ -36,6 +36,8 @@ import org.jboss.arquillian.test.spi.event.suite.BeforeSuite;\nimport org.jboss.logging.Logger;\nimport org.keycloak.admin.client.Keycloak;\nimport org.keycloak.representations.idm.RealmRepresentation;\n+import org.keycloak.services.error.KeycloakErrorHandler;\n+import org.keycloak.testsuite.arquillian.annotation.UncaughtServerErrorExpected;\nimport org.keycloak.testsuite.client.KeycloakTestingClient;\nimport org.keycloak.testsuite.util.LogChecker;\nimport org.keycloak.testsuite.util.OAuthClient;\n@@ -44,6 +46,7 @@ import org.wildfly.extras.creaper.commands.undertow.RemoveUndertowListener;\nimport org.wildfly.extras.creaper.commands.undertow.SslVerifyClient;\nimport org.wildfly.extras.creaper.commands.undertow.UndertowListenerType;\nimport org.wildfly.extras.creaper.core.CommandFailedException;\n+import org.keycloak.testsuite.util.TextFileChecker;\nimport org.wildfly.extras.creaper.core.ManagementClient;\nimport org.wildfly.extras.creaper.core.online.CliException;\nimport org.wildfly.extras.creaper.core.online.OnlineManagementClient;\n@@ -58,11 +61,18 @@ import java.net.MalformedURLException;\nimport java.net.URL;\nimport java.util.List;\nimport java.util.Objects;\n+import java.util.Optional;\nimport java.util.Set;\nimport java.util.concurrent.TimeoutException;\n+import java.util.regex.Matcher;\n+import java.util.regex.Pattern;\nimport java.util.stream.Collectors;\n+import java.util.stream.Stream;\nimport javax.ws.rs.NotFoundException;\n+import org.jboss.arquillian.test.spi.event.suite.After;\n+import org.jboss.arquillian.test.spi.event.suite.Before;\n+import org.junit.Assert;\n/**\n*\n@@ -321,12 +331,34 @@ public class AuthServerTestEnricher {\nstartContainerEvent.fire(new StartContainer(suiteContext.getAuthServerInfo().getArquillianContainer()));\n}\n+ private static final Pattern RECOGNIZED_ERRORS = Pattern.compile(\"ERROR|SEVERE|Exception \");\n+ private static final Pattern IGNORED = Pattern.compile(\"Jetty ALPN support not found|org.keycloak.events\");\n+\n+ private static final boolean isRecognizedErrorLog(String logText) {\n+ //There is expected string \"Exception\" in server log: Adding provider\n+ //singleton org.keycloak.services.resources.ModelExceptionMapper\n+ return RECOGNIZED_ERRORS.matcher(logText).find() && ! IGNORED.matcher(logText).find();\n+ }\n+\n+ private static final void failOnRecognizedErrorInLog(Stream<String> logStream) {\n+ Optional<String> anyRecognizedError = logStream.filter(AuthServerTestEnricher::isRecognizedErrorLog).findAny();\n+ if (anyRecognizedError.isPresent()) {\n+ throw new RuntimeException(String.format(\"Server log file contains ERROR: '%s'\", anyRecognizedError.get()));\n+ }\n+ }\n+\npublic void checkServerLogs(@Observes(precedence = -1) BeforeSuite event) throws IOException, InterruptedException {\n+ if (! suiteContext.getAuthServerInfo().isJBossBased()) {\n+ suiteContext.setServerLogChecker(new TextFileChecker()); // checks nothing\n+ return;\n+ }\n+\nboolean checkLog = Boolean.parseBoolean(System.getProperty(\"auth.server.log.check\", \"true\"));\n- if (checkLog && suiteContext.getAuthServerInfo().isJBossBased()) {\nString jbossHomePath = suiteContext.getAuthServerInfo().getProperties().get(\"jbossHome\");\n- LogChecker.checkJBossServerLog(jbossHomePath);\n+ if (checkLog) {\n+ LogChecker.getJBossServerLogsChecker(true, jbossHomePath).checkFiles(AuthServerTestEnricher::failOnRecognizedErrorInLog);\n}\n+ suiteContext.setServerLogChecker(LogChecker.getJBossServerLogsChecker(false, jbossHomePath));\n}\npublic void initializeTestContext(@Observes(precedence = 2) BeforeClass event) {\n@@ -390,6 +422,31 @@ public class AuthServerTestEnricher {\noAuthClientProducer.set(oAuthClient);\n}\n+ public void beforeTest(@Observes(precedence = 100) Before event) throws IOException {\n+ suiteContext.getServerLogChecker().updateLastCheckedPositionsOfAllFilesToEndOfFile();\n+ }\n+\n+ private static final Pattern UNEXPECTED_UNCAUGHT_ERROR = Pattern.compile(\n+ KeycloakErrorHandler.class.getSimpleName()\n+ + \".*\"\n+ + Pattern.quote(KeycloakErrorHandler.UNCAUGHT_SERVER_ERROR_TEXT)\n+ + \"[\\\\s:]*(.*)$\"\n+ );\n+\n+ private void checkForNoUnexpectedUncaughtError(Stream<String> logStream) {\n+ Optional<Matcher> anyUncaughtError = logStream.map(UNEXPECTED_UNCAUGHT_ERROR::matcher).filter(Matcher::find).findAny();\n+ if (anyUncaughtError.isPresent()) {\n+ Matcher m = anyUncaughtError.get();\n+ Assert.fail(\"Uncaught server error detected: \" + m.group(1));\n+ }\n+ }\n+\n+ public void afterTest(@Observes(precedence = -1) After event) throws IOException {\n+ if (event.getTestMethod().getAnnotation(UncaughtServerErrorExpected.class) == null) {\n+ suiteContext.getServerLogChecker().checkFiles(this::checkForNoUnexpectedUncaughtError);\n+ }\n+ }\n+\npublic void afterClass(@Observes(precedence = 2) AfterClass event) {\n//check if a test accidentally left the auth-server not running\nContainerController controller = containerConroller.get();\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/SuiteContext.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/SuiteContext.java",
"diff": "@@ -24,6 +24,7 @@ import java.util.Set;\nimport org.keycloak.testsuite.arquillian.migration.MigrationContext;\n+import org.keycloak.testsuite.util.TextFileChecker;\nimport java.util.LinkedList;\nimport static org.keycloak.testsuite.util.MailServerConfiguration.FROM;\nimport static org.keycloak.testsuite.util.MailServerConfiguration.HOST;\n@@ -48,6 +49,8 @@ public final class SuiteContext {\nprivate boolean adminPasswordUpdated;\nprivate final Map<String, String> smtpServer = new HashMap<>();\n+ private TextFileChecker serverLogChecker;\n+\n/**\n* True if the testsuite is running in the adapter backward compatibility testing mode,\n* i.e. if the tests are running against newer auth server\n@@ -62,6 +65,14 @@ public final class SuiteContext {\nsmtpServer.put(\"port\", PORT);\n}\n+ public TextFileChecker getServerLogChecker() {\n+ return this.serverLogChecker;\n+ }\n+\n+ public void setServerLogChecker(TextFileChecker serverLogChecker) {\n+ this.serverLogChecker = serverLogChecker;\n+ }\n+\npublic boolean isAdminPasswordUpdated() {\nreturn adminPasswordUpdated;\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/annotation/UncaughtServerErrorExpected.java",
"diff": "+/*\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.keycloak.testsuite.arquillian.annotation;\n+\n+import java.lang.annotation.Documented;\n+import java.lang.annotation.ElementType;\n+import java.lang.annotation.Retention;\n+import java.lang.annotation.Target;\n+import static java.lang.annotation.RetentionPolicy.RUNTIME;\n+\n+/**\n+ * This annotation is for test methods that expect server to throw an uncaught server error\n+ * @author hmlnarik\n+ */\n+@Documented\n+@Retention(RUNTIME)\n+@Target({ElementType.METHOD})\n+public @interface UncaughtServerErrorExpected {\n+\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/LogChecker.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/LogChecker.java",
"diff": "*/\npackage org.keycloak.testsuite.util;\n-import org.apache.commons.io.FileUtils;\n-import org.jboss.logging.Logger;\n-\nimport java.io.File;\nimport java.io.IOException;\n+import java.nio.file.Path;\n+import java.util.Arrays;\n/**\n*\n- * @author vramik\n- * @author tkyjovsk\n+ * @author hmlnarik\n*/\npublic class LogChecker {\n- private static final Logger log = Logger.getLogger(LogChecker.class);\n-\n- private static final String[] IGNORED = new String[] { \".*Jetty ALPN support not found.*\", \".*org.keycloak.events.*\" };\n-\n- public static void checkServerLog(File logFile) throws IOException {\n- log.info(String.format(\"Checking server log: '%s'\", logFile.getAbsolutePath()));\n- String[] logContent = FileUtils.readFileToString(logFile, \"UTF-8\").split(\"\\n\");\n-\n- for (String logText : logContent) {\n- boolean containsError = logText.contains(\"ERROR\") || logText.contains(\"SEVERE\") || logText.contains(\"Exception \");\n- //There is expected string \"Exception\" in server log: Adding provider\n- //singleton org.keycloak.services.resources.ModelExceptionMapper\n- if (containsError) {\n- boolean ignore = false;\n- for (String i : IGNORED) {\n- if (logText.matches(i)) {\n- ignore = true;\n- break;\n- }\n- }\n- if (!ignore) {\n- throw new RuntimeException(String.format(\"Server log file contains ERROR: '%s'\", logText));\n- }\n- }\n- }\n-\n- }\n-\n- public static void checkJBossServerLog(String jbossHome) throws IOException {\n+ public static String[] getJBossServerLogFiles(String jbossHome) {\nboolean domain = System.getProperty(\"auth.server.config.property.name\", \"standalone\").contains(\"domain\");\nif (domain) {\n- checkServerLog(new File(jbossHome + \"/domain/log/process-controller.log\"));\n- checkServerLog(new File(jbossHome + \"/domain/log/host-controller.log\"));\n- checkServerLog(new File(jbossHome + \"/domain/servers/load-balancer/log/server.log\"));\n- checkServerLog(new File(jbossHome + \"/domain/servers/server-one/log/server.log\"));\n+ return new String[] {\n+ jbossHome + \"/domain/log/process-controller.log\",\n+ jbossHome + \"/domain/log/host-controller.log\",\n+ jbossHome + \"/domain/servers/load-balancer/log/server.log\",\n+ jbossHome + \"/domain/servers/server-one/log/server.log\"\n+ };\n} else {\n- checkServerLog(new File(jbossHome + \"/standalone/log/server.log\"));\n+ return new String[] {\n+ jbossHome + \"/standalone/log/server.log\"\n+ };\n}\n}\n+ public static TextFileChecker getJBossServerLogsChecker(boolean verbose, String jbossHome) throws IOException {\n+ String[] pathsToCheck = getJBossServerLogFiles(jbossHome);\n+ Path[] pathsArray = Arrays.stream(pathsToCheck).map(File::new).map(File::toPath).toArray(Path[]::new);\n+\n+ return new TextFileChecker(verbose, pathsArray);\n+ }\n+\n}\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/TextFileChecker.java",
"diff": "+/*\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.keycloak.testsuite.util;\n+\n+import java.io.BufferedReader;\n+import java.io.IOException;\n+import java.io.InputStream;\n+import java.io.InputStreamReader;\n+import java.nio.file.Files;\n+import java.nio.file.Path;\n+import java.util.HashMap;\n+import java.util.Map;\n+import java.util.function.Consumer;\n+import java.util.stream.Stream;\n+import org.jboss.logging.Logger;\n+import org.jboss.logging.Logger.Level;\n+\n+/**\n+ *\n+ * @author hmlnarik\n+ */\n+public class TextFileChecker {\n+\n+ private static final Logger log = Logger.getLogger(TextFileChecker.class);\n+\n+ private final Map<Path, Long> lastCheckedPositions = new HashMap<>();\n+\n+ private final Path[] paths;\n+\n+ private final boolean verbose;\n+\n+ public TextFileChecker(boolean verbose, Path... paths) {\n+ this.verbose = verbose;\n+ this.paths = paths;\n+ }\n+\n+ public TextFileChecker(Path... paths) {\n+ this(false, paths);\n+ }\n+\n+ private void updateLastCheckedPositionsOfAllFilesToEndOfFile(Path path) throws IOException {\n+ if (Files.exists(path)) {\n+ lastCheckedPositions.put(path, Files.size(path));\n+ } else {\n+ lastCheckedPositions.remove(path);\n+ }\n+ }\n+\n+ public void checkFiles(Consumer<Stream<String>> lineChecker) throws IOException {\n+ for (Path path : paths) {\n+ log.logf(verbose ? Level.INFO : Level.DEBUG, \"Checking server log: '%s'\", path.toAbsolutePath());\n+\n+ if (! Files.exists(path)) {\n+ continue;\n+ }\n+\n+ try (InputStream in = Files.newInputStream(path)) {\n+ Long lastCheckedPosition = lastCheckedPositions.computeIfAbsent(path, p -> 0L);\n+ in.skip(lastCheckedPosition);\n+ BufferedReader b = new BufferedReader(new InputStreamReader(in));\n+ lineChecker.accept(b.lines());\n+ }\n+ }\n+ }\n+\n+ public void updateLastCheckedPositionsOfAllFilesToEndOfFile() throws IOException {\n+ for (Path path : paths) {\n+ updateLastCheckedPositionsOfAllFilesToEndOfFile(path);\n+ }\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/error/UncaughtErrorPageTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/error/UncaughtErrorPageTest.java",
"diff": "@@ -7,6 +7,7 @@ import org.keycloak.admin.client.resource.RealmResource;\nimport org.keycloak.common.util.StreamUtil;\nimport org.keycloak.representations.idm.RealmRepresentation;\nimport org.keycloak.testsuite.AbstractKeycloakTest;\n+import org.keycloak.testsuite.arquillian.annotation.UncaughtServerErrorExpected;\nimport org.keycloak.testsuite.pages.ErrorPage;\nimport javax.ws.rs.core.Response;\n@@ -49,6 +50,7 @@ public class UncaughtErrorPageTest extends AbstractKeycloakTest {\n}\n@Test\n+ @UncaughtServerErrorExpected\npublic void uncaughtErrorJson() throws IOException {\nResponse response = testingClient.testing().uncaughtError();\nassertEquals(500, response.getStatus());\n@@ -60,6 +62,7 @@ public class UncaughtErrorPageTest extends AbstractKeycloakTest {\n}\n@Test\n+ @UncaughtServerErrorExpected\npublic void uncaughtError() throws MalformedURLException {\nURI uri = suiteContext.getAuthServerInfo().getUriBuilder().path(\"/auth/realms/master/testing/uncaught-error\").build();\ndriver.navigate().to(uri.toURL());\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/util/TextFileCheckerTest.java",
"diff": "+/*\n+ * Copyright 2018 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.keycloak.testsuite.util;\n+\n+import java.io.File;\n+import java.io.FileWriter;\n+import java.io.IOException;\n+import java.util.Collection;\n+import java.util.LinkedList;\n+import java.util.List;\n+import java.util.function.Consumer;\n+import java.util.stream.Stream;\n+import org.hamcrest.Matchers;\n+import org.junit.After;\n+import org.junit.Assert;\n+import org.junit.Before;\n+import org.junit.Test;\n+\n+/**\n+ *\n+ * @author hmlnarik\n+ */\n+public class TextFileCheckerTest {\n+\n+ private TextFileChecker tfc;\n+ private File tempFile;\n+\n+ private Consumer<Stream<String>> collector(Collection<String> target) {\n+ return (Stream<String> s) -> s.forEachOrdered(target::add);\n+ }\n+\n+ @Before\n+ public void before() throws IOException {\n+ tempFile = File.createTempFile(\"TextFileCheckerTest-\", \".tmp\");\n+ tfc = new TextFileChecker(tempFile.toPath());\n+ }\n+\n+ @After\n+ public void after() throws IOException {\n+ tempFile.delete();\n+ }\n+\n+ @Test\n+ public void testFileChecker() throws Exception {\n+ try (FileWriter fw = new FileWriter(tempFile)) {\n+ assertCheckedOutputIs();\n+\n+ fw.write(\"Hello, Dolly\\n\");\n+ fw.flush();\n+ assertCheckedOutputIs(\"Hello, Dolly\");\n+\n+ fw.write(\"Well, hello, Dolly\\n\");\n+ fw.flush();\n+ assertCheckedOutputIs(\"Hello, Dolly\", \"Well, hello, Dolly\");\n+\n+ fw.write(\"It's so nice to have you back where you belong\\n\");\n+ fw.write(\"You're lookin' swell, Dolly\\n\");\n+ fw.flush();\n+ assertCheckedOutputIs(\"Hello, Dolly\", \"Well, hello, Dolly\", \"It's so nice to have you back where you belong\", \"You're lookin' swell, Dolly\");\n+\n+ tfc.updateLastCheckedPositionsOfAllFilesToEndOfFile();\n+\n+ fw.write(\"I can tell, Dolly\\n\");\n+ fw.write(\"You're still glowin', you're still crowin'\\n\");\n+ fw.flush();\n+ assertCheckedOutputIs(\"I can tell, Dolly\", \"You're still glowin', you're still crowin'\");\n+\n+ tfc.updateLastCheckedPositionsOfAllFilesToEndOfFile();\n+ assertCheckedOutputIs();\n+ }\n+ }\n+\n+ public void assertCheckedOutputIs(String... expectedOutput) throws IOException {\n+ List<String> target = new LinkedList<>();\n+ tfc.checkFiles(collector(target));\n+ Assert.assertThat(target,\n+ expectedOutput == null || expectedOutput.length == 0\n+ ? Matchers.empty()\n+ : Matchers.contains(expectedOutput));\n+ }\n+\n+}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9113 Add support for inspecting log messages for uncaught errors |
339,185 | 18.12.2018 13:05:00 | -3,600 | 52840533c9e3efca4dc620ca830594c4a61ddcf9 | Fix for unhandled exception | [
{
"change_type": "MODIFY",
"old_path": "model/infinispan/src/main/java/org/keycloak/keys/infinispan/InfinispanPublicKeyStorageProvider.java",
"new_path": "model/infinispan/src/main/java/org/keycloak/keys/infinispan/InfinispanPublicKeyStorageProvider.java",
"diff": "@@ -163,7 +163,7 @@ public class InfinispanPublicKeyStorageProvider implements PublicKeyStorageProvi\n}\n} catch (ExecutionException ee) {\n- throw new RuntimeException(\"Error when loading public keys\", ee);\n+ throw new RuntimeException(\"Error when loading public keys: \" + ee.getMessage(), ee);\n} catch (InterruptedException ie) {\nthrow new RuntimeException(\"Error. Interrupted when loading public keys\", ie);\n} finally {\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/broker/oidc/AbstractOAuth2IdentityProvider.java",
"new_path": "services/src/main/java/org/keycloak/broker/oidc/AbstractOAuth2IdentityProvider.java",
"diff": "@@ -21,7 +21,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;\nimport org.jboss.logging.Logger;\nimport org.keycloak.OAuth2Constants;\nimport org.keycloak.OAuthErrorException;\n-import org.keycloak.broker.oidc.OIDCIdentityProvider.OIDCEndpoint;\nimport org.keycloak.broker.provider.AbstractIdentityProvider;\nimport org.keycloak.broker.provider.AuthenticationRequest;\nimport org.keycloak.broker.provider.BrokeredIdentityContext;\n@@ -63,7 +62,6 @@ import java.io.IOException;\nimport java.net.URI;\nimport java.util.Arrays;\nimport java.util.List;\n-import java.util.Map;\nimport java.util.UUID;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/broker/oidc/KeycloakOIDCIdentityProvider.java",
"new_path": "services/src/main/java/org/keycloak/broker/oidc/KeycloakOIDCIdentityProvider.java",
"diff": "@@ -43,7 +43,6 @@ import javax.ws.rs.Path;\nimport javax.ws.rs.core.MultivaluedMap;\nimport javax.ws.rs.core.Response;\nimport java.io.IOException;\n-import java.security.PublicKey;\n/**\n* @author <a href=\"mailto:[email protected]\">Bill Burke</a>\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/broker/oidc/OIDCIdentityProvider.java",
"new_path": "services/src/main/java/org/keycloak/broker/oidc/OIDCIdentityProvider.java",
"diff": "@@ -481,9 +481,14 @@ public class OIDCIdentityProvider extends AbstractOAuth2IdentityProvider<OIDCIde\nprotected boolean verify(JWSInput jws) {\nif (!getConfig().isValidateSignature()) return true;\n+ try {\nPublicKey publicKey = PublicKeyStorageManager.getIdentityProviderPublicKey(session, session.getContext().getRealm(), getConfig(), jws);\nreturn publicKey != null && RSAProvider.verify(jws, publicKey);\n+ } catch (Exception e) {\n+ logger.debug(\"Failed to verify token\", e);\n+ return false;\n+ }\n}\nprotected JsonWebToken validateToken(String encodedToken) {\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9111 Fix for unhandled exception |
339,185 | 15.01.2019 14:21:55 | -3,600 | c34c0a3860fa3c6de5963eb56f431696e826404c | KEYCLOAK-9108 Ignore expected exceptions | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/authorization/AbstractPhotozExampleAdapterTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/authorization/AbstractPhotozExampleAdapterTest.java",
"diff": "@@ -50,6 +50,7 @@ import org.keycloak.representations.idm.authorization.ResourceServerRepresentati\nimport org.keycloak.testsuite.adapter.page.PhotozClientAuthzTestApp;\nimport org.keycloak.testsuite.admin.ApiUtil;\nimport org.keycloak.testsuite.arquillian.AppServerTestEnricher;\n+import org.keycloak.testsuite.arquillian.annotation.UncaughtServerErrorExpected;\nimport org.keycloak.testsuite.auth.page.login.OAuthGrant;\nimport org.keycloak.testsuite.util.DroneUtils;\nimport org.keycloak.testsuite.util.JavascriptBrowser;\n@@ -214,6 +215,7 @@ public abstract class AbstractPhotozExampleAdapterTest extends AbstractPhotozJav\n}\n@Test\n+ @UncaughtServerErrorExpected\npublic void createAlbumWithInvalidUser() throws Exception {\nloginToClientPage(aliceUser);\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/authorization/UserPolicyManagementTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/authorization/UserPolicyManagementTest.java",
"diff": "@@ -41,6 +41,7 @@ import org.keycloak.representations.idm.authorization.DecisionStrategy;\nimport org.keycloak.representations.idm.authorization.Logic;\nimport org.keycloak.representations.idm.authorization.PolicyRepresentation;\nimport org.keycloak.representations.idm.authorization.UserPolicyRepresentation;\n+import org.keycloak.testsuite.arquillian.annotation.UncaughtServerErrorExpected;\nimport org.keycloak.testsuite.util.RealmBuilder;\nimport org.keycloak.testsuite.util.UserBuilder;\n@@ -200,6 +201,7 @@ public class UserPolicyManagementTest extends AbstractPolicyManagementTest {\n}\n@Test\n+ @UncaughtServerErrorExpected\npublic void failInvalidUser() {\nAuthorizationResource authorization = getClient().authorization();\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/kerberos/KerberosStandaloneTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/kerberos/KerberosStandaloneTest.java",
"diff": "@@ -36,6 +36,7 @@ import org.keycloak.representations.idm.ComponentRepresentation;\nimport org.keycloak.representations.idm.UserRepresentation;\nimport org.keycloak.storage.UserStorageProvider;\nimport org.keycloak.testsuite.ActionURIUtils;\n+import org.keycloak.testsuite.arquillian.annotation.UncaughtServerErrorExpected;\nimport org.keycloak.testsuite.util.KerberosRule;\nimport org.keycloak.util.ldap.KerberosEmbeddedServer;\n@@ -156,6 +157,7 @@ public class KerberosStandaloneTest extends AbstractKerberosSingleRealmTest {\n* @throws Exception\n*/\n@Test\n+ @UncaughtServerErrorExpected\npublic void handleUnknownKerberosRealm() throws Exception {\n// Switch kerberos realm to \"unavailable\"\nList<ComponentRepresentation> reps = testRealmResource().components().query(\"test\", UserStorageProvider.class.getName());\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/FlowOverrideTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/FlowOverrideTest.java",
"diff": "@@ -41,6 +41,7 @@ import org.keycloak.representations.idm.RealmRepresentation;\nimport org.keycloak.representations.idm.UserRepresentation;\nimport org.keycloak.testsuite.AbstractTestRealmKeycloakTest;\nimport org.keycloak.testsuite.AssertEvents;\n+import org.keycloak.testsuite.arquillian.annotation.UncaughtServerErrorExpected;\nimport org.keycloak.testsuite.authentication.PushButtonAuthenticatorFactory;\nimport org.keycloak.testsuite.pages.AppPage;\nimport org.keycloak.testsuite.pages.ErrorPage;\n@@ -556,9 +557,16 @@ public class FlowOverrideTest extends AbstractTestRealmKeycloakTest {\nclientRep.getAuthenticationFlowBindingOverrides().put(AuthenticationFlowBindings.BROWSER_BINDING, browserFlowId);\nclients.get(clientRep.getId()).update(clientRep);\ntestWithClientBrowserOverride();\n+ }\n+\n+ @Test\n+ @UncaughtServerErrorExpected\n+ public void testRestInterfaceWithBadId() throws Exception {\n+ ClientsResource clients = adminClient.realm(\"test\").clients();\n+ List<ClientRepresentation> query = clients.findByClientId(TEST_APP_FLOW);\n+ ClientRepresentation clientRep = query.get(0);\n+ String browserFlowId = clientRep.getAuthenticationFlowBindingOverrides().get(AuthenticationFlowBindings.BROWSER_BINDING);\n- query = clients.findByClientId(TEST_APP_FLOW);\n- clientRep = query.get(0);\nclientRep.getAuthenticationFlowBindingOverrides().put(AuthenticationFlowBindings.BROWSER_BINDING, \"bad-id\");\ntry {\nclients.get(clientRep.getId()).update(clientRep);\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9112 KEYCLOAK-9108 Ignore expected exceptions |
339,364 | 25.01.2019 12:38:05 | -3,600 | 7afd068c279482543eb1ab25e901afc9652e95a3 | Fix Stack Overflow Social Login test | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/pages/social/StackOverflowLoginPage.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/pages/social/StackOverflowLoginPage.java",
"diff": "@@ -30,7 +30,7 @@ public class StackOverflowLoginPage extends AbstractSocialLoginPage {\n@FindBy(id = \"password\")\nprivate WebElement passwordInput;\n- @FindBy(xpath = \"//input[@value='Log in']\")\n+ @FindBy(xpath = \"//button[@name='submit-button']\")\nprivate WebElement loginButton;\n@Override\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9423 Fix Stack Overflow Social Login test |
339,465 | 18.02.2019 09:19:39 | -3,600 | e4d41597431d5cf558ee0b125d4c3ab127cef72c | Fix cluster tests. Fix cross-dc tests on embedded undertow | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/HOW-TO-RUN.md",
"new_path": "testsuite/integration-arquillian/HOW-TO-RUN.md",
"diff": "@@ -635,8 +635,9 @@ For **JBoss-based** Keycloak backend containers on real DB, the previous command\nFirst we will manually download, configure and run infinispan servers. Then we can run the tests from IDE against the servers.\nIt's more effective during development as there is no need to restart infinispan server(s) among test runs.\n-1) Download infinispan server 8.2.X from http://infinispan.org/download/ and go through the steps\n-from the [Keycloak Cross-DC documentation](http://www.keycloak.org/docs/latest/server_installation/index.html#jdgsetup) for setup infinispan servers.\n+1) Download infinispan server of corresponding version (See \"infinispan.version\" property in [root pom.xml](../../pom.xml))\n+from http://infinispan.org/download/ and go through the steps from the\n+[Keycloak Cross-DC documentation](http://www.keycloak.org/docs/latest/server_installation/index.html#jdgsetup) for setup infinispan servers.\nThe difference to original docs is, that you need to have JDG servers available on localhost with port offsets. So:\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/servers/auth-server/jboss/common/ant/configure.xml",
"new_path": "testsuite/integration-arquillian/servers/auth-server/jboss/common/ant/configure.xml",
"diff": "<target name=\"check-configuration-state\">\n<available property=\"crossdc-configured\" file=\"${project.build.directory}/crossdc-configured\"/>\n+ <available property=\"cluster-configured\" file=\"${project.build.directory}/cluster-configured\"/>\n<echo>crossdc-configured: ${crossdc-configured}</echo>\n+ <echo>cluster-configured: ${cluster-configured}</echo>\n</target>\n<macrodef name=\"bin-chmod\">\n<touch file=\"${project.build.directory}/crossdc-configured\"/>\n</target>\n+ <!-- TODO: will be better if other subsystems are configured through CLI as well rather than XSL -->\n+ <target name=\"undertow-subsystem-cluster\" unless=\"cluster-configured\" depends=\"check-configuration-state\">\n+ <bin-chmod/>\n+ <exec dir=\"${auth.server.home}/bin\" executable=\"./${jboss.cli.executable}\" failonerror=\"true\">\n+ <arg value=\"--file=${common.resources}/jboss-cli/undertow-subsystem-cluster-setup.cli\"/>\n+ </exec>\n+ <cleanup/>\n+ <touch file=\"${project.build.directory}/cluster-configured\"/>\n+ </target>\n+\n</project>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/servers/auth-server/jboss/common/jboss-cli/undertow-subsystem-cluster-setup.cli",
"diff": "+embed-server --server-config=standalone-ha.xml\n+\n+echo **** Begin ****\n+\n+echo *** Update undertow subsystem ***\n+/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=proxy-address-forwarding,value=true)\n+\n+echo **** End ****\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/servers/auth-server/jboss/pom.xml",
"new_path": "testsuite/integration-arquillian/servers/auth-server/jboss/pom.xml",
"diff": "</execution>\n</executions>\n</plugin>\n-\n+ <plugin>\n+ <groupId>org.apache.maven.plugins</groupId>\n+ <artifactId>maven-antrun-plugin</artifactId>\n+ <executions>\n+ <execution>\n+ <id>configure-undertow-subsystem</id>\n+ <phase>process-resources</phase>\n+ <goals>\n+ <goal>run</goal>\n+ </goals>\n+ <configuration>\n+ <target>\n+ <ant antfile=\"${common.resources}/ant/configure.xml\" target=\"undertow-subsystem-cluster\" />\n+ </target>\n+ </configuration>\n+ </execution>\n+ </executions>\n+ </plugin>\n</plugins>\n</pluginManagement>\n</build>\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/KeycloakOnUndertow.java",
"new_path": "testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/KeycloakOnUndertow.java",
"diff": "package org.keycloak.testsuite.arquillian.undertow;\nimport io.undertow.Undertow;\n+import io.undertow.server.HttpHandler;\nimport io.undertow.server.handlers.PathHandler;\n+import io.undertow.server.handlers.ProxyPeerAddressHandler;\nimport io.undertow.servlet.Servlets;\nimport io.undertow.servlet.api.DefaultServletConfig;\nimport io.undertow.servlet.api.DeploymentInfo;\n@@ -72,7 +74,7 @@ public class KeycloakOnUndertow implements DeployableContainer<KeycloakOnUnderto\nprotected final Logger log = Logger.getLogger(this.getClass());\n- private UndertowJaxrsServer undertow;\n+ private KeycloakUndertowJaxrsServer undertow;\nprivate KeycloakOnUndertowConfiguration configuration;\nprivate KeycloakSessionFactory sessionFactory;\n@@ -187,7 +189,7 @@ public class KeycloakOnUndertow implements DeployableContainer<KeycloakOnUnderto\nlong start = System.currentTimeMillis();\nif (undertow == null) {\n- undertow = new UndertowJaxrsServer();\n+ undertow = new KeycloakUndertowJaxrsServer();\n}\nundertow.start(Undertow.builder()\n@@ -281,4 +283,29 @@ public class KeycloakOnUndertow implements DeployableContainer<KeycloakOnUnderto\nthrow new UnsupportedOperationException(\"Not implemented\");\n}\n+\n+ private static class KeycloakUndertowJaxrsServer extends UndertowJaxrsServer {\n+\n+ @Override\n+ public KeycloakUndertowJaxrsServer start(Undertow.Builder builder) {\n+ try {\n+ // Need to wrap the original handler with ProxyPeerAddressHandler. Thanks to that, if undertow is behind proxy and the proxy\n+ // forwards \"https\" request to undertow as \"http\" request, undertow will be able to establish protocol correctly on the request\n+ // based on the X-Proto headers\n+ Field f = UndertowJaxrsServer.class.getDeclaredField(\"root\");\n+ f.setAccessible(true);\n+ HttpHandler origRootHandler = (HttpHandler) f.get(this);\n+\n+ HttpHandler wrappedHandler = new ProxyPeerAddressHandler(origRootHandler);\n+\n+ server = builder.setHandler(wrappedHandler).build();\n+ server.start();\n+ return this;\n+ } catch (NoSuchFieldException | IllegalAccessException e) {\n+ throw new RuntimeException(e);\n+ }\n+ }\n+\n+ }\n+\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/KeycloakOnUndertowConfiguration.java",
"new_path": "testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/KeycloakOnUndertowConfiguration.java",
"diff": "@@ -118,7 +118,12 @@ public class KeycloakOnUndertowConfiguration extends UndertowContainerConfigurat\nint basePort = getBindHttpPort();\nint newPort = basePort + bindHttpPortOffset;\nsetBindHttpPort(newPort);\n- log.info(\"KeycloakOnUndertow will listen on port: \" + newPort);\n+\n+ int baseHttpsPort = getBindHttpsPort();\n+ int newHttpsPort = baseHttpsPort + bindHttpsPortOffset;\n+ setBindHttpsPort(newHttpsPort);\n+\n+ log.info(\"KeycloakOnUndertow will listen for http on port: \" + newPort + \" and for https on port: \" + newHttpsPort);\nif (this.keycloakConfigPropertyOverrides != null) {\ntry {\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/lb/SimpleUndertowLoadBalancer.java",
"new_path": "testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/lb/SimpleUndertowLoadBalancer.java",
"diff": "@@ -104,7 +104,7 @@ public class SimpleUndertowLoadBalancer {\n.build();\nundertow.start();\n- log.infof(\"#### Loadbalancer started and ready to serve requests on http://%s:%d, http://%s:%d ####\", host, httpPort, host, httpsPort);\n+ log.infof(\"#### Loadbalancer started and ready to serve requests on http://%s:%d, https://%s:%d ####\", host, httpPort, host, httpsPort);\n} catch (Exception e) {\nthrow new RuntimeException(e);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java",
"diff": "@@ -112,6 +112,10 @@ public class AuthServerTestEnricher {\npublic static final String AUTH_SERVER_CROSS_DC_PROPERTY = \"auth.server.crossdc\";\npublic static final boolean AUTH_SERVER_CROSS_DC = Boolean.parseBoolean(System.getProperty(AUTH_SERVER_CROSS_DC_PROPERTY, \"false\"));\n+ public static final String CACHE_SERVER_LIFECYCLE_SKIP_PROPERTY = \"cache.server.lifecycle.skip\";\n+ public static final boolean CACHE_SERVER_LIFECYCLE_SKIP = Boolean.parseBoolean(System.getProperty(CACHE_SERVER_LIFECYCLE_SKIP_PROPERTY, \"false\"));\n+\n+\npublic static final Boolean START_MIGRATION_CONTAINER = \"auto\".equals(System.getProperty(\"migration.mode\")) ||\n\"manual\".equals(System.getProperty(\"migration.mode\"));\n@@ -226,8 +230,7 @@ public class AuthServerTestEnricher {\nif (suiteContext.getDcAuthServerBackendsInfo().stream().anyMatch(List::isEmpty)) {\nthrow new RuntimeException(String.format(\"Some data center has no auth server container matching '%s' defined in arquillian.xml.\", AUTH_SERVER_BACKEND));\n}\n- boolean cacheServerLifecycleSkip = Boolean.parseBoolean(System.getProperty(\"cache.server.lifecycle.skip\"));\n- if (suiteContext.getCacheServersInfo().isEmpty() && !cacheServerLifecycleSkip) {\n+ if (suiteContext.getCacheServersInfo().isEmpty() && !CACHE_SERVER_LIFECYCLE_SKIP) {\nthrow new IllegalStateException(\"Cache containers misconfiguration\");\n}\n@@ -369,21 +372,39 @@ public class AuthServerTestEnricher {\npublic void initializeTLS(@Observes(precedence = 3) BeforeClass event) throws Exception {\n// TLS for Undertow is configured in KeycloakOnUndertow since it requires\n// SSLContext while initializing HTTPS handlers\n- if (AUTH_SERVER_SSL_REQUIRED && isAuthServerJBossBased() && !suiteContext.isAuthServerCrossDc()) {\n- log.info(\"\\n\\n### Setting up TLS ##\\n\\n\");\n+ if (!suiteContext.isAuthServerCrossDc() && !suiteContext.isAuthServerCluster()) {\n+ initializeTLS(suiteContext.getAuthServerInfo());\n+ }\n+ }\n+ public static void initializeTLS(ContainerInfo containerInfo) {\n+ if (AUTH_SERVER_SSL_REQUIRED && containerInfo.isJBossBased()) {\n+ log.infof(\"\\n\\n### Setting up TLS for %s ##\\n\\n\", containerInfo);\ntry {\n- OnlineManagementClient client = getManagementClient();\n- enableTLS(client);\n+ OnlineManagementClient client = getManagementClient(containerInfo);\n+ AuthServerTestEnricher.enableTLS(client);\nclient.close();\n} catch (Exception e) {\n- log.warn(\"Failed to set up TLS. This may lead to unexpected behavior unless the test\" +\n+ log.warn(\"Failed to set up TLS for container '\" + containerInfo.getQualifier() + \"'. This may lead to unexpected behavior unless the test\" +\n\" sets it up manually\", e);\n}\n+\n+ }\n+ }\n+\n+ private static OnlineManagementClient getManagementClient(ContainerInfo containerInfo) {\n+ try {\n+ return ManagementClient.online(OnlineOptions\n+ .standalone()\n+ .hostAndPort(\"localhost\", Integer.valueOf(containerInfo.getProperties().get(\"managementPort\")))\n+ .build()\n+ );\n+ } catch (IOException e) {\n+ throw new RuntimeException(e);\n}\n}\n- protected static void enableTLS(OnlineManagementClient client) throws Exception {\n+ private static void enableTLS(OnlineManagementClient client) throws Exception {\nAdministration administration = new Administration(client);\nOperations operations = new Operations(client);\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/ContainerInfo.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/ContainerInfo.java",
"diff": "@@ -79,7 +79,7 @@ public class ContainerInfo implements Comparable<ContainerInfo> {\n}\npublic boolean isJBossBased() {\n- return isAS7() || isWildfly() || isEAP();\n+ return isAS7() || isWildfly() || isEAP() || getQualifier().toLowerCase().contains(\"jboss\");\n}\n@Override\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/CrossDCTestEnricher.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/CrossDCTestEnricher.java",
"diff": "@@ -76,6 +76,10 @@ public class CrossDCTestEnricher {\nstatic void initializeSuiteContext(SuiteContext suiteContext) {\nValidate.notNull(suiteContext, \"Suite context cannot be null.\");\nCrossDCTestEnricher.suiteContext = suiteContext;\n+\n+ if (AuthServerTestEnricher.AUTH_SERVER_CROSS_DC && suiteContext.getCacheServersInfo().isEmpty() && !AuthServerTestEnricher.CACHE_SERVER_LIFECYCLE_SKIP) {\n+ throw new IllegalStateException(\"Cache containers misconfiguration\");\n+ }\n}\npublic void beforeTest(@Observes(precedence = -2) Before event) {\n@@ -160,33 +164,6 @@ public class CrossDCTestEnricher {\nsuspendPeriodicTasks();\n}\n- private static void initializeTLS(ContainerInfo containerInfo) {\n- if (AuthServerTestEnricher.AUTH_SERVER_SSL_REQUIRED) {\n- log.infof(\"\\n\\n### Setting up TLS for %s ##\\n\\n\", containerInfo);\n- try {\n- OnlineManagementClient client = getManagementClient(containerInfo);\n- AuthServerTestEnricher.enableTLS(client);\n- client.close();\n- } catch (Exception e) {\n- log.warn(\"Failed to set up TLS. This may lead to unexpected behavior unless the test\" +\n- \" sets it up manually\", e);\n- }\n-\n- }\n- }\n-\n- private static OnlineManagementClient getManagementClient(ContainerInfo containerInfo) {\n- try {\n- return ManagementClient.online(OnlineOptions\n- .standalone()\n- .hostAndPort(\"localhost\", Integer.valueOf(containerInfo.getProperties().get(\"managementPort\")))\n- .build()\n- );\n- } catch (IOException e) {\n- throw new RuntimeException(e);\n- }\n- }\n-\npublic void afterTest(@Observes After event) {\nif (!suiteContext.isAuthServerCrossDc()) return;\n@@ -205,12 +182,14 @@ public class CrossDCTestEnricher {\n.map(StopContainer::new)\n.forEach(stopContainer::fire);\n+ if (!AuthServerTestEnricher.CACHE_SERVER_LIFECYCLE_SKIP) {\nDC.validDcsStream()\n.map(CrossDCTestEnricher::getCacheServer)\n.map(ContainerInfo::getArquillianContainer)\n.map(StopContainer::new)\n.forEach(stopContainer::fire);\n}\n+ }\npublic void stopSuiteContainers(@Observes(precedence = 4) StopSuiteContainers event) {\nif (!suiteContext.isAuthServerCrossDc()) return;\n@@ -292,6 +271,8 @@ public class CrossDCTestEnricher {\n}\npublic static void startCacheServer(DC dc) {\n+ if (AuthServerTestEnricher.CACHE_SERVER_LIFECYCLE_SKIP) return;\n+\nif (!containerController.get().isStarted(getCacheServer(dc).getQualifier())) {\nlog.infof(\"--DC: Starting %s\", getCacheServer(dc).getQualifier());\ncontainerController.get().start(getCacheServer(dc).getQualifier());\n@@ -300,6 +281,8 @@ public class CrossDCTestEnricher {\n}\npublic static void stopCacheServer(DC dc) {\n+ if (AuthServerTestEnricher.CACHE_SERVER_LIFECYCLE_SKIP) return;\n+\nString qualifier = getCacheServer(dc).getQualifier();\nif (containerController.get().isStarted(qualifier)) {\n@@ -359,7 +342,7 @@ public class CrossDCTestEnricher {\nif (! containerInfo.isStarted()) {\nlog.infof(\"--DC: Starting backend auth-server node: %s\", containerInfo.getQualifier());\ncontainerController.get().start(containerInfo.getQualifier());\n- initializeTLS(containerInfo);\n+ AuthServerTestEnricher.initializeTLS(containerInfo);\ncreateRESTClientsForNode(containerInfo);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cluster/AbstractClusterTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cluster/AbstractClusterTest.java",
"diff": "@@ -8,6 +8,7 @@ import org.keycloak.admin.client.Keycloak;\nimport org.keycloak.models.Constants;\nimport org.keycloak.representations.idm.RealmRepresentation;\nimport org.keycloak.testsuite.AbstractKeycloakTest;\n+import org.keycloak.testsuite.arquillian.AuthServerTestEnricher;\nimport org.keycloak.testsuite.arquillian.ContainerInfo;\nimport org.keycloak.testsuite.arquillian.undertow.TLSUtils;\nimport org.keycloak.testsuite.client.KeycloakTestingClient;\n@@ -108,6 +109,9 @@ public abstract class AbstractClusterTest extends AbstractKeycloakTest {\nassertTrue(controller.isStarted(node.getQualifier()));\n}\nlog.info(\"Backend node \" + node + \" is started\");\n+\n+ AuthServerTestEnricher.initializeTLS(node);\n+\nif (!backendAdminClients.containsKey(node)) {\nbackendAdminClients.put(node, createAdminClientFor(node));\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml",
"diff": "<property name=\"adapterImplClass\">org.keycloak.testsuite.arquillian.undertow.KeycloakOnUndertow</property>\n<property name=\"bindAddress\">localhost</property>\n<property name=\"bindHttpPort\">${auth.server.http.port}</property>\n+ <property name=\"bindHttpsPort\">${auth.server.https.port}</property>\n<property name=\"bindHttpPortOffset\">-79</property>\n+ <property name=\"bindHttpsPortOffset\">-79</property>\n<property name=\"remoteMode\">${undertow.remote}</property>\n<property name=\"dataCenter\">0</property>\n<property name=\"keycloakConfigPropertyOverrides\">{\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9586 Fix cluster tests. Fix cross-dc tests on embedded undertow |
339,235 | 19.02.2019 19:59:45 | -3,600 | 191c9753decfb9d4338503d4390444c5da29e937 | Update to repository documentation, including updated contributors guide | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "CONTRIBUTING.md",
"diff": "+# Keycloak Community\n+\n+Keycloak is an Open Source Identity and Access Management solution for modern Applications and Services.\n+\n+## Building and working with the codebase\n+\n+Details for building from source and working with the codebase are provided in the [building and working with the code base](docs/building.md) guide.\n+\n+## Contributing to Keycloak\n+\n+Keycloak is an Open Source community-driven project and we welcome contributions as well as feedback from the community.\n+\n+We do have a few guidelines in place to help you be successful with your contribution to Keycloak.\n+\n+Here's a quick checklist for a good PR, more details below:\n+\n+1. [Keycloak Dev Mailing List](https://lists.jboss.org/mailman/listinfo/keycloak-dev)\n+2. A JIRA associated with the PR\n+3. One feature/change per PR\n+4. One commit per PR\n+5. PR rebased on master (`git rebase`, not `git pull`)\n+5. Commit message is prefixed by JIRA number\n+6. No changes to code not directly related to your PR\n+7. Includes functional/integration test\n+8. Includes documentation\n+\n+Once you have submitted your PR please monitor it for comments/feedback. We reserve the right to close inactive PRs if\n+you do not respond within 2 weeks (bear in mind you can always open a new PR if it is closed due to inactivity).\n+\n+Also, please remember that we do receive a fairly large amount of PRs and also have code to write ourselves, so we may\n+not be able to respond to your PR immediately. The best place to ping us is on the thread you started on the dev mailing list.\n+\n+### Finding something to work on\n+\n+If you would like to contribute to Keycloak, but are not sure exactly what to work on, you can find a number of open\n+issues that are awaiting contributions in the\n+[Keycloak JIRA](https://issues.jboss.org/projects/KEYCLOAK/versions/12340167).\n+\n+### Open a discussion on Keycloak Dev Mailing List\n+\n+As Keycloak is a community-driven project we require contributors to send a description of what they are planning to\n+work on to the [Keycloak Dev Mailing List](https://lists.jboss.org/mailman/listinfo/keycloak-dev).\n+\n+We recommend starting the discussion prior to submitting your PR. Through the mailing list you can get valuable\n+feedback both from the core Keycloak team as well as the wider community.\n+\n+### Create an issue in Keycloak JIRA\n+\n+Take your time to write a proper JIRA including a good summary and description.\n+\n+Remember this may be the first thing a reviewer of your PR will look at to get an idea of what you are proposing\n+and it will also be used by the community in the future to find about what new features and enhancements are included in\n+new releases.\n+\n+Note: Keycloak Node.js Admin Client uses GitHub issues and not the Keycloak JIRA.\n+\n+### Implementing\n+\n+Details for building from source and working with the codebase are provided in the\n+[building and working with the code base](docs/building.md) guide.\n+\n+Do not format or refactor code that is not directly related to your contribution. If you do this it will significantly\n+increase our effort in reviewing your PR. If you have a strong need to refactor code then submit a separate PR for the\n+refactoring.\n+\n+### Testing\n+\n+Details for implementing tests are provided in the [writing tests](docs/tests-development.md) guide.\n+\n+Do not add mock frameworks or other testing frameworks that are not already part of the testsuite. Please write tests\n+in the same way as we have written our tests.\n+\n+### Submitting your PR\n+\n+When preparing your PR make sure you have a single commit and your branch is rebased on the master branch from the\n+project repository.\n+\n+This means use the `git rebase` command and not `git pull` when integrating changes from master to your branch. See\n+[Git Documentation](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) for more details.\n+\n+We require that you squash to a single commit. You can do this with the `git rebase -i HEAD~X` command where X\n+is the number of commits you want to squash. See the [Git Documentation](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History)\n+for more details.\n+\n+The above helps us review your PR and also makes it easier for us to maintain the repository. It is also required by\n+our automatic merging process.\n+\n+We also require that the commit message is prefixed with the Keycloak JIRA issue number (example commit message\n+\"KEYCLOAK-9876 My super cool new feature\").\n"
},
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "-Keycloak\n-========\n+# Keycloak\n-Open Source Identity and Access Management for modern Applications and Services.\n+Keycloak is an Open Source Identity and Access Management solution for modern Applications and Services.\n-For more information about Keycloak visit [Keycloak homepage](http://keycloak.org) and [Keycloak blog](http://blog.keycloak.org).\n+This repository contains the source code for the Keycloak Server, Java adapters and the JavaScript adapter.\n-Building\n---------\n+## Help and Documentation\n-Ensure you have JDK 8 (or newer), Maven 3.1.1 (or newer) and Git installed\n+* [Documentation](https://www.keycloak.org/documentation.html)\n+* [User Mailing List](https://lists.jboss.org/mailman/listinfo/keycloak-user) - Mailing list for help and general questions about Keycloak\n+* [JIRA](https://issues.jboss.org/projects/KEYCLOAK) - Issue tracker for bugs and feature requests\n- java -version\n- mvn -version\n- git --version\n-First clone the Keycloak repository:\n+## Reporting Security Vulnerabilities\n- git clone https://github.com/keycloak/keycloak.git\n- cd keycloak\n+If you've found a security vulnerability, please look at the [instructions on how to properly report it](http://www.keycloak.org/security.html)\n-To build Keycloak run:\n- mvn install\n+## Reporting an issue\n-This will build all modules and run the testsuite.\n+If you believe you have discovered a defect in Keycloak please open an issue in our [Issue Tracker](https://issues.jboss.org/projects/KEYCLOAK).\n+Please remember to provide a good summary, description as well as steps to reproduce the issue.\n-To build the distribution run:\n- mvn install -Pdistribution\n+## Getting started\n-Once completed you will find distribution archives in `distribution`.\n+To run Keycloak download the distribution from our [website](https://www.keycloak.org/downloads.html). Unzip and run:\n-To build only the server run:\n+ bin/standalone.[sh|bat]\n- mvn -Pdistribution -pl distribution/server-dist -am -Dmaven.test.skip clean install\n+Alternatively, you can use the Docker image by running:\n+ docker run jboss/keycloak\n-Starting Keycloak\n------------------\n+For more details refer to the [Keycloak Documentation](https://www.keycloak.org/documentation.html).\n-To start Keycloak during development first build as specified above, then run:\n- mvn -f testsuite/utils/pom.xml exec:java -Pkeycloak-server\n+## Building from Source\n-When running testsuite, by default an account with username `admin` and password `admin` will be created within the master realm at start.\n+To build from source refer to the [building and working with the code base](docs/building.md) guide.\n-To start Keycloak from the server distribution first build the distribution it as specified above, then run:\n- tar xfz distribution/server-dist/target/keycloak-<VERSION>.tar.gz\n- cd keycloak-<VERSION>\n- bin/standalone.sh\n+### Testing\n-To stop the server press `Ctrl + C`.\n+To run tests refer to the [running tests](docs/tests.md) guide.\n-Reporting security vulnerabilities\n-----------------------------------\n-If you've found a security vulnerability, please look at the [instructions on how to properly report it](http://www.keycloak.org/security.html)\n+### Writing Tests\n-Help and Documentation\n-----------------------\n-* [Documentation](http://www.keycloak.org/documentation.html) - User Guide, Admin REST API and Javadocs\n-* [User Mailing List](https://lists.jboss.org/mailman/listinfo/keycloak-user) - Mailing list to ask for help and general questions about Keycloak\n-* [JIRA](https://issues.jboss.org/projects/KEYCLOAK) - Issue tracker for bugs and feature requests\n+To write tests refer to the [writing tests](docs/tests-development.md) guide.\n+\n+\n+## Contributing\n+\n+Before contributing to Keycloak please read our [contributing guidelines](CONTRIBUTING.md).\n-Contributing\n-------------\n+## Other Keycloak Projects\n-* Developer documentation\n- * [Hacking on Keycloak](misc/HackingOnKeycloak.md) - How to become a Keycloak contributor\n- * [Testsuite](misc/Testsuite.md) - Details about testsuite, but also how to quickly run Keycloak during development and a few test tools (OTP generation, LDAP server, Mail server)\n- * [Database Testing](misc/DatabaseTesting.md) - How to do testing of Keycloak on different databases\n- * [Updating Database](misc/UpdatingDatabaseSchema.md) - How to change the Keycloak database\n- * [Changing the Default keycloak-subsystem Configuration](misc/UpdatingServerConfig.md) - How to update the default keycloak-subsystem config\n-* [Developer Mailing List](https://lists.jboss.org/mailman/listinfo/keycloak-dev) - Mailing list to discuss development of Keycloak\n+* [Keycloak](https://github.com/keycloak/keycloak) - Keycloak Server and Java adapters\n+* [Keycloak Documentation](https://github.com/keycloak/keycloak-documentation) - Documentation for Keycloak\n+* [Keycloak QuickStarts](https://github.com/keycloak/keycloak-quickstarts) - QuickStarts for getting started with Keycloak\n+* [Keycloak Docker](https://github.com/jboss-dockerfiles/keycloak) - Docker images for Keycloak\n+* [Keycloak Gatekeeper](https://github.com/keycloak/keycloak-gatekeeper) - Proxy service to secure apps and services with Keycloak\n+* [Keycloak Node.js Connect](https://github.com/keycloak/keycloak-nodejs-connect) - Node.js adapter for Keycloak\n+* [Keycloak Node.js Admin Client](https://github.com/keycloak/keycloak-nodejs-admin-client) - Node.js library for Keycloak Admin REST API\n-License\n--------\n+## License\n* [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "docs/building.md",
"diff": "+## Building from source\n+\n+Ensure you have JDK 8 (or newer), Maven 3.1.1 (or newer) and Git installed\n+\n+ java -version\n+ mvn -version\n+ git --version\n+\n+First clone the Keycloak repository:\n+\n+ git clone https://github.com/keycloak/keycloak.git\n+ cd keycloak\n+\n+To build Keycloak run:\n+\n+ mvn install\n+\n+This will build all modules and run the testsuite.\n+\n+To build the ZIP distribution run:\n+\n+ mvn install -Pdistribution\n+\n+Once completed you will find distribution archives in `distribution`.\n+\n+To build only the server run:\n+\n+ mvn -Pdistribution -pl distribution/server-dist -am -Dmaven.test.skip clean install\n+\n+\n+## Starting Keycloak\n+\n+To start Keycloak during development first build as specified above, then run:\n+\n+ mvn -f testsuite/utils/pom.xml exec:java -Pkeycloak-server\n+\n+When running testsuite, by default an account with username `admin` and password `admin` will be created within the master realm at start.\n+\n+To start Keycloak from the server distribution first build the distribution it as specified above, then run:\n+\n+ tar xfz distribution/server-dist/target/keycloak-<VERSION>.tar.gz\n+ cd keycloak-<VERSION>\n+ bin/standalone.sh\n+\n+To stop the server press `Ctrl + C`.\n+\n+\n+## Working with the codebase\n+\n+We don't currently enforce a code style in Keycloak, but a good reference is the code style used by WildFly. This can be\n+retrieved from [Wildfly ide-configs](https://github.com/wildfly/wildfly-core/tree/master/ide-configs).To import formatting\n+rules, see following [instructions](http://community.jboss.org/wiki/ImportFormattingRules).\n+\n+If your changes require updates to the database read [Updating Database Schema](updating-database-schema.md).\n+\n+If your changes require introducing new dependencies or updating dependency versions please discuss this first on the\n+dev mailing list. We do not accept new dependencies to be added lightly, so try to use what is available.\n"
},
{
"change_type": "RENAME",
"old_path": "misc/DependencyLicenseInformation.md",
"new_path": "docs/dependency-license-information.md",
"diff": ""
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "docs/test-development.md",
"diff": "+## Writing tests\n+\n+We focus primarily on integration/functional level tests. Unit tests are avoided and only recommended for isolated\n+classes such as small utils. We do not use any mocking frameworks and we will not accept any contributions that adds a\n+mocking framework.\n+\n+When writing tests please follow the same approach as we have taken in the other tests. There are many ways to\n+test software and we have chosen ours, so please appreciate that.\n+\n+The main tests are provided in testsuite/integration-arquillian/tests/base. Most server tests are here.\n+\n+Integration tests can be executed from the IDE in the same way as you would run unit tests. When ran from within the\n+IDE an embedded Keycloak server is executed automatically.\n+\n+A good test to start looking at is org.keycloak.testsuite.forms.LoginTest. It is reasonable straightforward to understand\n+this test.\n+\n+When developing your test depending on the feature or enhancement you are testing you may find it best to add to an\n+existing test, or to write a test from scratch. For the latter, we recommend finding another test that is close to what\n+you need and use that as a basis.\n+\n+All tests don't have to be fully black box testing as the testsuite deploys a special feature to the Keycloak server\n+that allows running code within the server. This allows writing tests that can execute functions not exposed through\n+APIs as well as access data that is not exposed. For an example on how to do this look at org.keycloak.testsuite.runonserver.RunOnServerTest.\n\\ No newline at end of file\n"
},
{
"change_type": "RENAME",
"old_path": "misc/DatabaseTesting.md",
"new_path": "docs/tests-db.md",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "misc/OIDCConformanceTestsuite.md",
"new_path": "docs/tests-oidc-conformance.md",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "misc/Testsuite.md",
"new_path": "docs/tests.md",
"diff": "-Executing testsuite\n-===================\n+Executing tests\n+===============\nBrowser\n-------\n@@ -11,7 +11,7 @@ To run the tests with Firefox add `-Dbrowser=firefox` or for Chrome add `-Dbrows\nDatabase\n--------\n-By default the testsuite uses an embedded H2 database to test with other databases see (Database Testing)[DatabaseTesting.md].\n+By default the testsuite uses an embedded H2 database to test with other databases see (Database Testing)[tests-db.md].\nTest utils\n==========\n"
},
{
"change_type": "RENAME",
"old_path": "misc/UpdatingDatabaseSchema.md",
"new_path": "docs/updating-database-schema.md",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "misc/UpdatingServerConfig.md",
"new_path": "docs/updating-server-config.md",
"diff": ""
},
{
"change_type": "DELETE",
"old_path": "misc/HackingOnKeycloak.md",
"new_path": null,
"diff": "-Hacking on Keycloak\n-===================\n-\n-GitHub Repository\n------------------\n-\n-### Create a GitHub account if you don't already have one\n-\n-[Join GitHub](https://github.com/join)\n-\n-### Fork Keycloak repository into your account\n-\n-[https://github.com/keycloak/keycloak](https://github.com/keycloak/keycloak)\n-\n-### Clone your newly forked copy onto your local workspace\n-\n- git clone https://github.com/<your username>/keycloak.git\n- cd keycloak\n-\n-### Add a remote ref to upstream for pulling future updates\n-\n- git remote add upstream https://github.com/keycloak/keycloak.git\n-\n-### Pull later updates from upstream\n-\n- git fetch upstream\n- git rebase upstream/master\n-\n-\n-Discuss changes\n----------------\n-\n-Before starting work on a new feature or anything besides a minor bug fix join the [Keycloak Dev mailing list](https://lists.jboss.org/mailman/listinfo/keycloak-dev)\n-and send a mail about your proposed changes. This is vital as otherwise you may waste days implementing a feature that is later rejected.\n-\n-Once you have received feedback from the mailing list if there's not one already create a [JIRA issue](https://issues.jboss.org/browse/KEYCLOAK).\n-\n-\n-Implement changes\n------------------\n-\n-We don't currently enforce a code style in Keycloak, but a good reference is the code style used by WildFly. This can be retrieved from [Wildfly ide-configs](https://github.com/wildfly/wildfly-core/tree/master/ide-configs).To import formatting rules, see following [instructions](http://community.jboss.org/wiki/ImportFormattingRules)\n-\n-If your changes requires updates to the database read [Updating Database Schema](UpdatingDatabaseSchema.md).\n-\n-To try your changes out manually you can quickly start Keycloak from within your IDEA or Maven, to find out how to do this\n-read [Testsuite](Testsuite.md). It's also important that you add tests to the testsuite for your changes.\n-\n-\n-Get your changes merged into upstream\n--------------------------------------\n-\n-Here's a quick check list for a good pull request (PR):\n-\n-* Discussed and agreed on Keycloak Dev mailing list\n-* One commit per PR\n-* One feature/change per PR\n-* No changes to code not directly related to your change (e.g. no formatting changes or refactoring to existing code, if you want to refactor/improve existing code that's a separate discussion to mailing list and JIRA issue)\n-* A JIRA associated with your PR (include the JIRA issue number in commit comment)\n-* All tests in testsuite pass\n-* Do a rebase on upstream master\n-* We only accept contributions to the master branch. The exception to this is if the fix is for the latest CR release and Final has not yet been released, in which case you can send the PR to both the corresponding branch and the master branch.\n-* PR needs to be accompanied with tests that sufficiently test added/changed functionality\n-* Relevant documentation change needs to be submitted to keycloak/keycloak-documentation repository\n-* Should a change be requested in a PR that stays without response for 2 weeks, the PR would be closed\n-\n-Once you're happy with your changes go to GitHub and create a PR to the master branch.\n-\n-\n-Development of Wildfly-based features\n--------------------------------------\n-\n-When your changes are developed for Wildfly only, it is rather useful to create a jar-less distro that would retrieve the module jars directly\n-from maven artifacts so that you would not to have to replace the module jars manually during development. You can create such a server\n-distribution by adding a keycloak.provisioning.xml parameter to the standard maven command for creating distribution:\n-\n- mvn clean install -Pdistribution -Dkeycloak.provisioning.xml=server-provisioning-devel.xml\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | Update to repository documentation, including updated contributors guide |
339,378 | 14.01.2019 12:02:04 | -3,600 | b666756b8f8d2bb23338cf04fa031df8d35417c9 | Make theme properties available in email templates | [
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/email/freemarker/FreeMarkerEmailTemplateProvider.java",
"new_path": "services/src/main/java/org/keycloak/email/freemarker/FreeMarkerEmailTemplateProvider.java",
"diff": "@@ -204,6 +204,7 @@ public class FreeMarkerEmailTemplateProvider implements EmailTemplateProvider {\nattributes.put(\"locale\", locale);\nProperties rb = theme.getMessages(locale);\nattributes.put(\"msg\", new MessageFormatterMethod(locale, rb));\n+ attributes.put(\"properties\", theme.getProperties());\nString subject = new MessageFormat(rb.getProperty(subjectKey, subjectKey), locale).format(subjectAttributes.toArray());\nString textTemplate = String.format(\"text/%s\", template);\nString textBody;\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9320 Make theme properties available in email templates |
339,176 | 10.12.2018 15:27:01 | -3,600 | cc79963f81e6ef4a7d6fc651ae0ffcdf760ded27 | Fix typo: "credentia" -> "credential" | [
{
"change_type": "MODIFY",
"old_path": "server-spi/src/main/java/org/keycloak/credential/hash/PasswordHashProvider.java",
"new_path": "server-spi/src/main/java/org/keycloak/credential/hash/PasswordHashProvider.java",
"diff": "@@ -25,7 +25,7 @@ import org.keycloak.provider.Provider;\n* @author <a href=\"mailto:[email protected]\">Kunal Kerkar</a>\n*/\npublic interface PasswordHashProvider extends Provider {\n- boolean policyCheck(PasswordPolicy policy, CredentialModel credentia);\n+ boolean policyCheck(PasswordPolicy policy, CredentialModel credential);\nvoid encode(String rawPassword, int iterations, CredentialModel credential);\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | Fix typo: "credentia" -> "credential" |
339,241 | 29.11.2018 10:51:07 | 21,600 | 4cd617bc42bd719f49a30499d84d6b1c3d39004f | Added method to return KeycloakSession from RealmCreationEvent | [
{
"change_type": "MODIFY",
"old_path": "model/jpa/src/main/java/org/keycloak/models/jpa/JpaRealmProvider.java",
"new_path": "model/jpa/src/main/java/org/keycloak/models/jpa/JpaRealmProvider.java",
"diff": "@@ -81,6 +81,10 @@ public class JpaRealmProvider implements RealmProvider {\npublic RealmModel getCreatedRealm() {\nreturn adapter;\n}\n+ @Override\n+ public KeycloakSession getKeycloakSession() {\n+ return session;\n+ }\n});\nreturn adapter;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "server-spi/src/main/java/org/keycloak/models/RealmModel.java",
"new_path": "server-spi/src/main/java/org/keycloak/models/RealmModel.java",
"diff": "@@ -34,6 +34,7 @@ import java.util.*;\npublic interface RealmModel extends RoleContainerModel {\ninterface RealmCreationEvent extends ProviderEvent {\nRealmModel getCreatedRealm();\n+ KeycloakSession getKeycloakSession();\n}\ninterface RealmPostCreateEvent extends ProviderEvent {\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8977 Added method to return KeycloakSession from RealmCreationEvent |
339,526 | 23.01.2019 18:15:15 | 0 | 3c0e8022a97c155e7da56ad3fb5e58b40ff60b08 | Added tests for common utilities CollectionUtil & HtmlUtils.
These tests were written using Diffblue Cover. | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "common/src/test/java/org/keycloak/common/util/CollectionUtilTest.java",
"diff": "+package org.keycloak.common.util;\n+\n+import org.junit.Assert;\n+import org.junit.Test;\n+import org.keycloak.common.util.CollectionUtil;\n+\n+import java.util.ArrayList;\n+\n+public class CollectionUtilTest {\n+\n+ @Test\n+ public void joinInputNoneOutputEmpty() {\n+ final ArrayList<String> strings = new ArrayList<String>();\n+ final String retval = CollectionUtil.join(strings, \",\");\n+ Assert.assertEquals(\"\", retval);\n+ }\n+\n+ @Test\n+ public void joinInput2SeparatorNull() {\n+ final ArrayList<String> strings = new ArrayList<String>();\n+ strings.add(\"foo\");\n+ strings.add(\"bar\");\n+ final String retval = CollectionUtil.join(strings, null);\n+ Assert.assertEquals(\"foonullbar\", retval);\n+ }\n+\n+ @Test\n+ public void joinInput1SeparatorNotNull() {\n+ final ArrayList<String> strings = new ArrayList<String>();\n+ strings.add(\"foo\");\n+ final String retval = CollectionUtil.join(strings, \",\");\n+ Assert.assertEquals(\"foo\", retval);\n+ }\n+\n+ @Test\n+ public void joinInput2SeparatorNotNull() {\n+ final ArrayList<String> strings = new ArrayList<String>();\n+ strings.add(\"foo\");\n+ strings.add(\"bar\");\n+ final String retval = CollectionUtil.join(strings, \",\");\n+ Assert.assertEquals(\"foo,bar\", retval);\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "common/src/test/java/org/keycloak/common/util/HtmlUtilsTest.java",
"diff": "+package org.keycloak.common.util;\n+\n+import org.junit.Assert;\n+import org.junit.Test;\n+import org.keycloak.common.util.HtmlUtils;\n+\n+public class HtmlUtilsTest {\n+\n+ @Test\n+ public void escapeAttribute() {\n+ Assert.assertEquals(HtmlUtils.escapeAttribute(\"1<2\"), \"1<2\");\n+ Assert.assertEquals(HtmlUtils.escapeAttribute(\"2<3&&3>2\"), \"2<3&&3>2\");\n+ Assert.assertEquals(HtmlUtils.escapeAttribute(\"test\"), \"test\");\n+ Assert.assertEquals(HtmlUtils.escapeAttribute(\"\\'test\\'\"), \"'test'\");\n+ Assert.assertEquals(HtmlUtils.escapeAttribute(\"\\\"test\\\"\"), \""test"\");\n+ }\n+}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | Added tests for common utilities CollectionUtil & HtmlUtils.
These tests were written using Diffblue Cover. |
339,470 | 22.01.2019 14:20:39 | 0 | b5fbc04e5e8acc2d72e521573ee18ae54a8e6f18 | Add "aud" to DEFAULT_CLAIMS_SUPPORTED
See | [
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/protocol/oidc/OIDCWellKnownProvider.java",
"new_path": "services/src/main/java/org/keycloak/protocol/oidc/OIDCWellKnownProvider.java",
"diff": "@@ -58,7 +58,7 @@ public class OIDCWellKnownProvider implements WellKnownProvider {\npublic static final List<String> DEFAULT_CLIENT_AUTH_SIGNING_ALG_VALUES_SUPPORTED = list(Algorithm.RS256.toString());\n// The exact list depends on protocolMappers\n- public static final List<String> DEFAULT_CLAIMS_SUPPORTED= list(\"sub\", \"iss\", IDToken.AUTH_TIME, IDToken.NAME, IDToken.GIVEN_NAME, IDToken.FAMILY_NAME, IDToken.PREFERRED_USERNAME, IDToken.EMAIL);\n+ public static final List<String> DEFAULT_CLAIMS_SUPPORTED= list(\"aud\", \"sub\", \"iss\", IDToken.AUTH_TIME, IDToken.NAME, IDToken.GIVEN_NAME, IDToken.FAMILY_NAME, IDToken.PREFERRED_USERNAME, IDToken.EMAIL);\npublic static final List<String> DEFAULT_CLAIM_TYPES_SUPPORTED= list(\"normal\");\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9376 Add "aud" to DEFAULT_CLAIMS_SUPPORTED
See https://issues.jboss.org/browse/KEYCLOAK-9376?_sscc=t |
339,168 | 17.12.2018 15:58:50 | -3,600 | 9b1ab0f99285f93af55ec6688f0cd021e6b2690d | Fixes JWK serialization of ECDSA public key coordinates. | [
{
"change_type": "MODIFY",
"old_path": "core/src/main/java/org/keycloak/jose/jwk/JWKBuilder.java",
"new_path": "core/src/main/java/org/keycloak/jose/jwk/JWKBuilder.java",
"diff": "@@ -77,20 +77,23 @@ public class JWKBuilder {\nreturn k;\n}\n-\npublic JWK ec(Key key) {\nECPublicKey ecKey = (ECPublicKey) key;\nECPublicJWK k = new ECPublicJWK();\nString kid = this.kid != null ? this.kid : KeyUtils.createKeyId(key);\n+ int fieldSize = ecKey.getParams().getCurve().getField().getFieldSize();\n+ BigInteger affineX = ecKey.getW().getAffineX();\n+ BigInteger affineY = ecKey.getW().getAffineY();\n+\nk.setKeyId(kid);\nk.setKeyType(KeyType.EC);\nk.setAlgorithm(algorithm);\nk.setPublicKeyUse(DEFAULT_PUBLIC_KEY_USE);\n- k.setCrv(\"P-\" + ecKey.getParams().getCurve().getField().getFieldSize());\n- k.setX(Base64Url.encode(ecKey.getW().getAffineX().toByteArray()));\n- k.setY(Base64Url.encode(ecKey.getW().getAffineY().toByteArray()));\n+ k.setCrv(\"P-\" + fieldSize);\n+ k.setX(Base64Url.encode(toIntegerBytes(ecKey.getW().getAffineX())));\n+ k.setY(Base64Url.encode(toIntegerBytes(ecKey.getW().getAffineY())));\nreturn k;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "core/src/test/java/org/keycloak/jose/jwk/JWKTest.java",
"new_path": "core/src/test/java/org/keycloak/jose/jwk/JWKTest.java",
"diff": "package org.keycloak.jose.jwk;\nimport org.junit.Test;\n+import org.keycloak.common.util.Base64Url;\nimport org.keycloak.common.util.KeyUtils;\nimport org.keycloak.crypto.JavaAlgorithm;\nimport org.keycloak.util.JsonSerialization;\n@@ -86,9 +87,17 @@ public class JWKTest {\nassertTrue(jwk instanceof ECPublicJWK);\n- assertNotNull(((ECPublicJWK) jwk).getCrv());\n- assertNotNull(((ECPublicJWK) jwk).getX());\n- assertNotNull(((ECPublicJWK) jwk).getY());\n+ ECPublicJWK ecJwk = (ECPublicJWK) jwk;\n+\n+ assertNotNull(ecJwk.getCrv());\n+ assertNotNull(ecJwk.getX());\n+ assertNotNull(ecJwk.getY());\n+\n+ byte[] xBytes = Base64Url.decode(ecJwk.getX());\n+ byte[] yBytes = Base64Url.decode(ecJwk.getY());\n+\n+ assertEquals(256/8, xBytes.length);\n+ assertEquals(256/8, yBytes.length);\nString jwkJson = JsonSerialization.writeValueAsString(jwk);\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9116: Fixes JWK serialization of ECDSA public key coordinates.
Signed-off-by: Lars Wilhelmsen <[email protected]> |
339,581 | 03.12.2018 15:15:14 | -3,600 | 195aeaca681ff3f62e139df3481f52f8395a3dd7 | Update stress-testing script | [
{
"change_type": "MODIFY",
"old_path": "testsuite/performance/README.stress-test.md",
"new_path": "testsuite/performance/README.stress-test.md",
"diff": "-# Stress Testing\n+# Keycloak Performance Testsuite - Stress Testing\n-Stress testing is a type of performance testing focused on *finding the maximum performance* of the system for a specific scenario.\n+## Requirements\n-There are various strategies but in general the stress test is a cycle of individual tests runs.\n-After each run the performance assertions are evaluated before deciding if/how the loop should continue.\n+- Bash\n+- `bc`: Arbitrary precision calculator.\n-The [test assertions](https://gatling.io/docs/2.3/general/assertions/) are constructed as boolean expressions on top of computed performance metrics, such as mean response time, percentage of failed requests, etc.\n+## Stress Test\n+The performance testsuite contains a stress-testing script: `stress-test.sh`.\n-## Requirements\n+The stress test is implemented as a loop of individual performance test runs.\n+The script supports two algorithms:\n+- incremental (default)\n+- bisection\n-- `bc` tool for floating-point arithmetic\n+The *incremental algorithm* loop starts from a base load and then increases the load by a specified amount in each iteration.\n+The loop ends when a performance test fails, or when the maximum number of iterations is reached.\n+The *bisection algorithm* loop has a lower and an upper bound, and a resolution parameter.\n+In each iteration the middle of the interval is used as a value for the performance test load.\n+Depending on whether the test passes or fails the lower or upper half of the interval is used for the next iteration.\n+The loop ends if size of the interval is lower than the specified resolution, or when the maximum number of iterations is reached.\n## Usage\n-`./stress-test.sh [ADDITIONAL_TEST_PARAMS]`\n-\n-Parameters of the stress test are loaded from `stress-test-config.sh`.\n+```\n+export PARAMETER1=value1\n+export PARAMETER2=value2\n+...\n+stress-test.sh [-DadditionalTestsuiteParam1=value1 -DadditionalTestsuiteParam2=value2 ...]\n+```\n-Additional `PROVISIONING_PARAMETERS` can be set via environment variable.\n+## Parameters\n-## Common Parameters\n+### Script Execution Parameters\n-| Environment Variable | Description | Default Value |\n+| Variable | Description | Default Value |\n| --- | --- | --- |\n-| `algorithm` | Stress test loop algorithm. Available values: `incremental`, `bisection`. | `incremental` |\n-| `provisioning` | When `true` (enabled), the `provision` and `import-dump` operations are run before, and the `teardown` operation is run after test in each iteration. Warm-up is applied in all iterations. When `false` (disabled), there is no provisioning or teardown, and the warm-up is only applied in the first iteration. | `true` (enabled) |\n-| `PROVISIONING_PARAMETERS` | Additional set of parameters passed to the provisioning command. | |\n-| `maxIterations` | Maximum number of iterations of the stress test loop. | `10` iterations |\n-| `dataset` | Dataset to be used. | `100u2c` |\n-| `warmUpPeriod` | Sets value of `warmUpPeriod` parameter. If `provisioning` is disabled the warm-up is only done in the first iteration. | `120` seconds |\n-| `sequentialUsersFrom` | Value for the `sequentialUsersFrom` test parameter. If provisioning is disabled the value passed to the test command will be multiplied with each iteration. To be used with registration test scenario. | `-1` (random user iteration) |\n-\n-\n-## Incremental Method\n+| `MVN` | The base Maven command to be used. | `mvn` |\n+| `KEYCLOAK_PROJECT_HOME` | Root directory of the Keycloak project. | Root directory relative to the location of the `stress-test.sh` script. |\n+| `DRY_RUN` | Don't execute performance tests. Only print out execution information for each iteration. | `false` |\n-Incremental stress test is a loop with gradually increasing load being put on the system.\n-The cycle breaks with the first loop that fails the performance assertions, or after a maximum number of iterations\n+### Performance Testuite Parameters\n-It is useful for testing how various performance metrics evolve dependning on linear increments of load.\n-\n-### Parameters of Incremental Stress Test\n-\n-| Environment Variable | Description | Default Value |\n+| Variable | Description | Default Value |\n| --- | --- | --- |\n-| `usersPerSec0` | Value of `usersPerSec` parameter for the first iteration. | `5` user per second |\n-| `incrementFactor` | Factor of increment of `usersPerSec` with each subsequent iteration. The `usersPerSec` for iteration `i` (counted from 0) is computed as `usersPerSec0 + i * incrementFactor`. | `1` |\n+| `DATASET` | Dataset to be used. | `1r_10c_100u` |\n+| `WARMUP_PERIOD` | Value of `warmUpPeriod` testsuite parameter. | `120` seconds |\n+| `RAMPUP_PERIOD` | Value of `rampUpPeriod` testsuite parameter. | `60` seconds |\n+| `MEASUREMENT_PERIOD` | Value of `measurementPeriod` testsuite parameter. | `120` seconds |\n+| `FILTER_RESULTS` | Value of `filterResults` testsuite parameter. Should be enabled. | `true` |\n+| `@` | Any parameters provided to the `stress-test.sh` script will be passed to the performance testsuite. Optional. | |\n+### Stress Test Parameters\n-## Bisection Method\n+| Variable | Description | Default Value |\n+| --- | --- | --- |\n+| `STRESS_TEST_ALGORITHM` | Stress test loop algorithm: `incremental` or `bisection`. | `incremental` |\n+| `STRESS_TEST_MAX_ITERATIONS` | Maximum number of stress test loop iterations. | `10` iterations |\n+| `STRESS_TEST_PROVISIONING` | Should the system be re-provisioned in each iteration? If enabled the dataset DB dump is re-imported and the warmup is run in each iteration. | `false` |\n+| `STRESS_TEST_PROVISIONING_GENERATE_DATASET` | Should the dataset be generated, instead of imported from DB dump? | `false` |\n+| `STRESS_TEST_PROVISIONING_PARAMETERS` | Additional parameters for the provisioning command. Optional. | |\n-This method (also called interval halving method) halves an interval defined by the lowest and highest expected value.\n-The test is performed with a load value from the middle of the specified interval and depending on the result either the lower or the upper half is used in the next iteration.\n-The cycle breaks when the interval gets smaller than a specified tolerance value, or after a maximum number of iterations.\n+#### Incremental Algorithm\n-If set up properly the bisection algorithm is typically faster and more precise than the incremental method.\n-However it doesn't show metrics evolving with the linear progression of load.\n+| Variable | Description | Default Value |\n+| --- | --- | --- |\n+| `STRESS_TEST_UPS_FIRST` | Value of `usersPerSec` parameter in the first iteration. | `1.000` users per second |\n+| `STRESS_TEST_UPS_INCREMENT` | Increment of `usersPerSec` parameter for each subsequent iteration. | `1.000` users per second |\n-### Parameters of Bisection Stress Test\n+#### Bisection Algorithm\n-| Environment Variable | Description | Default Value |\n+| Variable | Description | Default Value |\n| --- | --- | --- |\n-| `lowPoint` | The lower bound of the halved interval. Should be set to the lowest reasonably expected value of maximum performance. | `0` users per second |\n-| `highPoint` | The upper bound of the halved interval. | `10` users per second |\n-| `tolerance` | Indicates the precision of measurement. The stress test loop stops when the size of the halved interval is lower than this value. | `1` users per second |\n+| `STRESS_TEST_UPS_LOWER_BOUND` | Lower bound of `usersPerSec` parameter. | `0.000` users per second |\n+| `STRESS_TEST_UPS_UPPER_BOUND` | Upper bound of `usersPerSec` parameter. | `10.000` users per second |\n+| `STRESS_TEST_UPS_RESOLUTION` | Required resolution of the bisection algorithm. | `1.000` users per second |\n"
},
{
"change_type": "DELETE",
"old_path": "testsuite/performance/stress-test-config.sh",
"new_path": null,
"diff": "-#!/bin/bash\n-\n-# common settings\n-export algorithm=incremental\n-export provisioning=false\n-export maxIterations=10\n-\n-export dataset=100u2c\n-export warmUpPeriod=120\n-export sequentialUsersFrom=-1\n-\n-# incremental\n-export usersPerSec0=5\n-export incrementFactor=1\n-\n-# bisection\n-export lowPoint=0.000\n-export highPoint=10.000\n-export tolerance=1.000\n-\n-# other\n-export debug=false\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/performance/stress-test.sh",
"new_path": "testsuite/performance/stress-test.sh",
"diff": "#!/bin/bash\n-BASEDIR=$(cd \"$(dirname \"$0\")\"; pwd)\n-cd $BASEDIR\n-\n-. ./stress-test-config.sh\n-\n-MVN=${MVN:-mvn}\n-PROVISIONING_PARAMETERS=${PROVISIONING_PARAMETERS:-}\n-PROVISION_COMMAND=\"$MVN verify -P provision,import-dump $PROVISIONING_PARAMETERS -Ddataset=$dataset\"\n-TEARDOWN_COMMAND=\"$MVN verify -P teardown\"\n-\n-function runCommand {\n+# Execution Parameters\n+MVN=\"${MVN:-mvn}\"\n+KEYCLOAK_PROJECT_HOME=${KEYCLOAK_PROJECT_HOME:-$(cd \"$(dirname \"$0\")/../..\"; pwd)}\n+DRY_RUN=${DRY_RUN:-false}\n+\n+# Performance Testsuite Parameters\n+DATASET=${DATASET:-1r_10c_100u}\n+WARMUP_PERIOD=${WARMUP_PERIOD:-120}\n+RAMPUP_PERIOD=${RAMPUP_PERIOD:-60}\n+MEASUREMENT_PERIOD=${MEASUREMENT_PERIOD:-120}\n+FILTER_RESULTS=${FILTER_RESULTS:-true}\n+\n+# Stress Test Parameters\n+STRESS_TEST_ALGORITHM=${STRESS_TEST_ALGORITHM:-incremental}\n+STRESS_TEST_MAX_ITERATIONS=${STRESS_TEST_MAX_ITERATIONS:-10}\n+STRESS_TEST_PROVISIONING=${STRESS_TEST_PROVISIONING:-false}\n+STRESS_TEST_PROVISIONING_GENERATE_DATASET=${STRESS_TEST_PROVISIONING_GENERATE_DATASET:-false}\n+STRESS_TEST_PROVISIONING_PARAMETERS=${STRESS_TEST_PROVISIONING_PARAMETERS:-}\n+\n+# Stress Test - Incremental Algorithm Parameters\n+STRESS_TEST_UPS_FIRST=${STRESS_TEST_UPS_FIRST:-1.000}\n+STRESS_TEST_UPS_INCREMENT=${STRESS_TEST_UPS_INCREMENT:-1.000}\n+\n+# Stress Test - Bisection Algorithm Parameters\n+lower_bound=${STRESS_TEST_UPS_LOWER_BOUND:-0.000}\n+upper_bound=${STRESS_TEST_UPS_UPPER_BOUND:-10.000}\n+STRESS_TEST_UPS_RESOLUTION=${STRESS_TEST_UPS_RESOLUTION:-1.000}\n+\n+if $STRESS_TEST_PROVISIONING_GENERATE_DATASET; then DATASET_PROFILE=\"generate-data\"; else DATASET_PROFILE=\"import-dump\"; fi\n+PROVISIONING_COMMAND=\"$MVN -f $KEYCLOAK_PROJECT_HOME/testsuite/performance/pom.xml verify -P provision,$DATASET_PROFILE $STRESS_TEST_PROVISIONING_PARAMETERS -Ddataset=$DATASET\"\n+TEARDOWN_COMMAND=\"$MVN -f $KEYCLOAK_PROJECT_HOME/testsuite/performance/pom.xml verify -P teardown\"\n+\n+function run_command {\necho \" $1\"\necho\n- if ! $debug; then eval \"$1\"; fi\n+ if ! $DRY_RUN; then eval \"$1\"; fi\n}\n-function runTest {\n+function run_test {\n- # use specified warmUpPeriod only in the first iteration, or if provisioning is enabled\n- if [[ $i == 0 || $provisioning == true ]]; then\n- warmUpParameter=\"-DwarmUpPeriod=$warmUpPeriod \";\n+ if [[ $i == 0 || $STRESS_TEST_PROVISIONING == true ]]; then # use specified WARMUP_PERIOD only in the first iteration, or if STRESS_TEST_PROVISIONING is enabled\n+ WARMUP_PARAMETER=\"-DwarmUpPeriod=$WARMUP_PERIOD \";\nelse\n- warmUpParameter=\"-DwarmUpPeriod=0 \";\n- fi\n- if [[ $sequentialUsersFrom == -1 || $provisioning == true ]]; then\n- sequentialUsers=$sequentialUsersFrom\n- else\n- sequentialUsers=`echo \"$sequentialUsersFrom * ( $i + 1 )\" | bc`\n+ WARMUP_PARAMETER=\"-DwarmUpPeriod=0 \";\nfi\n- TEST_COMMAND=\"$MVN verify -Ptest $@ -Ddataset=$dataset $warmUpParameter -DfilterResults=true -DsequentialUsersFrom=$sequentialUsers -DusersPerSec=$usersPerSec\"\n+ test_command=\"$MVN -f $KEYCLOAK_PROJECT_HOME/testsuite/performance/tests/pom.xml verify -Ptest $@ -Ddataset=$DATASET $WARMUP_PARAMETER -DrampUpPeriod=$RAMPUP_PERIOD -DmeasurementPeriod=$MEASUREMENT_PERIOD -DfilterResults=$FILTER_RESULTS -DusersPerSec=$users_per_sec\"\n- echo \"ITERATION: $(( i+1 )) / $maxIterations $ITERATION_INFO\"\n- echo\n-\n- if $provisioning; then\n- runCommand \"$PROVISION_COMMAND\"\n+ if $STRESS_TEST_PROVISIONING; then\n+ run_command \"$PROVISIONING_COMMAND\"\nif [[ $? != 0 ]]; then\necho \"Provisioning failed.\"\n- runCommand \"$TEARDOWN_COMMAND\" || break\n+ run_command \"$TEARDOWN_COMMAND\" || break\nbreak\nfi\n- runCommand \"$TEST_COMMAND\"\n- export testResult=$?\n- runCommand \"$TEARDOWN_COMMAND\" || exit 1\n+ run_command \"$test_command\"\n+ export test_result=$?\n+ run_command \"$TEARDOWN_COMMAND\" || exit 1\nelse\n- runCommand \"$TEST_COMMAND\"\n- export testResult=$?\n+ run_command \"$test_command\"\n+ export test_result=$?\nfi\n- [[ $testResult != 0 ]] && echo \"Test exit code: $testResult\"\n+ [[ $test_result != 0 ]] && echo \"Test exit code: $test_result\"\n}\n+cat <<EOM\n+Stress Test Summary:\n+\n+Script Execution Parameters:\n+ MVN: $MVN\n+ KEYCLOAK_PROJECT_HOME: $KEYCLOAK_PROJECT_HOME\n+ DRY_RUN: $DRY_RUN\n+\n+Performance Testsuite Parameters:\n+ DATASET: $DATASET\n+ WARMUP_PERIOD: $WARMUP_PERIOD seconds\n+ RAMPUP_PERIOD: $RAMPUP_PERIOD seconds\n+ MEASUREMENT_PERIOD: $MEASUREMENT_PERIOD seconds\n+ FILTER_RESULTS: $FILTER_RESULTS\n+\n+Stress Test Parameters:\n+ STRESS_TEST_ALGORITHM: $STRESS_TEST_ALGORITHM\n+ STRESS_TEST_MAX_ITERATIONS: $STRESS_TEST_MAX_ITERATIONS\n+ STRESS_TEST_PROVISIONING: $STRESS_TEST_PROVISIONING\n+EOM\n+if $STRESS_TEST_PROVISIONING; then cat <<EOM\n+ STRESS_TEST_PROVISIONING_GENERATE_DATASET: $STRESS_TEST_PROVISIONING_GENERATE_DATASET (MVN -P $DATASET_PROFILE)\n+ STRESS_TEST_PROVISIONING_PARAMETERS: $STRESS_TEST_PROVISIONING_PARAMETERS\n+EOM\n+fi\n+users_per_sec_max=0\n-echo \"Starting ${algorithm} stress test\"\n-echo\n+case \"${STRESS_TEST_ALGORITHM}\" in\n-usersPerSecTop=0\n+ incremental)\n-case \"${algorithm}\" in\n+ cat <<EOM\n- incremental)\n+Incremental Stress Test Parameters:\n+ STRESS_TEST_UPS_FIRST: $STRESS_TEST_UPS_FIRST users per second\n+ STRESS_TEST_UPS_INCREMENT: $STRESS_TEST_UPS_INCREMENT users per second\n+EOM\n- for (( i=0; i < $maxIterations; i++)); do\n+ for (( i=0; i < $STRESS_TEST_MAX_ITERATIONS; i++)); do\n- usersPerSec=`echo \"$usersPerSec0 + $i * $incrementFactor\" | bc`\n+ users_per_sec=`bc <<<\"scale=10; $STRESS_TEST_UPS_FIRST + $i * $STRESS_TEST_UPS_INCREMENT\"`\n- runTest $@\n+ echo\n+ echo \"STRESS TEST ITERATION: $(( i+1 )) / $STRESS_TEST_MAX_ITERATIONS Load: $users_per_sec users per second\"\n+ echo\n+\n+ run_test $@\n- if [[ $testResult == 0 ]]; then\n- usersPerSecTop=$usersPerSec\n+ if [[ $test_result == 0 ]]; then\n+ users_per_sec_max=$users_per_sec\nelse\necho \"INFO: Last iteration failed. Stopping the loop.\"\nbreak\n@@ -84,23 +129,35 @@ case \"${algorithm}\" in\nbisection)\n- for (( i=0; i < $maxIterations; i++)); do\n+ cat <<EOM\n- intervalSize=`echo \"$highPoint - $lowPoint\" | bc`\n- usersPerSec=`echo \"$lowPoint + $intervalSize * 0.5\" | bc`\n- if [[ `echo \"$intervalSize < $tolerance\" | bc` == 1 ]]; then echo \"INFO: intervalSize < tolerance. Stopping the loop.\"; break; fi\n- if [[ `echo \"$intervalSize < 0\" | bc` == 1 ]]; then echo \"ERROR: Invalid state: lowPoint > highPoint. Stopping the loop.\"; exit 1; fi\n- ITERATION_INFO=\"L: $lowPoint H: $highPoint intervalSize: $intervalSize tolerance: $tolerance\"\n+Bisection Stress Test Parameters:\n+ STRESS_TEST_UPS_LOWER_BOUND: $lower_bound users per second\n+ STRESS_TEST_UPS_UPPER_BOUND: $upper_bound users per second\n+ STRESS_TEST_UPS_RESOLUTION: $STRESS_TEST_UPS_RESOLUTION users per second\n+EOM\n- runTest $@\n+ for (( i=0; i < $STRESS_TEST_MAX_ITERATIONS; i++)); do\n- if [[ $testResult == 0 ]]; then\n- usersPerSecTop=$usersPerSec\n+ interval_size=`bc<<<\"scale=10; $upper_bound - $lower_bound\"`\n+ users_per_sec=`bc<<<\"scale=10; $lower_bound + $interval_size * 0.5\"`\n+\n+ echo\n+ echo \"STRESS TEST ITERATION: $(( i+1 )) / $STRESS_TEST_MAX_ITERATIONS Bisection interval: [$lower_bound, $upper_bound], interval_size: $interval_size, STRESS_TEST_UPS_RESOLUTION: $STRESS_TEST_UPS_RESOLUTION, Load: $users_per_sec users per second\"\n+ echo\n+\n+ if [[ `bc<<<\"scale=10; $interval_size < $STRESS_TEST_UPS_RESOLUTION\"` == 1 ]]; then echo \"INFO: interval_size < STRESS_TEST_UPS_RESOLUTION. Stopping the loop.\"; break; fi\n+ if [[ `bc<<<\"scale=10; $interval_size < 0\"` == 1 ]]; then echo \"ERROR: Invalid state: lower_bound > upper_bound. Stopping the loop.\"; exit 1; fi\n+\n+ run_test $@\n+\n+ if [[ $test_result == 0 ]]; then\n+ users_per_sec_max=$users_per_sec\necho \"INFO: Last iteration succeeded. Continuing with the upper half of the interval.\"\n- lowPoint=$usersPerSec\n+ lower_bound=$users_per_sec\nelse\necho \"INFO: Last iteration failed. Continuing with the lower half of the interval.\"\n- highPoint=$usersPerSec\n+ upper_bound=$users_per_sec\nfi\ndone\n@@ -108,10 +165,15 @@ case \"${algorithm}\" in\n;;\n*)\n- echo \"Algorithm '${algorithm}' not supported.\"\n+ echo \"Algorithm '${STRESS_TEST_ALGORITHM}' not supported.\"\nexit 1\n;;\nesac\n-echo \"Highest load with passing test: $usersPerSecTop users per second\"\n+echo \"Maximal load with passing test: $users_per_sec_max users per second\"\n+\n+if ! $DRY_RUN; then # Generate a Jenkins Plot Plugin-compatible data file\n+ mkdir -p \"$KEYCLOAK_PROJECT_HOME/testsuite/performance/tests/target\"\n+ echo \"YVALUE=$users_per_sec_max\" > \"$KEYCLOAK_PROJECT_HOME/testsuite/performance/tests/target/stress-test-result.properties\"\n+fi\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9000 Update stress-testing script |
339,465 | 15.02.2019 18:36:44 | -3,600 | 362faf3adb3871a433d94db0314b35b4c00901ab | Closing admin clients and testing clients in testsuite | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/OAuthClient.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/OAuthClient.java",
"diff": "@@ -1192,8 +1192,8 @@ public class OAuthClient {\nprivate JSONWebKeySet getRealmKeys(String realm) {\nString certUrl = baseUrl + \"/realms/\" + realm + \"/protocol/openid-connect/certs\";\n- try {\n- return SimpleHttp.doGet(certUrl, httpClient.get()).asJson(JSONWebKeySet.class);\n+ try (CloseableHttpClient client = httpClient.get()){\n+ return SimpleHttp.doGet(certUrl, client).asJson(JSONWebKeySet.class);\n} catch (IOException e) {\nthrow new RuntimeException(\"Failed to retrieve keys\", e);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/CrossRealmPermissionsTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/CrossRealmPermissionsTest.java",
"diff": "package org.keycloak.testsuite.admin;\n+import org.junit.AfterClass;\nimport org.junit.Test;\nimport org.keycloak.admin.client.Keycloak;\nimport org.keycloak.admin.client.resource.RealmResource;\n@@ -48,6 +49,9 @@ public class CrossRealmPermissionsTest extends AbstractKeycloakTest {\nprivate static final String REALM_NAME = \"crossrealm-test\";\nprivate static final String REALM2_NAME = \"crossrealm2-test\";\n+ private static Keycloak adminClient1;\n+ private static Keycloak adminClient2;\n+\nprivate RealmResource realm1;\nprivate RealmResource realm2;\n@@ -62,7 +66,8 @@ public class CrossRealmPermissionsTest extends AbstractKeycloakTest {\n.addPassword(\"password\"));\ntestRealms.add(builder.build());\n- realm1 = Keycloak.getInstance(AuthServerTestEnricher.getAuthServerContextRoot() + \"/auth\", REALM_NAME, AdminRoles.REALM_ADMIN, \"password\", \"test-client\", \"secret\", TLSUtils.initializeTLS()).realm(REALM_NAME);\n+ adminClient1 = Keycloak.getInstance(AuthServerTestEnricher.getAuthServerContextRoot() + \"/auth\", REALM_NAME, AdminRoles.REALM_ADMIN, \"password\", \"test-client\", \"secret\", TLSUtils.initializeTLS());\n+ realm1 = adminClient1.realm(REALM_NAME);\nbuilder = RealmBuilder.create().name(REALM2_NAME).testMail();\nbuilder.client(ClientBuilder.create().clientId(\"test-client\").publicClient().directAccessGrants());\n@@ -74,9 +79,18 @@ public class CrossRealmPermissionsTest extends AbstractKeycloakTest {\ntestRealms.add(builder.build());\n- realm2 = Keycloak.getInstance(AuthServerTestEnricher.getAuthServerContextRoot() + \"/auth\", REALM2_NAME, AdminRoles.REALM_ADMIN, \"password\", \"test-client\", \"secret\", TLSUtils.initializeTLS()).realm(REALM2_NAME);\n+ adminClient2 = Keycloak.getInstance(AuthServerTestEnricher.getAuthServerContextRoot() + \"/auth\", REALM2_NAME, AdminRoles.REALM_ADMIN, \"password\", \"test-client\", \"secret\", TLSUtils.initializeTLS());\n+ realm2 = adminClient2.realm(REALM2_NAME);\n}\n+\n+ @AfterClass\n+ public static void afterClass() {\n+ adminClient1.close();\n+ adminClient2.close();\n+ }\n+\n+\n@Test\npublic void users() {\nUserRepresentation user = UserBuilder.create().username(\"randomuser-\" + Time.currentTimeMillis()).build();\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/FineGrainAdminUnitTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/FineGrainAdminUnitTest.java",
"diff": "@@ -893,11 +893,11 @@ public class FineGrainAdminUnitTest extends AbstractKeycloakTest {\nString exchanged = oauth.doTokenExchange(\"master\", token, \"admin-cli\", \"kcinit\", \"password\").getAccessToken();\nAssert.assertNotNull(exchanged);\n- Keycloak client = Keycloak.getInstance(AuthServerTestEnricher.getAuthServerContextRoot() + \"/auth\",\n- AuthRealm.MASTER, Constants.ADMIN_CLI_CLIENT_ID, exchanged, TLSUtils.initializeTLS());\n-\n+ try (Keycloak client = Keycloak.getInstance(AuthServerTestEnricher.getAuthServerContextRoot() + \"/auth\",\n+ AuthRealm.MASTER, Constants.ADMIN_CLI_CLIENT_ID, exchanged, TLSUtils.initializeTLS())) {\nAssert.assertNotNull(client.realm(\"master\").roles().get(\"offline_access\"));\n}\n+ }\n@Test\npublic void testUserPagination() {\n@@ -949,8 +949,8 @@ public class FineGrainAdminUnitTest extends AbstractKeycloakTest {\n}\n});\n- Keycloak client = Keycloak.getInstance(AuthServerTestEnricher.getAuthServerContextRoot() + \"/auth\",\n- \"test\", \"customer-a-manager\", \"password\", Constants.ADMIN_CLI_CLIENT_ID, TLSUtils.initializeTLS());\n+ try (Keycloak client = Keycloak.getInstance(AuthServerTestEnricher.getAuthServerContextRoot() + \"/auth\",\n+ \"test\", \"customer-a-manager\", \"password\", Constants.ADMIN_CLI_CLIENT_ID, TLSUtils.initializeTLS())) {\nList<UserRepresentation> result = client.realm(\"test\").users().search(null, \"test\", null, null, -1, 20);\n@@ -960,11 +960,12 @@ public class FineGrainAdminUnitTest extends AbstractKeycloakTest {\nresult = client.realm(\"test\").users().search(null, \"test\", null, null, 20, 40);\nAssert.assertEquals(0, result.size());\n+ }\n- client = Keycloak.getInstance(AuthServerTestEnricher.getAuthServerContextRoot() + \"/auth\",\n- \"test\", \"regular-admin-user\", \"password\", Constants.ADMIN_CLI_CLIENT_ID, TLSUtils.initializeTLS());\n+ try (Keycloak client = Keycloak.getInstance(AuthServerTestEnricher.getAuthServerContextRoot() + \"/auth\",\n+ \"test\", \"regular-admin-user\", \"password\", Constants.ADMIN_CLI_CLIENT_ID, TLSUtils.initializeTLS())) {\n- result = client.realm(\"test\").users().search(null, \"test\", null, null, -1, 20);\n+ List<UserRepresentation> result = client.realm(\"test\").users().search(null, \"test\", null, null, -1, 20);\nAssert.assertEquals(20, result.size());\nAssert.assertThat(result, Matchers.everyItem(Matchers.hasProperty(\"username\", Matchers.startsWith(\"a\"))));\n@@ -973,11 +974,12 @@ public class FineGrainAdminUnitTest extends AbstractKeycloakTest {\nAssert.assertEquals(20, result.size());\nAssert.assertThat(result, Matchers.everyItem(Matchers.hasProperty(\"username\", Matchers.startsWith(\"a\"))));\n+ }\n- client = Keycloak.getInstance(AuthServerTestEnricher.getAuthServerContextRoot() + \"/auth\",\n- \"test\", \"customer-a-manager\", \"password\", Constants.ADMIN_CLI_CLIENT_ID, TLSUtils.initializeTLS());\n+ try (Keycloak client = Keycloak.getInstance(AuthServerTestEnricher.getAuthServerContextRoot() + \"/auth\",\n+ \"test\", \"customer-a-manager\", \"password\", Constants.ADMIN_CLI_CLIENT_ID, TLSUtils.initializeTLS())) {\n- result = client.realm(\"test\").users().search(null, null, null, null, -1, 20);\n+ List<UserRepresentation> result = client.realm(\"test\").users().search(null, null, null, null, -1, 20);\nAssert.assertEquals(20, result.size());\nAssert.assertThat(result, Matchers.everyItem(Matchers.hasProperty(\"username\", Matchers.startsWith(\"b\"))));\n@@ -986,5 +988,6 @@ public class FineGrainAdminUnitTest extends AbstractKeycloakTest {\nAssert.assertEquals(0, result.size());\n}\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/concurrency/AbstractConcurrencyTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/concurrency/AbstractConcurrencyTest.java",
"diff": "@@ -25,9 +25,12 @@ import org.keycloak.testsuite.AbstractKeycloakTest;\nimport org.keycloak.testsuite.AbstractTestRealmKeycloakTest;\nimport org.keycloak.testsuite.arquillian.undertow.TLSUtils;\n+import java.util.Collections;\n+import java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.Collection;\nimport java.util.List;\n+import java.util.Set;\nimport java.util.concurrent.Callable;\nimport java.util.concurrent.ConcurrentLinkedQueue;\nimport java.util.concurrent.ExecutorService;\n@@ -78,11 +81,18 @@ public abstract class AbstractConcurrencyTest extends AbstractTestRealmKeycloakT\nCollection<Callable<Void>> tasks = new LinkedList<>();\nCollection<Throwable> failures = new ConcurrentLinkedQueue<>();\nfinal List<Callable<Void>> runnablesToTasks = new LinkedList<>();\n+\n+ // Track all used admin clients, so they can be closed after the test\n+ Set<Keycloak> usedKeycloaks = Collections.synchronizedSet(new HashSet<>());\n+\nfor (KeycloakRunnable runnable : runnables) {\nrunnablesToTasks.add(() -> {\nint arrayIndex = currentThreadIndex.getAndIncrement() % numThreads;\ntry {\n- runnable.run(arrayIndex % numThreads, keycloaks.get(), keycloaks.get().realm(REALM_NAME));\n+ Keycloak keycloak = keycloaks.get();\n+ usedKeycloaks.add(keycloak);\n+\n+ runnable.run(arrayIndex % numThreads, keycloak, keycloak.realm(REALM_NAME));\n} catch (Throwable ex) {\nfailures.add(ex);\n}\n@@ -99,6 +109,14 @@ public abstract class AbstractConcurrencyTest extends AbstractTestRealmKeycloakT\nservice.awaitTermination(3, TimeUnit.MINUTES);\n} catch (InterruptedException ex) {\nthrow new RuntimeException(ex);\n+ } finally {\n+ for (Keycloak keycloak : usedKeycloaks) {\n+ try {\n+ keycloak.close();\n+ } catch (Exception e) {\n+ failures.add(e);\n+ }\n+ }\n}\nif (! failures.isEmpty()) {\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/group/GroupTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/group/GroupTest.java",
"diff": "@@ -569,12 +569,13 @@ public class GroupTest extends AbstractGroupTest {\nRoleMappingResource mappings = realm.users().get(userId).roles();\nmappings.realmLevel().add(Collections.singletonList(adminRole));\n- Keycloak userClient = Keycloak.getInstance(AuthServerTestEnricher.getAuthServerContextRoot() + \"/auth\",\n- realmName, userName, \"pwd\", Constants.ADMIN_CLI_CLIENT_ID, TLSUtils.initializeTLS());\n+ try (Keycloak userClient = Keycloak.getInstance(AuthServerTestEnricher.getAuthServerContextRoot() + \"/auth\",\n+ realmName, userName, \"pwd\", Constants.ADMIN_CLI_CLIENT_ID, TLSUtils.initializeTLS())) {\nassertThat(userClient.realms().findAll(), // Any admin operation will do\nnot(empty()));\n}\n+ }\n/**\n* Verifies that the role assigned to a user's group is correctly handled by Keycloak Admin endpoint.\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/GroupNamePolicyTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/GroupNamePolicyTest.java",
"diff": "@@ -28,6 +28,8 @@ import java.util.function.Function;\nimport java.util.function.Predicate;\nimport java.util.stream.Collectors;\n+import javax.ws.rs.core.Response;\n+\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.keycloak.admin.client.resource.AuthorizationResource;\n@@ -195,7 +197,8 @@ public class GroupNamePolicyTest extends AbstractAuthzTest {\npolicy.setGroupsClaim(\"groups\");\npolicy.addGroupPath(groupPath, extendChildren);\n- getClient().authorization().policies().group().create(policy);\n+ Response response = getClient().authorization().policies().group().create(policy);\n+ response.close();\n}\nprivate void createResourcePermission(String name, String resource, String... policies) {\n@@ -205,19 +208,21 @@ public class GroupNamePolicyTest extends AbstractAuthzTest {\npermission.addResource(resource);\npermission.addPolicy(policies);\n- getClient().authorization().permissions().resource().create(permission);\n+ Response response = getClient().authorization().permissions().resource().create(permission);\n+ response.close();\n}\nprivate void createResource(String name) {\nAuthorizationResource authorization = getClient().authorization();\nResourceRepresentation resource = new ResourceRepresentation(name);\n- authorization.resources().create(resource);\n+ Response response = authorization.resources().create(resource);\n+ response.close();\n}\nprivate RealmResource getRealm() {\ntry {\n- return AdminClientUtil.createAdminClient().realm(\"authz-test\");\n+ return getAdminClient().realm(\"authz-test\");\n} catch (Exception e) {\nthrow new RuntimeException(\"Failed to create admin client\");\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/GroupPathPolicyTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/GroupPathPolicyTest.java",
"diff": "@@ -28,6 +28,8 @@ import java.util.function.Function;\nimport java.util.function.Predicate;\nimport java.util.stream.Collectors;\n+import javax.ws.rs.core.Response;\n+\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.keycloak.admin.client.resource.AuthorizationResource;\n@@ -179,7 +181,8 @@ public class GroupPathPolicyTest extends AbstractAuthzTest {\npolicy.setGroupsClaim(\"groups\");\npolicy.addGroupPath(groupPath, extendChildren);\n- getClient().authorization().policies().group().create(policy);\n+ Response response = getClient().authorization().policies().group().create(policy);\n+ response.close();\n}\nprivate void createResourcePermission(String name, String resource, String... policies) {\n@@ -189,19 +192,21 @@ public class GroupPathPolicyTest extends AbstractAuthzTest {\npermission.addResource(resource);\npermission.addPolicy(policies);\n- getClient().authorization().permissions().resource().create(permission);\n+ Response response = getClient().authorization().permissions().resource().create(permission);\n+ response.close();\n}\nprivate void createResource(String name) {\nAuthorizationResource authorization = getClient().authorization();\nResourceRepresentation resource = new ResourceRepresentation(name);\n- authorization.resources().create(resource);\n+ Response response = authorization.resources().create(resource);\n+ response.close();\n}\nprivate RealmResource getRealm() {\ntry {\n- return AdminClientUtil.createAdminClient().realm(\"authz-test\");\n+ return getAdminClient().realm(\"authz-test\");\n} catch (Exception e) {\nthrow new RuntimeException(\"Failed to create admin client\");\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/RolePolicyTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/RolePolicyTest.java",
"diff": "@@ -23,6 +23,8 @@ import java.io.IOException;\nimport java.util.Arrays;\nimport java.util.List;\n+import javax.ws.rs.core.Response;\n+\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.keycloak.admin.client.resource.AuthorizationResource;\n@@ -177,7 +179,8 @@ public class RolePolicyTest extends AbstractAuthzTest {\npolicy.addRole(role);\n}\n- getClient().authorization().policies().role().create(policy);\n+ Response response = getClient().authorization().policies().role().create(policy);\n+ response.close();\n}\nprivate void createResourcePermission(String name, String resource, String... policies) {\n@@ -187,19 +190,21 @@ public class RolePolicyTest extends AbstractAuthzTest {\npermission.addResource(resource);\npermission.addPolicy(policies);\n- getClient().authorization().permissions().resource().create(permission);\n+ Response response = getClient().authorization().permissions().resource().create(permission);\n+ response.close();\n}\nprivate void createResource(String name) {\nAuthorizationResource authorization = getClient().authorization();\nResourceRepresentation resource = new ResourceRepresentation(name);\n- authorization.resources().create(resource);\n+ Response response = authorization.resources().create(resource);\n+ response.close();\n}\nprivate RealmResource getRealm() {\ntry {\n- return AdminClientUtil.createAdminClient().realm(\"authz-test\");\n+ return getAdminClient().realm(\"authz-test\");\n} catch (Exception e) {\nthrow new RuntimeException(\"Failed to create admin client\");\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cluster/AbstractClusterTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cluster/AbstractClusterTest.java",
"diff": "@@ -2,6 +2,7 @@ package org.keycloak.testsuite.cluster;\nimport org.jboss.arquillian.container.test.api.ContainerController;\nimport org.jboss.arquillian.test.api.ArquillianResource;\n+import org.junit.AfterClass;\nimport org.junit.Before;\nimport org.junit.BeforeClass;\nimport org.keycloak.admin.client.Keycloak;\n@@ -38,9 +39,9 @@ public abstract class AbstractClusterTest extends AbstractKeycloakTest {\n@ArquillianResource\nprotected ContainerController controller;\n- protected Map<ContainerInfo, Keycloak> backendAdminClients = new HashMap<>();\n+ protected static Map<ContainerInfo, Keycloak> backendAdminClients = new HashMap<>();\n- protected Map<ContainerInfo, KeycloakTestingClient> backendTestingClients = new HashMap<>();\n+ protected static Map<ContainerInfo, KeycloakTestingClient> backendTestingClients = new HashMap<>();\nprivate int currentFailNodeIndex = 0;\n@@ -165,6 +166,16 @@ public abstract class AbstractClusterTest extends AbstractKeycloakTest {\nContainerAssume.assumeClusteredContainer();\n}\n+ @AfterClass\n+ public static void closeClients() {\n+ backendAdminClients.values().forEach(Keycloak::close);\n+ backendAdminClients.clear();\n+\n+ backendTestingClients.values().forEach(KeycloakTestingClient::close);\n+ backendTestingClients.clear();\n+\n+ }\n+\n@Before\npublic void beforeClusterTest() {\nfailback();\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/url/FixedHostnameTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/url/FixedHostnameTest.java",
"diff": "@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.JsonNode;\nimport com.fasterxml.jackson.databind.ObjectMapper;\nimport org.jboss.arquillian.container.test.api.ContainerController;\nimport org.jboss.arquillian.test.api.ArquillianResource;\n+import org.junit.After;\nimport org.junit.Before;\nimport org.junit.Ignore;\nimport org.junit.Test;\n@@ -42,8 +43,6 @@ public class FixedHostnameTest extends AbstractKeycloakTest {\nprivate String authServerUrl;\n- private Keycloak testAdminClient;\n-\n@Override\npublic void addTestRealms(List<RealmRepresentation> testRealms) {\nRealmRepresentation realm = loadJson(getClass().getResourceAsStream(\"/testrealm.json\"), RealmRepresentation.class);\n@@ -62,11 +61,10 @@ public class FixedHostnameTest extends AbstractKeycloakTest {\npublic void fixedHostname() throws Exception {\nauthServerUrl = oauth.AUTH_SERVER_ROOT;\noauth.baseUrl(authServerUrl);\n- testAdminClient = AdminClientUtil.createAdminClient(suiteContext.isAdapterCompatTesting(), AuthServerTestEnricher.getAuthServerContextRoot());\noauth.clientId(\"direct-grant\");\n- try {\n+ try (Keycloak testAdminClient = AdminClientUtil.createAdminClient(suiteContext.isAdapterCompatTesting(), AuthServerTestEnricher.getAuthServerContextRoot())) {\nassertWellKnown(\"test\", AUTH_SERVER_SCHEME + \"://localhost:\" + AUTH_SERVER_PORT);\nconfigureFixedHostname(-1, -1, false);\n@@ -77,8 +75,8 @@ public class FixedHostnameTest extends AbstractKeycloakTest {\nassertTokenIssuer(\"test\", AUTH_SERVER_SCHEME + \"://keycloak.127.0.0.1.nip.io:\" + AUTH_SERVER_PORT);\nassertTokenIssuer(\"hostname\", AUTH_SERVER_SCHEME + \"://custom-domain.127.0.0.1.nip.io:\" + AUTH_SERVER_PORT);\n- assertInitialAccessTokenFromMasterRealm(\"test\", AUTH_SERVER_SCHEME + \"://keycloak.127.0.0.1.nip.io:\" + AUTH_SERVER_PORT);\n- assertInitialAccessTokenFromMasterRealm(\"hostname\", AUTH_SERVER_SCHEME + \"://custom-domain.127.0.0.1.nip.io:\" + AUTH_SERVER_PORT);\n+ assertInitialAccessTokenFromMasterRealm(testAdminClient,\"test\", AUTH_SERVER_SCHEME + \"://keycloak.127.0.0.1.nip.io:\" + AUTH_SERVER_PORT);\n+ assertInitialAccessTokenFromMasterRealm(testAdminClient,\"hostname\", AUTH_SERVER_SCHEME + \"://custom-domain.127.0.0.1.nip.io:\" + AUTH_SERVER_PORT);\n} finally {\nclearFixedHostname();\n}\n@@ -89,11 +87,10 @@ public class FixedHostnameTest extends AbstractKeycloakTest {\n// Make sure request are always sent with http\nauthServerUrl = \"http://localhost:8180/auth\";\noauth.baseUrl(authServerUrl);\n- testAdminClient = AdminClientUtil.createAdminClient(suiteContext.isAdapterCompatTesting(), \"http://localhost:8180\");\noauth.clientId(\"direct-grant\");\n- try {\n+ try (Keycloak testAdminClient = AdminClientUtil.createAdminClient(suiteContext.isAdapterCompatTesting(), \"http://localhost:8180\")) {\nassertWellKnown(\"test\", \"http://localhost:8180\");\nconfigureFixedHostname(80, -1, false);\n@@ -104,8 +101,8 @@ public class FixedHostnameTest extends AbstractKeycloakTest {\nassertTokenIssuer(\"test\", \"http://keycloak.127.0.0.1.nip.io\");\nassertTokenIssuer(\"hostname\", \"http://custom-domain.127.0.0.1.nip.io\");\n- assertInitialAccessTokenFromMasterRealm(\"test\", \"http://keycloak.127.0.0.1.nip.io\");\n- assertInitialAccessTokenFromMasterRealm(\"hostname\", \"http://custom-domain.127.0.0.1.nip.io\");\n+ assertInitialAccessTokenFromMasterRealm(testAdminClient,\"test\", \"http://keycloak.127.0.0.1.nip.io\");\n+ assertInitialAccessTokenFromMasterRealm(testAdminClient,\"hostname\", \"http://custom-domain.127.0.0.1.nip.io\");\n} finally {\nclearFixedHostname();\n}\n@@ -116,11 +113,10 @@ public class FixedHostnameTest extends AbstractKeycloakTest {\n// Make sure request are always sent with http\nauthServerUrl = \"http://localhost:8180/auth\";\noauth.baseUrl(authServerUrl);\n- testAdminClient = AdminClientUtil.createAdminClient(suiteContext.isAdapterCompatTesting(), \"http://localhost:8180\");\noauth.clientId(\"direct-grant\");\n- try {\n+ try (Keycloak testAdminClient = AdminClientUtil.createAdminClient(suiteContext.isAdapterCompatTesting(), \"http://localhost:8180\")) {\nassertWellKnown(\"test\", \"http://localhost:8180\");\nconfigureFixedHostname(-1, 443, true);\n@@ -131,14 +127,14 @@ public class FixedHostnameTest extends AbstractKeycloakTest {\nassertTokenIssuer(\"test\", \"https://keycloak.127.0.0.1.nip.io\");\nassertTokenIssuer(\"hostname\", \"https://custom-domain.127.0.0.1.nip.io\");\n- assertInitialAccessTokenFromMasterRealm(\"test\", \"https://keycloak.127.0.0.1.nip.io\");\n- assertInitialAccessTokenFromMasterRealm(\"hostname\", \"https://custom-domain.127.0.0.1.nip.io\");\n+ assertInitialAccessTokenFromMasterRealm(testAdminClient, \"test\", \"https://keycloak.127.0.0.1.nip.io\");\n+ assertInitialAccessTokenFromMasterRealm(testAdminClient, \"hostname\", \"https://custom-domain.127.0.0.1.nip.io\");\n} finally {\nclearFixedHostname();\n}\n}\n- private void assertInitialAccessTokenFromMasterRealm(String realm, String expectedBaseUrl) throws JWSInputException, ClientRegistrationException {\n+ private void assertInitialAccessTokenFromMasterRealm(Keycloak testAdminClient, String realm, String expectedBaseUrl) throws JWSInputException, ClientRegistrationException {\nClientInitialAccessCreatePresentation rep = new ClientInitialAccessCreatePresentation();\nrep.setCount(1);\nrep.setExpiration(10000);\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-deprecated/src/test/java/org/keycloak/testsuite/broker/OIDCKeycloakServerBrokerWithConsentTest.java",
"new_path": "testsuite/integration-deprecated/src/test/java/org/keycloak/testsuite/broker/OIDCKeycloakServerBrokerWithConsentTest.java",
"diff": "package org.keycloak.testsuite.broker;\n+import org.junit.AfterClass;\nimport org.junit.Assert;\nimport org.junit.BeforeClass;\nimport org.junit.ClassRule;\n@@ -33,7 +34,6 @@ import org.keycloak.representations.idm.UserRepresentation;\nimport org.keycloak.services.managers.RealmManager;\nimport org.keycloak.testsuite.KeycloakServer;\nimport org.keycloak.testsuite.rule.AbstractKeycloakRule;\n-import org.openqa.selenium.NoSuchElementException;\nimport java.util.List;\n@@ -97,6 +97,12 @@ public class OIDCKeycloakServerBrokerWithConsentTest extends AbstractIdentityPro\nrealmWithBroker.update(realmRep);\n}\n+ @AfterClass\n+ public static void after() {\n+ keycloak1.close();\n+ keycloak2.close();\n+ }\n+\n@Override\nprotected String getProviderId() {\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-deprecated/src/test/java/org/keycloak/testsuite/federation/storage/BrokenUserStorageTest.java",
"new_path": "testsuite/integration-deprecated/src/test/java/org/keycloak/testsuite/federation/storage/BrokenUserStorageTest.java",
"diff": "@@ -113,7 +113,7 @@ public class BrokenUserStorageTest {\n// make sure we can list components and delete provider as this is an admin console operation\n- Keycloak keycloakAdmin = Keycloak.getInstance(AUTH_SERVER_URL, \"master\", \"admin\", \"admin\", Constants.ADMIN_CLI_CLIENT_ID);\n+ try (Keycloak keycloakAdmin = Keycloak.getInstance(AUTH_SERVER_URL, \"master\", \"admin\", \"admin\", Constants.ADMIN_CLI_CLIENT_ID)) {\nRealmResource master = keycloakAdmin.realms().realm(\"master\");\nList<ComponentRepresentation> components = master.components().query(masterId, UserStorageProvider.class.getName());\nboolean found = false;\n@@ -129,6 +129,7 @@ public class BrokenUserStorageTest {\nList<ComponentRepresentation> components2 = master.components().query(masterId, UserStorageProvider.class.getName());\nAssert.assertEquals(components.size() - 1, components2.size());\n}\n+ }\n@After\npublic void resetTimeoffset() {\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-deprecated/src/test/java/org/keycloak/testsuite/helper/adapter/AdapterTestStrategy.java",
"new_path": "testsuite/integration-deprecated/src/test/java/org/keycloak/testsuite/helper/adapter/AdapterTestStrategy.java",
"diff": "@@ -202,7 +202,8 @@ public class AdapterTestStrategy extends ExternalResource {\nAssert.assertTrue(pageSource.contains(\"iPhone\") && pageSource.contains(\"iPad\"));\n// View stats\n- List<Map<String, String>> stats = Keycloak.getInstance(\"http://localhost:8081/auth\", \"master\", \"admin\", \"admin\", Constants.ADMIN_CLI_CLIENT_ID).realm(\"demo\").getClientSessionStats();\n+ try (Keycloak adminClient = Keycloak.getInstance(\"http://localhost:8081/auth\", \"master\", \"admin\", \"admin\", Constants.ADMIN_CLI_CLIENT_ID)) {\n+ List<Map<String, String>> stats = adminClient.realm(\"demo\").getClientSessionStats();\nMap<String, String> customerPortalStats = null;\nMap<String, String> productPortalStats = null;\nfor (Map<String, String> s : stats) {\n@@ -214,6 +215,7 @@ public class AdapterTestStrategy extends ExternalResource {\n}\nAssert.assertEquals(1, Integer.parseInt(customerPortalStats.get(\"active\")));\nAssert.assertEquals(1, Integer.parseInt(productPortalStats.get(\"active\")));\n+ }\n// test logout\nString logoutUri = OIDCLoginProtocolService.logoutUrl(UriBuilder.fromUri(AUTH_SERVER_URL))\n@@ -603,7 +605,7 @@ public class AdapterTestStrategy extends ExternalResource {\nloginAndCheckSession(driver, loginPage);\n// logout mposolda with admin client\n- Keycloak keycloakAdmin = Keycloak.getInstance(AUTH_SERVER_URL, \"master\", \"admin\", \"admin\", Constants.ADMIN_CLI_CLIENT_ID);\n+ try (Keycloak keycloakAdmin = Keycloak.getInstance(AUTH_SERVER_URL, \"master\", \"admin\", \"admin\", Constants.ADMIN_CLI_CLIENT_ID)) {\nUserRepresentation mposolda = keycloakAdmin.realm(\"demo\").users().search(\"mposolda\", null, null, null, null, null).get(0);\nkeycloakAdmin.realm(\"demo\").users().get(mposolda.getId()).logout();\n@@ -613,6 +615,7 @@ public class AdapterTestStrategy extends ExternalResource {\nString pageSource = driver.getPageSource();\nAssert.assertTrue(pageSource.contains(\"Counter=3\"));\n}\n+ }\n/**\n* KEYCLOAK-1216\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-6627 Closing admin clients and testing clients in testsuite |
339,281 | 26.02.2019 13:52:22 | -3,600 | 5d205d16e88834b2d2b5030a6dddd88316474915 | Using kcadm to update an identity-provider instance via a json file does not work without an "internalId" present in the json | [
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/services/resources/admin/IdentityProviderResource.java",
"new_path": "services/src/main/java/org/keycloak/services/resources/admin/IdentityProviderResource.java",
"diff": "@@ -172,6 +172,10 @@ public class IdentityProviderResource {\nString newProviderId = providerRep.getAlias();\nString oldProviderId = getProviderIdByInternalId(realm, internalId);\n+ if (oldProviderId == null) {\n+ lookUpProviderIdByAlias(realm, providerRep);\n+ }\n+\nIdentityProviderModel updated = RepresentationToModel.toModel(realm, providerRep);\nif (updated.getConfig() != null && ComponentRepresentation.SECRET_VALUE.equals(updated.getConfig().get(\"clientSecret\"))) {\n@@ -201,6 +205,18 @@ public class IdentityProviderResource {\nreturn null;\n}\n+ // sets internalId to IdentityProvider based on alias\n+ private static void lookUpProviderIdByAlias(RealmModel realm, IdentityProviderRepresentation providerRep) {\n+ List<IdentityProviderModel> providerModels = realm.getIdentityProviders();\n+ for (IdentityProviderModel providerModel : providerModels) {\n+ if (providerModel.getAlias().equals(providerRep.getAlias())) {\n+ providerRep.setInternalId(providerModel.getInternalId());\n+ return;\n+ }\n+ }\n+ throw new javax.ws.rs.NotFoundException();\n+ }\n+\nprivate static void updateUsersAfterProviderAliasChange(List<UserModel> users, String oldProviderId, String newProviderId, RealmModel realm, KeycloakSession session) {\nfor (UserModel user : users) {\nFederatedIdentityModel federatedIdentity = session.users().getFederatedIdentity(user, oldProviderId, realm);\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cli/admin/KcAdmUpdateTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/cli/admin/KcAdmUpdateTest.java",
"diff": "@@ -9,17 +9,62 @@ import org.keycloak.testsuite.util.TempFileResource;\nimport org.keycloak.util.JsonSerialization;\nimport java.io.ByteArrayInputStream;\n+import java.io.Closeable;\n+import java.io.File;\nimport java.io.IOException;\nimport java.util.Arrays;\n+import static org.hamcrest.Matchers.equalTo;\n+import static org.hamcrest.Matchers.is;\n+import org.keycloak.admin.client.resource.RealmResource;\n+import org.keycloak.broker.saml.SAMLIdentityProviderConfig;\n+import org.keycloak.broker.saml.SAMLIdentityProviderFactory;\n+import org.keycloak.representations.idm.IdentityProviderRepresentation;\nimport static org.keycloak.testsuite.cli.KcAdmExec.CMD;\nimport static org.keycloak.testsuite.cli.KcAdmExec.execute;\n+import org.keycloak.testsuite.updaters.IdentityProviderCreator;\n+import org.keycloak.testsuite.util.IdentityProviderBuilder;\n/**\n* @author <a href=\"mailto:[email protected]\">Marko Strukelj</a>\n*/\npublic class KcAdmUpdateTest extends AbstractAdmCliTest {\n+ @Test\n+ public void testUpdateIDPWithoutInternalId() throws IOException {\n+\n+ final String realm = \"test\";\n+ final RealmResource realmResource = adminClient.realm(realm);\n+\n+ IdentityProviderRepresentation identityProvider = IdentityProviderBuilder.create()\n+ .providerId(SAMLIdentityProviderFactory.PROVIDER_ID)\n+ .alias(\"idpAlias\")\n+ .displayName(\"SAML\")\n+ .setAttribute(SAMLIdentityProviderConfig.SINGLE_SIGN_ON_SERVICE_URL, \"http://saml.idp/saml\")\n+ .setAttribute(SAMLIdentityProviderConfig.SINGLE_LOGOUT_SERVICE_URL, \"http://saml.idp/saml\")\n+ .setAttribute(SAMLIdentityProviderConfig.NAME_ID_POLICY_FORMAT, \"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress\")\n+ .setAttribute(SAMLIdentityProviderConfig.POST_BINDING_RESPONSE, \"false\")\n+ .setAttribute(SAMLIdentityProviderConfig.POST_BINDING_AUTHN_REQUEST, \"false\")\n+ .setAttribute(SAMLIdentityProviderConfig.BACKCHANNEL_SUPPORTED, \"false\")\n+ .build();\n+\n+ try (Closeable ipc = new IdentityProviderCreator(realmResource, identityProvider)) {\n+ FileConfigHandler handler = initCustomConfigFile();\n+ try (TempFileResource configFile = new TempFileResource(handler.getConfigFile())) {\n+ loginAsUser(configFile.getFile(), serverUrl, realm, \"user1\", \"userpass\");\n+\n+ KcAdmExec exe = execute(\"get identity-provider/instances/idpAlias -r \" + realm + \" --config \" + configFile.getFile());\n+ assertExitCodeAndStdErrSize(exe, 0, 0);\n+\n+ final File idpJson = new File(\"target/test-classes/cli/idp-keycloak-9167.json\");\n+ exe = execute(\"update identity-provider/instances/idpAlias -r \" + realm + \" -f \" + idpJson.getAbsolutePath() + \" --config \" + configFile.getFile());\n+ assertExitCodeAndStdErrSize(exe, 0, 0);\n+ }\n+\n+ Assert.assertThat(realmResource.identityProviders().get(\"idpAlias\").toRepresentation().getDisplayName(), is(equalTo(\"SAML_UPDATED\")));\n+ }\n+ }\n+\n@Test\npublic void testUpdateThoroughly() throws IOException {\n@@ -39,9 +84,9 @@ public class KcAdmUpdateTest extends AbstractAdmCliTest {\nClientRepresentation client = JsonSerialization.readValue(exe.stdout(), ClientRepresentation.class);\n- Assert.assertEquals(\"enabled\", true, client.isEnabled());\n- Assert.assertEquals(\"publicClient\", false, client.isPublicClient());\n- Assert.assertEquals(\"bearerOnly\", false, client.isBearerOnly());\n+ Assert.assertTrue(\"enabled\", client.isEnabled());\n+ Assert.assertFalse(\"publicClient\", client.isPublicClient());\n+ Assert.assertFalse(\"bearerOnly\", client.isBearerOnly());\nAssert.assertTrue(\"redirectUris is empty\", client.getRedirectUris().isEmpty());\n@@ -52,7 +97,7 @@ public class KcAdmUpdateTest extends AbstractAdmCliTest {\nassertExitCodeAndStdErrSize(exe, 0, 0);\nclient = JsonSerialization.readValue(exe.stdout(), ClientRepresentation.class);\n- Assert.assertEquals(\"enabled\", false, client.isEnabled());\n+ Assert.assertFalse(\"enabled\", client.isEnabled());\nAssert.assertEquals(\"redirectUris\", Arrays.asList(\"http://localhost:8980/myapp/*\"), client.getRedirectUris());\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/tests/base/src/test/resources/cli/idp-keycloak-9167.json",
"diff": "+{\n+ \"alias\" : \"idpAlias\",\n+ \"displayName\" : \"SAML_UPDATED\",\n+ \"providerId\" : \"saml\",\n+ \"enabled\" : true,\n+ \"updateProfileFirstLoginMode\" : \"on\",\n+ \"trustEmail\" : false,\n+ \"storeToken\" : false,\n+ \"addReadTokenRoleOnCreate\" : false,\n+ \"authenticateByDefault\" : false,\n+ \"linkOnly\" : false,\n+ \"firstBrokerLoginFlowAlias\" : \"first broker login\",\n+ \"config\" : {\n+ \"nameIDPolicyFormat\" : \"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress\",\n+ \"postBindingResponse\" : \"false\",\n+ \"singleLogoutServiceUrl\" : \"http://saml.idp/saml\",\n+ \"postBindingAuthnRequest\" : \"false\",\n+ \"singleSignOnServiceUrl\" : \"http://saml.idp/saml\",\n+ \"backchannelSupported\" : \"false\"\n+ }\n+}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9167 Using kcadm to update an identity-provider instance via a json file does not work without an "internalId" present in the json |
339,487 | 21.02.2019 01:32:47 | 10,800 | 9c34cc73655f3bf0a734237d4e1c734e01b03568 | Fix premature termination of sessions when remember-me is in use | [
{
"change_type": "MODIFY",
"old_path": "model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanUserSessionProvider.java",
"new_path": "model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanUserSessionProvider.java",
"diff": "@@ -529,7 +529,7 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {\nlocalClientSessionCacheStoreIgnore\n.entrySet()\n.stream()\n- .filter(AuthenticatedClientSessionPredicate.create(realm.getId()).expired(expired))\n+ .filter(AuthenticatedClientSessionPredicate.create(realm.getId()).expired(Math.min(expired, expiredRememberMe)))\n.map(Mappers.clientSessionEntity())\n.forEach(new Consumer<AuthenticatedClientSessionEntity>() {\n"
},
{
"change_type": "MODIFY",
"old_path": "model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/stream/UserSessionPredicate.java",
"new_path": "model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/stream/UserSessionPredicate.java",
"diff": "@@ -133,7 +133,7 @@ public class UserSessionPredicate implements Predicate<Map.Entry<String, Session\n}\nif (entity.isRememberMe()) {\n- if (expiredRememberMe != null && expiredRefreshRememberMe != null && entity.getStarted() > expiredRefreshRememberMe && entity.getLastSessionRefresh() > expiredRefreshRememberMe) {\n+ if (expiredRememberMe != null && expiredRefreshRememberMe != null && entity.getStarted() > expiredRememberMe && entity.getLastSessionRefresh() > expiredRefreshRememberMe) {\nreturn false;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/model/UserSessionProviderTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/model/UserSessionProviderTest.java",
"diff": "@@ -27,7 +27,9 @@ import org.junit.Test;\nimport org.keycloak.admin.client.resource.UserResource;\nimport org.keycloak.common.util.Time;\nimport org.keycloak.models.*;\n+import org.keycloak.models.sessions.infinispan.entities.UserSessionEntity;\nimport org.keycloak.models.utils.KeycloakModelUtils;\n+import org.keycloak.models.utils.SessionTimeoutHelper;\nimport org.keycloak.protocol.oidc.OIDCLoginProtocol;\nimport org.keycloak.representations.idm.RealmRepresentation;\nimport org.keycloak.testsuite.AbstractTestRealmKeycloakTest;\n@@ -328,50 +330,142 @@ public class UserSessionProviderTest extends AbstractTestRealmKeycloakTest {\n@Test\n@ModelTest\npublic void testRemoveUserSessionsByExpired(KeycloakSession session) {\n+ try {\nRealmModel realm = session.realms().getRealmByName(\"test\");\n- session.sessions().getUserSessions(realm, session.users().getUserByUsername(\"user1\", realm));\nClientModel client = realm.getClientByClientId(\"test-app\");\n- try {\n- Set<String> expired = new HashSet<String>();\n+ Set<String> validUserSessions = new HashSet<>();\n+ Set<String> validClientSessions = new HashSet<>();\n+ Set<String> expiredUserSessions = new HashSet<>();\n+ // create an user session that is older than the max lifespan timeout.\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession session1) -> {\nTime.setOffset(-(realm.getSsoSessionMaxLifespan() + 1));\n- UserSessionModel userSession = session.sessions().createUserSession(realm, session.users().getUserByUsername(\"user1\", realm), \"user1\", \"127.0.0.1\", \"form\", true, null, null);\n- expired.add(userSession.getId());\n- AuthenticatedClientSessionModel clientSession = session.sessions().createClientSession(realm, client, userSession);\n- Assert.assertEquals(userSession, clientSession.getUserSession());\n+ UserSessionModel userSession = session1.sessions().createUserSession(realm, session1.users().getUserByUsername(\"user1\", realm), \"user1\", \"127.0.0.1\", \"form\", false, null, null);\n+ expiredUserSessions.add(userSession.getId());\n+ AuthenticatedClientSessionModel clientSession = session1.sessions().createClientSession(realm, client, userSession);\n+ assertEquals(userSession, clientSession.getUserSession());\n+ });\n- Time.setOffset(0);\n- UserSessionModel s = session.sessions().createUserSession(realm, session.users().getUserByUsername(\"user2\", realm), \"user2\", \"127.0.0.1\", \"form\", true, null, null);\n- //s.setLastSessionRefresh(Time.currentTime() - (realm.getSsoSessionIdleTimeout() + 1));\n- s.setLastSessionRefresh(0);\n- expired.add(s.getId());\n+ // create an user session whose last refresh exceeds the max session idle timeout.\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession session1) -> {\n+ Time.setOffset(-(realm.getSsoSessionIdleTimeout() + SessionTimeoutHelper.PERIODIC_CLEANER_IDLE_TIMEOUT_WINDOW_SECONDS + 1));\n+ UserSessionModel s = session1.sessions().createUserSession(realm, session1.users().getUserByUsername(\"user2\", realm), \"user2\", \"127.0.0.1\", \"form\", false, null, null);\n+ // no need to explicitly set the last refresh time - it is the same as the creation time.\n+ expiredUserSessions.add(s.getId());\n+ });\n- Set<String> valid = new HashSet<String>();\n- Set<String> validClientSessions = new HashSet<String>();\n- userSession = session.sessions().createUserSession(realm, session.users().getUserByUsername(\"user1\", realm), \"user1\", \"127.0.0.1\", \"form\", true, null, null);\n- valid.add(userSession.getId());\n- validClientSessions.add(session.sessions().createClientSession(realm, client, userSession).getId());\n+ // create an user session and associated client session that conforms to the max lifespan and max idle timeouts.\n+ Time.setOffset(0);\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession session1) -> {\n+ UserSessionModel userSession = session1.sessions().createUserSession(realm, session1.users().getUserByUsername(\"user1\", realm), \"user1\", \"127.0.0.1\", \"form\", false, null, null);\n+ validUserSessions.add(userSession.getId());\n+ validClientSessions.add(session1.sessions().createClientSession(realm, client, userSession).getId());\n+ });\n- session.sessions().removeExpired(realm);\n+ // remove the expired sessions - we expect the first two sessions to have been removed as they either expired the max lifespan or the session idle timeouts.\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession session1) -> session1.sessions().removeExpired(realm));\n- //Under the new testsuite nothing ever seems to become Null\n- /*for (String e : expired) {\n+ for (String e : expiredUserSessions) {\nassertNull(session.sessions().getUserSession(realm, e));\n- }*/\n+ }\n- for (String v : valid) {\n+ for (String v : validUserSessions) {\nUserSessionModel userSessionLoaded = session.sessions().getUserSession(realm, v);\nassertNotNull(userSessionLoaded);\n- Assert.assertEquals(1, userSessionLoaded.getAuthenticatedClientSessions().size());\n- //Comparing sizes, not NULLs. Null seems to not be doable under the new testsuite because of the persistent session\n- //Assert.assertNotNull(userSessionLoaded.getAuthenticatedClientSessions().get(client.getId()));\n+ // the only valid user session should also have a valid client session that hasn't expired.\n+ AuthenticatedClientSessionModel clientSessionModel = userSessionLoaded.getAuthenticatedClientSessions().get(client.getId());\n+ assertNotNull(clientSessionModel);\n+ assertTrue(validClientSessions.contains(clientSessionModel.getId()));\n}\n} finally {\nTime.setOffset(0);\n}\n}\n+ /**\n+ * Tests the removal of expired sessions with remember-me enabled. It differs from the non remember me scenario by\n+ * taking into consideration the specific remember-me timeout values.\n+ *\n+ * @param session the {@code KeycloakSession}\n+ */\n+ @Test\n+ @ModelTest\n+ public void testRemoveUserSessionsByExpiredRememberMe(KeycloakSession session) {\n+ RealmModel testRealm = session.realms().getRealmByName(\"test\");\n+ int previousMaxLifespan = testRealm.getSsoSessionMaxLifespanRememberMe();\n+ int previousMaxIdle = testRealm.getSsoSessionIdleTimeoutRememberMe();\n+ try {\n+ ClientModel client = testRealm.getClientByClientId(\"test-app\");\n+ Set<String> validUserSessions = new HashSet<>();\n+ Set<String> validClientSessions = new HashSet<>();\n+ Set<String> expiredUserSessions = new HashSet<>();\n+\n+ // first lets update the realm by setting remember-me timeout values, which will be 4 times higher than the default timeout values.\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession kcSession) -> {\n+ RealmModel r = kcSession.realms().getRealmByName(\"test\");\n+ r.setSsoSessionMaxLifespanRememberMe(r.getSsoSessionMaxLifespan() * 4);\n+ r.setSsoSessionIdleTimeoutRememberMe(r.getSsoSessionIdleTimeout() * 4);\n+ });\n+ // update the realm reference so that the remember-me timeouts are now visible.\n+ RealmModel realm = session.realms().getRealmByName(\"test\");\n+\n+ // create an user session with remember-me enabled that is older than the default 'max lifespan' timeout but not older than the 'max lifespan remember-me' timeout.\n+ // the session's last refresh also exceeds the default 'session idle' timeout but doesn't exceed the 'session idle remember-me' timeout.\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession kcSession) -> {\n+ Time.setOffset(-(realm.getSsoSessionMaxLifespan() * 2));\n+ UserSessionModel userSession = kcSession.sessions().createUserSession(realm, kcSession.users().getUserByUsername(\"user1\", realm), \"user1\", \"127.0.0.1\", \"form\", true, null, null);\n+ AuthenticatedClientSessionModel clientSession = kcSession.sessions().createClientSession(realm, client, userSession);\n+ assertEquals(userSession, clientSession.getUserSession());\n+ Time.setOffset(-(realm.getSsoSessionIdleTimeout() * 2));\n+ userSession.setLastSessionRefresh(Time.currentTime());\n+ validUserSessions.add(userSession.getId());\n+ validClientSessions.add(clientSession.getId());\n+ });\n+\n+ // create an user session with remember-me enabled that is older than the 'max lifespan remember-me' timeout.\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession kcSession) -> {\n+ Time.setOffset(-(realm.getSsoSessionMaxLifespanRememberMe() + 1));\n+ UserSessionModel userSession = kcSession.sessions().createUserSession(realm, kcSession.users().getUserByUsername(\"user1\", realm), \"user1\", \"127.0.0.1\", \"form\", true, null, null);\n+ expiredUserSessions.add(userSession.getId());\n+ });\n+\n+ // finally create an user session with remember-me enabled whose last refresh exceeds the 'session idle remember-me' timeout.\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession kcSession) -> {\n+ Time.setOffset(-(realm.getSsoSessionIdleTimeoutRememberMe() + SessionTimeoutHelper.PERIODIC_CLEANER_IDLE_TIMEOUT_WINDOW_SECONDS + 1));\n+ UserSessionModel userSession = kcSession.sessions().createUserSession(realm, kcSession.users().getUserByUsername(\"user2\", realm), \"user2\", \"127.0.0.1\", \"form\", true, null, null);\n+ // no need to explicitly set the last refresh time - it is the same as the creation time.\n+ expiredUserSessions.add(userSession.getId());\n+ });\n+\n+ // remove the expired sessions - the first session should not be removed as it doesn't exceed any of the remember-me timeout values.\n+ Time.setOffset(0);\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession kcSession) -> kcSession.sessions().removeExpired(realm));\n+\n+ for (String sessionId : expiredUserSessions) {\n+ assertNull(session.sessions().getUserSession(realm, sessionId));\n+ }\n+\n+ for (String sessionId : validUserSessions) {\n+ UserSessionModel userSessionLoaded = session.sessions().getUserSession(realm, sessionId);\n+ assertNotNull(userSessionLoaded);\n+ // the only valid user session should also have a valid client session that hasn't expired.\n+ AuthenticatedClientSessionModel clientSessionModel = userSessionLoaded.getAuthenticatedClientSessions().get(client.getId());\n+ assertNotNull(clientSessionModel);\n+ assertTrue(validClientSessions.contains(clientSessionModel.getId()));\n+ }\n+\n+ } finally {\n+ Time.setOffset(0);\n+ // restore the original remember-me timeout values in the realm.\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession kcSession) -> {\n+ RealmModel r = kcSession.realms().getRealmByName(\"test\");\n+ r.setSsoSessionMaxLifespanRememberMe(previousMaxLifespan);\n+ r.setSsoSessionIdleTimeoutRememberMe(previousMaxIdle);\n+ });\n+ }\n+ }\n+\n// KEYCLOAK-2508\n@Test\n@ModelTest\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | [KEYCLOAK-9371] Fix premature termination of sessions when remember-me is in use |
339,259 | 09.11.2018 09:14:57 | -3,600 | 007c364027de8740f3b81db8d7fe0cca5aa79d5b | Store rewritten redirect URL in adapter-core | [
{
"change_type": "MODIFY",
"old_path": "adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/OAuthRequestAuthenticator.java",
"new_path": "adapters/oidc/adapter-core/src/main/java/org/keycloak/adapters/OAuthRequestAuthenticator.java",
"diff": "@@ -327,12 +327,12 @@ public class OAuthRequestAuthenticator {\nif (challenge != null) return challenge;\nAccessTokenResponse tokenResponse = null;\n- strippedOauthParametersRequestUri = stripOauthParametersFromRedirect();\n+ strippedOauthParametersRequestUri = rewrittenRedirectUri(stripOauthParametersFromRedirect());\ntry {\n// For COOKIE store we don't have httpSessionId and single sign-out won't be available\nString httpSessionId = deployment.getTokenStore() == TokenStore.SESSION ? reqAuthenticator.changeHttpSessionId(true) : null;\n- tokenResponse = ServerRequest.invokeAccessCodeToToken(deployment, code, rewrittenRedirectUri(strippedOauthParametersRequestUri), httpSessionId);\n+ tokenResponse = ServerRequest.invokeAccessCodeToToken(deployment, code, strippedOauthParametersRequestUri, httpSessionId);\n} catch (ServerRequest.HttpFailure failure) {\nlog.error(\"failed to turn code into token\");\nlog.error(\"status from server: \" + failure.getStatus());\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | Store rewritten redirect URL in adapter-core |
339,465 | 01.03.2019 09:50:52 | -3,600 | d5b28013d132f82e0f5364fadc1c5f2639769c91 | Remove jaxrs package from old testsuite and deprecate jaxrs filter | [
{
"change_type": "MODIFY",
"old_path": "adapters/oidc/jaxrs-oauth-client/src/main/java/org/keycloak/jaxrs/JaxrsBearerTokenFilter.java",
"new_path": "adapters/oidc/jaxrs-oauth-client/src/main/java/org/keycloak/jaxrs/JaxrsBearerTokenFilter.java",
"diff": "@@ -24,8 +24,12 @@ import javax.ws.rs.container.PreMatching;\n/**\n* @author <a href=\"mailto:[email protected]\">Marek Posolda</a>\n+ * @deprecated Class is deprecated and may be removed in the future. If you want to maintain this class for Keycloak community, please\n+ * contact Keycloak team on keycloak-dev mailing list. You can fork it into your github repository and\n+ * Keycloak team will reference it from \"Keycloak Extensions\" page.\n*/\n@PreMatching\n@Priority(Priorities.AUTHENTICATION)\n+@Deprecated\npublic interface JaxrsBearerTokenFilter extends ContainerRequestFilter {\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "adapters/oidc/jaxrs-oauth-client/src/main/java/org/keycloak/jaxrs/JaxrsBearerTokenFilterImpl.java",
"new_path": "adapters/oidc/jaxrs-oauth-client/src/main/java/org/keycloak/jaxrs/JaxrsBearerTokenFilterImpl.java",
"diff": "@@ -52,9 +52,13 @@ import java.util.logging.Logger;\n/**\n* @author <a href=\"mailto:[email protected]\">Bill Burke</a>\n* @version $Revision: 1 $\n+ * @deprecated Class is deprecated and may be removed in the future. If you want to maintain this class for Keycloak community, please\n+ * contact Keycloak team on keycloak-dev mailing list. You can fork it into your github repository and\n+ * Keycloak team will reference it from \"Keycloak Extensions\" page.\n*/\n@PreMatching\n@Priority(Priorities.AUTHENTICATION)\n+@Deprecated\npublic class JaxrsBearerTokenFilterImpl implements JaxrsBearerTokenFilter {\nprivate final static Logger log = Logger.getLogger(\"\" + JaxrsBearerTokenFilterImpl.class);\n"
},
{
"change_type": "MODIFY",
"old_path": "adapters/oidc/jaxrs-oauth-client/src/main/java/org/keycloak/jaxrs/JaxrsHttpFacade.java",
"new_path": "adapters/oidc/jaxrs-oauth-client/src/main/java/org/keycloak/jaxrs/JaxrsHttpFacade.java",
"diff": "@@ -37,7 +37,11 @@ import java.util.Map;\n/**\n* @author <a href=\"mailto:[email protected]\">Marek Posolda</a>\n+ * @deprecated Class is deprecated and may be removed in the future. If you want to maintain this class for Keycloak community, please\n+ * contact Keycloak team on keycloak-dev mailing list. You can fork it into your github repository and\n+ * Keycloak team will reference it from \"Keycloak Extensions\" page.\n*/\n+@Deprecated\npublic class JaxrsHttpFacade implements OIDCHttpFacade {\nprotected final ContainerRequestContext requestContext;\n"
},
{
"change_type": "MODIFY",
"old_path": "adapters/oidc/jaxrs-oauth-client/src/main/java/org/keycloak/jaxrs/JaxrsOAuthClient.java",
"new_path": "adapters/oidc/jaxrs-oauth-client/src/main/java/org/keycloak/jaxrs/JaxrsOAuthClient.java",
"diff": "@@ -42,7 +42,11 @@ import java.util.logging.Logger;\n*\n* @author <a href=\"mailto:[email protected]\">Bill Burke</a>\n* @version $Revision: 1 $\n+ * @deprecated Class is deprecated and may be removed in the future. If you want to maintain this class for Keycloak community, please\n+ * contact Keycloak team on keycloak-dev mailing list. You can fork it into your github repository and\n+ * Keycloak team will reference it from \"Keycloak Extensions\" page.\n*/\n+@Deprecated\npublic class JaxrsOAuthClient extends AbstractOAuthClient {\nprivate final static Logger logger = Logger.getLogger(\"\" + JaxrsOAuthClient.class);\nprotected Client client;\n"
},
{
"change_type": "MODIFY",
"old_path": "adapters/oidc/jaxrs-oauth-client/src/main/java/org/keycloak/jaxrs/OsgiJaxrsBearerTokenFilterImpl.java",
"new_path": "adapters/oidc/jaxrs-oauth-client/src/main/java/org/keycloak/jaxrs/OsgiJaxrsBearerTokenFilterImpl.java",
"diff": "@@ -33,9 +33,13 @@ import java.util.logging.Logger;\n* Variant of JaxrsBearerTokenFilter, which can be used to properly use resources from current osgi bundle\n*\n* @author <a href=\"mailto:[email protected]\">Marek Posolda</a>\n+ * @deprecated Class is deprecated and may be removed in the future. If you want to maintain this class for Keycloak community, please\n+ * contact Keycloak team on keycloak-dev mailing list. You can fork it into your github repository and\n+ * Keycloak team will reference it from \"Keycloak Extensions\" page.\n*/\n@PreMatching\n@Priority(Priorities.AUTHENTICATION)\n+@Deprecated\npublic class OsgiJaxrsBearerTokenFilterImpl extends JaxrsBearerTokenFilterImpl {\nprivate final static Logger log = Logger.getLogger(\"\" + JaxrsBearerTokenFilterImpl.class);\n"
},
{
"change_type": "DELETE",
"old_path": "testsuite/integration-deprecated/src/test/java/org/keycloak/testsuite/jaxrs/JaxrsBasicAuthTest.java",
"new_path": null,
"diff": "-/*\n- * Copyright 2016 Red Hat, Inc. and/or its affiliates\n- * and other contributors as indicated by the @author tags.\n- *\n- * Licensed under the Apache License, Version 2.0 (the \"License\");\n- * you may not use this file except in compliance with the License.\n- * You may obtain a copy of the License at\n- *\n- * http://www.apache.org/licenses/LICENSE-2.0\n- *\n- * Unless required by applicable law or agreed to in writing, software\n- * distributed under the License is distributed on an \"AS IS\" BASIS,\n- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n- * See the License for the specific language governing permissions and\n- * limitations under the License.\n- */\n-\n-package org.keycloak.testsuite.jaxrs;\n-\n-import org.apache.http.impl.client.DefaultHttpClient;\n-import org.jboss.resteasy.client.jaxrs.ResteasyClient;\n-import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;\n-import org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine;\n-import org.junit.Assert;\n-import org.junit.ClassRule;\n-import org.junit.Rule;\n-import org.junit.Test;\n-import org.junit.rules.ExternalResource;\n-import org.keycloak.adapters.HttpClientBuilder;\n-import org.keycloak.common.util.Base64;\n-import org.keycloak.models.ClientModel;\n-import org.keycloak.models.RealmModel;\n-import org.keycloak.models.utils.KeycloakModelUtils;\n-import org.keycloak.services.managers.RealmManager;\n-import org.keycloak.testsuite.Constants;\n-import org.keycloak.testsuite.rule.KeycloakRule;\n-import org.keycloak.testsuite.rule.WebResource;\n-import org.keycloak.testsuite.rule.WebRule;\n-import org.openqa.selenium.WebDriver;\n-\n-import javax.ws.rs.client.Entity;\n-import javax.ws.rs.core.Form;\n-import javax.ws.rs.core.HttpHeaders;\n-import javax.ws.rs.core.Response;\n-import java.util.Map;\n-import java.util.TreeMap;\n-import java.util.UUID;\n-\n-/**\n- * Test for basic authentication.\n- */\n-public class JaxrsBasicAuthTest {\n-\n- private static final String JAXRS_APP_URL = Constants.SERVER_ROOT + \"/jaxrs-simple/res\";\n-\n- public static final String CONFIG_FILE_INIT_PARAM = \"config-file\";\n-\n- @ClassRule\n- public static KeycloakRule keycloakRule = new KeycloakRule(new KeycloakRule.KeycloakSetup() {\n-\n- @Override\n- public void config(RealmManager manager, RealmModel adminstrationRealm, RealmModel appRealm) {\n- ClientModel app = KeycloakModelUtils.createClient(appRealm, \"jaxrs-app\");\n- app.setEnabled(true);\n- app.setSecret(\"password\");\n- app.setFullScopeAllowed(true);\n- app.setDirectAccessGrantsEnabled(true);\n-\n- JaxrsBasicAuthTest.appRealm = appRealm;\n- }\n- });\n-\n- @ClassRule\n- public static ExternalResource clientRule = new ExternalResource() {\n-\n- @Override\n- protected void before() throws Throwable {\n- DefaultHttpClient httpClient = (DefaultHttpClient) new HttpClientBuilder().build();\n- ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient);\n- client = new ResteasyClientBuilder().httpEngine(engine).build();\n- }\n-\n- @Override\n- protected void after() {\n- client.close();\n- }\n- };\n-\n- private static ResteasyClient client;\n-\n- @Rule\n- public WebRule webRule = new WebRule(this);\n-\n- @WebResource\n- protected WebDriver driver;\n-\n- // Used for signing admin action\n- protected static RealmModel appRealm;\n-\n-\n- @Test\n- public void testBasic() {\n- keycloakRule.update(new KeycloakRule.KeycloakSetup() {\n-\n- @Override\n- public void config(RealmManager manager, RealmModel adminstrationRealm, RealmModel appRealm) {\n- Map<String,String> initParams = new TreeMap<String,String>();\n- initParams.put(CONFIG_FILE_INIT_PARAM, \"classpath:jaxrs-test/jaxrs-keycloak-basicauth.json\");\n- keycloakRule.deployJaxrsApplication(\"JaxrsSimpleApp\", \"/jaxrs-simple\", JaxrsTestApplication.class, initParams);\n- }\n-\n- });\n-\n- // Send GET request without credentials, it should fail\n- Response getResp = client.target(JAXRS_APP_URL).request().get();\n- Assert.assertEquals(getResp.getStatus(), 401);\n- getResp.close();\n-\n- // Send POST request without credentials, it should fail\n- Response postResp = client.target(JAXRS_APP_URL).request().post(Entity.form(new Form()));\n- Assert.assertEquals(postResp.getStatus(), 401);\n- postResp.close();\n-\n- // Retrieve token\n- String incorrectAuthHeader = \"Basic \"+encodeCredentials(\"invalid-user\", \"password\");\n-\n- // Send GET request with incorrect credentials, it shojuld fail\n- getResp = client.target(JAXRS_APP_URL).request()\n- .header(HttpHeaders.AUTHORIZATION, incorrectAuthHeader)\n- .get();\n- Assert.assertEquals(getResp.getStatus(), 401);\n- getResp.close();\n-\n- // Retrieve token\n- String authHeader = \"Basic \"+encodeCredentials(\"test-user@localhost\", \"password\");\n-\n- // Send GET request with token and assert it's passing\n- JaxrsTestResource.SimpleRepresentation getRep = client.target(JAXRS_APP_URL).request()\n- .header(HttpHeaders.AUTHORIZATION, authHeader)\n- .get(JaxrsTestResource.SimpleRepresentation.class);\n- Assert.assertEquals(\"get\", getRep.getMethod());\n-\n- Assert.assertTrue(getRep.getHasUserRole());\n- Assert.assertFalse(getRep.getHasAdminRole());\n- Assert.assertFalse(getRep.getHasJaxrsAppRole());\n- // Assert that principal is ID of user (should be in UUID format)\n- UUID.fromString(getRep.getPrincipal());\n-\n- // Send POST request with token and assert it's passing\n- JaxrsTestResource.SimpleRepresentation postRep = client.target(JAXRS_APP_URL).request()\n- .header(HttpHeaders.AUTHORIZATION, authHeader)\n- .post(Entity.form(new Form()), JaxrsTestResource.SimpleRepresentation.class);\n- Assert.assertEquals(\"post\", postRep.getMethod());\n- Assert.assertEquals(getRep.getPrincipal(), postRep.getPrincipal());\n- }\n-\n- private String encodeCredentials(String username, String password) {\n- String text=username+\":\"+password;\n- return (Base64.encodeBytes(text.getBytes()));\n- }\n-}\n"
},
{
"change_type": "DELETE",
"old_path": "testsuite/integration-deprecated/src/test/java/org/keycloak/testsuite/jaxrs/JaxrsFilterTest.java",
"new_path": null,
"diff": "-/*\n- * Copyright 2016 Red Hat, Inc. and/or its affiliates\n- * and other contributors as indicated by the @author tags.\n- *\n- * Licensed under the Apache License, Version 2.0 (the \"License\");\n- * you may not use this file except in compliance with the License.\n- * You may obtain a copy of the License at\n- *\n- * http://www.apache.org/licenses/LICENSE-2.0\n- *\n- * Unless required by applicable law or agreed to in writing, software\n- * distributed under the License is distributed on an \"AS IS\" BASIS,\n- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n- * See the License for the specific language governing permissions and\n- * limitations under the License.\n- */\n-\n-package org.keycloak.testsuite.jaxrs;\n-\n-import org.apache.http.impl.client.DefaultHttpClient;\n-import org.jboss.resteasy.client.jaxrs.ResteasyClient;\n-import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;\n-import org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine;\n-import org.junit.Assert;\n-import org.junit.ClassRule;\n-import org.junit.Rule;\n-import org.junit.Test;\n-import org.junit.rules.ExternalResource;\n-import org.keycloak.OAuth2Constants;\n-import org.keycloak.TokenIdGenerator;\n-import org.keycloak.adapters.CorsHeaders;\n-import org.keycloak.adapters.HttpClientBuilder;\n-import org.keycloak.common.util.Time;\n-import org.keycloak.constants.AdapterConstants;\n-import org.keycloak.models.ClientModel;\n-import org.keycloak.models.RealmModel;\n-import org.keycloak.models.RoleModel;\n-import org.keycloak.models.UserModel;\n-import org.keycloak.protocol.oidc.TokenManager;\n-import org.keycloak.representations.adapters.action.PushNotBeforeAction;\n-import org.keycloak.services.managers.RealmManager;\n-import org.keycloak.testsuite.Constants;\n-import org.keycloak.testsuite.OAuthClient;\n-import org.keycloak.testsuite.rule.KeycloakRule;\n-import org.keycloak.testsuite.rule.WebResource;\n-import org.keycloak.testsuite.rule.WebRule;\n-import org.openqa.selenium.WebDriver;\n-\n-import javax.ws.rs.client.Entity;\n-import javax.ws.rs.core.Form;\n-import javax.ws.rs.core.HttpHeaders;\n-import javax.ws.rs.core.Response;\n-import java.util.Map;\n-import java.util.TreeMap;\n-import java.util.UUID;\n-\n-/**\n- * @author <a href=\"mailto:[email protected]\">Marek Posolda</a>\n- */\n-public class JaxrsFilterTest {\n-\n- private static final String JAXRS_APP_URL = Constants.SERVER_ROOT + \"/jaxrs-simple/res\";\n- private static final String JAXRS_APP_PUSN_NOT_BEFORE_URL = Constants.SERVER_ROOT + \"/jaxrs-simple/\" + AdapterConstants.K_PUSH_NOT_BEFORE;\n-\n- public static final String CONFIG_FILE_INIT_PARAM = \"config-file\";\n-\n- @ClassRule\n- public static KeycloakRule keycloakRule = new KeycloakRule(new KeycloakRule.KeycloakSetup() {\n-\n- @Override\n- public void config(RealmManager manager, RealmModel adminstrationRealm, RealmModel appRealm) {\n- ClientModel app = appRealm.addClient(\"jaxrs-app\");\n- app.setEnabled(true);\n- RoleModel role = app.addRole(\"jaxrs-app-user\");\n- UserModel user = manager.getSession().users().getUserByUsername(\"test-user@localhost\", appRealm);\n- user.grantRole(role);\n-\n- JaxrsFilterTest.appRealm = appRealm;\n- }\n- });\n-\n- @ClassRule\n- public static ExternalResource clientRule = new ExternalResource() {\n-\n- @Override\n- protected void before() throws Throwable {\n- DefaultHttpClient httpClient = (DefaultHttpClient) new HttpClientBuilder().build();\n- ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient);\n- client = new ResteasyClientBuilder().httpEngine(engine).build();\n- }\n-\n- @Override\n- protected void after() {\n- client.close();\n- }\n- };\n-\n- private static ResteasyClient client;\n-\n- @Rule\n- public WebRule webRule = new WebRule(this);\n-\n- @WebResource\n- protected WebDriver driver;\n-\n- // Used for signing admin action\n- protected static RealmModel appRealm;\n-\n-\n- @Test\n- public void testBasic() {\n- keycloakRule.update(new KeycloakRule.KeycloakSetup() {\n-\n- @Override\n- public void config(RealmManager manager, RealmModel adminstrationRealm, RealmModel appRealm) {\n- Map<String,String> initParams = new TreeMap<String,String>();\n- initParams.put(CONFIG_FILE_INIT_PARAM, \"classpath:jaxrs-test/jaxrs-keycloak.json\");\n- keycloakRule.deployJaxrsApplication(\"JaxrsSimpleApp\", \"/jaxrs-simple\", JaxrsTestApplication.class, initParams);\n- }\n-\n- });\n-\n- // Send GET request without token, it should fail\n- Response getResp = client.target(JAXRS_APP_URL).request().get();\n- Assert.assertEquals(getResp.getStatus(), 401);\n- getResp.close();\n-\n- // Send POST request without token, it should fail\n- Response postResp = client.target(JAXRS_APP_URL).request().post(Entity.form(new Form()));\n- Assert.assertEquals(postResp.getStatus(), 401);\n- postResp.close();\n-\n- // Retrieve token\n- OAuthClient.AccessTokenResponse accessTokenResp = retrieveAccessToken();\n- String authHeader = \"Bearer \" + accessTokenResp.getAccessToken();\n-\n- // Send GET request with token and assert it's passing\n- JaxrsTestResource.SimpleRepresentation getRep = client.target(JAXRS_APP_URL).request()\n- .header(HttpHeaders.AUTHORIZATION, authHeader)\n- .get(JaxrsTestResource.SimpleRepresentation.class);\n- Assert.assertEquals(\"get\", getRep.getMethod());\n- Assert.assertTrue(getRep.getHasUserRole());\n- Assert.assertFalse(getRep.getHasAdminRole());\n- Assert.assertFalse(getRep.getHasJaxrsAppRole());\n- // Assert that principal is ID of user (should be in UUID format)\n- UUID.fromString(getRep.getPrincipal());\n-\n- // Send POST request with token and assert it's passing\n- JaxrsTestResource.SimpleRepresentation postRep = client.target(JAXRS_APP_URL).request()\n- .header(HttpHeaders.AUTHORIZATION, authHeader)\n- .post(Entity.form(new Form()), JaxrsTestResource.SimpleRepresentation.class);\n- Assert.assertEquals(\"post\", postRep.getMethod());\n- Assert.assertEquals(getRep.getPrincipal(), postRep.getPrincipal());\n- }\n-\n- @Test\n- public void testRelativeUriAndPublicKey() {\n- keycloakRule.update(new KeycloakRule.KeycloakSetup() {\n-\n- @Override\n- public void config(RealmManager manager, RealmModel adminstrationRealm, RealmModel appRealm) {\n- Map<String,String> initParams = new TreeMap<String,String>();\n- initParams.put(CONFIG_FILE_INIT_PARAM, \"classpath:jaxrs-test/jaxrs-keycloak-relative.json\");\n- keycloakRule.deployJaxrsApplication(\"JaxrsSimpleApp\", \"/jaxrs-simple\", JaxrsTestApplication.class, initParams);\n- }\n-\n- });\n-\n- // Send GET request without token, it should fail\n- Response getResp = client.target(JAXRS_APP_URL).request().get();\n- Assert.assertEquals(getResp.getStatus(), 401);\n- getResp.close();\n-\n- // Retrieve token\n- OAuthClient.AccessTokenResponse accessTokenResp = retrieveAccessToken();\n- String authHeader = \"Bearer \" + accessTokenResp.getAccessToken();\n-\n- // Send GET request with token and assert it's passing\n- JaxrsTestResource.SimpleRepresentation getRep = client.target(JAXRS_APP_URL).request()\n- .header(HttpHeaders.AUTHORIZATION, authHeader)\n- .get(JaxrsTestResource.SimpleRepresentation.class);\n- Assert.assertEquals(\"get\", getRep.getMethod());\n- Assert.assertTrue(getRep.getHasUserRole());\n- Assert.assertFalse(getRep.getHasAdminRole());\n- Assert.assertFalse(getRep.getHasJaxrsAppRole());\n- // Assert that principal is ID of user (should be in UUID format)\n- UUID.fromString(getRep.getPrincipal());\n- }\n-\n- @Test\n- public void testSslRequired() {\n- keycloakRule.update(new KeycloakRule.KeycloakSetup() {\n-\n- @Override\n- public void config(RealmManager manager, RealmModel adminstrationRealm, RealmModel appRealm) {\n- Map<String, String> initParams = new TreeMap<String, String>();\n- initParams.put(CONFIG_FILE_INIT_PARAM, \"classpath:jaxrs-test/jaxrs-keycloak-ssl.json\");\n- keycloakRule.deployJaxrsApplication(\"JaxrsSimpleApp\", \"/jaxrs-simple\", JaxrsTestApplication.class, initParams);\n- }\n-\n- });\n-\n- // Retrieve token\n- OAuthClient.AccessTokenResponse accessTokenResp = retrieveAccessToken();\n- String authHeader = \"Bearer \" + accessTokenResp.getAccessToken();\n-\n- // Fail due to non-https\n- Response getResp = client.target(JAXRS_APP_URL).request()\n- .header(HttpHeaders.AUTHORIZATION, authHeader)\n- .get();\n- Assert.assertEquals(getResp.getStatus(), 403);\n- getResp.close();\n- }\n-\n- @Test\n- public void testResourceRoleMappings() {\n- keycloakRule.update(new KeycloakRule.KeycloakSetup() {\n-\n- @Override\n- public void config(RealmManager manager, RealmModel adminstrationRealm, RealmModel appRealm) {\n- Map<String, String> initParams = new TreeMap<String, String>();\n- initParams.put(CONFIG_FILE_INIT_PARAM, \"classpath:jaxrs-test/jaxrs-keycloak-resource-mappings.json\");\n- keycloakRule.deployJaxrsApplication(\"JaxrsSimpleApp\", \"/jaxrs-simple\", JaxrsTestApplication.class, initParams);\n- }\n-\n- });\n-\n- // Retrieve token\n- OAuthClient.AccessTokenResponse accessTokenResp = retrieveAccessToken();\n- String authHeader = \"Bearer \" + accessTokenResp.getAccessToken();\n-\n- // Send GET request with token and assert it's passing\n- JaxrsTestResource.SimpleRepresentation getRep = client.target(JAXRS_APP_URL).request()\n- .header(HttpHeaders.AUTHORIZATION, authHeader)\n- .get(JaxrsTestResource.SimpleRepresentation.class);\n- Assert.assertEquals(\"get\", getRep.getMethod());\n-\n- // principal is username\n- Assert.assertEquals(\"test-user@localhost\", getRep.getPrincipal());\n-\n- // User is in jaxrs-app-user role thanks to use-resource-role-mappings\n- Assert.assertFalse(getRep.getHasUserRole());\n- Assert.assertFalse(getRep.getHasAdminRole());\n- Assert.assertTrue(getRep.getHasJaxrsAppRole());\n- }\n-\n- @Test\n- public void testCors() {\n- keycloakRule.update(new KeycloakRule.KeycloakSetup() {\n-\n- @Override\n- public void config(RealmManager manager, RealmModel adminstrationRealm, RealmModel appRealm) {\n- Map<String,String> initParams = new TreeMap<String,String>();\n- initParams.put(CONFIG_FILE_INIT_PARAM, \"classpath:jaxrs-test/jaxrs-keycloak.json\");\n- keycloakRule.deployJaxrsApplication(\"JaxrsSimpleApp\", \"/jaxrs-simple\", JaxrsTestApplication.class, initParams);\n- }\n-\n- });\n-\n- // Send OPTIONS request\n- Response optionsResp = client.target(JAXRS_APP_URL).request()\n- .header(CorsHeaders.ORIGIN, \"http://localhost:8081\")\n- .options();\n- Assert.assertEquals(\"true\", optionsResp.getHeaderString(CorsHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS));\n- Assert.assertEquals(\"http://localhost:8081\", optionsResp.getHeaderString(CorsHeaders.ACCESS_CONTROL_ALLOW_ORIGIN));\n- optionsResp.close();\n-\n- // Retrieve token\n- OAuthClient.AccessTokenResponse accessTokenResp = retrieveAccessToken();\n- String authHeader = \"Bearer \" + accessTokenResp.getAccessToken();\n-\n- // Send GET request with token but bad origin\n- Response badOriginResp = client.target(JAXRS_APP_URL).request()\n- .header(HttpHeaders.AUTHORIZATION, authHeader)\n- .header(CorsHeaders.ORIGIN, \"http://evil.org\")\n- .get();\n- Assert.assertEquals(403, badOriginResp.getStatus());\n- badOriginResp.close();\n-\n- // Send GET request with token and good origin\n- Response goodResp = client.target(JAXRS_APP_URL).request()\n- .header(HttpHeaders.AUTHORIZATION, authHeader)\n- .header(CorsHeaders.ORIGIN, \"http://localhost:8081\")\n- .get();\n- Assert.assertEquals(200, goodResp.getStatus());\n- Assert.assertEquals(\"true\", optionsResp.getHeaderString(CorsHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS));\n- Assert.assertEquals(\"http://localhost:8081\", optionsResp.getHeaderString(CorsHeaders.ACCESS_CONTROL_ALLOW_ORIGIN));\n- JaxrsTestResource.SimpleRepresentation getRep = goodResp.readEntity(JaxrsTestResource.SimpleRepresentation.class);\n- Assert.assertEquals(\"get\", getRep.getMethod());\n- goodResp.close();\n- }\n-\n- // @Test\n- public void testCxfExample() {\n- //String uri = \"http://localhost:9000/customerservice/customers/123\";\n- String uri = \"http://localhost:8080/jax_rs_basic_servlet/services/service1/customerservice/customers/123\";\n- Response resp = client.target(uri).request()\n- .get();\n- Assert.assertEquals(resp.getStatus(), 401);\n- resp.close();\n-\n- // Retrieve token\n- OAuthClient.AccessTokenResponse accessTokenResp = retrieveAccessToken();\n- String authHeader = \"Bearer \" + accessTokenResp.getAccessToken();\n-\n- String resp2 = client.target(uri).request()\n- .header(HttpHeaders.AUTHORIZATION, authHeader)\n- .get(String.class);\n- System.out.println(resp2);\n- }\n-\n-\n- private OAuthClient.AccessTokenResponse retrieveAccessToken() {\n- OAuthClient oauth = new OAuthClient(driver);\n- oauth.doLogin(\"test-user@localhost\", \"password\");\n- String code = oauth.getCurrentQuery().get(OAuth2Constants.CODE);\n- OAuthClient.AccessTokenResponse response = oauth.doAccessTokenRequest(code, \"password\");\n- Assert.assertEquals(200, response.getStatusCode());\n- return response;\n- }\n-\n-}\n"
},
{
"change_type": "DELETE",
"old_path": "testsuite/integration-deprecated/src/test/java/org/keycloak/testsuite/jaxrs/JaxrsTestApplication.java",
"new_path": null,
"diff": "-/*\n- * Copyright 2016 Red Hat, Inc. and/or its affiliates\n- * and other contributors as indicated by the @author tags.\n- *\n- * Licensed under the Apache License, Version 2.0 (the \"License\");\n- * you may not use this file except in compliance with the License.\n- * You may obtain a copy of the License at\n- *\n- * http://www.apache.org/licenses/LICENSE-2.0\n- *\n- * Unless required by applicable law or agreed to in writing, software\n- * distributed under the License is distributed on an \"AS IS\" BASIS,\n- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n- * See the License for the specific language governing permissions and\n- * limitations under the License.\n- */\n-\n-package org.keycloak.testsuite.jaxrs;\n-\n-import org.keycloak.jaxrs.JaxrsBearerTokenFilterImpl;\n-\n-import javax.servlet.ServletContext;\n-import javax.ws.rs.core.Application;\n-import javax.ws.rs.core.Context;\n-import java.util.HashSet;\n-import java.util.Set;\n-\n-/**\n- * @author <a href=\"mailto:[email protected]\">Marek Posolda</a>\n- */\n-public class JaxrsTestApplication extends Application {\n-\n- protected Set<Class<?>> classes = new HashSet<Class<?>>();\n- protected Set<Object> singletons = new HashSet<Object>();\n-\n- public JaxrsTestApplication(@Context ServletContext context) throws Exception {\n- singletons.add(new JaxrsTestResource());\n-\n- String configFile = context.getInitParameter(JaxrsFilterTest.CONFIG_FILE_INIT_PARAM);\n- JaxrsBearerTokenFilterImpl filter = new JaxrsBearerTokenFilterImpl();\n- filter.setKeycloakConfigFile(configFile);\n- singletons.add(filter);\n- }\n-\n- @Override\n- public Set<Class<?>> getClasses() {\n- return classes;\n- }\n-\n- @Override\n- public Set<Object> getSingletons() {\n- return singletons;\n- }\n-}\n"
},
{
"change_type": "DELETE",
"old_path": "testsuite/integration-deprecated/src/test/java/org/keycloak/testsuite/jaxrs/JaxrsTestResource.java",
"new_path": null,
"diff": "-/*\n- * Copyright 2016 Red Hat, Inc. and/or its affiliates\n- * and other contributors as indicated by the @author tags.\n- *\n- * Licensed under the Apache License, Version 2.0 (the \"License\");\n- * you may not use this file except in compliance with the License.\n- * You may obtain a copy of the License at\n- *\n- * http://www.apache.org/licenses/LICENSE-2.0\n- *\n- * Unless required by applicable law or agreed to in writing, software\n- * distributed under the License is distributed on an \"AS IS\" BASIS,\n- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n- * See the License for the specific language governing permissions and\n- * limitations under the License.\n- */\n-\n-package org.keycloak.testsuite.jaxrs;\n-\n-import javax.ws.rs.GET;\n-import javax.ws.rs.POST;\n-import javax.ws.rs.Path;\n-import javax.ws.rs.Produces;\n-import javax.ws.rs.core.Context;\n-import javax.ws.rs.core.SecurityContext;\n-\n-/**\n- * @author <a href=\"mailto:[email protected]\">Marek Posolda</a>\n- */\n-@Path(\"res\")\n-public class JaxrsTestResource {\n-\n- @Context\n- protected SecurityContext securityContext;\n-\n- @GET\n- @Produces(\"application/json\")\n- public SimpleRepresentation get() {\n- return new SimpleRepresentation(\"get\", securityContext.getUserPrincipal().getName(), securityContext.isUserInRole(\"user\"),\n- securityContext.isUserInRole(\"admin\"), securityContext.isUserInRole(\"jaxrs-app-user\"));\n- }\n-\n- @POST\n- @Produces(\"application/json\")\n- public SimpleRepresentation post() {\n- return new SimpleRepresentation(\"post\", securityContext.getUserPrincipal().getName(), securityContext.isUserInRole(\"user\"),\n- securityContext.isUserInRole(\"admin\"), securityContext.isUserInRole(\"jaxrs-app-user\"));\n- }\n-\n- public static class SimpleRepresentation {\n- private String method;\n- private String principal;\n- private Boolean hasUserRole;\n- private Boolean hasAdminRole;\n- private Boolean hasJaxrsAppRole;\n-\n- public SimpleRepresentation() {\n- }\n-\n- public SimpleRepresentation(String method, String principal, boolean hasUserRole, boolean hasAdminRole,\n- boolean hasJaxrsAppRole) {\n- this.method = method;\n- this.principal = principal;\n- this.hasUserRole = hasUserRole;\n- this.hasAdminRole = hasAdminRole;\n- this.hasJaxrsAppRole = hasJaxrsAppRole;\n- }\n-\n- public String getMethod() {\n- return method;\n- }\n-\n- public void setMethod(String method) {\n- this.method = method;\n- }\n-\n- public String getPrincipal() {\n- return principal;\n- }\n-\n- public void setPrincipal(String principal) {\n- this.principal = principal;\n- }\n-\n- public Boolean getHasUserRole() {\n- return hasUserRole;\n- }\n-\n- public void setHasUserRole(Boolean hasUserRole) {\n- this.hasUserRole = hasUserRole;\n- }\n-\n- public Boolean getHasAdminRole() {\n- return hasAdminRole;\n- }\n-\n- public void setHasAdminRole(Boolean hasAdminRole) {\n- this.hasAdminRole = hasAdminRole;\n- }\n-\n- public Boolean getHasJaxrsAppRole() {\n- return hasJaxrsAppRole;\n- }\n-\n- public void setHasJaxrsAppRole(Boolean hasJaxrsAppRole) {\n- this.hasJaxrsAppRole = hasJaxrsAppRole;\n- }\n- }\n-}\n"
},
{
"change_type": "DELETE",
"old_path": "testsuite/integration-deprecated/src/test/resources/jaxrs-test/jaxrs-keycloak-basicauth.json",
"new_path": null,
"diff": "-{\n- \"realm\": \"test\",\n- \"resource\": \"jaxrs-app\",\n- \"realm-public-key\": \"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB\",\n- \"auth-server-url\": \"http://localhost:8081/auth\",\n- \"ssl-required\" : \"external\",\n- \"enable-basic-auth\": true,\n- \"bearer-only\": true,\n- \"credentials\": {\n- \"secret\": \"password\"\n- }\n-}\n\\ No newline at end of file\n"
},
{
"change_type": "DELETE",
"old_path": "testsuite/integration-deprecated/src/test/resources/jaxrs-test/jaxrs-keycloak-relative.json",
"new_path": null,
"diff": "-{\n- \"realm\": \"test\",\n- \"resource\": \"jaxrs-app\",\n- \"auth-server-url\": \"/auth\",\n- \"ssl-required\" : \"external\",\n- \"bearer-only\": true\n-}\n\\ No newline at end of file\n"
},
{
"change_type": "DELETE",
"old_path": "testsuite/integration-deprecated/src/test/resources/jaxrs-test/jaxrs-keycloak-resource-mappings.json",
"new_path": null,
"diff": "-{\n- \"realm\": \"test\",\n- \"resource\": \"jaxrs-app\",\n- \"realm-public-key\": \"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB\",\n- \"auth-server-url\": \"http://localhost:8081/auth\",\n- \"ssl-required\" : \"external\",\n- \"bearer-only\": true,\n- \"principal-attribute\": \"preferred_username\",\n- \"use-resource-role-mappings\": true\n-}\n"
},
{
"change_type": "DELETE",
"old_path": "testsuite/integration-deprecated/src/test/resources/jaxrs-test/jaxrs-keycloak-ssl.json",
"new_path": null,
"diff": "-{\n- \"realm\": \"test\",\n- \"resource\": \"jaxrs-app\",\n- \"realm-public-key\": \"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB\",\n- \"auth-server-url\": \"http://localhost:8081/auth\",\n- \"ssl-required\" : \"all\",\n- \"bearer-only\": true\n-}\n\\ No newline at end of file\n"
},
{
"change_type": "DELETE",
"old_path": "testsuite/integration-deprecated/src/test/resources/jaxrs-test/jaxrs-keycloak.json",
"new_path": null,
"diff": "-{\n- \"realm\": \"test\",\n- \"resource\": \"jaxrs-app\",\n- \"realm-public-key\": \"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB\",\n- \"auth-server-url\": \"http://localhost:8081/auth\",\n- \"ssl-required\" : \"external\",\n- \"bearer-only\": true,\n- \"enable-cors\": true\n-}\n\\ No newline at end of file\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8523 Remove jaxrs package from old testsuite and deprecate jaxrs filter |
339,367 | 22.01.2019 08:04:27 | -3,600 | f295a2e3034d739d5af960f688b4d6106787f895 | Fixed updated of protocol mappers within client updates in clients-registrations resource | [
{
"change_type": "MODIFY",
"old_path": "server-spi-private/src/main/java/org/keycloak/models/utils/RepresentationToModel.java",
"new_path": "server-spi-private/src/main/java/org/keycloak/models/utils/RepresentationToModel.java",
"diff": "@@ -1336,7 +1336,6 @@ public class RepresentationToModel {\n}\n}\n-\nif (rep.getNotBefore() != null) {\nresource.setNotBefore(rep.getNotBefore());\n}\n@@ -1365,6 +1364,39 @@ public class RepresentationToModel {\nresource.updateClient();\n}\n+ public static void updateClientProtocolMappers(ClientRepresentation rep, ClientModel resource) {\n+\n+ if (rep.getProtocolMappers() != null) {\n+ Map<String,ProtocolMapperModel> existingProtocolMappers = new HashMap<>();\n+ for (ProtocolMapperModel existingProtocolMapper : resource.getProtocolMappers()) {\n+ existingProtocolMappers.put(generateProtocolNameKey(existingProtocolMapper.getProtocol(), existingProtocolMapper.getName()), existingProtocolMapper);\n+ }\n+\n+ for (ProtocolMapperRepresentation protocolMapperRepresentation : rep.getProtocolMappers()) {\n+ String protocolNameKey = generateProtocolNameKey(protocolMapperRepresentation.getProtocol(), protocolMapperRepresentation.getName());\n+ ProtocolMapperModel existingMapper = existingProtocolMappers.get(protocolNameKey);\n+ if (existingMapper != null) {\n+ ProtocolMapperModel updatedProtocolMapperModel = toModel(protocolMapperRepresentation);\n+ updatedProtocolMapperModel.setId(existingMapper.getId());\n+ resource.updateProtocolMapper(updatedProtocolMapperModel);\n+\n+ existingProtocolMappers.remove(protocolNameKey);\n+\n+ } else {\n+ resource.addProtocolMapper(toModel(protocolMapperRepresentation));\n+ }\n+ }\n+\n+ for (Map.Entry<String, ProtocolMapperModel> entryToDelete : existingProtocolMappers.entrySet()) {\n+ resource.removeProtocolMapper(entryToDelete.getValue());\n+ }\n+ }\n+ }\n+\n+ private static String generateProtocolNameKey(String protocol, String name) {\n+ return String.format(\"%s%%%s\", protocol, name);\n+ }\n+\n// CLIENT SCOPES\nprivate static Map<String, ClientScopeModel> createClientScopes(KeycloakSession session, List<ClientScopeRepresentation> clientScopes, RealmModel realm) {\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/services/clientregistration/AbstractClientRegistrationProvider.java",
"new_path": "services/src/main/java/org/keycloak/services/clientregistration/AbstractClientRegistrationProvider.java",
"diff": "@@ -19,11 +19,7 @@ package org.keycloak.services.clientregistration;\nimport org.keycloak.events.EventBuilder;\nimport org.keycloak.events.EventType;\n-import org.keycloak.models.ClientInitialAccessModel;\n-import org.keycloak.models.ClientModel;\n-import org.keycloak.models.KeycloakSession;\n-import org.keycloak.models.ModelDuplicateException;\n-import org.keycloak.models.RealmModel;\n+import org.keycloak.models.*;\nimport org.keycloak.models.utils.ModelToRepresentation;\nimport org.keycloak.models.utils.RepresentationToModel;\nimport org.keycloak.representations.idm.ClientRepresentation;\n@@ -142,6 +138,8 @@ public abstract class AbstractClientRegistrationProvider implements ClientRegist\n}\nRepresentationToModel.updateClient(rep, client);\n+ RepresentationToModel.updateClientProtocolMappers(rep, client);\n+\nrep = ModelToRepresentation.toRepresentation(client, session);\nif (auth.isRegistrationAccessToken()) {\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/client/ClientRegistrationTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/client/ClientRegistrationTest.java",
"diff": "@@ -24,21 +24,19 @@ import org.keycloak.client.registration.Auth;\nimport org.keycloak.client.registration.ClientRegistration;\nimport org.keycloak.client.registration.ClientRegistrationException;\nimport org.keycloak.client.registration.HttpErrorException;\n-import org.keycloak.models.ClientModel;\nimport org.keycloak.models.Constants;\n-import org.keycloak.models.UserModel;\nimport org.keycloak.representations.idm.ClientRepresentation;\n+import org.keycloak.representations.idm.ProtocolMapperRepresentation;\nimport org.keycloak.representations.idm.UserRepresentation;\nimport org.keycloak.testsuite.runonserver.RunOnServerDeployment;\n-import org.keycloak.testsuite.runonserver.RunOnServerTest;\nimport javax.ws.rs.NotFoundException;\n+import java.util.ArrayList;\nimport java.util.Collections;\n-import static org.junit.Assert.assertEquals;\n-import static org.junit.Assert.assertNotNull;\n-import static org.junit.Assert.assertNull;\n-import static org.junit.Assert.fail;\n+import static org.hamcrest.Matchers.nullValue;\n+import static org.hamcrest.core.Is.is;\n+import static org.junit.Assert.*;\n/**\n* @author <a href=\"mailto:[email protected]\">Stian Thorgersen</a>\n@@ -245,6 +243,68 @@ public class ClientRegistrationTest extends AbstractClientRegistrationTest {\nassertEquals(\"mysecret\", updatedClient.getSecret());\n}\n+ @Test\n+ public void addClientProtcolMappers() throws ClientRegistrationException {\n+ authManageClients();\n+\n+ ClientRepresentation initialClient = buildClient();\n+\n+ registerClient(initialClient);\n+ ClientRepresentation client = reg.get(CLIENT_ID);\n+\n+ addProtocolMapper(client, \"mapperA\");\n+ reg.update(client);\n+\n+ ClientRepresentation updatedClient = reg.get(CLIENT_ID);\n+ assertThat(\"Adding protocolMapper failed\", updatedClient.getProtocolMappers().size(), is(1));\n+ }\n+\n+ @Test\n+ public void removeClientProtcolMappers() throws ClientRegistrationException {\n+ authManageClients();\n+\n+ ClientRepresentation initialClient = buildClient();\n+ addProtocolMapper(initialClient, \"mapperA\");\n+ registerClient(initialClient);\n+ ClientRepresentation client = reg.get(CLIENT_ID);\n+ client.setProtocolMappers(new ArrayList<>());\n+ reg.update(client);\n+\n+ ClientRepresentation updatedClient = reg.get(CLIENT_ID);\n+ assertThat(\"Removing protocolMapper failed\", updatedClient.getProtocolMappers(), nullValue());\n+ }\n+\n+ @Test\n+ public void updateClientProtcolMappers() throws ClientRegistrationException {\n+ authManageClients();\n+\n+ ClientRepresentation initialClient = buildClient();\n+ addProtocolMapper(initialClient, \"mapperA\");\n+ registerClient(initialClient);\n+ ClientRepresentation client = reg.get(CLIENT_ID);\n+ client.getProtocolMappers().get(0).getConfig().put(\"claim.name\", \"updatedClaimName\");\n+ reg.update(client);\n+\n+ ClientRepresentation updatedClient = reg.get(CLIENT_ID);\n+ assertThat(\"Updating protocolMapper failed\", updatedClient.getProtocolMappers().get(0).getConfig().get(\"claim.name\"), is(\"updatedClaimName\"));\n+ }\n+\n+ private void addProtocolMapper(ClientRepresentation client, String mapperName) {\n+ ProtocolMapperRepresentation mapper = new ProtocolMapperRepresentation();\n+ mapper.setName(mapperName);\n+ mapper.setProtocol(\"openid-connect\");\n+ mapper.setProtocolMapper(\"oidc-usermodel-attribute-mapper\");\n+ mapper.getConfig().put(\"userinfo.token.claim\", \"true\");\n+ mapper.getConfig().put(\"user.attribute\", \"someAttribute\");\n+ mapper.getConfig().put(\"id.token.claim\", \"true\");\n+ mapper.getConfig().put(\"access.token.claim\", \"true\");\n+ mapper.getConfig().put(\"claim.name\", \"someClaimName\");\n+ mapper.getConfig().put(\"jsonType.label\", \"long\");\n+\n+ client.setProtocolMappers(new ArrayList<>());\n+ client.getProtocolMappers().add(mapper);\n+ }\n+\n@Test\npublic void updateClientAsAdminWithCreateOnly() throws ClientRegistrationException {\nauthCreateClients();\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | [KEYCLOAK-3723] Fixed updated of protocol mappers within client updates in clients-registrations resource |
339,235 | 04.03.2019 11:25:45 | -3,600 | c52c4fec23d954bd52e82e7ee030606b5062c03d | Move bower/npm packaging from keycloak/keycloak-js-bower repository | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "distribution/adapters/js-adapter-npm-zip/assembly.xml",
"diff": "+<!--\n+ ~ Copyright 2016 Red Hat, Inc. and/or its affiliates\n+ ~ and other contributors as indicated by the @author tags.\n+ ~\n+ ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n+ ~ you may not use this file except in compliance with the License.\n+ ~ You may obtain a copy of the License at\n+ ~\n+ ~ http://www.apache.org/licenses/LICENSE-2.0\n+ ~\n+ ~ Unless required by applicable law or agreed to in writing, software\n+ ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ ~ See the License for the specific language governing permissions and\n+ ~ limitations under the License.\n+ -->\n+\n+<assembly>\n+ <id>war-dist</id>\n+\n+ <formats>\n+ <format>zip</format>\n+ </formats>\n+ <includeBaseDirectory>true</includeBaseDirectory>\n+\n+ <files>\n+ <file>\n+ <source>src/main/resources/bower.json</source>\n+ <outputDirectory>/</outputDirectory>\n+ <filtered>true</filtered>\n+ </file>\n+ <file>\n+ <source>src/main/resources/package.json</source>\n+ <outputDirectory>/</outputDirectory>\n+ <filtered>true</filtered>\n+ </file>\n+ </files>\n+\n+ <fileSets>\n+ <fileSet>\n+ <directory>${project.build.directory}/unpacked/js-adapter</directory>\n+ <outputDirectory>dist/</outputDirectory>\n+ <includes>\n+ <include>**/*.js</include>\n+ <include>**/*.map</include>\n+ <include>**/*.d.ts</include>\n+ </includes>\n+ </fileSet>\n+ </fileSets>\n+</assembly>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "distribution/adapters/js-adapter-npm-zip/pom.xml",
"diff": "+<!--\n+ ~ Copyright 2016 Red Hat, Inc. and/or its affiliates\n+ ~ and other contributors as indicated by the @author tags.\n+ ~\n+ ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n+ ~ you may not use this file except in compliance with the License.\n+ ~ You may obtain a copy of the License at\n+ ~\n+ ~ http://www.apache.org/licenses/LICENSE-2.0\n+ ~\n+ ~ Unless required by applicable law or agreed to in writing, software\n+ ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ ~ See the License for the specific language governing permissions and\n+ ~ limitations under the License.\n+ -->\n+\n+<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n+ xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n+ <modelVersion>4.0.0</modelVersion>\n+ <parent>\n+ <artifactId>keycloak-parent</artifactId>\n+ <groupId>org.keycloak</groupId>\n+ <version>5.0.0-SNAPSHOT</version>\n+ <relativePath>../../../pom.xml</relativePath>\n+ </parent>\n+\n+ <artifactId>keycloak-js-adapter-npm-dist</artifactId>\n+ <packaging>pom</packaging>\n+ <name>Keycloak JS Adapter NPM Distribution</name>\n+ <description/>\n+\n+ <dependencies>\n+ <dependency>\n+ <groupId>org.keycloak</groupId>\n+ <artifactId>keycloak-js-adapter</artifactId>\n+ </dependency>\n+ </dependencies>\n+ <build>\n+ <plugins>\n+ <plugin>\n+ <groupId>org.apache.maven.plugins</groupId>\n+ <artifactId>maven-dependency-plugin</artifactId>\n+ <executions>\n+ <execution>\n+ <id>unpack</id>\n+ <phase>prepare-package</phase>\n+ <goals>\n+ <goal>unpack-dependencies</goal>\n+ </goals>\n+ <configuration>\n+ <excludeTransitive>true</excludeTransitive>\n+ <includeGroupIds>org.keycloak</includeGroupIds>\n+ <includeArtifactIds>keycloak-js-adapter</includeArtifactIds>\n+ <outputDirectory>${project.build.directory}/unpacked/js-adapter</outputDirectory>\n+ <includes>*.js,*.map,*.d.ts</includes>\n+ <excludes>**/welcome-content/*</excludes>\n+ </configuration>\n+ </execution>\n+ </executions>\n+ </plugin>\n+ <plugin>\n+ <artifactId>maven-assembly-plugin</artifactId>\n+ <executions>\n+ <execution>\n+ <id>assemble</id>\n+ <phase>package</phase>\n+ <goals>\n+ <goal>single</goal>\n+ </goals>\n+ <configuration>\n+ <descriptors>\n+ <descriptor>assembly.xml</descriptor>\n+ </descriptors>\n+ <outputDirectory>\n+ target\n+ </outputDirectory>\n+ <workDirectory>\n+ target/assembly/work\n+ </workDirectory>\n+ <appendAssemblyId>false</appendAssemblyId>\n+ </configuration>\n+ </execution>\n+ </executions>\n+ </plugin>\n+ </plugins>\n+ </build>\n+\n+ <profiles>\n+ <profile>\n+ <id>product</id>\n+ <activation>\n+ <property>\n+ <name>product</name>\n+ </property>\n+ </activation>\n+ <build>\n+ <finalName>${product.name}-${product.filename.version}-js-adapter</finalName>\n+ </build>\n+ </profile>\n+ </profiles>\n+\n+</project>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "distribution/adapters/js-adapter-npm-zip/src/main/resources/bower.json",
"diff": "+{\n+ \"name\": \"keycloak\",\n+ \"version\": \"${project.version}\",\n+ \"main\": \"dist/keycloak.js\",\n+ \"ignore\": [\n+ \"**/.*\"\n+ ],\n+ \"description\": \"Keycloak adapter\",\n+ \"keywords\": [\n+ \"keycloak\",\n+ \"sso\",\n+ \"oauth\",\n+ \"oauth2\",\n+ \"authentication\"\n+ ],\n+ \"license\": \"Apache-2.0\"\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "distribution/adapters/js-adapter-npm-zip/src/main/resources/package.json",
"diff": "+{\n+ \"name\": \"keycloak-js\",\n+ \"version\": \"${project.version}\",\n+ \"description\": \"Keycloak Adapter\",\n+ \"main\": \"dist/keycloak.js\",\n+ \"typings\": \"dist/keycloak.d.ts\",\n+ \"scripts\": {\n+ \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n+ },\n+ \"repository\": {\n+ \"type\": \"git\",\n+ \"url\": \"https://github.com/keycloak/keycloak\"\n+ },\n+ \"author\": \"Keycloak\",\n+ \"license\": \"Apache-2.0\",\n+ \"homepage\": \"https://www.keycloak.org\",\n+ \"keywords\": [\n+ \"keycloak\",\n+ \"sso\",\n+ \"oauth\",\n+ \"oauth2\",\n+ \"authentication\"\n+ ]\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "distribution/adapters/pom.xml",
"new_path": "distribution/adapters/pom.xml",
"diff": "<module>jetty93-adapter-zip</module>\n<module>jetty94-adapter-zip</module>\n<module>wf8-adapter</module>\n+ <module>js-adapter-npm-zip</module>\n</modules>\n</profile>\n</profiles>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9720 Move bower/npm packaging from keycloak/keycloak-js-bower repository |
339,419 | 13.12.2018 11:32:18 | 21,600 | 7bd1f32eb1cc76bb6a60e2d757a56f868d75a9a1 | Adds support for SAML SessionNotOnOrAfter attribute in response xml serialization | [
{
"change_type": "MODIFY",
"old_path": "saml-core/src/main/java/org/keycloak/saml/processing/core/parsers/saml/assertion/SAMLAssertionQNames.java",
"new_path": "saml-core/src/main/java/org/keycloak/saml/processing/core/parsers/saml/assertion/SAMLAssertionQNames.java",
"diff": "@@ -79,6 +79,7 @@ public enum SAMLAssertionQNames implements HasQName {\nATTR_NOT_ON_OR_AFTER(null, \"NotOnOrAfter\"),\nATTR_RECIPIENT(null, \"Recipient\"),\nATTR_SESSION_INDEX(null, \"SessionIndex\"),\n+ ATTR_SESSION_NOT_ON_OR_AFTER(null, \"SessionNotOnOrAfter\"),\nATTR_SP_PROVIDED_ID(null, \"SPProvidedID\"),\nATTR_SP_NAME_QUALIFIER(null, \"SPNameQualifier\"),\nATTR_VERSION(null, \"Version\"),\n"
},
{
"change_type": "MODIFY",
"old_path": "saml-core/src/main/java/org/keycloak/saml/processing/core/parsers/saml/assertion/SAMLAuthnStatementParser.java",
"new_path": "saml-core/src/main/java/org/keycloak/saml/processing/core/parsers/saml/assertion/SAMLAuthnStatementParser.java",
"diff": "@@ -48,7 +48,7 @@ public class SAMLAuthnStatementParser extends AbstractStaxSamlAssertionParser<Au\nAuthnStatementType res = new AuthnStatementType(authnInstant);\nres.setSessionIndex(StaxParserUtil.getAttributeValue(element, SAMLAssertionQNames.ATTR_SESSION_INDEX));\n- res.setSessionNotOnOrAfter(StaxParserUtil.getXmlTimeAttributeValue(element, SAMLAssertionQNames.ATTR_NOT_ON_OR_AFTER));\n+ res.setSessionNotOnOrAfter(StaxParserUtil.getXmlTimeAttributeValue(element, SAMLAssertionQNames.ATTR_SESSION_NOT_ON_OR_AFTER));\nreturn res;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/writers/SAMLAssertionWriter.java",
"new_path": "saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/writers/SAMLAssertionWriter.java",
"diff": "@@ -38,6 +38,7 @@ import org.keycloak.dom.saml.v2.assertion.URIType;\nimport org.keycloak.saml.common.constants.JBossSAMLConstants;\nimport org.keycloak.saml.common.exceptions.ProcessingException;\nimport org.keycloak.saml.common.util.StaxUtil;\n+import org.keycloak.saml.processing.core.parsers.saml.assertion.SAMLAssertionQNames;\nimport org.w3c.dom.Element;\nimport javax.xml.datatype.XMLGregorianCalendar;\n@@ -221,6 +222,11 @@ public class SAMLAssertionWriter extends BaseWriter {\nStaxUtil.writeAttribute(writer, JBossSAMLConstants.SESSION_INDEX.get(), sessionIndex);\n}\n+ XMLGregorianCalendar sessionNotOnOrAfter = authnStatement.getSessionNotOnOrAfter();\n+ if (sessionNotOnOrAfter != null) {\n+ StaxUtil.writeAttribute(writer, SAMLAssertionQNames.ATTR_SESSION_NOT_ON_OR_AFTER.getQName(), sessionNotOnOrAfter.toString());\n+ }\n+\nAuthnContextType authnContext = authnStatement.getAuthnContext();\nif (authnContext != null)\nwrite(authnContext);\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "saml-core/src/test/java/org/keycloak/saml/processing/core/saml/v2/writers/SAMLAssertionWriterTest.java",
"diff": "+package org.keycloak.saml.processing.core.saml.v2.writers;\n+\n+import org.junit.Assert;\n+import org.junit.Test;\n+import org.keycloak.dom.saml.v2.assertion.AuthnStatementType;\n+import org.keycloak.saml.common.constants.GeneralConstants;\n+import org.keycloak.saml.common.exceptions.ProcessingException;\n+import org.keycloak.saml.common.util.StaxUtil;\n+import org.keycloak.saml.processing.core.saml.v2.util.XMLTimeUtil;\n+\n+import javax.xml.datatype.XMLGregorianCalendar;\n+import java.io.ByteArrayOutputStream;\n+\n+public class SAMLAssertionWriterTest {\n+ @Test\n+ public void testAuthnStatementSessionNotOnOrAfterExists() throws ProcessingException {\n+ long sessionLengthInSeconds = 3600;\n+\n+ XMLGregorianCalendar issueInstant = XMLTimeUtil.getIssueInstant();\n+ XMLGregorianCalendar sessionExpirationDate = XMLTimeUtil.add(issueInstant, sessionLengthInSeconds);\n+\n+ AuthnStatementType authnStatementType = new AuthnStatementType(issueInstant);\n+\n+ authnStatementType.setSessionIndex(\"9b3cf799-225b-424a-8e5e-ee3c38e06ded::24b2f572-163c-43ad-8011-de6cd3803f76\");\n+ authnStatementType.setSessionNotOnOrAfter(sessionExpirationDate);\n+\n+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n+ SAMLAssertionWriter samlAssertionWriter = new SAMLAssertionWriter(StaxUtil.getXMLStreamWriter(byteArrayOutputStream));\n+\n+ samlAssertionWriter.write(authnStatementType, true);\n+\n+ String serializedAssertion = new String(byteArrayOutputStream.toByteArray(), GeneralConstants.SAML_CHARSET);\n+ String expectedXMLAttribute = \"SessionNotOnOrAfter=\\\"\" + sessionExpirationDate.toString() + \"\\\"\";\n+\n+ Assert.assertTrue(serializedAssertion.contains(expectedXMLAttribute));\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "saml-core/src/test/resources/org/keycloak/saml/processing/core/parsers/saml/saml20-assertion-example.xml",
"new_path": "saml-core/src/test/resources/org/keycloak/saml/processing/core/parsers/saml/saml20-assertion-example.xml",
"diff": "</saml:AudienceRestriction>\n</saml:Conditions>\n- <saml:AuthnStatement AuthnInstant=\"2009-06-17T18:45:10.738Z\" NotOnOrAfter=\"2009-06-17T18:55:10.738Z\">\n+ <saml:AuthnStatement AuthnInstant=\"2009-06-17T18:45:10.738Z\" SessionNotOnOrAfter=\"2009-06-17T18:55:10.738Z\">\n<saml:AuthnContext>\n<saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified\n</saml:AuthnContextClassRef>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9077 Adds support for SAML SessionNotOnOrAfter attribute in response xml serialization |
339,281 | 28.02.2019 12:38:52 | -3,600 | 845275ef0fca3fa5ec6edbff518236b13cd36766 | support for legacy driver for migration tests | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/HOW-TO-RUN.md",
"new_path": "testsuite/integration-arquillian/HOW-TO-RUN.md",
"diff": "@@ -260,8 +260,9 @@ This test will:\n-Dtest=MigrationTest \\\n-Dmigration.mode=auto \\\n-Djdbc.mvn.groupId=mysql \\\n- -Djdbc.mvn.version=5.1.29 \\\n-Djdbc.mvn.artifactId=mysql-connector-java \\\n+ -Djdbc.mvn.version=8.0.12 \\\n+ -Djdbc.mvn.version.legacy=5.1.38 \\\n-Dkeycloak.connectionsJpa.url=jdbc:mysql://$DB_HOST/keycloak \\\n-Dkeycloak.connectionsJpa.user=keycloak \\\n-Dkeycloak.connectionsJpa.password=keycloak\n@@ -270,6 +271,7 @@ The profile \"test-7X-migration\" indicates from which version you want to test mi\n* test-70-migration - indicates migration from RHSSO 7.0 (Equivalent to Keycloak 1.9.8.Final)\n* test-71-migration - indicates migration from RHSSO 7.1 (Equivalent to Keycloak 2.5.5.Final)\n* test-72-migration - indicates migration from RHSSO 7.2 (Equivalent to Keycloak 3.4.3.Final)\n+* test-73-migration - indicates migration from RHSSO 7.3 (Equivalent to Keycloak 4.8.3.Final)\n### DB migration test with manual mode\n@@ -286,8 +288,9 @@ just exports the needed SQL into the script. This SQL script then needs to be ma\n-Dtest=MigrationTest \\\n-Dmigration.mode=manual \\\n-Djdbc.mvn.groupId=mysql \\\n- -Djdbc.mvn.version=5.1.29 \\\n-Djdbc.mvn.artifactId=mysql-connector-java \\\n+ -Djdbc.mvn.version=8.0.12 \\\n+ -Djdbc.mvn.version.legacy=5.1.38 \\\n-Dkeycloak.connectionsJpa.url=jdbc:mysql://$DB_HOST/keycloak \\\n-Dkeycloak.connectionsJpa.user=keycloak \\\n-Dkeycloak.connectionsJpa.password=keycloak\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/servers/migration/pom.xml",
"new_path": "testsuite/integration-arquillian/servers/migration/pom.xml",
"diff": "<property>jdbc.mvn.artifactId</property>\n</requireProperty>\n<requireProperty>\n- <property>jdbc.mvn.version</property>\n+ <property>jdbc.mvn.version.legacy</property>\n</requireProperty>\n<requireProperty>\n<property>keycloak.connectionsJpa.user</property>\n<artifactItem>\n<groupId>${jdbc.mvn.groupId}</groupId>\n<artifactId>${jdbc.mvn.artifactId}</artifactId>\n- <version>${jdbc.mvn.version}</version>\n+ <version>${jdbc.mvn.version.legacy}</version>\n<type>jar</type>\n</artifactItem>\n</artifactItems>\n</parameter>\n<parameter>\n<name>version</name>\n- <value>${jdbc.mvn.version}</value>\n+ <value>${jdbc.mvn.version.legacy}</value>\n</parameter>\n</parameters>\n</transformationSet>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9624 support for legacy driver for migration tests |
339,281 | 01.03.2019 12:49:21 | -3,600 | 2e7eb92f43a2d0e0b9e6a2e7e612ba3859b82708 | replace hostnames with nip.io ones to include cors tests by default | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/test-apps/cors/angular-product/src/main/webapp/js/app.js",
"new_path": "testsuite/integration-arquillian/test-apps/cors/angular-product/src/main/webapp/js/app.js",
"diff": "var module = angular.module('product', []);\nfunction getAuthServerUrl() {\n- var url = 'https://localhost-auth:8543';\n+ var url = 'https://localhost-auth-127.0.0.1.nip.io:8543';\nreturn url;\n}\n@@ -69,7 +69,7 @@ module.controller('GlobalCtrl', function($scope, $http) {\n$scope.realm = [];\n$scope.version = [];\n$scope.reloadData = function() {\n- $http.get(getAppServerUrl(\"localhost-db\") + \"/cors-database/products\").success(function(data, status, headers, config) {\n+ $http.get(getAppServerUrl(\"localhost-db-127.0.0.1.nip.io\") + \"/cors-database/products\").success(function(data, status, headers, config) {\n$scope.products = angular.fromJson(data);\n$scope.headers = headers();\n});\n@@ -109,7 +109,7 @@ module.controller('GlobalCtrl', function($scope, $http) {\n};\n$scope.loadVersion = function() {\n- $http.get(getAppServerUrl(\"localhost-db\") + \"/cors-database/products/k_version\").success(function(data) {\n+ $http.get(getAppServerUrl(\"localhost-db-127.0.0.1.nip.io\") + \"/cors-database/products/k_version\").success(function(data) {\n$scope.version = angular.fromJson(data);\n});\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/test-apps/cors/angular-product/src/main/webapp/keycloak.json",
"new_path": "testsuite/integration-arquillian/test-apps/cors/angular-product/src/main/webapp/keycloak.json",
"diff": "{\n\"realm\" : \"cors\",\n\"realm-public-key\" : \"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB\",\n- \"auth-server-url\" : \"http://localhost-auth:8180/auth\",\n+ \"auth-server-url\" : \"http://localhost-auth-127.0.0.1.nip.io:8180/auth\",\n\"ssl-required\" : \"external\",\n\"disable-trust-manager\" : \"true\",\n\"resource\" : \"angular-cors-product\",\n"
},
{
"change_type": "DELETE",
"old_path": "testsuite/integration-arquillian/test-apps/cors/database-service/README.md",
"new_path": null,
"diff": "-Keycloak CORS support\n-===================================\n-The following examples requires Wildfly 8.0.0, JBoss EAP 6.x, or JBoss AS 7.1.1. This example simulates Browser CORS\n-requests. While the examples will run on one machine, the servers/applications are configured to point to different domains:\n-* **localhost-auth** is where the Keycloak auth server lives\n-* **localhost-db** is where a database REST service lives\n-* **localhost** is where the Javascript application lives\n-\n-In the demo you will visit the Javascript application and be redirected to Keycloak to login. As part of the login process,\n-the javascript application will have to make a CORS request to the auth server (localhost-auth) to obtain a token. After it logs in, the\n-application will make another CORS request to the REST database service (localhost-db).\n-\n-Here are some of the configuration additions to this example to enable CORS:\n-1. The **angular-product** application in realm configuration has a Web Origin of **http://localhost:8080**. When you log into\n-the angular-product application, Keycloak will add the Web Origins for that application to the token. Any CORS request made\n-will check these allowed origins to make sure they match up with the Origin header the browser is sending\n-2. The **angular-product** application config (keycloak.json) points the auth-server at **http://localhost-auth:8080/auth**\n-3. The **database-service** config (keycloak.json) has an additional flag set **enable-cors**\n-\n-Step 1: Edit your hosts file\n---------------------------------------\n-The demo expects additional host mappings for localhost. So, you need to edit your machine's host file (/etc/hosts or\n-C:\\Windows\\System32\\drivers\\etc\\hosts) and add the following entries:\n-\n-\n-```\n-127.0.0.1 localhost-auth\n-127.0.0.1 localhost-db\n-```\n-\n-\n-Step 2: Make sure you've set up the Keycloak Server and have it running\n---------------------------------------\n-You will run this demo on the same server as the keycloak server. Its best to use the appliance as everything is all set up.\n-See documentation on how to set this up.\n-\n-Step 3: Import the Test Realm\n----------------------------------------\n-Next thing you have to do is import the test realm for the demo. Clicking on the below link will bring you to the\n-create realm page in the Admin UI. The username/password is admin/admin to login in. Keycloak will ask you to\n-create a new admin password before you can go to the create realm page.\n-\n-[http://localhost-auth:8080/auth/admin/index.html#/create/realm](http://localhost-auth:8080/auth/admin/index.html#/create/realm)\n-\n-Import the cors-realm.json file that is in the cors/ example directory. Feel free to browse the setup of the realm,\n-particularly the angular-product application.\n-\n-\n-Step 4: Build and deploy\n----------------------------------------\n-next you must build and deploy\n-\n-```\n-cd cors\n-mvn clean install wildfly:deploy\n-```\n-\n-Step 5: Login and Observe Apps\n----------------------------------------\n-Try going to the customer app and view customer data:\n-\n-[http://localhost:8080/angular-cors-product/index.html](http://localhost:8080/angular-cors-product/index.html)\n-\n-This should take you to the auth-server login screen. Enter username: [email protected] and password: password. You\n-should be brought back to a simple and boring HTML page. Click the Reload button to show the product listing. Reload\n-causes an HTTP request to a different domain, this will trigger the browser's CORS protocol.\n-\n-\n-\n-\n-\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/test-apps/cors/database-service/src/main/webapp/WEB-INF/keycloak.json",
"new_path": "testsuite/integration-arquillian/test-apps/cors/database-service/src/main/webapp/WEB-INF/keycloak.json",
"diff": "\"realm\" : \"cors\",\n\"resource\" : \"cors-database-service\",\n\"realm-public-key\" : \"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB\",\n- \"auth-server-url\": \"http://localhost-auth:8180/auth\",\n+ \"auth-server-url\": \"http://localhost-auth-127.0.0.1.nip.io:8180/auth\",\n\"bearer-only\" : true,\n\"ssl-required\": \"external\",\n\"disable-trust-manager\" : \"true\",\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/pom.xml",
"new_path": "testsuite/integration-arquillian/tests/base/pom.xml",
"diff": "<exclude.x509>**/x509/*Test.java</exclude.x509>\n<!-- KEYCLOAK-6771 exclude Mutual TLS Holder of Key Token x509 tests by default, enabled by 'ssl' profile -->\n<exclude.HoK>**/hok/**/*Test.java</exclude.HoK>\n- <!-- see include-CORS-tests profile -->\n- <exclude.cors.tests>**/cors/*Test.java</exclude.cors.tests>\n</properties>\n<dependencies>\n<exclude>${exclude.cluster}</exclude>\n<exclude>${exclude.crossdc}</exclude>\n<exclude>${exclude.x509}</exclude>\n- <exclude>${exclude.cors.tests}</exclude>\n<exclude>${exclude.HoK}</exclude>\n</excludes>\n<systemPropertyVariables>\n<surefire.memory.settings>-Xms512m -Xmx1024m -XX:MetaspaceSize=96m -XX:MaxMetaspaceSize=256m</surefire.memory.settings>\n</properties>\n</profile>\n- <profile>\n- <id>include-CORS-tests</id>\n- <!--\n- If you want to run CORS tests it is necessary to put\n-\n- 127.0.0.1 localhost-auth\n- 127.0.0.1 localhost-db\n-\n- to your /etc/hosts file\n- -->\n- <activation>\n- <property>\n- <name>includeCorsTests</name>\n- </property>\n- </activation>\n- <properties>\n- <exclude.cors.tests>-</exclude.cors.tests>\n- </properties>\n- </profile>\n</profiles>\n</project>\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/cors/CorsExampleAdapterTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/cors/CorsExampleAdapterTest.java",
"diff": "@@ -49,13 +49,14 @@ import java.util.regex.Pattern;\nimport static junit.framework.TestCase.assertNotNull;\nimport org.junit.Assume;\n+import org.keycloak.testsuite.util.DroneUtils;\nimport static org.keycloak.testsuite.utils.io.IOUtil.loadRealm;\nimport static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;\nimport static org.keycloak.testsuite.util.WaitUtils.waitForPageToLoad;\nimport static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;\n/**\n- * Tests CORS fuctionality in adapters.\n+ * Tests CORS functionality in adapters.\n*\n* <p>\n* Note, for SSL this test disables TLS certificate verification. Since CORS uses different hostnames\n@@ -72,7 +73,7 @@ import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;\npublic class CorsExampleAdapterTest extends AbstractExampleAdapterTest {\npublic static final String CORS = \"cors\";\n- public static final String AUTH_SERVER_HOST = \"localhost-auth\";\n+ public static final String AUTH_SERVER_HOST = \"localhost-auth-127.0.0.1.nip.io\";\nprivate static final String hostBackup;\n@ArquillianResource\n@@ -113,6 +114,7 @@ public class CorsExampleAdapterTest extends AbstractExampleAdapterTest {\n@Before\npublic void onBefore() {\n+ DroneUtils.addWebDriver(jsDriver);\nAssume.assumeFalse(System.getProperty(\"os.name\").startsWith(\"Windows\"));\ndeployer.deploy(CorsDatabaseServiceTestApp.DEPLOYMENT_NAME);\ndeployer.deploy(AngularCorsProductTestApp.DEPLOYMENT_NAME);\n@@ -182,14 +184,14 @@ public class CorsExampleAdapterTest extends AbstractExampleAdapterTest {\n@Nullable\nprivate String getAuthServerVersion() {\n- jsDriver.navigate().to(suiteContext.getAuthServerInfo().getContextRoot().toString() +\n+ DroneUtils.getCurrentDriver().navigate().to(suiteContext.getAuthServerInfo().getContextRoot().toString() +\n\"/auth/admin/master/console/#/server-info\");\njsDriverTestRealmLoginPage.form().login(\"admin\", \"admin\");\nWaitUtils.waitUntilElement(By.tagName(\"body\")).is().visible();\nPattern pattern = Pattern.compile(\"<td [^>]+>Server Version</td>\" +\n\"\\\\s+<td [^>]+>([^<]+)</td>\");\n- Matcher matcher = pattern.matcher(jsDriver.getPageSource());\n+ Matcher matcher = pattern.matcher(DroneUtils.getCurrentDriver().getPageSource());\nif (matcher.find()) {\nreturn matcher.group(1);\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/other/adapters/pom.xml",
"new_path": "testsuite/integration-arquillian/tests/other/adapters/pom.xml",
"diff": "<adapter.config.bundled>true</adapter.config.bundled>\n<examples.basedir>${keycloak-parent.basedir}/examples</examples.basedir>\n<exclude.test>-</exclude.test>\n- <exclude.cors.tests>**/cors/*Test.java</exclude.cors.tests>\n</properties>\n<modules>\n</pluginManagement>\n</build>\n</profile>\n- <profile>\n- <id>Include CORS tests</id>\n- <!--\n- If you want to run CORS tests it is necessary to put\n-\n- 127.0.0.1 localhost-auth\n- 127.0.0.1 localhost-db\n-\n- to your /etc/hosts file\n- -->\n- <activation>\n- <property>\n- <name>includeCorsTests</name>\n- </property>\n- </activation>\n- <properties>\n- <exclude.cors.tests>-</exclude.cors.tests>\n- </properties>\n- </profile>\n</profiles>\n</project>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8699 replace hostnames with nip.io ones to include cors tests by default |
339,582 | 05.03.2019 11:15:57 | -3,600 | c2d5bbc662f5d5a85df02c4b15f46ad2b55f099f | adding springboot tests app to parent pom | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/test-apps/pom.xml",
"new_path": "testsuite/integration-arquillian/test-apps/pom.xml",
"diff": "<module>app-profile-jee</module>\n<module>cors</module>\n<module>fuse</module>\n+ <module>spring-boot-adapter</module>\n+ <module>spring-boot-2-adapter</module>\n+ <module>spring-boot-21-adapter</module>\n</modules>\n<properties>\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/test-apps/spring-boot-2-adapter/pom.xml",
"new_path": "testsuite/integration-arquillian/test-apps/spring-boot-2-adapter/pom.xml",
"diff": "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\nxsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n<modelVersion>4.0.0</modelVersion>\n-\n- <groupId>org.keycloak</groupId>\n- <artifactId>spring-boot-2-adapter</artifactId>\n- <version>0.0.1-SNAPSHOT</version>\n- <packaging>jar</packaging>\n-\n- <name>spring-boot-adapter</name>\n+ <artifactId>spring-boot-2-adapter-2</artifactId>\n+ <name>spring-boot-adapter-2</name>\n<description>Spring boot adapter test application</description>\n<parent>\n- <groupId>org.springframework.boot</groupId>\n- <artifactId>spring-boot-starter-parent</artifactId>\n- <version>2.0.0.RELEASE</version>\n- <relativePath/> <!-- lookup parent from repository -->\n+ <artifactId>integration-arquillian-test-apps</artifactId>\n+ <groupId>org.keycloak.testsuite</groupId>\n+ <version>5.0.0-SNAPSHOT</version>\n</parent>\n<properties>\n<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>\n<java.version>1.8</java.version>\n-\n- <keycloak.version>4.0.0.Beta2-SNAPSHOT</keycloak.version>\n-\n- <repo.url />\n-\n-\n- <jetty.adapter.version />\n+ <springboot-version>2.0.0.RELEASE</springboot-version>\n</properties>\n-\n+ <dependencyManagement>\n+ <dependencies>\n+ <dependency>\n+ <groupId>org.springframework.boot</groupId>\n+ <artifactId>spring-boot-starter-parent</artifactId>\n+ <version>${springboot-version}</version>\n+ <type>pom</type>\n+ <scope>import</scope>\n+ </dependency>\n+ </dependencies>\n+ </dependencyManagement>\n<dependencies>\n<dependency>\n<dependency>\n<groupId>org.keycloak</groupId>\n<artifactId>keycloak-spring-boot-2-adapter</artifactId>\n- <version>${keycloak.version}</version>\n</dependency>\n</dependencies>\n<dependency>\n<groupId>org.keycloak</groupId>\n<artifactId>keycloak-tomcat8-adapter</artifactId>\n- <version>${keycloak.version}</version>\n</dependency>\n</dependencies>\n</profile>\n<groupId>org.springframework.boot</groupId>\n<artifactId>spring-boot-starter-undertow</artifactId>\n</dependency>\n-\n<dependency>\n<groupId>org.keycloak</groupId>\n<artifactId>keycloak-undertow-adapter</artifactId>\n- <version>${keycloak.version}</version>\n</dependency>\n</dependencies>\n</profile>\n<dependency>\n<groupId>org.keycloak</groupId>\n<artifactId>keycloak-jetty94-adapter</artifactId>\n- <version>${keycloak.version}</version>\n</dependency>\n<dependency>\n<groupId>org.springframework.boot</groupId>\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/test-apps/spring-boot-21-adapter/pom.xml",
"new_path": "testsuite/integration-arquillian/test-apps/spring-boot-21-adapter/pom.xml",
"diff": "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\nxsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n<modelVersion>4.0.0</modelVersion>\n-\n- <groupId>org.keycloak</groupId>\n<artifactId>spring-boot-21-adapter</artifactId>\n- <version>0.0.1-SNAPSHOT</version>\n- <packaging>jar</packaging>\n-\n- <name>spring-boot-adapter</name>\n+ <name>spring-boot-adapter-21</name>\n<description>Spring boot adapter test application</description>\n<parent>\n- <groupId>org.springframework.boot</groupId>\n- <artifactId>spring-boot-starter-parent</artifactId>\n- <version>2.1.0.RELEASE</version>\n- <relativePath/> <!-- lookup parent from repository -->\n+ <artifactId>integration-arquillian-test-apps</artifactId>\n+ <groupId>org.keycloak.testsuite</groupId>\n+ <version>5.0.0-SNAPSHOT</version>\n</parent>\n<properties>\n<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>\n<java.version>1.8</java.version>\n-\n- <keycloak.version>4.0.0.Beta2-SNAPSHOT</keycloak.version>\n-\n- <repo.url />\n-\n-\n- <jetty.adapter.version />\n+ <springboot-version>2.1.3.RELEASE</springboot-version>\n</properties>\n+ <dependencyManagement>\n+ <dependencies>\n+ <dependency>\n+ <groupId>org.springframework.boot</groupId>\n+ <artifactId>spring-boot-starter-parent</artifactId>\n+ <version>${springboot-version}</version>\n+ <type>pom</type>\n+ <scope>import</scope>\n+ </dependency>\n+ </dependencies>\n+ </dependencyManagement>\n+\n<dependencies>\n<dependency>\n<dependency>\n<groupId>org.keycloak</groupId>\n<artifactId>keycloak-spring-boot-2-adapter</artifactId>\n- <version>${keycloak.version}</version>\n</dependency>\n</dependencies>\n<dependency>\n<groupId>org.keycloak</groupId>\n<artifactId>keycloak-tomcat8-adapter</artifactId>\n- <version>${keycloak.version}</version>\n</dependency>\n</dependencies>\n</profile>\n<dependency>\n<groupId>org.keycloak</groupId>\n<artifactId>keycloak-undertow-adapter</artifactId>\n- <version>${keycloak.version}</version>\n</dependency>\n</dependencies>\n</profile>\n<dependency>\n<groupId>org.keycloak</groupId>\n<artifactId>keycloak-jetty94-adapter</artifactId>\n- <version>${keycloak.version}</version>\n</dependency>\n<dependency>\n<groupId>org.springframework.boot</groupId>\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/test-apps/spring-boot-adapter/pom.xml",
"new_path": "testsuite/integration-arquillian/test-apps/spring-boot-adapter/pom.xml",
"diff": "xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n<modelVersion>4.0.0</modelVersion>\n- <groupId>org.keycloak</groupId>\n<artifactId>spring-boot-adapter</artifactId>\n- <version>0.0.1-SNAPSHOT</version>\n- <packaging>jar</packaging>\n<name>spring-boot-adapter</name>\n<description>Spring boot adapter test application</description>\n<parent>\n- <groupId>org.springframework.boot</groupId>\n- <artifactId>spring-boot-starter-parent</artifactId>\n- <version>1.5.9.RELEASE</version>\n- <relativePath/> <!-- lookup parent from repository -->\n+ <artifactId>integration-arquillian-test-apps</artifactId>\n+ <groupId>org.keycloak.testsuite</groupId>\n+ <version>5.0.0-SNAPSHOT</version>\n</parent>\n<properties>\n<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>\n<java.version>1.8</java.version>\n-\n- <keycloak.version>4.0.0.Beta2-SNAPSHOT</keycloak.version>\n-\n- <repo.url />\n-\n- <jetty.version />\n- <jetty.adapter.version />\n+ <springboot-version>1.5.19.RELEASE</springboot-version>\n</properties>\n-\n+ <dependencyManagement>\n+ <dependencies>\n+ <dependency>\n+ <groupId>org.springframework.boot</groupId>\n+ <artifactId>spring-boot-starter-parent</artifactId>\n+ <version>${springboot-version}</version>\n+ <type>pom</type>\n+ <scope>import</scope>\n+ </dependency>\n+ </dependencies>\n+ </dependencyManagement>\n<dependencies>\n<dependency>\n<dependency>\n<groupId>org.keycloak</groupId>\n<artifactId>keycloak-spring-boot-adapter</artifactId>\n- <version>${keycloak.version}</version>\n</dependency>\n</dependencies>\n<dependency>\n<groupId>org.keycloak</groupId>\n<artifactId>keycloak-tomcat8-adapter</artifactId>\n- <version>${keycloak.version}</version>\n</dependency>\n</dependencies>\n</profile>\n<dependency>\n<groupId>org.keycloak</groupId>\n<artifactId>keycloak-undertow-adapter</artifactId>\n- <version>${keycloak.version}</version>\n</dependency>\n</dependencies>\n</profile>\n<dependency>\n<groupId>org.keycloak</groupId>\n<artifactId>keycloak-jetty81-adapter</artifactId>\n- <version>${keycloak.version}</version>\n</dependency>\n<dependency>\n<groupId>org.springframework.boot</groupId>\n<dependency>\n<groupId>org.keycloak</groupId>\n<artifactId>keycloak-jetty93-adapter</artifactId>\n- <version>${keycloak.version}</version>\n</dependency>\n<dependency>\n<groupId>org.springframework.boot</groupId>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-6979 : adding springboot tests app to parent pom |
339,414 | 05.03.2019 15:58:26 | -3,600 | 4cde8d8534107704fd99856aef9688137c24d680 | Compilation error in PNC for Keycloak 5.x | [
{
"change_type": "MODIFY",
"old_path": "prod-arguments.json",
"new_path": "prod-arguments.json",
"diff": "\"dependencyExclusion.org.jboss.web:jbossweb@*\": \"$EAP6SUPPORTED_ORG_JBOSS_WEB_JBOSSWEB\",\n\"dependencyOverride.com.google.guava:[email protected]:integration-arquillian\": \"\",\n\"dependencyOverride.org.apache.httpcomponents:[email protected]:integration-arquillian-tests\": \"\",\n+ \"dependencyOverride.org.apache.httpcomponents:httpcore@*\": \"4.4.5.redhat-1\",\n+ \"dependencyOverride.org.apache.httpcomponents:httpclient@*\": \"4.5.4.redhat-00001\",\n\"dependencyOverride.org.jboss.logging:jboss-logging-processor@*\": \"\"\n}\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9686 - Compilation error in PNC for Keycloak 5.x |
339,235 | 06.03.2019 11:33:57 | -3,600 | 7ad02e73186a751b27d8e74211868c77b0b7e754 | Fixes for releasing | [
{
"change_type": "MODIFY",
"old_path": "dependencies/drools-bom/pom.xml",
"new_path": "dependencies/drools-bom/pom.xml",
"diff": "xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n<parent>\n<groupId>org.keycloak</groupId>\n- <artifactId>keycloak-parent</artifactId>\n+ <artifactId>keycloak-dependencies-parent</artifactId>\n<version>5.0.0-SNAPSHOT</version>\n- <relativePath>../../pom.xml</relativePath>\n</parent>\n<modelVersion>4.0.0</modelVersion>\n"
},
{
"change_type": "MODIFY",
"old_path": "dependencies/pom.xml",
"new_path": "dependencies/pom.xml",
"diff": "<module>server-min</module>\n<module>server-all</module>\n</modules>\n-\n- <build>\n- <plugins>\n- <plugin>\n- <groupId>org.apache.maven.plugins</groupId>\n- <artifactId>maven-deploy-plugin</artifactId>\n- <configuration>\n- <skip>true</skip>\n- </configuration>\n- </plugin>\n- </plugins>\n- </build>\n</project>\n"
},
{
"change_type": "MODIFY",
"old_path": "dependencies/server-all/pom.xml",
"new_path": "dependencies/server-all/pom.xml",
"diff": "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\nxsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n<parent>\n- <artifactId>keycloak-parent</artifactId>\n+ <artifactId>keycloak-dependencies-parent</artifactId>\n<groupId>org.keycloak</groupId>\n<version>5.0.0-SNAPSHOT</version>\n- <relativePath>../../pom.xml</relativePath>\n</parent>\n<modelVersion>4.0.0</modelVersion>\n"
},
{
"change_type": "MODIFY",
"old_path": "dependencies/server-min/pom.xml",
"new_path": "dependencies/server-min/pom.xml",
"diff": "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\nxsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n<parent>\n- <artifactId>keycloak-parent</artifactId>\n+ <artifactId>keycloak-dependencies-parent</artifactId>\n<groupId>org.keycloak</groupId>\n<version>5.0.0-SNAPSHOT</version>\n- <relativePath>../../pom.xml</relativePath>\n</parent>\n<modelVersion>4.0.0</modelVersion>\n"
},
{
"change_type": "MODIFY",
"old_path": "distribution/pom.xml",
"new_path": "distribution/pom.xml",
"diff": "<profiles>\n<profile>\n- <id>jboss-release</id>\n+ <id>distribution-downloads</id>\n<modules>\n<module>api-docs-dist</module>\n<module>examples-dist</module>\n"
},
{
"change_type": "MODIFY",
"old_path": "examples/demo-template/pom.xml",
"new_path": "examples/demo-template/pom.xml",
"diff": "<artifactId>keycloak-examples-demo-parent</artifactId>\n<packaging>pom</packaging>\n- <build>\n- <plugins>\n- <plugin>\n- <groupId>org.apache.maven.plugins</groupId>\n- <artifactId>maven-deploy-plugin</artifactId>\n- <configuration>\n- <skip>true</skip>\n- </configuration>\n- </plugin>\n- </plugins>\n- </build>\n<modules>\n<!-- <module>server</module> -->\n<module>customer-app</module>\n"
},
{
"change_type": "MODIFY",
"old_path": "examples/saml/pom.xml",
"new_path": "examples/saml/pom.xml",
"diff": "<artifactId>keycloak-examples-saml-parent</artifactId>\n<packaging>pom</packaging>\n- <build>\n- <plugins>\n- <plugin>\n- <groupId>org.apache.maven.plugins</groupId>\n- <artifactId>maven-deploy-plugin</artifactId>\n- <configuration>\n- <skip>true</skip>\n- </configuration>\n- </plugin>\n- </plugins>\n- </build>\n<modules>\n<module>post-with-signature</module>\n<module>post-with-encryption</module>\n"
},
{
"change_type": "MODIFY",
"old_path": "model/infinispan/pom.xml",
"new_path": "model/infinispan/pom.xml",
"diff": "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\nxsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n<parent>\n- <artifactId>keycloak-parent</artifactId>\n+ <artifactId>keycloak-model-pom</artifactId>\n<groupId>org.keycloak</groupId>\n<version>5.0.0-SNAPSHOT</version>\n- <relativePath>../../pom.xml</relativePath>\n</parent>\n<modelVersion>4.0.0</modelVersion>\n"
},
{
"change_type": "MODIFY",
"old_path": "model/jpa/pom.xml",
"new_path": "model/jpa/pom.xml",
"diff": "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\nxsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n<parent>\n- <artifactId>keycloak-parent</artifactId>\n+ <artifactId>keycloak-model-pom</artifactId>\n<groupId>org.keycloak</groupId>\n<version>5.0.0-SNAPSHOT</version>\n- <relativePath>../../pom.xml</relativePath>\n</parent>\n<modelVersion>4.0.0</modelVersion>\n"
},
{
"change_type": "MODIFY",
"old_path": "model/pom.xml",
"new_path": "model/pom.xml",
"diff": "<artifactId>keycloak-model-pom</artifactId>\n<packaging>pom</packaging>\n- <build>\n- <plugins>\n- <plugin>\n- <groupId>org.apache.maven.plugins</groupId>\n- <artifactId>maven-deploy-plugin</artifactId>\n- <configuration>\n- <skip>true</skip>\n- </configuration>\n- </plugin>\n- </plugins>\n- </build>\n<modules>\n<module>jpa</module>\n<module>infinispan</module>\n"
},
{
"change_type": "MODIFY",
"old_path": "pom.xml",
"new_path": "pom.xml",
"diff": "<module>integration</module>\n<module>adapters</module>\n<module>authz</module>\n- <module>examples</module>\n<module>misc</module>\n</modules>\n</modules>\n</profile>\n+ <profile>\n+ <id>examples</id>\n+ <activation>\n+ <property>\n+ <name>!skipExamples</name>\n+ </property>\n+ </activation>\n+ </profile>\n+\n<profile>\n<id>distribution</id>\n<modules>\n"
},
{
"change_type": "MODIFY",
"old_path": "release.sh",
"new_path": "release.sh",
"diff": "#!/bin/bash -e\nDIR=\"$PWD\"\n-VERSION=`./get-version.sh`\n+source release-details\n+\necho \"Version: $VERSION\"\necho \"------------------------------------------------------------------------------------------------------------\"\necho \"Building:\"\necho \"\"\n-mvn -Pjboss-release -DskipTests clean install\n+mvn -Pjboss-release,distribution-downloads -DskipTests -DskipTestsuite clean install\necho \"------------------------------------------------------------------------------------------------------------\"\necho \"Deploying:\"\necho \"\"\n-mvn -Pjboss-release -DretryFailedDeploymentCount=10 -DskipTests -DstagingDescription=\"Keycloak $VERSION release\" deploy\n-\n-mvn nexus-staging:release -DstagingDescription=\"Keycloak $VERSION release\"\n+mvn -Pjboss-release,nexus-staging -DretryFailedDeploymentCount=10 -DskipTests -DskipTestsuite -DskipExamples -DautoReleaseAfterClose=true deploy\necho \"------------------------------------------------------------------------------------------------------------\"\n@@ -33,7 +32,7 @@ echo \"\"\nTMP=`mktemp -d`\ncd $TMP\n-unzip $DIR/keycloak/distribution/adapters/js-adapter-npm-zip/target/keycloak-js-adapter-npm-dist-$VERSION.zip\n+unzip $DIR/distribution/adapters/js-adapter-npm-zip/target/keycloak-js-adapter-npm-dist-$VERSION.zip\ncd keycloak-js-adapter-npm-dist-$VERSION\nnpm publish\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | Fixes for releasing |
339,390 | 05.03.2018 08:43:22 | -36,000 | be77fd9459a7e29ddd0848ad6f4e9c984f2ea32f | Adding impersonator details to user session notes and supporting built-in protocol mappers. | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "server-spi-private/src/main/java/org/keycloak/models/ImpersonationSessionNote.java",
"diff": "+package org.keycloak.models;\n+\n+/**\n+ * Session note metadata for impersonation details stored in user session notes.\n+ */\n+public enum ImpersonationSessionNote implements UserSessionNoteDescriptor {\n+ IMPERSONATOR_ID(\"Impersonator User ID\"),\n+ IMPERSONATOR_USERNAME(\"Impersonator Username\");\n+\n+ final String displayName;\n+\n+ ImpersonationSessionNote(String displayName) {\n+ this.displayName = displayName;\n+ }\n+\n+ public String getDisplayName() {\n+ return displayName;\n+ }\n+\n+ public String getTokenClaim() {\n+ return this.toString().toLowerCase().replace('_', '.');\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server-spi-private/src/main/java/org/keycloak/models/UserSessionNoteDescriptor.java",
"diff": "+package org.keycloak.models;\n+\n+/**\n+ * Describes a user session note for simple and generic {@link ProtocolMapperModel} creation.\n+ */\n+public interface UserSessionNoteDescriptor {\n+ /**\n+ * @return A human-readable name for the session note. This should tell the end user what the session note contains\n+ */\n+ String getDisplayName();\n+\n+ /**\n+ * @return Token claim name/path to store the user session note value in.\n+ */\n+ String getTokenClaim();\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/protocol/oidc/OIDCLoginProtocolFactory.java",
"new_path": "services/src/main/java/org/keycloak/protocol/oidc/OIDCLoginProtocolFactory.java",
"diff": "@@ -50,6 +50,9 @@ import java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n+import static org.keycloak.models.ImpersonationSessionNote.IMPERSONATOR_ID;\n+import static org.keycloak.models.ImpersonationSessionNote.IMPERSONATOR_USERNAME;\n+\n/**\n* @author <a href=\"mailto:[email protected]\">Bill Burke</a>\n* @version $Revision: 1 $\n@@ -173,6 +176,9 @@ public class OIDCLoginProtocolFactory extends AbstractLoginProtocolFactory {\nmodel = AllowedWebOriginsProtocolMapper.createClaimMapper(ALLOWED_WEB_ORIGINS);\nbuiltins.put(ALLOWED_WEB_ORIGINS, model);\n+\n+ builtins.put(IMPERSONATOR_ID.getDisplayName(), UserSessionNoteMapper.createUserSessionNoteMapper(IMPERSONATOR_ID));\n+ builtins.put(IMPERSONATOR_USERNAME.getDisplayName(), UserSessionNoteMapper.createUserSessionNoteMapper(IMPERSONATOR_USERNAME));\n}\nprivate static void createUserAttributeMapper(String name, String attrName, String claimName, String type) {\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/protocol/oidc/endpoints/TokenEndpoint.java",
"new_path": "services/src/main/java/org/keycloak/protocol/oidc/endpoints/TokenEndpoint.java",
"diff": "@@ -29,8 +29,8 @@ import org.keycloak.authorization.authorization.AuthorizationTokenService;\nimport org.keycloak.authorization.util.Tokens;\nimport org.keycloak.broker.provider.BrokeredIdentityContext;\nimport org.keycloak.broker.provider.ExchangeExternalToken;\n-import org.keycloak.broker.provider.IdentityProvider;\nimport org.keycloak.broker.provider.ExchangeTokenToIdentityProviderToken;\n+import org.keycloak.broker.provider.IdentityProvider;\nimport org.keycloak.broker.provider.IdentityProviderFactory;\nimport org.keycloak.broker.provider.IdentityProviderMapper;\nimport org.keycloak.common.ClientConnection;\n@@ -45,8 +45,8 @@ import org.keycloak.events.EventBuilder;\nimport org.keycloak.events.EventType;\nimport org.keycloak.jose.jws.JWSInput;\nimport org.keycloak.jose.jws.JWSInputException;\n-import org.keycloak.models.AuthenticationFlowModel;\nimport org.keycloak.models.AuthenticatedClientSessionModel;\n+import org.keycloak.models.AuthenticationFlowModel;\nimport org.keycloak.models.ClientModel;\nimport org.keycloak.models.ClientScopeModel;\nimport org.keycloak.models.ClientSessionContext;\n@@ -99,6 +99,7 @@ import javax.ws.rs.core.MediaType;\nimport javax.ws.rs.core.MultivaluedMap;\nimport javax.ws.rs.core.Response;\nimport javax.ws.rs.core.Response.Status;\n+import java.security.MessageDigest;\nimport java.util.List;\nimport java.util.Map;\n@@ -106,7 +107,9 @@ import java.util.Objects;\nimport java.util.Set;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n-import java.security.MessageDigest;\n+\n+import static org.keycloak.models.ImpersonationSessionNote.IMPERSONATOR_ID;\n+import static org.keycloak.models.ImpersonationSessionNote.IMPERSONATOR_USERNAME;\n/**\n* @author <a href=\"mailto:[email protected]\">Stian Thorgersen</a>\n@@ -755,12 +758,16 @@ public class TokenEndpoint {\n}\n}\n- tokenUser = requestedUser;\ntokenSession = session.sessions().createUserSession(realm, requestedUser, requestedUser.getUsername(), clientConnection.getRemoteAddr(), \"impersonate\", false, null, null);\n+ if (tokenUser != null) {\n+ tokenSession.setNote(IMPERSONATOR_ID.toString(), tokenUser.getId());\n+ tokenSession.setNote(IMPERSONATOR_USERNAME.toString(), tokenUser.getUsername());\n}\n- String requestedIssuer = formParams.getFirst(OAuth2Constants.REQUESTED_ISSUER);\n+ tokenUser = requestedUser;\n+ }\n+ String requestedIssuer = formParams.getFirst(OAuth2Constants.REQUESTED_ISSUER);\nif (requestedIssuer == null) {\nreturn exchangeClientToClient(tokenUser, tokenSession);\n} else {\n@@ -825,7 +832,6 @@ public class TokenEndpoint {\n}\n}\n-\nif (targetClient.isConsentRequired()) {\nevent.detail(Details.REASON, \"audience requires consent\");\nevent.error(Errors.CONSENT_DENIED);\n@@ -924,8 +930,6 @@ public class TokenEndpoint {\nuserSession.setNote(IdentityProvider.FEDERATED_ACCESS_TOKEN, subjectToken);\nreturn exchangeClientToClient(user, userSession);\n-\n-\n}\nprotected UserModel importUserFromExternalIdentity(BrokeredIdentityContext context) {\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/protocol/oidc/mappers/UserSessionNoteMapper.java",
"new_path": "services/src/main/java/org/keycloak/protocol/oidc/mappers/UserSessionNoteMapper.java",
"diff": "@@ -19,6 +19,7 @@ package org.keycloak.protocol.oidc.mappers;\nimport org.keycloak.models.ProtocolMapperModel;\nimport org.keycloak.models.UserSessionModel;\n+import org.keycloak.models.UserSessionNoteDescriptor;\nimport org.keycloak.protocol.ProtocolMapperUtils;\nimport org.keycloak.protocol.oidc.OIDCLoginProtocol;\nimport org.keycloak.provider.ProviderConfigProperty;\n@@ -101,4 +102,20 @@ public class UserSessionNoteMapper extends AbstractOIDCProtocolMapper implements\nmapper.setConfig(config);\nreturn mapper;\n}\n+\n+ /**\n+ * For session notes defined using a {@link UserSessionNoteDescriptor} enum\n+ *\n+ * @param userSessionNoteDescriptor User session note descriptor for which to create a protocol mapper model.\n+ */\n+ public static ProtocolMapperModel createUserSessionNoteMapper(UserSessionNoteDescriptor userSessionNoteDescriptor) {\n+ return UserSessionNoteMapper.createClaimMapper(\n+ userSessionNoteDescriptor.getDisplayName(),\n+ userSessionNoteDescriptor.toString(),\n+ userSessionNoteDescriptor.getTokenClaim(),\n+ \"String\",\n+ true, true\n+ );\n+ }\n+\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/services/resources/admin/UserResource.java",
"new_path": "services/src/main/java/org/keycloak/services/resources/admin/UserResource.java",
"diff": "@@ -40,6 +40,7 @@ import org.keycloak.models.Constants;\nimport org.keycloak.models.FederatedIdentityModel;\nimport org.keycloak.models.GroupModel;\nimport org.keycloak.models.IdentityProviderModel;\n+import org.keycloak.models.ImpersonationSessionNote;\nimport org.keycloak.models.KeycloakSession;\nimport org.keycloak.models.ModelDuplicateException;\nimport org.keycloak.models.ModelException;\n@@ -105,6 +106,9 @@ import java.util.Properties;\nimport java.util.Set;\nimport java.util.concurrent.TimeUnit;\n+import static org.keycloak.models.ImpersonationSessionNote.IMPERSONATOR_ID;\n+import static org.keycloak.models.ImpersonationSessionNote.IMPERSONATOR_USERNAME;\n+\n/**\n* Base resource for managing users\n*\n@@ -281,6 +285,13 @@ public class UserResource {\nEventBuilder event = new EventBuilder(realm, session, clientConnection);\nUserSessionModel userSession = session.sessions().createUserSession(realm, user, user.getUsername(), clientConnection.getRemoteAddr(), \"impersonate\", false, null, null);\n+\n+ UserModel adminUser = auth.adminAuth().getUser();\n+ String impersonatorId = adminUser.getId();\n+ String impersonator = adminUser.getUsername();\n+ userSession.setNote(IMPERSONATOR_ID.toString(), impersonatorId);\n+ userSession.setNote(IMPERSONATOR_USERNAME.toString(), impersonator);\n+\nAuthenticationManager.createLoginCookie(session, realm, userSession.getUser(), userSession, session.getContext().getUri(), clientConnection);\nURI redirect = AccountFormService.accountServiceApplicationPage(session.getContext().getUri()).build(realm.getName());\nMap<String, Object> result = new HashMap<>();\n@@ -290,7 +301,7 @@ public class UserResource {\n.session(userSession)\n.user(user)\n.detail(Details.IMPERSONATOR_REALM, authenticatedRealm.getName())\n- .detail(Details.IMPERSONATOR, auth.adminAuth().getUser().getUsername()).success();\n+ .detail(Details.IMPERSONATOR, impersonator).success();\nreturn result;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/ImpersonationTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/ImpersonationTest.java",
"diff": "package org.keycloak.testsuite.admin;\n+import org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.graphene.page.Page;\nimport org.jboss.resteasy.client.jaxrs.ResteasyClient;\nimport org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;\n+import org.jboss.shrinkwrap.api.spec.WebArchive;\nimport org.junit.Assert;\n+import org.junit.Assume;\nimport org.junit.Before;\n+import org.junit.BeforeClass;\nimport org.junit.Rule;\nimport org.junit.Test;\nimport org.keycloak.Config;\n@@ -35,6 +39,10 @@ import org.keycloak.events.EventType;\nimport org.keycloak.models.AdminRoles;\nimport org.keycloak.models.Constants;\nimport org.keycloak.models.ImpersonationConstants;\n+import org.keycloak.models.ImpersonationSessionNote;\n+import org.keycloak.models.RealmModel;\n+import org.keycloak.models.UserModel;\n+import org.keycloak.models.UserSessionModel;\nimport org.keycloak.models.utils.KeycloakModelUtils;\nimport org.keycloak.representations.idm.EventRepresentation;\nimport org.keycloak.representations.idm.RealmRepresentation;\n@@ -46,24 +54,24 @@ import org.keycloak.testsuite.arquillian.AuthServerTestEnricher;\nimport org.keycloak.testsuite.auth.page.AuthRealm;\nimport org.keycloak.testsuite.pages.AppPage;\nimport org.keycloak.testsuite.pages.LoginPage;\n+import org.keycloak.testsuite.runonserver.RunOnServerDeployment;\nimport org.keycloak.testsuite.util.AdminClientUtil;\nimport org.keycloak.testsuite.util.ClientBuilder;\nimport org.keycloak.testsuite.util.CredentialBuilder;\nimport org.keycloak.testsuite.util.OAuthClient;\nimport org.keycloak.testsuite.util.RealmBuilder;\nimport org.keycloak.testsuite.util.UserBuilder;\n+import org.openqa.selenium.Cookie;\nimport javax.ws.rs.ClientErrorException;\nimport javax.ws.rs.client.Client;\nimport javax.ws.rs.core.HttpHeaders;\nimport javax.ws.rs.core.NewCookie;\nimport javax.ws.rs.core.Response;\n+import java.util.HashMap;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\n-import org.junit.Assume;\n-import org.junit.BeforeClass;\n-import org.openqa.selenium.Cookie;\nimport static org.hamcrest.Matchers.containsString;\n@@ -74,6 +82,25 @@ import static org.hamcrest.Matchers.containsString;\n*/\npublic class ImpersonationTest extends AbstractKeycloakTest {\n+ static class UserSessionNotesHolder {\n+ private Map<String, String> notes = new HashMap<>();\n+\n+ public UserSessionNotesHolder() {\n+ }\n+\n+ public UserSessionNotesHolder(final Map<String, String> notes) {\n+ this.notes = notes;\n+ }\n+\n+ public void setNotes(final Map<String, String> notes) {\n+ this.notes = notes;\n+ }\n+\n+ public Map<String, String> getNotes() {\n+ return notes;\n+ }\n+ }\n+\n@Rule\npublic AssertEvents events = new AssertEvents(this);\n@@ -85,6 +112,12 @@ public class ImpersonationTest extends AbstractKeycloakTest {\nprivate String impersonatedUserId;\n+ @Deployment\n+ public static WebArchive deploy() {\n+ return RunOnServerDeployment.create(ImpersonationTest.class, AbstractKeycloakTest.class, UserResource.class)\n+ .addPackages(true, \"org.keycloak.testsuite\", \"org.keycloak.admin.client\", \"org.openqa.selenium\");\n+ }\n+\n@Override\npublic void addTestRealms(List<RealmRepresentation> testRealms) {\nRealmBuilder realm = RealmBuilder.create().name(\"test\").testEventListener();\n@@ -234,8 +267,21 @@ public class ImpersonationTest extends AbstractKeycloakTest {\n.detail(Details.IMPERSONATOR_REALM, adminRealm)\n.client((String) null).assertEvent();\n- NewCookie cookie = response.getCookies().get(AuthenticationManager.KEYCLOAK_IDENTITY_COOKIE);\n+ // Fetch user session notes\n+ final String userId = impersonatedUserId;\n+ final UserSessionNotesHolder notesHolder = testingClient.server(\"test\").fetch(session -> {\n+ final RealmModel realm = session.realms().getRealmByName(\"test\");\n+ final UserModel user = session.users().getUserById(userId, realm);\n+ final UserSessionModel userSession = session.sessions().getUserSessions(realm, user).get(0);\n+ return new UserSessionNotesHolder(userSession.getNotes());\n+ }, UserSessionNotesHolder.class);\n+ // Check impersonation details\n+ final Map<String, String> notes = notesHolder.getNotes();\n+ Assert.assertNotNull(notes.get(ImpersonationSessionNote.IMPERSONATOR_ID.toString()));\n+ Assert.assertEquals(admin, notes.get(ImpersonationSessionNote.IMPERSONATOR_USERNAME.toString()));\n+\n+ NewCookie cookie = response.getCookies().get(AuthenticationManager.KEYCLOAK_IDENTITY_COOKIE);\nAssert.assertNotNull(cookie);\nreturn new Cookie(cookie.getName(), cookie.getValue(), cookie.getDomain(), cookie.getPath(), cookie.getExpiry(), cookie.isSecure(), cookie.isHttpOnly());\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/oauth/ClientTokenExchangeTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/oauth/ClientTokenExchangeTest.java",
"diff": "@@ -34,6 +34,8 @@ import org.keycloak.models.RoleModel;\nimport org.keycloak.models.UserCredentialModel;\nimport org.keycloak.models.UserModel;\nimport org.keycloak.protocol.oidc.OIDCLoginProtocol;\n+import org.keycloak.protocol.oidc.OIDCLoginProtocolFactory;\n+import org.keycloak.protocol.oidc.mappers.UserSessionNoteMapper;\nimport org.keycloak.representations.AccessToken;\nimport org.keycloak.representations.AccessTokenResponse;\nimport org.keycloak.representations.idm.RealmRepresentation;\n@@ -57,8 +59,12 @@ import javax.ws.rs.core.Form;\nimport javax.ws.rs.core.HttpHeaders;\nimport javax.ws.rs.core.Response;\nimport java.util.List;\n+import java.util.Map;\n+import static org.hamcrest.Matchers.instanceOf;\nimport static org.junit.Assert.assertEquals;\n+import static org.keycloak.models.ImpersonationSessionNote.IMPERSONATOR_ID;\n+import static org.keycloak.models.ImpersonationSessionNote.IMPERSONATOR_USERNAME;\nimport static org.keycloak.testsuite.auth.page.AuthRealm.TEST;\n/**\n@@ -110,6 +116,8 @@ public class ClientTokenExchangeTest extends AbstractKeycloakTest {\nclientExchanger.setProtocol(OIDCLoginProtocol.LOGIN_PROTOCOL);\nclientExchanger.setFullScopeAllowed(false);\nclientExchanger.addScopeMapping(impersonateRole);\n+ clientExchanger.addProtocolMapper(UserSessionNoteMapper.createUserSessionNoteMapper(IMPERSONATOR_ID));\n+ clientExchanger.addProtocolMapper(UserSessionNoteMapper.createUserSessionNoteMapper(IMPERSONATOR_USERNAME));\nClientModel directExchanger = realm.addClient(\"direct-exchanger\");\n@@ -302,8 +310,15 @@ public class ClientTokenExchangeTest extends AbstractKeycloakTest {\nAccessToken exchangedToken = verifier.parse().getToken();\nAssert.assertEquals(\"client-exchanger\", exchangedToken.getIssuedFor());\nAssert.assertNull(exchangedToken.getAudience());\n- Assert.assertEquals(exchangedToken.getPreferredUsername(), \"impersonated-user\");\n+ Assert.assertEquals(\"impersonated-user\", exchangedToken.getPreferredUsername());\nAssert.assertNull(exchangedToken.getRealmAccess());\n+\n+ Object impersonatorRaw = exchangedToken.getOtherClaims().get(\"impersonator\");\n+ Assert.assertThat(impersonatorRaw, instanceOf(Map.class));\n+ Map impersonatorClaim = (Map) impersonatorRaw;\n+\n+ Assert.assertEquals(token.getSubject(), impersonatorClaim.get(\"id\"));\n+ Assert.assertEquals(\"user\", impersonatorClaim.get(\"username\"));\n}\n// client-exchanger can impersonate from token \"user\" to user \"impersonated-user\" and to \"target\" client\n@@ -449,7 +464,7 @@ public class ClientTokenExchangeTest extends AbstractKeycloakTest {\n.param(OAuth2Constants.AUDIENCE, \"target\")\n));\n- org.junit.Assert.assertEquals(403, response.getStatus());\n+ Assert.assertEquals(403, response.getStatus());\nresponse.close();\n}\n@@ -464,7 +479,7 @@ public class ClientTokenExchangeTest extends AbstractKeycloakTest {\n.param(OAuth2Constants.AUDIENCE, \"target\")\n));\n- org.junit.Assert.assertTrue(response.getStatus() >= 400);\n+ Assert.assertTrue(response.getStatus() >= 400);\nresponse.close();\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-2339 Adding impersonator details to user session notes and supporting built-in protocol mappers. |
339,414 | 08.03.2019 11:40:09 | -3,600 | e271542fcc6c020ae53f9975ca5ad8d9b09116ed | Missing api-docs in PNC builds | [
{
"change_type": "MODIFY",
"old_path": "prod-arguments.json",
"new_path": "prod-arguments.json",
"diff": "{\n\"mvn\": {\n- \"profiles\": [\"product\", \"!community\", \"jboss-release\"],\n+ \"profiles\": [\"product\", \"!community\", \"jboss-release\", \"distribution-downloads\"],\n\"properties\": {\n\"skipTests\": \"true\"\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9777 - Missing api-docs in PNC builds |
339,167 | 05.03.2019 13:52:10 | -3,600 | d0b7700c0491bd5079ab7b744df681b3655c6bac | Migrate ModelClass: AuthenticationSessionProviderTest | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/model/AuthenticationSessionProviderTest.java",
"diff": "+/*\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.keycloak.testsuite.model;\n+\n+import org.jboss.arquillian.container.test.api.Deployment;\n+import org.jboss.arquillian.container.test.api.TargetsContainer;\n+import org.jboss.shrinkwrap.api.spec.WebArchive;\n+import org.junit.After;\n+import org.junit.Before;\n+import org.junit.Test;\n+import org.keycloak.admin.client.resource.UserResource;\n+import org.keycloak.common.util.Time;\n+import org.keycloak.models.*;\n+import org.keycloak.models.utils.KeycloakModelUtils;\n+import org.keycloak.representations.idm.RealmRepresentation;\n+import org.keycloak.services.managers.ClientManager;\n+import org.keycloak.services.managers.RealmManager;\n+import org.keycloak.sessions.AuthenticationSessionModel;\n+import org.keycloak.sessions.CommonClientSessionModel;\n+import org.keycloak.sessions.RootAuthenticationSessionModel;\n+import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;\n+import org.keycloak.testsuite.arquillian.annotation.ModelTest;\n+import org.keycloak.testsuite.runonserver.RunOnServerDeployment;\n+\n+import java.util.concurrent.atomic.AtomicReference;\n+\n+import static org.hamcrest.core.Is.is;\n+import static org.hamcrest.core.IsNull.notNullValue;\n+import static org.hamcrest.core.IsNull.nullValue;\n+import static org.junit.Assert.assertThat;\n+import static org.keycloak.testsuite.arquillian.DeploymentTargetModifier.AUTH_SERVER_CURRENT;\n+\n+/**\n+ * @author <a href=\"mailto:[email protected]\">Marek Posolda</a>\n+ */\n+public class AuthenticationSessionProviderTest extends AbstractTestRealmKeycloakTest {\n+\n+ @Deployment\n+ @TargetsContainer(AUTH_SERVER_CURRENT)\n+ public static WebArchive deploy() {\n+ return RunOnServerDeployment.create(UserResource.class, AuthenticationSessionProviderTest.class)\n+ .addPackages(true,\n+ \"org.keycloak.testsuite\",\n+ \"org.keycloak.testsuite.model\");\n+ }\n+\n+ @Before\n+ public void before() {\n+ testingClient.server().run(session -> {\n+ RealmModel realm = session.realms().getRealm(\"test\");\n+ session.users().addUser(realm, \"user1\").setEmail(\"user1@localhost\");\n+ session.users().addUser(realm, \"user2\").setEmail(\"user2@localhost\");\n+\n+ });\n+ }\n+\n+ @After\n+ public void after() {\n+ testingClient.server().run(session -> {\n+ RealmModel realm = session.realms().getRealm(\"test\");\n+ session.sessions().removeUserSessions(realm);\n+\n+ UserModel user1 = session.users().getUserByUsername(\"user1\", realm);\n+ UserModel user2 = session.users().getUserByUsername(\"user2\", realm);\n+\n+ UserManager um = new UserManager(session);\n+ if (user1 != null) {\n+ um.removeUser(realm, user1);\n+ }\n+ if (user2 != null) {\n+ um.removeUser(realm, user2);\n+ }\n+ });\n+ }\n+\n+ @Test\n+ @ModelTest\n+ public void testLoginSessionsCRUD(KeycloakSession session) {\n+ AtomicReference<String> rootAuthSessionID = new AtomicReference<>();\n+ AtomicReference<String> tabID = new AtomicReference<>();\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionCRUD1) -> {\n+ KeycloakSession currentSession = sessionCRUD1;\n+ RealmModel realm = currentSession.realms().getRealm(\"test\");\n+\n+ ClientModel client1 = realm.getClientByClientId(\"test-app\");\n+\n+ RootAuthenticationSessionModel rootAuthSession = currentSession.authenticationSessions().createRootAuthenticationSession(realm);\n+ rootAuthSessionID.set(rootAuthSession.getId());\n+\n+ AuthenticationSessionModel authSession = rootAuthSession.createAuthenticationSession(client1);\n+ tabID.set(authSession.getTabId());\n+\n+ authSession.setAction(\"foo\");\n+ rootAuthSession.setTimestamp(100);\n+ });\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionCRUD2) -> {\n+ KeycloakSession currentSession = sessionCRUD2;\n+ RealmModel realm = currentSession.realms().getRealm(\"test\");\n+\n+ ClientModel client1 = realm.getClientByClientId(\"test-app\");\n+\n+ // Ensure currentSession is here\n+ RootAuthenticationSessionModel rootAuthSession = currentSession.authenticationSessions().getRootAuthenticationSession(realm, rootAuthSessionID.get());\n+ AuthenticationSessionModel authSession = rootAuthSession.getAuthenticationSession(client1, tabID.get());\n+ testAuthenticationSession(authSession, client1.getId(), null, \"foo\");\n+\n+ assertThat(rootAuthSession.getTimestamp(), is(100));\n+\n+ // Update and commit\n+ authSession.setAction(\"foo-updated\");\n+ rootAuthSession.setTimestamp(200);\n+ authSession.setAuthenticatedUser(currentSession.users().getUserByUsername(\"user1\", realm));\n+ });\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionCRUD3) -> {\n+ KeycloakSession currentSession = sessionCRUD3;\n+ RealmModel realm = currentSession.realms().getRealm(\"test\");\n+ UserModel user1 = currentSession.users().getUserByUsername(\"user1\", realm);\n+\n+ // Ensure currentSession was updated\n+ RootAuthenticationSessionModel rootAuthSession = currentSession.authenticationSessions().getRootAuthenticationSession(realm, rootAuthSessionID.get());\n+ ClientModel client1 = realm.getClientByClientId(\"test-app\");\n+ AuthenticationSessionModel authSession = rootAuthSession.getAuthenticationSession(client1, tabID.get());\n+\n+ testAuthenticationSession(authSession, client1.getId(), user1.getId(), \"foo-updated\");\n+\n+ assertThat(rootAuthSession.getTimestamp(), is(200));\n+\n+ // Remove and commit\n+ currentSession.authenticationSessions().removeRootAuthenticationSession(realm, rootAuthSession);\n+ });\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionCRUD4) -> {\n+ KeycloakSession currentSession = sessionCRUD4;\n+ RealmModel realm = currentSession.realms().getRealm(\"test\");\n+\n+ // Ensure currentSession was removed\n+ assertThat(currentSession.authenticationSessions().getRootAuthenticationSession(realm, rootAuthSessionID.get()), nullValue());\n+ });\n+ }\n+\n+ @Test\n+ @ModelTest\n+ public void testAuthenticationSessionRestart(KeycloakSession session) {\n+ AtomicReference<String> parentAuthSessionID = new AtomicReference<>();\n+ AtomicReference<String> tabID = new AtomicReference<>();\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionRestart1) -> {\n+ KeycloakSession currentSession = sessionRestart1;\n+ RealmModel realm = currentSession.realms().getRealm(\"test\");\n+\n+ ClientModel client1 = realm.getClientByClientId(\"test-app\");\n+ UserModel user1 = currentSession.users().getUserByUsername(\"user1\", realm);\n+\n+ AuthenticationSessionModel authSession = currentSession.authenticationSessions().createRootAuthenticationSession(realm)\n+ .createAuthenticationSession(client1);\n+\n+ parentAuthSessionID.set(authSession.getParentSession().getId());\n+ tabID.set(authSession.getTabId());\n+\n+ authSession.setAction(\"foo\");\n+ authSession.getParentSession().setTimestamp(100);\n+\n+ authSession.setAuthenticatedUser(user1);\n+ authSession.setAuthNote(\"foo\", \"bar\");\n+ authSession.setClientNote(\"foo2\", \"bar2\");\n+ authSession.setExecutionStatus(\"123\", CommonClientSessionModel.ExecutionStatus.SUCCESS);\n+ });\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionRestart2) -> {\n+ KeycloakSession currentSession = sessionRestart2;\n+ RealmModel realm = currentSession.realms().getRealm(\"test\");\n+\n+ // Test restart root authentication session\n+ ClientModel client1 = realm.getClientByClientId(\"test-app\");\n+ AuthenticationSessionModel authSession = currentSession.authenticationSessions().getRootAuthenticationSession(realm, parentAuthSessionID.get())\n+ .getAuthenticationSession(client1, tabID.get());\n+ authSession.getParentSession().restartSession(realm);\n+ });\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionRestart3) -> {\n+ KeycloakSession currentSession = sessionRestart3;\n+ RealmModel realm = currentSession.realms().getRealm(\"test\");\n+\n+ ClientModel client1 = realm.getClientByClientId(\"test-app\");\n+\n+ RootAuthenticationSessionModel rootAuthSession = currentSession.authenticationSessions().getRootAuthenticationSession(realm, parentAuthSessionID.get());\n+\n+ assertThat(rootAuthSession.getAuthenticationSession(client1, tabID.get()), nullValue());\n+ assertThat(rootAuthSession.getTimestamp() > 0, is(true));\n+ });\n+ }\n+\n+ @Test\n+ @ModelTest\n+ public void testExpiredAuthSessions(KeycloakSession session) {\n+ AtomicReference<String> authSessionID = new AtomicReference<>();\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionExpired) -> {\n+ KeycloakSession mainSession = sessionExpired;\n+ try {\n+ // AccessCodeLifespan = 10 ; AccessCodeLifespanUserAction = 10 ; AccessCodeLifespanLogin = 30\n+ setAccessCodeLifespan(mainSession, 10, 10, 30);\n+\n+ createAuthSession(mainSession, authSessionID);\n+ testExpiredOffset(mainSession, 25, false, authSessionID.get());\n+ testExpiredOffset(mainSession, 35, true, authSessionID.get());\n+\n+ // AccessCodeLifespan = Not set ; AccessCodeLifespanUserAction = 10 ; AccessCodeLifespanLogin = Not set\n+ setAccessCodeLifespan(mainSession, -1, 40, -1);\n+\n+ createAuthSession(mainSession, authSessionID);\n+ testExpiredOffset(mainSession, 35, false, authSessionID.get());\n+ testExpiredOffset(mainSession, 45, true, authSessionID.get());\n+\n+ // AccessCodeLifespan = 50 ; AccessCodeLifespanUserAction = Not set ; AccessCodeLifespanLogin = Not set\n+ setAccessCodeLifespan(mainSession, 50, -1, -1);\n+\n+ createAuthSession(mainSession, authSessionID);\n+ testExpiredOffset(mainSession, 45, false, authSessionID.get());\n+ testExpiredOffset(mainSession, 55, true, authSessionID.get());\n+\n+ } finally {\n+ Time.setOffset(0);\n+ setAccessCodeLifespan(mainSession, 60, 300, 1800);\n+ }\n+ });\n+ }\n+\n+ @Test\n+ @ModelTest\n+ public void testOnRealmRemoved(KeycloakSession session) {\n+ AtomicReference<String> authSessionID = new AtomicReference<>();\n+ AtomicReference<String> authSessionID2 = new AtomicReference<>();\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sesRealmRemoved1) -> {\n+ KeycloakSession currentSession = sesRealmRemoved1;\n+ RealmModel realm = currentSession.realms().getRealm(\"test\");\n+ RealmModel fooRealm = currentSession.realms().createRealm(\"foo-realm\");\n+\n+ fooRealm.addClient(\"foo-client\");\n+\n+ authSessionID.set(currentSession.authenticationSessions().createRootAuthenticationSession(realm).getId());\n+ authSessionID2.set(currentSession.authenticationSessions().createRootAuthenticationSession(fooRealm).getId());\n+ });\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sesRealmRemoved2) -> {\n+ KeycloakSession currentSession = sesRealmRemoved2;\n+\n+ new RealmManager(currentSession).removeRealm(currentSession.realms().getRealmByName(\"foo-realm\"));\n+ });\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sesRealmRemoved3) -> {\n+ KeycloakSession currentSession = sesRealmRemoved3;\n+ RealmModel realm = currentSession.realms().getRealm(\"test\");\n+\n+ RootAuthenticationSessionModel authSession = currentSession.authenticationSessions().getRootAuthenticationSession(realm, authSessionID.get());\n+\n+ assertThat(authSession, notNullValue());\n+ assertThat(currentSession.authenticationSessions().getRootAuthenticationSession(realm, authSessionID2.get()), nullValue());\n+ });\n+ }\n+\n+ @Test\n+ @ModelTest\n+ public void testOnClientRemoved(KeycloakSession session) {\n+ AtomicReference<String> tab1ID = new AtomicReference<>();\n+ AtomicReference<String> tab2ID = new AtomicReference<>();\n+ AtomicReference<String> authSessionID = new AtomicReference<>();\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sesRealmRemoved1) -> {\n+ KeycloakSession currentSession = sesRealmRemoved1;\n+ RealmModel realm = currentSession.realms().getRealm(\"test\");\n+\n+ authSessionID.set(currentSession.authenticationSessions().createRootAuthenticationSession(realm).getId());\n+\n+ AuthenticationSessionModel authSession1 = currentSession.authenticationSessions().getRootAuthenticationSession(realm, authSessionID.get()).createAuthenticationSession(realm.getClientByClientId(\"test-app\"));\n+ AuthenticationSessionModel authSession2 = currentSession.authenticationSessions().getRootAuthenticationSession(realm, authSessionID.get()).createAuthenticationSession(realm.getClientByClientId(\"third-party\"));\n+ tab1ID.set(authSession1.getTabId());\n+ tab2ID.set(authSession2.getTabId());\n+\n+ authSession1.setAuthNote(\"foo\", \"bar\");\n+ authSession2.setAuthNote(\"foo\", \"baz\");\n+ });\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sesRealmRemoved1) -> {\n+ KeycloakSession currentSession = sesRealmRemoved1;\n+ RealmModel realm = currentSession.realms().getRealm(\"test\");\n+\n+ RootAuthenticationSessionModel rootAuthSession = currentSession.authenticationSessions().getRootAuthenticationSession(realm, authSessionID.get());\n+\n+ assertThat(rootAuthSession.getAuthenticationSessions().size(), is(2));\n+ assertThat(rootAuthSession.getAuthenticationSession(realm.getClientByClientId(\"test-app\"), tab1ID.get()).getAuthNote(\"foo\"), is(\"bar\"));\n+ assertThat(rootAuthSession.getAuthenticationSession(realm.getClientByClientId(\"third-party\"), tab2ID.get()).getAuthNote(\"foo\"), is(\"baz\"));\n+\n+ new ClientManager(new RealmManager(currentSession)).removeClient(realm, realm.getClientByClientId(\"third-party\"));\n+ });\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sesRealmRemoved1) -> {\n+ KeycloakSession currentSession = sesRealmRemoved1;\n+ RealmModel realm = currentSession.realms().getRealm(\"test\");\n+ RootAuthenticationSessionModel rootAuthSession = currentSession.authenticationSessions().getRootAuthenticationSession(realm, authSessionID.get());\n+\n+ assertThat(rootAuthSession.getAuthenticationSession(realm.getClientByClientId(\"test-app\"), tab1ID.get()).getAuthNote(\"foo\"), is(\"bar\"));\n+ assertThat(rootAuthSession.getAuthenticationSession(realm.getClientByClientId(\"third-party\"), tab2ID.get()), nullValue());\n+\n+ // Revert client\n+ realm.addClient(\"third-party\");\n+ });\n+ }\n+\n+ private void testAuthenticationSession(AuthenticationSessionModel authSession, String expectedClientId, String expectedUserId, String expectedAction) {\n+ assertThat(authSession.getClient().getId(), is(expectedClientId));\n+\n+ if (expectedUserId == null) {\n+ assertThat(authSession.getAuthenticatedUser(), nullValue());\n+ } else {\n+ assertThat(authSession.getAuthenticatedUser().getId(), is(expectedUserId));\n+ }\n+\n+ if (expectedAction == null) {\n+ assertThat(authSession.getAction(), nullValue());\n+ } else {\n+ assertThat(authSession.getAction(), is(expectedAction));\n+ }\n+ }\n+\n+ private void createAuthSession(KeycloakSession session, AtomicReference<String> authSessionID) {\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession createAuthSession) -> {\n+ KeycloakSession currentSession = createAuthSession;\n+ RealmModel realm = currentSession.realms().getRealm(\"test\");\n+\n+ Time.setOffset(0);\n+ authSessionID.set(currentSession.authenticationSessions().createRootAuthenticationSession(realm).getId());\n+ });\n+ }\n+\n+ private void testExpiredOffset(KeycloakSession session, int offset, boolean isSessionNull, String authSessionID) {\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionExp) -> {\n+ KeycloakSession currentSession = sessionExp;\n+ RealmModel realm = currentSession.realms().getRealm(\"test\");\n+\n+ Time.setOffset(offset);\n+ currentSession.authenticationSessions().removeExpired(realm);\n+ });\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionExpVerify) -> {\n+ KeycloakSession currentSession = sessionExpVerify;\n+ RealmModel realm = currentSession.realms().getRealm(\"test\");\n+\n+ if (isSessionNull)\n+ assertThat(currentSession.authenticationSessions().getRootAuthenticationSession(realm, authSessionID), nullValue());\n+ else\n+ assertThat(currentSession.authenticationSessions().getRootAuthenticationSession(realm, authSessionID), notNullValue());\n+ });\n+ }\n+\n+ // If parameter is -1, then the parameter won't change.\n+ private void setAccessCodeLifespan(KeycloakSession session, int lifespan, int lifespanUserAction, int lifespanLogin) {\n+\n+ KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), (KeycloakSession sessionLifespan) -> {\n+ KeycloakSession currentSession = sessionLifespan;\n+ RealmModel realm = currentSession.realms().getRealm(\"test\");\n+\n+ if (lifespan != -1)\n+ realm.setAccessCodeLifespan(lifespan);\n+\n+ if (lifespanUserAction != -1)\n+ realm.setAccessCodeLifespanUserAction(lifespanUserAction);\n+\n+ if (lifespanLogin != -1)\n+ realm.setAccessCodeLifespanLogin(lifespanLogin);\n+ });\n+ }\n+\n+ @Override\n+ public void configureTestRealm(RealmRepresentation testRealm) {\n+ }\n+}\n"
},
{
"change_type": "DELETE",
"old_path": "testsuite/integration-deprecated/src/test/java/org/keycloak/testsuite/model/AuthenticationSessionProviderTest.java",
"new_path": null,
"diff": "-/*\n- * Copyright 2016 Red Hat, Inc. and/or its affiliates\n- * and other contributors as indicated by the @author tags.\n- *\n- * Licensed under the Apache License, Version 2.0 (the \"License\");\n- * you may not use this file except in compliance with the License.\n- * You may obtain a copy of the License at\n- *\n- * http://www.apache.org/licenses/LICENSE-2.0\n- *\n- * Unless required by applicable law or agreed to in writing, software\n- * distributed under the License is distributed on an \"AS IS\" BASIS,\n- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n- * See the License for the specific language governing permissions and\n- * limitations under the License.\n- */\n-\n-package org.keycloak.testsuite.model;\n-\n-import org.junit.After;\n-import org.junit.Assert;\n-import org.junit.Before;\n-import org.junit.ClassRule;\n-import org.junit.Test;\n-import org.keycloak.common.util.Time;\n-import org.keycloak.models.ClientModel;\n-import org.keycloak.models.KeycloakSession;\n-import org.keycloak.models.RealmModel;\n-import org.keycloak.models.UserManager;\n-import org.keycloak.models.UserModel;\n-import org.keycloak.services.managers.ClientManager;\n-import org.keycloak.services.managers.RealmManager;\n-import org.keycloak.sessions.AuthenticationSessionModel;\n-import org.keycloak.sessions.CommonClientSessionModel;\n-import org.keycloak.sessions.RootAuthenticationSessionModel;\n-import org.keycloak.testsuite.rule.KeycloakRule;\n-\n-import static org.junit.Assert.assertNotNull;\n-import static org.junit.Assert.assertNull;\n-\n-/**\n- * @author <a href=\"mailto:[email protected]\">Marek Posolda</a>\n- */\n-public class AuthenticationSessionProviderTest {\n-\n- @ClassRule\n- public static KeycloakRule kc = new KeycloakRule();\n-\n- private KeycloakSession session;\n- private RealmModel realm;\n-\n- @Before\n- public void before() {\n- session = kc.startSession();\n- realm = session.realms().getRealm(\"test\");\n- session.users().addUser(realm, \"user1\").setEmail(\"user1@localhost\");\n- session.users().addUser(realm, \"user2\").setEmail(\"user2@localhost\");\n- }\n-\n- @After\n- public void after() {\n- resetSession();\n- UserModel user1 = session.users().getUserByUsername(\"user1\", realm);\n- UserModel user2 = session.users().getUserByUsername(\"user2\", realm);\n-\n- UserManager um = new UserManager(session);\n- if (user1 != null) {\n- um.removeUser(realm, user1);\n- }\n- if (user2 != null) {\n- um.removeUser(realm, user2);\n- }\n- kc.stopSession(session, true);\n- }\n-\n- private void resetSession() {\n- kc.stopSession(session, true);\n- session = kc.startSession();\n- realm = session.realms().getRealm(\"test\");\n- }\n-\n- @Test\n- public void testLoginSessionsCRUD() {\n- ClientModel client1 = realm.getClientByClientId(\"test-app\");\n- UserModel user1 = session.users().getUserByUsername(\"user1\", realm);\n-\n- RootAuthenticationSessionModel rootAuthSession = session.authenticationSessions().createRootAuthenticationSession(realm);\n- AuthenticationSessionModel authSession = rootAuthSession.createAuthenticationSession(client1);\n-\n- String tabId = authSession.getTabId();\n-\n- authSession.setAction(\"foo\");\n- rootAuthSession.setTimestamp(100);\n-\n-\n- resetSession();\n-\n- client1 = realm.getClientByClientId(\"test-app\");\n-\n- // Ensure session is here\n- rootAuthSession = session.authenticationSessions().getRootAuthenticationSession(realm, rootAuthSession.getId());\n- authSession = rootAuthSession.getAuthenticationSession(client1, tabId);\n- testAuthenticationSession(authSession, client1.getId(), null, \"foo\");\n- Assert.assertEquals(100, rootAuthSession.getTimestamp());\n-\n- // Update and commit\n- authSession.setAction(\"foo-updated\");\n- rootAuthSession.setTimestamp(200);\n- authSession.setAuthenticatedUser(session.users().getUserByUsername(\"user1\", realm));\n-\n- resetSession();\n-\n- // Ensure session was updated\n- rootAuthSession = session.authenticationSessions().getRootAuthenticationSession(realm, rootAuthSession.getId());\n- client1 = realm.getClientByClientId(\"test-app\");\n- authSession = rootAuthSession.getAuthenticationSession(client1, tabId);\n- testAuthenticationSession(authSession, client1.getId(), user1.getId(), \"foo-updated\");\n- Assert.assertEquals(200, rootAuthSession.getTimestamp());\n-\n- // Remove and commit\n- session.authenticationSessions().removeRootAuthenticationSession(realm, rootAuthSession);\n-\n- resetSession();\n-\n- // Ensure session was removed\n- Assert.assertNull(session.authenticationSessions().getRootAuthenticationSession(realm, rootAuthSession.getId()));\n-\n- }\n-\n- @Test\n- public void testAuthenticationSessionRestart() {\n- ClientModel client1 = realm.getClientByClientId(\"test-app\");\n- UserModel user1 = session.users().getUserByUsername(\"user1\", realm);\n-\n- AuthenticationSessionModel authSession = session.authenticationSessions().createRootAuthenticationSession(realm).createAuthenticationSession(client1);\n- String tabId = authSession.getTabId();\n-\n- authSession.setAction(\"foo\");\n- authSession.getParentSession().setTimestamp(100);\n-\n- authSession.setAuthenticatedUser(user1);\n- authSession.setAuthNote(\"foo\", \"bar\");\n- authSession.setClientNote(\"foo2\", \"bar2\");\n- authSession.setExecutionStatus(\"123\", CommonClientSessionModel.ExecutionStatus.SUCCESS);\n-\n- resetSession();\n-\n- // Test restart root authentication session\n- client1 = realm.getClientByClientId(\"test-app\");\n- authSession = session.authenticationSessions().getRootAuthenticationSession(realm, authSession.getParentSession().getId())\n- .getAuthenticationSession(client1, tabId);\n- authSession.getParentSession().restartSession(realm);\n-\n- resetSession();\n-\n- RootAuthenticationSessionModel rootAuthSession = session.authenticationSessions().getRootAuthenticationSession(realm, authSession.getParentSession().getId());\n- Assert.assertNull(rootAuthSession.getAuthenticationSession(client1, tabId));\n- Assert.assertTrue(rootAuthSession.getTimestamp() > 0);\n- }\n-\n-\n- @Test\n- public void testExpiredAuthSessions() {\n- try {\n- realm.setAccessCodeLifespan(10);\n- realm.setAccessCodeLifespanUserAction(10);\n- realm.setAccessCodeLifespanLogin(30);\n-\n- // Login lifespan is largest\n- String authSessionId = session.authenticationSessions().createRootAuthenticationSession(realm).getId();\n-\n- resetSession();\n-\n- Time.setOffset(25);\n- session.authenticationSessions().removeExpired(realm);\n- resetSession();\n-\n- assertNotNull(session.authenticationSessions().getRootAuthenticationSession(realm, authSessionId));\n-\n- Time.setOffset(35);\n- session.authenticationSessions().removeExpired(realm);\n- resetSession();\n-\n- assertNull(session.authenticationSessions().getRootAuthenticationSession(realm, authSessionId));\n-\n- // User action is largest\n- realm.setAccessCodeLifespanUserAction(40);\n-\n- Time.setOffset(0);\n- authSessionId = session.authenticationSessions().createRootAuthenticationSession(realm).getId();\n- resetSession();\n-\n- Time.setOffset(35);\n- session.authenticationSessions().removeExpired(realm);\n- resetSession();\n-\n- assertNotNull(session.authenticationSessions().getRootAuthenticationSession(realm, authSessionId));\n-\n- Time.setOffset(45);\n- session.authenticationSessions().removeExpired(realm);\n- resetSession();\n-\n- assertNull(session.authenticationSessions().getRootAuthenticationSession(realm, authSessionId));\n-\n- // Access code is largest\n- realm.setAccessCodeLifespan(50);\n-\n- Time.setOffset(0);\n- authSessionId = session.authenticationSessions().createRootAuthenticationSession(realm).getId();\n- resetSession();\n-\n- Time.setOffset(45);\n- session.authenticationSessions().removeExpired(realm);\n- resetSession();\n-\n- assertNotNull(session.authenticationSessions().getRootAuthenticationSession(realm, authSessionId));\n-\n- Time.setOffset(55);\n- session.authenticationSessions().removeExpired(realm);\n- resetSession();\n-\n- assertNull(session.authenticationSessions().getRootAuthenticationSession(realm, authSessionId));\n- } finally {\n- Time.setOffset(0);\n-\n- realm.setAccessCodeLifespan(60);\n- realm.setAccessCodeLifespanUserAction(300);\n- realm.setAccessCodeLifespanLogin(1800);\n-\n- }\n- }\n-\n-\n- @Test\n- public void testOnRealmRemoved() {\n- RealmModel fooRealm = session.realms().createRealm(\"foo-realm\");\n- ClientModel fooClient = fooRealm.addClient(\"foo-client\");\n-\n- String authSessionId = session.authenticationSessions().createRootAuthenticationSession(realm).getId();\n- String authSessionId2 = session.authenticationSessions().createRootAuthenticationSession(fooRealm).getId();\n-\n- resetSession();\n-\n- new RealmManager(session).removeRealm(session.realms().getRealmByName(\"foo-realm\"));\n-\n- resetSession();\n-\n- RootAuthenticationSessionModel authSession = session.authenticationSessions().getRootAuthenticationSession(realm, authSessionId);\n- Assert.assertNotNull(authSession);\n- Assert.assertNull(session.authenticationSessions().getRootAuthenticationSession(realm, authSessionId2));\n- }\n-\n- @Test\n- public void testOnClientRemoved() {\n- String authSessionId = session.authenticationSessions().createRootAuthenticationSession(realm).getId();\n- AuthenticationSessionModel authSession1 = session.authenticationSessions().getRootAuthenticationSession(realm, authSessionId).createAuthenticationSession(realm.getClientByClientId(\"test-app\"));\n- AuthenticationSessionModel authSession2 = session.authenticationSessions().getRootAuthenticationSession(realm, authSessionId).createAuthenticationSession(realm.getClientByClientId(\"third-party\"));\n- String tab1Id = authSession1.getTabId();\n- String tab2Id = authSession2.getTabId();\n-\n- authSession1.setAuthNote(\"foo\", \"bar\");\n- authSession2.setAuthNote(\"foo\", \"baz\");\n-\n- resetSession();\n-\n- RootAuthenticationSessionModel rootAuthSession = session.authenticationSessions().getRootAuthenticationSession(realm, authSessionId);\n- Assert.assertEquals(2, rootAuthSession.getAuthenticationSessions().size());\n- Assert.assertEquals(\"bar\", rootAuthSession.getAuthenticationSession(realm.getClientByClientId(\"test-app\"), tab1Id).getAuthNote(\"foo\"));\n- Assert.assertEquals(\"baz\", rootAuthSession.getAuthenticationSession(realm.getClientByClientId(\"third-party\"), tab2Id).getAuthNote(\"foo\"));\n-\n- new ClientManager(new RealmManager(session)).removeClient(realm, realm.getClientByClientId(\"third-party\"));\n-\n- resetSession();\n-\n- rootAuthSession = session.authenticationSessions().getRootAuthenticationSession(realm, authSessionId);\n- Assert.assertEquals(\"bar\", rootAuthSession.getAuthenticationSession(realm.getClientByClientId(\"test-app\"), tab1Id).getAuthNote(\"foo\"));\n- Assert.assertNull(rootAuthSession.getAuthenticationSession(realm.getClientByClientId(\"third-party\"), tab2Id));\n-\n- // Revert client\n- realm.addClient(\"third-party\");\n- }\n-\n-\n- private void testAuthenticationSession(AuthenticationSessionModel authSession, String expectedClientId, String expectedUserId, String expectedAction) {\n- Assert.assertEquals(expectedClientId, authSession.getClient().getId());\n-\n- if (expectedUserId == null) {\n- Assert.assertNull(authSession.getAuthenticatedUser());\n- } else {\n- Assert.assertEquals(expectedUserId, authSession.getAuthenticatedUser().getId());\n- }\n-\n- if (expectedAction == null) {\n- Assert.assertNull(authSession.getAction());\n- } else {\n- Assert.assertEquals(expectedAction, authSession.getAction());\n- }\n- }\n-}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8379 Migrate ModelClass: AuthenticationSessionProviderTest |
339,167 | 05.03.2019 14:47:38 | -3,600 | a3c175a21e2e5c36466cb1667c0199e9280ccbd8 | UserStorageConsentTest fails with some databases | [
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/storage/UserStorageTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/federation/storage/UserStorageTest.java",
"diff": "@@ -752,6 +752,8 @@ public class UserStorageTest extends AbstractAuthTest {\nAssert.assertEquals(1, UserMapStorage.allocations.get());\nAssert.assertEquals(0, UserMapStorage.closings.get());\n+\n+ session.users().removeUser(realm,session.users().getUserByUsername(\"memuser\",realm));\n});\ntestingClient.server().run(session -> {\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9348 UserStorageConsentTest fails with some databases |
339,187 | 14.12.2018 00:47:27 | -3,600 | e18fb563896cd5ec7ed7b79d4f462c87f6019eb7 | Add endpoint to get groups by role | [
{
"change_type": "MODIFY",
"old_path": "integration/admin-client/src/main/java/org/keycloak/admin/client/resource/RoleResource.java",
"new_path": "integration/admin-client/src/main/java/org/keycloak/admin/client/resource/RoleResource.java",
"diff": "package org.keycloak.admin.client.resource;\n+import org.keycloak.representations.idm.GroupRepresentation;\nimport org.keycloak.representations.idm.ManagementPermissionReference;\nimport org.keycloak.representations.idm.ManagementPermissionRepresentation;\nimport org.keycloak.representations.idm.RoleRepresentation;\n@@ -127,4 +128,30 @@ public interface RoleResource {\nSet<UserRepresentation> getRoleUserMembers(@QueryParam(\"first\") Integer firstResult,\n@QueryParam(\"max\") Integer maxResults);\n+ /**\n+ * Get role groups\n+ * <p/>\n+ * Returns groups that have the given role\n+ *\n+ * @return a list of groups with the given role\n+ */\n+ @GET\n+ @Path(\"groups\")\n+ @Produces(MediaType.APPLICATION_JSON)\n+ Set<GroupRepresentation> getRoleGroupMembers();\n+\n+ /**\n+ * Get role groups\n+ * <p/>\n+ * Returns groups that have the given role, paginated according to the query parameters\n+ *\n+ * @param firstResult Pagination offset\n+ * @param maxResults Pagination size\n+ * @return a list of groups with the given role\n+ */\n+ @GET\n+ @Path(\"groups\")\n+ @Produces(MediaType.APPLICATION_JSON)\n+ Set<GroupRepresentation> getRoleGroupMembers(@QueryParam(\"first\") Integer firstResult,\n+ @QueryParam(\"max\") Integer maxResults);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RealmCacheSession.java",
"new_path": "model/infinispan/src/main/java/org/keycloak/models/cache/infinispan/RealmCacheSession.java",
"diff": "@@ -879,6 +879,11 @@ public class RealmCacheSession implements CacheRealmProvider {\nreturn getRealmDelegate().getGroupsCountByNameContaining(realm, search);\n}\n+ @Override\n+ public List<GroupModel> getGroupsByRole(RealmModel realm, RoleModel role, int firstResult, int maxResults) {\n+ return getRealmDelegate().getGroupsByRole(realm, role, firstResult, maxResults);\n+ }\n+\n@Override\npublic List<GroupModel> getTopLevelGroups(RealmModel realm) {\nString cacheKey = getTopGroupsQueryCacheKey(realm.getId());\n"
},
{
"change_type": "MODIFY",
"old_path": "model/jpa/src/main/java/org/keycloak/models/jpa/JpaRealmProvider.java",
"new_path": "model/jpa/src/main/java/org/keycloak/models/jpa/JpaRealmProvider.java",
"diff": "@@ -386,6 +386,25 @@ public class JpaRealmProvider implements RealmProvider {\nreturn (long) searchForGroupByName(realm, search, null, null).size();\n}\n+ @Override\n+ public List<GroupModel> getGroupsByRole(RealmModel realm, RoleModel role, int firstResult, int maxResults) {\n+ TypedQuery<GroupEntity> query = em.createNamedQuery(\"groupsInRole\", GroupEntity.class);\n+ query.setParameter(\"roleId\", role.getId());\n+ if (firstResult != -1) {\n+ query.setFirstResult(firstResult);\n+ }\n+ if (maxResults != -1) {\n+ query.setMaxResults(maxResults);\n+ }\n+ List<GroupEntity> results = query.getResultList();\n+\n+ return results.stream()\n+ .map(g -> new GroupAdapter(realm, em, g))\n+ .sorted(Comparator.comparing(GroupModel::getName))\n+ .collect(Collectors.collectingAndThen(\n+ Collectors.toList(), Collections::unmodifiableList));\n+ }\n+\n@Override\npublic List<GroupModel> getTopLevelGroups(RealmModel realm) {\nRealmEntity ref = em.getReference(RealmEntity.class, realm.getId());\n"
},
{
"change_type": "MODIFY",
"old_path": "model/jpa/src/main/java/org/keycloak/models/jpa/entities/GroupRoleMappingEntity.java",
"new_path": "model/jpa/src/main/java/org/keycloak/models/jpa/entities/GroupRoleMappingEntity.java",
"diff": "@@ -34,6 +34,7 @@ import java.io.Serializable;\n* @version $Revision: 1 $\n*/\n@NamedQueries({\n+ @NamedQuery(name=\"groupsInRole\", query=\"select g from GroupRoleMappingEntity m, GroupEntity g where m.roleId=:roleId and g.id=m.group\"),\n@NamedQuery(name=\"groupHasRole\", query=\"select m from GroupRoleMappingEntity m where m.group = :group and m.roleId = :roleId\"),\n@NamedQuery(name=\"groupRoleMappings\", query=\"select m from GroupRoleMappingEntity m where m.group = :group\"),\n@NamedQuery(name=\"groupRoleMappingIds\", query=\"select m.roleId from GroupRoleMappingEntity m where m.group = :group\"),\n"
},
{
"change_type": "MODIFY",
"old_path": "server-spi/src/main/java/org/keycloak/models/RealmProvider.java",
"new_path": "server-spi/src/main/java/org/keycloak/models/RealmProvider.java",
"diff": "@@ -44,6 +44,8 @@ public interface RealmProvider extends Provider, ClientProvider {\nLong getGroupsCountByNameContaining(RealmModel realm, String search);\n+ List<GroupModel> getGroupsByRole(RealmModel realm, RoleModel role, int firstResult, int maxResults);\n+\nList<GroupModel> getTopLevelGroups(RealmModel realm);\nList<GroupModel> getTopLevelGroups(RealmModel realm, Integer first, Integer max);\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/services/resources/admin/RoleContainerResource.java",
"new_path": "services/src/main/java/org/keycloak/services/resources/admin/RoleContainerResource.java",
"diff": "@@ -23,6 +23,7 @@ import org.keycloak.events.admin.OperationType;\nimport org.keycloak.events.admin.ResourceType;\nimport org.keycloak.models.ClientModel;\nimport org.keycloak.models.Constants;\n+import org.keycloak.models.GroupModel;\nimport org.keycloak.models.KeycloakSession;\nimport org.keycloak.models.ModelDuplicateException;\nimport org.keycloak.models.RealmModel;\n@@ -30,6 +31,7 @@ import org.keycloak.models.RoleContainerModel;\nimport org.keycloak.models.RoleModel;\nimport org.keycloak.models.UserModel;\nimport org.keycloak.models.utils.ModelToRepresentation;\n+import org.keycloak.representations.idm.GroupRepresentation;\nimport org.keycloak.representations.idm.ManagementPermissionReference;\nimport org.keycloak.representations.idm.RoleRepresentation;\nimport org.keycloak.representations.idm.UserRepresentation;\n@@ -41,6 +43,7 @@ import org.keycloak.services.resources.admin.permissions.AdminPermissions;\nimport javax.ws.rs.BadRequestException;\nimport javax.ws.rs.Consumes;\nimport javax.ws.rs.DELETE;\n+import javax.ws.rs.DefaultValue;\nimport javax.ws.rs.GET;\nimport javax.ws.rs.POST;\nimport javax.ws.rs.PUT;\n@@ -54,6 +57,7 @@ import javax.ws.rs.core.UriInfo;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Set;\n+import java.util.stream.Collectors;\n/**\n* @resource Roles\n@@ -402,4 +406,35 @@ public class RoleContainerResource extends RoleResource {\nreturn results;\n}\n+\n+ /**\n+ * Return List of Groups that have the specified role name\n+ *\n+ *\n+ * @param roleName\n+ * @param firstResult\n+ * @param maxResults\n+ * @param fullRepresentation if true, return a full representation of the GroupRepresentation objects\n+ * @return\n+ */\n+ @Path(\"{role-name}/groups\")\n+ @GET\n+ @Produces(MediaType.APPLICATION_JSON)\n+ @NoCache\n+ public List<GroupRepresentation> getGroupsInRole(final @PathParam(\"role-name\") String roleName,\n+ @QueryParam(\"first\") Integer firstResult,\n+ @QueryParam(\"max\") Integer maxResults,\n+ @QueryParam(\"full\") @DefaultValue(\"false\") boolean fullRepresentation) {\n+\n+ auth.roles().requireView(roleContainer);\n+ firstResult = firstResult != null ? firstResult : 0;\n+ maxResults = maxResults != null ? maxResults : Constants.DEFAULT_MAX_RESULTS;\n+\n+ RoleModel role = roleContainer.getRole(roleName);\n+ List<GroupModel> groupsModel = session.realms().getGroupsByRole(realm, role, firstResult, maxResults);\n+\n+ return groupsModel.stream()\n+ .map(g -> ModelToRepresentation.toRepresentation(g, fullRepresentation))\n+ .collect(Collectors.toList());\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/realm/RealmRolesTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/realm/RealmRolesTest.java",
"diff": "@@ -25,6 +25,7 @@ import org.keycloak.admin.client.resource.UserResource;\nimport org.keycloak.events.admin.OperationType;\nimport org.keycloak.events.admin.ResourceType;\nimport org.keycloak.representations.idm.ClientRepresentation;\n+import org.keycloak.representations.idm.GroupRepresentation;\nimport org.keycloak.representations.idm.RoleRepresentation;\nimport org.keycloak.representations.idm.UserRepresentation;\nimport org.keycloak.testsuite.Assert;\n@@ -110,6 +111,11 @@ public class RealmRolesTest extends AbstractAdminTest {\ngetCleanup().addRoleId(ids.get(\"role-without-users\"));\ngetCleanup().addUserId(adminClient.realm(REALM_NAME).users().search(userRep.getUsername()).get(0).getId());\n+ GroupRepresentation groupRep = new GroupRepresentation();\n+ groupRep.setName(\"test-role-group\");\n+ groupRep.setPath(\"/test-role-group\");\n+ adminClient.realm(REALM_NAME).groups().add(groupRep);\n+ getCleanup().addGroupId(adminClient.realm(REALM_NAME).groups().groups().get(0).getId());\nresource = adminClient.realm(REALM_NAME).roles();\n@@ -122,7 +128,7 @@ public class RealmRolesTest extends AbstractAdminTest {\nassertAdminEvents.assertEvent(realmId, OperationType.CREATE, AdminEventPaths.clientRoleResourcePath(clientUuid, \"role-c\"), roleC, ResourceType.CLIENT_ROLE);\nassertAdminEvents.assertEvent(realmId, OperationType.CREATE, AdminEventPaths.userResourcePath(adminClient.realm(REALM_NAME).users().search(userRep.getUsername()).get(0).getId()), userRep, ResourceType.USER);\n-\n+ assertAdminEvents.assertEvent(realmId, OperationType.CREATE, AdminEventPaths.groupPath(adminClient.realm(REALM_NAME).groups().groups().get(0).getId()), groupRep, ResourceType.GROUP);\n}\n@@ -221,6 +227,7 @@ public class RealmRolesTest extends AbstractAdminTest {\n}\n+\n/**\n* KEYCLOAK-2035 Verifies that Role with no users assigned is being properly retrieved without members in API endpoint for role membership\n*/\n@@ -234,6 +241,41 @@ public class RealmRolesTest extends AbstractAdminTest {\n}\n+\n+ /**\n+ * KEYCLOAK-4978 Verifies that Groups assigned to Role are being properly retrieved as members in API endpoint for role membership\n+ */\n+ @Test\n+ public void testGroupsInRole() {\n+ RoleResource role = resource.get(\"role-with-users\");\n+\n+ List<GroupRepresentation> groups = adminClient.realm(REALM_NAME).groups().groups();\n+ GroupRepresentation groupRep = groups.stream().filter(g -> g.getPath().equals(\"/test-role-group\")).findFirst().get();\n+\n+ RoleResource roleResource = adminClient.realm(REALM_NAME).roles().get(role.toRepresentation().getName());\n+ List<RoleRepresentation> rolesToAdd = new LinkedList<>();\n+ rolesToAdd.add(roleResource.toRepresentation());\n+ adminClient.realm(REALM_NAME).groups().group(groupRep.getId()).roles().realmLevel().add(rolesToAdd);\n+\n+ roleResource = adminClient.realm(REALM_NAME).roles().get(role.toRepresentation().getName());\n+\n+ Set<GroupRepresentation> groupsInRole = roleResource.getRoleGroupMembers();\n+ assertTrue(groupsInRole.stream().filter(g -> g.getPath().equals(\"/test-role-group\")).findFirst().isPresent());\n+ }\n+\n+ /**\n+ * KEYCLOAK-4978 Verifies that Role with no users assigned is being properly retrieved without groups in API endpoint for role membership\n+ */\n+ @Test\n+ public void testGroupsNotInRole() {\n+ RoleResource role = resource.get(\"role-without-users\");\n+\n+ role = adminClient.realm(REALM_NAME).roles().get(role.toRepresentation().getName());\n+\n+ Set<GroupRepresentation> groupsInRole = role.getRoleGroupMembers();\n+ assertTrue(groupsInRole.isEmpty());\n+ }\n+\n/**\n* KEYCLOAK-2035 Verifies that Role Membership is ok after user removal\n*/\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-4978 Add endpoint to get groups by role |
339,512 | 14.11.2018 11:14:07 | 18,000 | 404ac1d0501bc79b48e19ed989534b7f84effef9 | changes needed to include x5c property in jwks | [
{
"change_type": "MODIFY",
"old_path": "core/src/main/java/org/keycloak/jose/jwk/JWKBuilder.java",
"new_path": "core/src/main/java/org/keycloak/jose/jwk/JWKBuilder.java",
"diff": "@@ -19,12 +19,14 @@ package org.keycloak.jose.jwk;\nimport org.keycloak.common.util.Base64Url;\nimport org.keycloak.common.util.KeyUtils;\n+import org.keycloak.common.util.PemUtils;\nimport org.keycloak.crypto.Algorithm;\nimport org.keycloak.crypto.KeyType;\nimport java.math.BigInteger;\nimport java.security.Key;\nimport java.security.PublicKey;\n+import java.security.cert.X509Certificate;\nimport java.security.interfaces.ECPublicKey;\nimport java.security.interfaces.RSAPublicKey;\n@@ -62,6 +64,10 @@ public class JWKBuilder {\n}\npublic JWK rsa(Key key) {\n+ return rsa(key, null);\n+ }\n+\n+ public JWK rsa(Key key, X509Certificate certificate) {\nRSAPublicKey rsaKey = (RSAPublicKey) key;\nRSAPublicJWK k = new RSAPublicJWK();\n@@ -74,6 +80,10 @@ public class JWKBuilder {\nk.setModulus(Base64Url.encode(toIntegerBytes(rsaKey.getModulus())));\nk.setPublicExponent(Base64Url.encode(toIntegerBytes(rsaKey.getPublicExponent())));\n+ if (certificate != null) {\n+ k.setX509CertificateChain(new String [] {PemUtils.encodeCertificate(certificate)});\n+ }\n+\nreturn k;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "core/src/main/java/org/keycloak/jose/jwk/RSAPublicJWK.java",
"new_path": "core/src/main/java/org/keycloak/jose/jwk/RSAPublicJWK.java",
"diff": "@@ -36,6 +36,9 @@ public class RSAPublicJWK extends JWK {\n@JsonProperty(\"e\")\nprivate String publicExponent;\n+ @JsonProperty(\"x5c\")\n+ private String[] x509CertificateChain;\n+\npublic String getModulus() {\nreturn modulus;\n}\n@@ -52,4 +55,12 @@ public class RSAPublicJWK extends JWK {\nthis.publicExponent = publicExponent;\n}\n+ public String[] getX509CertificateChain() {\n+ return x509CertificateChain;\n+ }\n+\n+ public void setX509CertificateChain(String[] x509CertificateChain) {\n+ this.x509CertificateChain = x509CertificateChain;\n+ }\n+\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "core/src/test/java/org/keycloak/jose/jwk/JWKTest.java",
"new_path": "core/src/test/java/org/keycloak/jose/jwk/JWKTest.java",
"diff": "@@ -19,7 +19,9 @@ package org.keycloak.jose.jwk;\nimport org.junit.Test;\nimport org.keycloak.common.util.Base64Url;\n+import org.keycloak.common.util.CertificateUtils;\nimport org.keycloak.common.util.KeyUtils;\n+import org.keycloak.common.util.PemUtils;\nimport org.keycloak.crypto.JavaAlgorithm;\nimport org.keycloak.util.JsonSerialization;\n@@ -30,6 +32,7 @@ import java.security.PublicKey;\nimport java.security.SecureRandom;\nimport java.security.Security;\nimport java.security.Signature;\n+import java.security.cert.X509Certificate;\nimport java.security.spec.ECGenParameterSpec;\nimport static org.junit.Assert.*;\n@@ -43,8 +46,9 @@ public class JWKTest {\npublic void publicRs256() throws Exception {\nKeyPair keyPair = KeyPairGenerator.getInstance(\"RSA\").generateKeyPair();\nPublicKey publicKey = keyPair.getPublic();\n+ X509Certificate certificate = CertificateUtils.generateV1SelfSignedCertificate(keyPair, \"Test\");\n- JWK jwk = JWKBuilder.create().kid(KeyUtils.createKeyId(publicKey)).algorithm(\"RS256\").rsa(publicKey);\n+ JWK jwk = JWKBuilder.create().kid(KeyUtils.createKeyId(publicKey)).algorithm(\"RS256\").rsa(publicKey, certificate);\nassertNotNull(jwk.getKeyId());\nassertEquals(\"RSA\", jwk.getKeyType());\n@@ -54,6 +58,8 @@ public class JWKTest {\nassertTrue(jwk instanceof RSAPublicJWK);\nassertNotNull(((RSAPublicJWK) jwk).getModulus());\nassertNotNull(((RSAPublicJWK) jwk).getPublicExponent());\n+ assertNotNull(((RSAPublicJWK) jwk).getX509CertificateChain());\n+ assertEquals(PemUtils.encodeCertificate(certificate), ((RSAPublicJWK) jwk).getX509CertificateChain()[0]);\nString jwkJson = JsonSerialization.writeValueAsString(jwk);\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/protocol/oidc/OIDCLoginProtocolService.java",
"new_path": "services/src/main/java/org/keycloak/protocol/oidc/OIDCLoginProtocolService.java",
"diff": "@@ -202,7 +202,7 @@ public class OIDCLoginProtocolService {\nif (k.getStatus().isEnabled() && k.getUse().equals(KeyUse.SIG) && k.getVerifyKey() != null) {\nJWKBuilder b = JWKBuilder.create().kid(k.getKid()).algorithm(k.getAlgorithm());\nif (k.getType().equals(KeyType.RSA)) {\n- keys.add(b.rsa(k.getVerifyKey()));\n+ keys.add(b.rsa(k.getVerifyKey(), k.getCertificate()));\n} else if (k.getType().equals(KeyType.EC)) {\nkeys.add(b.ec(k.getVerifyKey()));\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8701 changes needed to include x5c property in jwks |
339,281 | 06.03.2019 13:21:34 | -3,600 | d7313d91e5944df7e4023d03965a0c48242bdce7 | Upgrade to Wildfly 16 | [
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/configuration/domain/template.xml",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/configuration/domain/template.xml",
"diff": "~ limitations under the License.\n-->\n-<domain xmlns=\"urn:jboss:domain:9.0\">\n+<domain xmlns=\"urn:jboss:domain:10.0\">\n<extensions>\n<?EXTENSIONS?>\n"
},
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/configuration/host/host-master.xml",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/configuration/host/host-master.xml",
"diff": "is also started by this host controller file. The other instance must be started\nvia host-slave.xml\n-->\n-<host name=\"master\" xmlns=\"urn:jboss:domain:9.0\">\n+<host name=\"master\" xmlns=\"urn:jboss:domain:10.0\">\n<extensions>\n<?EXTENSIONS?>\n</extensions>\n"
},
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/configuration/host/host-slave.xml",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/configuration/host/host-slave.xml",
"diff": "~ limitations under the License.\n-->\n-<host xmlns=\"urn:jboss:domain:9.0\">\n+<host xmlns=\"urn:jboss:domain:10.0\">\n<extensions>\n<?EXTENSIONS?>\n</extensions>\n"
},
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/configuration/host/host.xml",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/configuration/host/host.xml",
"diff": "via host-slave.xml\n-->\n-<host name=\"master\" xmlns=\"urn:jboss:domain:9.0\">\n+<host name=\"master\" xmlns=\"urn:jboss:domain:10.0\">\n<extensions>\n<?EXTENSIONS?>\n</extensions>\n"
},
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/template.xml",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/template.xml",
"diff": "<?xml version='1.0' encoding='UTF-8'?>\n-<server xmlns=\"urn:jboss:domain:9.0\">\n+<server xmlns=\"urn:jboss:domain:10.0\">\n<extensions>\n<?EXTENSIONS?>\n"
},
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-clustered.cli",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-clustered.cli",
"diff": "@@ -578,4 +578,47 @@ if (outcome == failed) of /profile=$clusteredProfile/subsystem=logging/logger=io\necho\nend-if\n+# Migrate from 5.0.0 to 6.0.0\n+if (result == NON_XA) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=hibernate/local-cache=entity/component=transaction/:read-attribute(name=mode)\n+ echo Removing NON_XA transaction mode from infinispan/hibernate/entity\n+ /profile=$clusteredProfile/subsystem=infinispan/cache-container=hibernate/local-cache=entity/component=transaction/:undefine-attribute(name=mode)\n+ echo\n+end-if\n+\n+if (result == false) of /profile=$clusteredProfile/subsystem=datasources/data-source=ExampleDS/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to ExampleDS datasource\n+ /profile=$clusteredProfile/subsystem=datasources/data-source=ExampleDS/:write-attribute(name=statistics-enabled,value=${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /profile=$clusteredProfile/subsystem=datasources/data-source=KeycloakDS/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to KeycloakDS datasource\n+ /profile=$clusteredProfile/subsystem=datasources/data-source=KeycloakDS/:write-attribute(name=statistics-enabled,value=${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /profile=$clusteredProfile/subsystem=ejb3/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to ejb3 subsystem\n+ /profile=$clusteredProfile/subsystem=ejb3/:write-attribute(name=statistics-enabled,value=${wildfly.ejb3.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /profile=$clusteredProfile/subsystem=transactions/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to transactions subsystem\n+ /profile=$clusteredProfile/subsystem=transactions/:write-attribute(name=statistics-enabled,value=${wildfly.transactions.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /profile=$clusteredProfile/subsystem=undertow/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to undertow subsystem\n+ /profile=$clusteredProfile/subsystem=undertow/:write-attribute(name=statistics-enabled,value=${wildfly.undertow.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /profile=$clusteredProfile/subsystem=webservices/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to webservices subsystem\n+ /profile=$clusteredProfile/subsystem=webservices/:write-attribute(name=statistics-enabled,value=${wildfly.webservices.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\necho *** End Migration of /profile=$clusteredProfile ***\n"
},
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-standalone.cli",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-standalone.cli",
"diff": "@@ -503,4 +503,47 @@ if (outcome == failed) of /profile=$standaloneProfile/subsystem=logging/logger=i\necho\nend-if\n+# Migrate from 5.0.0 to 6.0.0\n+if (result == NON_XA) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=hibernate/local-cache=entity/component=transaction/:read-attribute(name=mode)\n+ echo Removing NON_XA transaction mode from infinispan/hibernate/entity\n+ /profile=$standaloneProfile/subsystem=infinispan/cache-container=hibernate/local-cache=entity/component=transaction/:undefine-attribute(name=mode)\n+ echo\n+end-if\n+\n+if (result == false) of /profile=$standaloneProfile/subsystem=datasources/data-source=ExampleDS/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to ExampleDS datasource\n+ /profile=$standaloneProfile/subsystem=datasources/data-source=ExampleDS/:write-attribute(name=statistics-enabled,value=${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /profile=$standaloneProfile/subsystem=datasources/data-source=KeycloakDS/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to KeycloakDS datasource\n+ /profile=$standaloneProfile/subsystem=datasources/data-source=KeycloakDS/:write-attribute(name=statistics-enabled,value=${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /profile=$standaloneProfile/subsystem=ejb3/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to ejb3 subsystem\n+ /profile=$standaloneProfile/subsystem=ejb3/:write-attribute(name=statistics-enabled,value=${wildfly.ejb3.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /profile=$standaloneProfile/subsystem=transactions/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to transactions subsystem\n+ /profile=$standaloneProfile/subsystem=transactions/:write-attribute(name=statistics-enabled,value=${wildfly.transactions.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /profile=$standaloneProfile/subsystem=undertow/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to undertow subsystem\n+ /profile=$standaloneProfile/subsystem=undertow/:write-attribute(name=statistics-enabled,value=${wildfly.undertow.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /profile=$standaloneProfile/subsystem=webservices/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to webservices subsystem\n+ /profile=$standaloneProfile/subsystem=webservices/:write-attribute(name=statistics-enabled,value=${wildfly.webservices.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\necho *** End Migration of /profile=$standaloneProfile ***\n"
},
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone-ha.cli",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone-ha.cli",
"diff": "@@ -574,4 +574,47 @@ if (outcome == failed) of /subsystem=logging/logger=io.jaegertracing.Configurati\necho\nend-if\n+# Migrate from 5.0.0 to 6.0.0\n+if (result == NON_XA) of /subsystem=infinispan/cache-container=hibernate/local-cache=entity/component=transaction/:read-attribute(name=mode)\n+ echo Removing NON_XA transaction mode from infinispan/hibernate/entity\n+ /subsystem=infinispan/cache-container=hibernate/local-cache=entity/component=transaction/:undefine-attribute(name=mode)\n+ echo\n+end-if\n+\n+if (result == false) of /subsystem=datasources/data-source=ExampleDS/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to ExampleDS datasource\n+ /subsystem=datasources/data-source=ExampleDS/:write-attribute(name=statistics-enabled,value=${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /subsystem=datasources/data-source=KeycloakDS/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to KeycloakDS datasource\n+ /subsystem=datasources/data-source=KeycloakDS/:write-attribute(name=statistics-enabled,value=${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /subsystem=ejb3/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to ejb3 subsystem\n+ /subsystem=ejb3/:write-attribute(name=statistics-enabled,value=${wildfly.ejb3.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /subsystem=transactions/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to transactions subsystem\n+ /subsystem=transactions/:write-attribute(name=statistics-enabled,value=${wildfly.transactions.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /subsystem=undertow/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to undertow subsystem\n+ /subsystem=undertow/:write-attribute(name=statistics-enabled,value=${wildfly.undertow.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /subsystem=webservices/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to webservices subsystem\n+ /subsystem=webservices/:write-attribute(name=statistics-enabled,value=${wildfly.webservices.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\necho *** End Migration ***\n"
},
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone.cli",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone.cli",
"diff": "@@ -463,4 +463,47 @@ if (outcome == failed) of /subsystem=logging/logger=io.jaegertracing.Configurati\necho\nend-if\n+# Migrate from 5.0.0 to 6.0.0\n+if (result == NON_XA) of /subsystem=infinispan/cache-container=hibernate/local-cache=entity/component=transaction/:read-attribute(name=mode)\n+ echo Removing NON_XA transaction mode from infinispan/hibernate/entity\n+ /subsystem=infinispan/cache-container=hibernate/local-cache=entity/component=transaction/:undefine-attribute(name=mode)\n+ echo\n+end-if\n+\n+if (result == false) of /subsystem=datasources/data-source=ExampleDS/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to ExampleDS datasource\n+ /subsystem=datasources/data-source=ExampleDS/:write-attribute(name=statistics-enabled,value=${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /subsystem=datasources/data-source=KeycloakDS/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to KeycloakDS datasource\n+ /subsystem=datasources/data-source=KeycloakDS/:write-attribute(name=statistics-enabled,value=${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /subsystem=ejb3/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to ejb3 subsystem\n+ /subsystem=ejb3/:write-attribute(name=statistics-enabled,value=${wildfly.ejb3.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /subsystem=transactions/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to transactions subsystem\n+ /subsystem=transactions/:write-attribute(name=statistics-enabled,value=${wildfly.transactions.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /subsystem=undertow/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to undertow subsystem\n+ /subsystem=undertow/:write-attribute(name=statistics-enabled,value=${wildfly.undertow.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\n+if (result == false) of /subsystem=webservices/:read-attribute(name=statistics-enabled)\n+ echo Adding statistics-enabled expression to webservices subsystem\n+ /subsystem=webservices/:write-attribute(name=statistics-enabled,value=${wildfly.webservices.statistics-enabled:${wildfly.statistics-enabled:false}})\n+ echo\n+end-if\n+\necho *** End Migration ***\n"
},
{
"change_type": "MODIFY",
"old_path": "examples/demo-template/third-party-cdi/pom.xml",
"new_path": "examples/demo-template/third-party-cdi/pom.xml",
"diff": "<dependency>\n<groupId>org.jboss.spec.javax.faces</groupId>\n<artifactId>jboss-jsf-api_2.3_spec</artifactId>\n- <version>2.3.5.SP1</version>\n+ <version>2.3.9.SP01</version>\n<scope>provided</scope>\n</dependency>\n<dependency>\n"
},
{
"change_type": "MODIFY",
"old_path": "pom.xml",
"new_path": "pom.xml",
"diff": "<parent>\n<groupId>org.jboss</groupId>\n<artifactId>jboss-parent</artifactId>\n- <version>28</version>\n+ <version>29</version>\n</parent>\n<name>Keycloak</name>\n<product.build-time>${timestamp}</product.build-time>\n- <wildfly.version>15.0.1.Final</wildfly.version>\n+ <wildfly.version>16.0.0.Final</wildfly.version>\n<wildfly.build-tools.version>1.2.10.Final</wildfly.build-tools.version>\n<eap.version>7.2.0.GA-redhat-00005</eap.version>\n<eap.build-tools.version>1.2.10.Final</eap.build-tools.version>\n- <wildfly.core.version>7.0.0.Final</wildfly.core.version>\n+ <wildfly.core.version>8.0.0.Final</wildfly.core.version>\n<jboss.as.version>7.2.0.Final</jboss.as.version>\n<!-- Versions used mostly for Undertow server, aligned with WildFly -->\n<jboss.aesh.version>0.66.19</jboss.aesh.version>\n- <aesh.version>1.8</aesh.version>\n- <aesh.readline.version>1.11</aesh.readline.version>\n+ <aesh.version>1.11</aesh.version>\n+ <aesh.readline.version>1.14</aesh.readline.version>\n<apache.httpcomponents.version>4.5.4</apache.httpcomponents.version>\n<apache.httpcomponents.httpcore.version>4.4.5</apache.httpcomponents.httpcore.version>\n<apache.mime4j.version>0.6</apache.mime4j.version>\n<jboss.dmr.version>1.5.0.Final</jboss.dmr.version>\n<bouncycastle.version>1.60</bouncycastle.version>\n- <cxf.version>3.2.5-jbossorg-1</cxf.version>\n+ <cxf.version>3.2.7</cxf.version>\n<dom4j.version>2.1.1</dom4j.version>\n<github.relaxng.version>2.3.1</github.relaxng.version>\n<h2.version>1.4.193</h2.version>\n<javax.persistence.version>2.2</javax.persistence.version>\n- <hibernate.core.version>5.3.7.Final</hibernate.core.version>\n- <hibernate.c3p0.version>5.3.7.Final</hibernate.c3p0.version>\n- <infinispan.version>9.4.3.Final</infinispan.version>\n- <jackson.version>2.9.5</jackson.version>\n+ <hibernate.core.version>5.3.9.Final</hibernate.core.version>\n+ <hibernate.c3p0.version>5.3.9.Final</hibernate.c3p0.version>\n+ <infinispan.version>9.4.8.Final</infinispan.version>\n+ <jackson.version>2.9.8</jackson.version>\n<javax.mail.version>1.6.2</javax.mail.version>\n<jboss.logging.version>3.3.2.Final</jboss.logging.version>\n<jboss.logging.tools.version>2.1.0.Final</jboss.logging.tools.version>\n<jboss.spec.javax.xml.bind.jboss-jaxb-api_2.3_spec.version>1.0.1.Final</jboss.spec.javax.xml.bind.jboss-jaxb-api_2.3_spec.version>\n<jboss.spec.javax.servlet.jsp.jboss-jsp-api_2.3_spec.version>1.0.3.Final</jboss.spec.javax.servlet.jsp.jboss-jsp-api_2.3_spec.version>\n<log4j.version>1.2.17</log4j.version>\n- <resteasy.version>3.6.2.Final</resteasy.version>\n- <resteasy.undertow.version>3.6.2.Final</resteasy.undertow.version>\n+ <resteasy.version>3.6.3.Final</resteasy.version>\n+ <resteasy.undertow.version>3.6.3.Final</resteasy.undertow.version>\n<owasp.html.sanitizer.version>20180219.1</owasp.html.sanitizer.version>\n<slf4j-api.version>1.7.22</slf4j-api.version>\n<slf4j.version>1.7.22</slf4j.version>\n<sun.istack.version>3.0.7</sun.istack.version>\n<sun.jaxb.version>2.3.1</sun.jaxb.version>\n<org.glassfish.jaxb.xsom.version>2.3.1</org.glassfish.jaxb.xsom.version>\n- <undertow.version>2.0.15.Final</undertow.version>\n- <elytron.version>1.7.0.Final</elytron.version>\n- <elytron.undertow-server.version>1.3.0.Final</elytron.undertow-server.version>\n+ <undertow.version>2.0.19.Final</undertow.version>\n+ <elytron.version>1.8.0.Final</elytron.version>\n+ <elytron.undertow-server.version>1.4.0.Final</elytron.undertow-server.version>\n<jetty81.version>8.1.17.v20150415</jetty81.version>\n<jetty91.version>9.1.5.v20140505</jetty91.version>\n<jetty92.version>9.2.4.v20141103</jetty92.version>\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/pom.xml",
"new_path": "testsuite/integration-arquillian/pom.xml",
"diff": "<app.server>undertow</app.server>\n<!-- Wildfly deprecated versions -->\n- <wildfly.deprecated.version>14.0.1.Final</wildfly.deprecated.version>\n- <wildfly.deprecated.wildfly.core.version>6.0.2.Final</wildfly.deprecated.wildfly.core.version>\n- <wildfly.deprecated.arquillian.wildfly.container>2.1.0.Final</wildfly.deprecated.arquillian.wildfly.container>\n+ <wildfly.deprecated.version>15.0.1.Final</wildfly.deprecated.version>\n+ <wildfly.deprecated.wildfly.core.version>7.0.0.Final</wildfly.deprecated.wildfly.core.version>\n+ <wildfly.deprecated.arquillian.wildfly.container>2.1.1.Final</wildfly.deprecated.arquillian.wildfly.container>\n<!--component versions-->\n<!--\n"
},
{
"change_type": "MODIFY",
"old_path": "wildfly/adduser/src/main/java/org/keycloak/wildfly/adduser/AddUser.java",
"new_path": "wildfly/adduser/src/main/java/org/keycloak/wildfly/adduser/AddUser.java",
"diff": "@@ -19,14 +19,9 @@ package org.keycloak.wildfly.adduser;\nimport com.fasterxml.jackson.core.type.TypeReference;\nimport org.aesh.command.CommandDefinition;\n-import org.aesh.command.impl.activator.AeshCommandActivatorProvider;\n-import org.aesh.command.impl.activator.AeshOptionActivatorProvider;\n-import org.aesh.command.impl.completer.AeshCompleterInvocationProvider;\nimport org.aesh.command.impl.container.AeshCommandContainerBuilder;\n-import org.aesh.command.impl.converter.AeshConverterInvocationProvider;\nimport org.aesh.command.impl.invocation.AeshInvocationProviders;\nimport org.aesh.command.impl.parser.CommandLineParser;\n-import org.aesh.command.impl.validator.AeshValidatorInvocationProvider;\nimport org.aesh.command.invocation.InvocationProviders;\nimport org.aesh.command.option.Option;\nimport org.aesh.command.Command;\n@@ -35,8 +30,8 @@ import org.aesh.command.CommandResult;\nimport org.aesh.command.container.CommandContainer;\nimport org.aesh.command.invocation.CommandInvocation;\nimport org.aesh.command.impl.registry.AeshCommandRegistryBuilder;\n-import org.aesh.command.parser.CommandLineParserException;\nimport org.aesh.command.registry.CommandRegistry;\n+import org.aesh.command.registry.CommandRegistryException;\nimport org.aesh.command.settings.Settings;\nimport org.aesh.command.settings.SettingsBuilder;\nimport org.aesh.readline.AeshContext;\n@@ -274,7 +269,7 @@ public class AddUser {\nreturn new String(passwordArray);\n}\n- private static void printHelp(Command command) throws CommandNotFoundException, CommandLineParserException {\n+ private static void printHelp(Command command) throws CommandNotFoundException, CommandRegistryException {\nCommandRegistry registry = new AeshCommandRegistryBuilder().command(command).create();\nCommandContainer commandContainer = registry.getCommand(command.getClass().getAnnotation(CommandDefinition.class).name(), null);\nString help = commandContainer.printHelp(null);\n"
},
{
"change_type": "MODIFY",
"old_path": "wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-datasources.xml",
"new_path": "wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-datasources.xml",
"diff": "<extension-module>org.jboss.as.connector</extension-module>\n<subsystem xmlns=\"urn:jboss:domain:datasources:5.0\">\n<datasources>\n- <datasource jndi-name=\"java:jboss/datasources/ExampleDS\" pool-name=\"ExampleDS\" enabled=\"true\" use-java-context=\"true\">\n+ <datasource jndi-name=\"java:jboss/datasources/ExampleDS\" pool-name=\"ExampleDS\" enabled=\"true\" use-java-context=\"true\" statistics-enabled=\"${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}\">\n<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>\n<driver>h2</driver>\n<security>\n<password>sa</password>\n</security>\n</datasource>\n- <datasource jndi-name=\"java:jboss/datasources/KeycloakDS\" pool-name=\"KeycloakDS\" enabled=\"true\" use-java-context=\"true\">\n+ <datasource jndi-name=\"java:jboss/datasources/KeycloakDS\" pool-name=\"KeycloakDS\" enabled=\"true\" use-java-context=\"true\" statistics-enabled=\"${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}\">\n<connection-url><?KEYCLOAK_DS_CONNECTION_URL?></connection-url>\n<driver>h2</driver>\n<security>\n"
},
{
"change_type": "MODIFY",
"old_path": "wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-infinispan.xml",
"new_path": "wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-infinispan.xml",
"diff": "<!-- See src/resources/configuration/ReadMe.txt for how the configuration assembly works -->\n<config default-supplement=\"default\">\n<extension-module>org.jboss.as.clustering.infinispan</extension-module>\n- <subsystem xmlns=\"urn:jboss:domain:infinispan:7.0\">\n+ <subsystem xmlns=\"urn:jboss:domain:infinispan:8.0\">\n<?CACHE-CONTAINERS?>\n</subsystem>\n<supplement name=\"default\">\n</cache-container>\n<cache-container name=\"hibernate\" module=\"org.infinispan.hibernate-cache\">\n<local-cache name=\"entity\">\n- <transaction mode=\"NON_XA\"/>\n<object-memory size=\"10000\"/>\n<expiration max-idle=\"100000\"/>\n</local-cache>\n"
},
{
"change_type": "MODIFY",
"old_path": "wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-undertow.xml",
"new_path": "wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-undertow.xml",
"diff": "<!-- See src/resources/configuration/ReadMe.txt for how the configuration assembly works -->\n<config>\n<extension-module>org.wildfly.extension.undertow</extension-module>\n- <subsystem xmlns=\"urn:jboss:domain:undertow:8.0\" default-server=\"default-server\" default-virtual-host=\"default-host\" default-servlet-container=\"default\" default-security-domain=\"other\">\n+ <subsystem xmlns=\"urn:jboss:domain:undertow:8.0\" default-server=\"default-server\" default-virtual-host=\"default-host\" default-servlet-container=\"default\" default-security-domain=\"other\" statistics-enabled=\"${wildfly.undertow.statistics-enabled:${wildfly.statistics-enabled:false}}\">\n<buffer-cache name=\"default\"/>\n<server name=\"default-server\">\n<?AJP?>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9709 Upgrade to Wildfly 16 |
339,281 | 07.03.2019 09:18:29 | -3,600 | 3cc405b1c582c1e512cfa76922200d7b7e21254e | Remove resteasy workaround - KeycloakStringEntityFilter | [
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak/org/keycloak/keycloak-server-subsystem/main/server-war/WEB-INF/web.xml",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak/org/keycloak/keycloak-server-subsystem/main/server-war/WEB-INF/web.xml",
"diff": "<async-supported>true</async-supported>\n</servlet>\n+ <context-param>\n+ <param-name>resteasy.disable.html.sanitizer</param-name>\n+ <param-value>true</param-value>\n+ </context-param>\n+\n<listener>\n<listener-class>org.keycloak.services.listeners.KeycloakSessionDestroyListener</listener-class>\n</listener>\n"
},
{
"change_type": "DELETE",
"old_path": "services/src/main/java/org/keycloak/services/filters/KeycloakStringEntityFilter.java",
"new_path": null,
"diff": "-/*\n- * Copyright 2017 Red Hat, Inc. and/or its affiliates\n- * and other contributors as indicated by the @author tags.\n- *\n- * Licensed under the Apache License, Version 2.0 (the \"License\");\n- * you may not use this file except in compliance with the License.\n- * You may obtain a copy of the License at\n- *\n- * http://www.apache.org/licenses/LICENSE-2.0\n- *\n- * Unless required by applicable law or agreed to in writing, software\n- * distributed under the License is distributed on an \"AS IS\" BASIS,\n- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n- * See the License for the specific language governing permissions and\n- * limitations under the License.\n- */\n-\n-package org.keycloak.services.filters;\n-\n-import java.io.IOException;\n-import java.nio.charset.StandardCharsets;\n-\n-import javax.ws.rs.container.ContainerRequestContext;\n-import javax.ws.rs.container.ContainerResponseContext;\n-import javax.ws.rs.container.ContainerResponseFilter;\n-\n-/**\n- * Workaround for KEYCLOAK-8461\n- *\n- * @author <a href=\"mailto:[email protected]\">Marek Posolda</a>\n- */\n-public class KeycloakStringEntityFilter implements ContainerResponseFilter {\n-\n- @Override\n- public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException {\n- if (responseContext.getStatus() == 400 && responseContext.hasEntity()) {\n- Object entity = responseContext.getEntity();\n- if (entity instanceof String) {\n- // Need to convert String to bytes, so that RestEasy won't escape it\n- responseContext.setEntity(responseContext.getEntity().toString().getBytes(StandardCharsets.UTF_8));\n- }\n- }\n- }\n-\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java",
"new_path": "services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java",
"diff": "@@ -43,7 +43,6 @@ import org.keycloak.representations.idm.UserRepresentation;\nimport org.keycloak.services.DefaultKeycloakSessionFactory;\nimport org.keycloak.services.ServicesLogger;\nimport org.keycloak.services.error.KeycloakErrorHandler;\n-import org.keycloak.services.filters.KeycloakStringEntityFilter;\nimport org.keycloak.services.filters.KeycloakTransactionCommitter;\nimport org.keycloak.services.managers.ApplianceBootstrap;\nimport org.keycloak.services.managers.RealmManager;\n@@ -128,10 +127,6 @@ public class KeycloakApplication extends Application {\nclasses.add(JsResource.class);\nclasses.add(KeycloakTransactionCommitter.class);\n-\n- // Workaround for KEYCLOAK-8461. TODO: Remove it once corresponding issue is fixed in Wildfly/Resteasy\n- classes.add(KeycloakStringEntityFilter.class);\n-\nclasses.add(KeycloakErrorHandler.class);\nsingletons.add(new ObjectMapperResolver(Boolean.parseBoolean(System.getProperty(\"keycloak.jsonPrettyPrint\", \"false\"))));\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/KeycloakOnUndertow.java",
"new_path": "testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/KeycloakOnUndertow.java",
"diff": "@@ -36,6 +36,7 @@ import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext;\nimport org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData;\nimport org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet;\nimport org.jboss.logging.Logger;\n+import org.jboss.resteasy.plugins.server.servlet.ResteasyContextParameters;\nimport org.jboss.resteasy.plugins.server.undertow.UndertowJaxrsServer;\nimport org.jboss.resteasy.spi.ResteasyDeployment;\nimport org.jboss.shrinkwrap.api.Archive;\n@@ -78,6 +79,9 @@ public class KeycloakOnUndertow implements DeployableContainer<KeycloakOnUnderto\nResteasyDeployment deployment = new ResteasyDeployment();\ndeployment.setApplicationClass(KeycloakApplication.class.getName());\n+ // RESTEASY-2034\n+ deployment.setProperty(ResteasyContextParameters.RESTEASY_DISABLE_HTML_SANITIZER, true);\n+\nDeploymentInfo di = undertow.undertowDeployment(deployment);\ndi.setClassLoader(getClass().getClassLoader());\ndi.setContextPath(\"/auth\");\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/pom.xml",
"new_path": "testsuite/integration-arquillian/tests/pom.xml",
"diff": "<auth.server.config.property.value>standalone.xml</auth.server.config.property.value>\n<auth.server.config.dir>${auth.server.home}/standalone/configuration</auth.server.config.dir>\n<h2.version>1.3.173</h2.version>\n+ <surefire.memory.settings>-Xms512m -Xmx1024m -XX:MetaspaceSize=96m -XX:MaxMetaspaceSize=256m</surefire.memory.settings>\n</properties>\n<dependencies>\n<dependency>\n<auth.server.config.property.value>standalone.xml</auth.server.config.property.value>\n<auth.server.config.dir>${auth.server.home}/standalone/configuration</auth.server.config.dir>\n<h2.version>1.3.173</h2.version>\n+ <surefire.memory.settings>-Xms512m -Xmx1024m -XX:MetaspaceSize=96m -XX:MaxMetaspaceSize=256m</surefire.memory.settings>\n</properties>\n<dependencies>\n<dependency>\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8542 Remove resteasy workaround - KeycloakStringEntityFilter |
339,235 | 15.03.2019 13:38:40 | -3,600 | 8d42c9193b9185625157d57cefbb15ab580d7a86 | Trim username in admin welcome page | [
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/services/resources/WelcomeResource.java",
"new_path": "services/src/main/java/org/keycloak/services/resources/WelcomeResource.java",
"diff": "@@ -119,6 +119,10 @@ public class WelcomeResource {\nString password = formData.getFirst(\"password\");\nString passwordConfirmation = formData.getFirst(\"passwordConfirmation\");\n+ if (username != null) {\n+ username = username.trim();\n+ }\n+\nif (username == null || username.length() == 0) {\nreturn createWelcomePage(null, \"Username is missing\");\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9838 Trim username in admin welcome page |
339,281 | 07.03.2019 10:05:17 | -3,600 | 5808ad2de0f9b9fc4fb95f6250bcc4e1da74a20b | Enable SmallRye Health and Metrics extensions | [
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/configuration/domain/subsystems.xml",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/configuration/domain/subsystems.xml",
"diff": "<subsystem>security.xml</subsystem>\n<subsystem>security-manager.xml</subsystem>\n<subsystem>transactions.xml</subsystem>\n+ <subsystem>microprofile-config-smallrye.xml</subsystem>\n+ <subsystem>microprofile-health-smallrye.xml</subsystem>\n+ <subsystem>microprofile-metrics-smallrye.xml</subsystem>\n<subsystem>keycloak-undertow.xml</subsystem>\n<subsystem>keycloak-server.xml</subsystem>\n</subsystems>\n<subsystem>security.xml</subsystem>\n<subsystem>security-manager.xml</subsystem>\n<subsystem>transactions.xml</subsystem>\n+ <subsystem>microprofile-config-smallrye.xml</subsystem>\n+ <subsystem>microprofile-health-smallrye.xml</subsystem>\n+ <subsystem>microprofile-metrics-smallrye.xml</subsystem>\n<subsystem supplement=\"ha\">keycloak-undertow.xml</subsystem>\n<subsystem>keycloak-server.xml</subsystem>\n</subsystems>\n"
},
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/subsystems-ha.xml",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/subsystems-ha.xml",
"diff": "<subsystem supplement=\"standalone-wildfly\">elytron.xml</subsystem>\n<subsystem>security.xml</subsystem>\n<subsystem>transactions.xml</subsystem>\n+ <subsystem>microprofile-config-smallrye.xml</subsystem>\n+ <subsystem>microprofile-health-smallrye.xml</subsystem>\n+ <subsystem>microprofile-metrics-smallrye.xml</subsystem>\n<subsystem supplement=\"ha\">keycloak-undertow.xml</subsystem>\n<subsystem>keycloak-server.xml</subsystem>\n</subsystems>\n"
},
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/subsystems.xml",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/configuration/standalone/subsystems.xml",
"diff": "<subsystem supplement=\"standalone-wildfly\">elytron.xml</subsystem>\n<subsystem>security.xml</subsystem>\n<subsystem>transactions.xml</subsystem>\n+ <subsystem>microprofile-config-smallrye.xml</subsystem>\n+ <subsystem>microprofile-health-smallrye.xml</subsystem>\n+ <subsystem>microprofile-metrics-smallrye.xml</subsystem>\n<subsystem>keycloak-undertow.xml</subsystem>\n<subsystem>keycloak-server.xml</subsystem>\n</subsystems>\n"
},
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-clustered.cli",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-clustered.cli",
"diff": "@@ -621,4 +621,50 @@ if (result == false) of /profile=$clusteredProfile/subsystem=webservices/:read-a\necho\nend-if\n+if (outcome == failed) of /profile=$clusteredProfile/subsystem=microprofile-config-smallrye/:read-resource\n+ try\n+ echo Trying to add microprofile-config-smallrye extension\n+ /extension=org.wildfly.extension.microprofile.config-smallrye/:add(module=org.wildfly.extension.microprofile.config-smallrye)\n+ echo\n+ catch\n+ echo Wasn't able to add microprofile-config-smallrye extension, it should be already added by migrate-domain-standalone.cli\n+ echo\n+ end-try\n+ echo Adding microprofile-config-smallrye subsystem\n+ /profile=$clusteredProfile/subsystem=microprofile-config-smallrye/:add\n+ echo\n+end-if\n+\n+if (outcome == failed) of /profile=$clusteredProfile/subsystem=microprofile-health-smallrye/:read-resource\n+ try\n+ echo Trying to add microprofile-health-smallrye extension\n+ /extension=org.wildfly.extension.microprofile.health-smallrye/:add(module=org.wildfly.extension.microprofile.health-smallrye)\n+ echo\n+ catch\n+ echo Wasn't able to add microprofile-health-smallrye extension, it should be already added by migrate-domain-standalone.cli\n+ echo\n+ end-try\n+ echo Adding microprofile-health-smallrye subsystem\n+ /profile=$clusteredProfile/subsystem=microprofile-health-smallrye/:add\n+ /profile=$clusteredProfile/subsystem=microprofile-health-smallrye/:write-attribute(name=security-enabled,value=false)\n+ echo\n+end-if\n+\n+if (outcome == failed) of /profile=$clusteredProfile/subsystem=microprofile-metrics-smallrye/:read-resource\n+ try\n+ echo Trying to add microprofile-metrics-smallrye extension\n+ /extension=org.wildfly.extension.microprofile.metrics-smallrye/:add(module=org.wildfly.extension.microprofile.metrics-smallrye)\n+ echo\n+ catch\n+ echo Wasn't able to add microprofile-metrics-smallrye extension, it should be already added by migrate-domain-standalone.cli\n+ echo\n+ end-try\n+ echo Adding microprofile-metrics-smallrye subsystem\n+ /profile=$clusteredProfile/subsystem=microprofile-metrics-smallrye/:add\n+ /profile=$clusteredProfile/subsystem=microprofile-metrics-smallrye/:write-attribute(name=security-enabled,value=false)\n+ /profile=$clusteredProfile/subsystem=microprofile-metrics-smallrye/:write-attribute(name=exposed-subsystems,value=[*])\n+ /profile=$clusteredProfile/subsystem=microprofile-metrics-smallrye/:write-attribute(name=prefix,value=${wildfly.metrics.prefix:wildfly})\n+ echo\n+end-if\n+\necho *** End Migration of /profile=$clusteredProfile ***\n"
},
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-standalone.cli",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-standalone.cli",
"diff": "@@ -546,4 +546,50 @@ if (result == false) of /profile=$standaloneProfile/subsystem=webservices/:read-\necho\nend-if\n+if (outcome == failed) of /profile=$standaloneProfile/subsystem=microprofile-config-smallrye/:read-resource\n+ try\n+ echo Trying to add microprofile-config-smallrye extension\n+ /extension=org.wildfly.extension.microprofile.config-smallrye/:add(module=org.wildfly.extension.microprofile.config-smallrye)\n+ echo\n+ catch\n+ echo Wasn't able to add microprofile-config-smallrye extension, it should be already added by migrate-domain-clustered.cli\n+ echo\n+ end-try\n+ echo Adding microprofile-config-smallrye subsystem\n+ /profile=$standaloneProfile/subsystem=microprofile-config-smallrye/:add\n+ echo\n+end-if\n+\n+if (outcome == failed) of /profile=$standaloneProfile/subsystem=microprofile-health-smallrye/:read-resource\n+ try\n+ echo Trying to add microprofile-health-smallrye extension\n+ /extension=org.wildfly.extension.microprofile.health-smallrye/:add(module=org.wildfly.extension.microprofile.health-smallrye)\n+ echo\n+ catch\n+ echo Wasn't able to add microprofile-health-smallrye extension, it should be already added by migrate-domain-clustered.cli\n+ echo\n+ end-try\n+ echo Adding microprofile-health-smallrye subsystem\n+ /profile=$standaloneProfile/subsystem=microprofile-health-smallrye/:add\n+ /profile=$standaloneProfile/subsystem=microprofile-health-smallrye/:write-attribute(name=security-enabled,value=false)\n+ echo\n+end-if\n+\n+if (outcome == failed) of /profile=$standaloneProfile/subsystem=microprofile-metrics-smallrye/:read-resource\n+ try\n+ echo Trying to add microprofile-metrics-smallrye extension\n+ /extension=org.wildfly.extension.microprofile.metrics-smallrye/:add(module=org.wildfly.extension.microprofile.metrics-smallrye)\n+ echo\n+ catch\n+ echo Wasn't able to add microprofile-metrics-smallrye extension, it should be already added by migrate-domain-clustered.cli\n+ echo\n+ end-try\n+ echo Adding microprofile-metrics-smallrye subsystem\n+ /profile=$standaloneProfile/subsystem=microprofile-metrics-smallrye/:add\n+ /profile=$standaloneProfile/subsystem=microprofile-metrics-smallrye/:write-attribute(name=security-enabled,value=false)\n+ /profile=$standaloneProfile/subsystem=microprofile-metrics-smallrye/:write-attribute(name=exposed-subsystems,value=[*])\n+ /profile=$standaloneProfile/subsystem=microprofile-metrics-smallrye/:write-attribute(name=prefix,value=${wildfly.metrics.prefix:wildfly})\n+ echo\n+end-if\n+\necho *** End Migration of /profile=$standaloneProfile ***\n"
},
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone-ha.cli",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone-ha.cli",
"diff": "@@ -617,4 +617,44 @@ if (result == false) of /subsystem=webservices/:read-attribute(name=statistics-e\necho\nend-if\n+if (outcome == failed) of /extension=org.wildfly.extension.microprofile.config-smallrye/:read-resource\n+ echo Adding microprofile.config-smallrye extension...\n+ /extension=org.wildfly.extension.microprofile.config-smallrye/:add(module=org.wildfly.extension.microprofile.config-smallrye)\n+ echo\n+end-if\n+\n+if (outcome == failed) of /subsystem=microprofile-config-smallrye/:read-resource\n+ echo Adding microprofile-config-smallrye subsystem\n+ /subsystem=microprofile-config-smallrye/:add\n+ echo\n+end-if\n+\n+if (outcome == failed) of /extension=org.wildfly.extension.microprofile.health-smallrye/:read-resource\n+ echo Adding microprofile.health-smallrye extension...\n+ /extension=org.wildfly.extension.microprofile.health-smallrye/:add(module=org.wildfly.extension.microprofile.health-smallrye)\n+ echo\n+end-if\n+\n+if (outcome == failed) of /subsystem=microprofile-health-smallrye/:read-resource\n+ echo Adding microprofile-health-smallrye subsystem\n+ /subsystem=microprofile-health-smallrye/:add\n+ /subsystem=microprofile-health-smallrye/:write-attribute(name=security-enabled,value=false)\n+ echo\n+end-if\n+\n+if (outcome == failed) of /extension=org.wildfly.extension.microprofile.metrics-smallrye/:read-resource\n+ echo Adding microprofile.metrics-smallrye extension...\n+ /extension=org.wildfly.extension.microprofile.metrics-smallrye/:add(module=org.wildfly.extension.microprofile.metrics-smallrye)\n+ echo\n+end-if\n+\n+if (outcome == failed) of /subsystem=microprofile-metrics-smallrye/:read-resource\n+ echo Adding microprofile-metrics-smallrye subsystem\n+ /subsystem=microprofile-metrics-smallrye/:add\n+ /subsystem=microprofile-metrics-smallrye/:write-attribute(name=security-enabled,value=false)\n+ /subsystem=microprofile-metrics-smallrye/:write-attribute(name=exposed-subsystems,value=[*])\n+ /subsystem=microprofile-metrics-smallrye/:write-attribute(name=prefix,value=${wildfly.metrics.prefix:wildfly})\n+ echo\n+end-if\n+\necho *** End Migration ***\n"
},
{
"change_type": "MODIFY",
"old_path": "distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone.cli",
"new_path": "distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone.cli",
"diff": "@@ -506,4 +506,44 @@ if (result == false) of /subsystem=webservices/:read-attribute(name=statistics-e\necho\nend-if\n+if (outcome == failed) of /extension=org.wildfly.extension.microprofile.health-smallrye/:read-resource\n+ echo Adding microprofile.health-smallrye extension...\n+ /extension=org.wildfly.extension.microprofile.health-smallrye/:add(module=org.wildfly.extension.microprofile.health-smallrye)\n+ echo\n+end-if\n+\n+if (outcome == failed) of /subsystem=microprofile-health-smallrye/:read-resource\n+ echo Adding microprofile-health-smallrye subsystem\n+ /subsystem=microprofile-health-smallrye/:add\n+ /subsystem=microprofile-health-smallrye/:write-attribute(name=security-enabled,value=false)\n+ echo\n+end-if\n+\n+if (outcome == failed) of /extension=org.wildfly.extension.microprofile.config-smallrye/:read-resource\n+ echo Adding microprofile.config-smallrye extension...\n+ /extension=org.wildfly.extension.microprofile.config-smallrye/:add(module=org.wildfly.extension.microprofile.config-smallrye)\n+ echo\n+end-if\n+\n+if (outcome == failed) of /subsystem=microprofile-config-smallrye/:read-resource\n+ echo Adding microprofile-config-smallrye subsystem\n+ /subsystem=microprofile-config-smallrye/:add\n+ echo\n+end-if\n+\n+if (outcome == failed) of /extension=org.wildfly.extension.microprofile.metrics-smallrye/:read-resource\n+ echo Adding microprofile.metrics-smallrye extension...\n+ /extension=org.wildfly.extension.microprofile.metrics-smallrye/:add(module=org.wildfly.extension.microprofile.metrics-smallrye)\n+ echo\n+end-if\n+\n+if (outcome == failed) of /subsystem=microprofile-metrics-smallrye/:read-resource\n+ echo Adding microprofile-metrics-smallrye subsystem\n+ /subsystem=microprofile-metrics-smallrye/:add\n+ /subsystem=microprofile-metrics-smallrye/:write-attribute(name=security-enabled,value=false)\n+ /subsystem=microprofile-metrics-smallrye/:write-attribute(name=exposed-subsystems,value=[*])\n+ /subsystem=microprofile-metrics-smallrye/:write-attribute(name=prefix,value=${wildfly.metrics.prefix:wildfly})\n+ echo\n+end-if\n+\necho *** End Migration ***\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/metrics/MetricsRestServiceTest.java",
"diff": "+/*\n+ * Copyright 2019 Red Hat, Inc. and/or its affiliates\n+ * and other contributors as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.keycloak.testsuite.metrics;\n+\n+import java.util.List;\n+import javax.ws.rs.client.Client;\n+import javax.ws.rs.client.ClientBuilder;\n+import javax.ws.rs.core.Response;\n+import javax.ws.rs.core.Response.Status;\n+\n+import org.junit.Assert;\n+import org.junit.BeforeClass;\n+import org.junit.Test;\n+import org.keycloak.representations.idm.RealmRepresentation;\n+import org.keycloak.testsuite.AbstractKeycloakTest;\n+import org.keycloak.testsuite.util.ContainerAssume;\n+\n+import static org.hamcrest.Matchers.containsString;\n+import static org.keycloak.testsuite.util.Matchers.body;\n+import static org.keycloak.testsuite.util.Matchers.statusCodeIs;\n+\n+public class MetricsRestServiceTest extends AbstractKeycloakTest {\n+\n+ private static final String MGMT_PORT = System.getProperty(\"auth.server.management.port\", \"10090\");\n+\n+ @Override\n+ public void addTestRealms(List<RealmRepresentation> testRealms) {\n+ // no test realms\n+ }\n+\n+ @BeforeClass\n+ public static void enabled() {\n+ ContainerAssume.assumeNotAuthServerUndertow();\n+ }\n+\n+ @Test\n+ public void testHealthEndpoint() {\n+ Client client = ClientBuilder.newClient();\n+\n+ try (Response response = client.target(\"http://localhost:\" + MGMT_PORT + \"/health\").request().get()) {\n+ Assert.assertThat(response, statusCodeIs(Status.OK));\n+ Assert.assertThat(response, body(containsString(\"{\\\"outcome\\\":\\\"UP\\\",\\\"checks\\\":[]}\")));\n+ } finally {\n+ client.close();\n+ }\n+ }\n+\n+ @Test\n+ public void testMetricsEndpoint() {\n+ Client client = ClientBuilder.newClient();\n+\n+ try (Response response = client.target(\"http://localhost:\" + MGMT_PORT + \"/metrics\").request().get()) {\n+ Assert.assertThat(response, statusCodeIs(Status.OK));\n+ Assert.assertThat(response, body(containsString(\"base:classloader_total_loaded_class_count\")));\n+ } finally {\n+ client.close();\n+ }\n+ }\n+}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9708 Enable SmallRye Health and Metrics extensions |
339,440 | 07.03.2019 22:11:05 | -32,400 | a868b8b22af29c909c9fe88704de0c8371c4f665 | Permissions are duplicated
when resource server is current user | [
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/authorization/util/Permissions.java",
"new_path": "services/src/main/java/org/keycloak/authorization/util/Permissions.java",
"diff": "@@ -44,7 +44,6 @@ import org.keycloak.representations.idm.authorization.AuthorizationRequest.Metad\n* @author <a href=\"mailto:[email protected]\">Pedro Igor</a>\n*/\npublic final class Permissions {\n-\npublic static ResourcePermission permission(ResourceServer server, Resource resource, Scope scope) {\nreturn new ResourcePermission(resource, new ArrayList<>(Arrays.asList(scope)), server);\n}\n@@ -80,12 +79,15 @@ public final class Permissions {\n}\n});\n+ // resource server isn't current user\n+ if (resourceServer.getId() != identity.getId()) {\n// obtain all resources where owner is the current user\nresourceStore.findByOwner(identity.getId(), resourceServer.getId(), resource -> {\nif (limit.decrementAndGet() >= 0) {\npermissions.add(createResourcePermissions(resource, authorization, request));\n}\n});\n+ }\n// obtain all resources granted to the user via permission tickets (uma)\nList<PermissionTicket> tickets = storeFactory.getPermissionTicketStore().findGranted(identity.getId(), resourceServer.getId());\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/AuthzClientCredentialsTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/AuthzClientCredentialsTest.java",
"diff": "@@ -165,7 +165,6 @@ public class AuthzClientCredentialsTest extends AbstractAuthzTest {\nprotection.resource().findByName(\"Default Resource\");\nuserSessions = clients.get(clientRepresentation.getId()).getUserSessions(null, null);\n-\nassertEquals(1, userSessions.size());\nThread.sleep(2000);\n@@ -177,6 +176,23 @@ public class AuthzClientCredentialsTest extends AbstractAuthzTest {\nassertEquals(1, userSessions.size());\n}\n+ @Test\n+ public void testPermissionWhenResourceServerIsCurrentUser() throws Exception {\n+ ClientsResource clients = getAdminClient().realm(\"authz-test-session\").clients();\n+ ClientRepresentation clientRepresentation = clients.findByClientId(\"resource-server-test\").get(0);\n+ List<UserSessionRepresentation> userSessions = clients.get(clientRepresentation.getId()).getUserSessions(-1, -1);\n+\n+ assertEquals(0, userSessions.size());\n+\n+ AuthzClient authzClient = getAuthzClient(\"default-session-keycloak.json\");\n+ org.keycloak.authorization.client.resource.AuthorizationResource authorization = authzClient.authorization(authzClient.obtainAccessToken().getToken());\n+ AuthorizationResponse response = authorization.authorize();\n+ AccessToken accessToken = toAccessToken(response.getToken());\n+\n+ assertEquals(1, accessToken.getAuthorization().getPermissions().size());\n+ assertEquals(\"Default Resource\", accessToken.getAuthorization().getPermissions().iterator().next().getResourceName());\n+ }\n+\n@Test\npublic void testSingleSessionPerUser() throws Exception {\nClientsResource clients = getAdminClient().realm(\"authz-test-session\").clients();\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | [KEYCLOAK-9772] Permissions are duplicated
- when resource server is current user |
339,185 | 18.03.2019 13:17:20 | -3,600 | 1c906c834beb8721790ee06fc427dbca946d8477 | Remove SAML IdP descriptor from client installation and publicize it in realm endpoint instead | [
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/protocol/saml/SamlService.java",
"new_path": "services/src/main/java/org/keycloak/protocol/saml/SamlService.java",
"diff": "@@ -37,7 +37,6 @@ import org.keycloak.events.Details;\nimport org.keycloak.events.Errors;\nimport org.keycloak.events.EventBuilder;\nimport org.keycloak.events.EventType;\n-import org.keycloak.keys.RsaKeyMetadata;\nimport org.keycloak.models.AuthenticatedClientSessionModel;\nimport org.keycloak.models.ClientModel;\nimport org.keycloak.models.KeyManager;\n@@ -80,6 +79,9 @@ import java.util.Properties;\nimport java.util.Set;\nimport java.util.TreeSet;\nimport org.keycloak.common.util.StringPropertyReplacer;\n+import org.keycloak.crypto.Algorithm;\n+import org.keycloak.crypto.KeyUse;\n+import org.keycloak.crypto.KeyWrapper;\nimport org.keycloak.dom.saml.v2.metadata.KeyTypes;\nimport org.keycloak.rotation.HardcodedKeyLocator;\nimport org.keycloak.rotation.KeyLocator;\n@@ -87,6 +89,8 @@ import org.keycloak.saml.SPMetadataDescriptor;\nimport org.keycloak.saml.processing.core.util.KeycloakKeySamlExtensionGenerator;\nimport org.keycloak.saml.validators.DestinationValidator;\nimport org.keycloak.sessions.AuthenticationSessionModel;\n+import java.nio.charset.StandardCharsets;\n+import java.util.logging.Level;\n/**\n* Resource class for the saml connect token service\n@@ -590,27 +594,33 @@ public class SamlService extends AuthorizationEndpointBase {\n}\n- public static String getIDPMetadataDescriptor(UriInfo uriInfo, KeycloakSession session, RealmModel realm) throws IOException {\n+ public static String getIDPMetadataDescriptor(UriInfo uriInfo, KeycloakSession session, RealmModel realm) {\nInputStream is = SamlService.class.getResourceAsStream(\"/idp-metadata-template.xml\");\n- String template = StreamUtil.readString(is);\n+ String template;\n+ try {\n+ template = StreamUtil.readString(is, StandardCharsets.UTF_8);\n+ } catch (IOException ex) {\n+ logger.error(\"Cannot generate IdP metadata\", ex);\n+ return \"\";\n+ }\nProperties props = new Properties();\nprops.put(\"idp.entityID\", RealmsResource.realmBaseUrl(uriInfo).build(realm.getName()).toString());\nprops.put(\"idp.sso.HTTP-POST\", RealmsResource.protocolUrl(uriInfo).build(realm.getName(), SamlProtocol.LOGIN_PROTOCOL).toString());\nprops.put(\"idp.sso.HTTP-Redirect\", RealmsResource.protocolUrl(uriInfo).build(realm.getName(), SamlProtocol.LOGIN_PROTOCOL).toString());\nprops.put(\"idp.sls.HTTP-POST\", RealmsResource.protocolUrl(uriInfo).build(realm.getName(), SamlProtocol.LOGIN_PROTOCOL).toString());\nStringBuilder keysString = new StringBuilder();\n- Set<RsaKeyMetadata> keys = new TreeSet<>((o1, o2) -> o1.getStatus() == o2.getStatus() // Status can be only PASSIVE OR ACTIVE, push PASSIVE to end of list\n+ Set<KeyWrapper> keys = new TreeSet<>((o1, o2) -> o1.getStatus() == o2.getStatus() // Status can be only PASSIVE OR ACTIVE, push PASSIVE to end of list\n? (int) (o2.getProviderPriority() - o1.getProviderPriority())\n: (o1.getStatus() == KeyStatus.PASSIVE ? 1 : -1));\n- keys.addAll(session.keys().getRsaKeys(realm));\n- for (RsaKeyMetadata key : keys) {\n+ keys.addAll(session.keys().getKeys(realm, KeyUse.SIG, Algorithm.RS256));\n+ for (KeyWrapper key : keys) {\naddKeyInfo(keysString, key, KeyTypes.SIGNING.value());\n}\nprops.put(\"idp.signing.certificates\", keysString.toString());\nreturn StringPropertyReplacer.replaceProperties(template, props);\n}\n- private static void addKeyInfo(StringBuilder target, RsaKeyMetadata key, String purpose) {\n+ private static void addKeyInfo(StringBuilder target, KeyWrapper key, String purpose) {\nif (key == null) {\nreturn;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/protocol/saml/installation/ModAuthMellonClientInstallation.java",
"new_path": "services/src/main/java/org/keycloak/protocol/saml/installation/ModAuthMellonClientInstallation.java",
"diff": "@@ -26,6 +26,7 @@ import org.keycloak.protocol.ClientInstallationProvider;\nimport org.keycloak.protocol.saml.SamlClient;\nimport org.keycloak.protocol.saml.SamlProtocol;\n+import org.keycloak.protocol.saml.SamlService;\nimport javax.ws.rs.core.Response;\nimport java.io.ByteArrayOutputStream;\nimport java.io.IOException;\n@@ -43,7 +44,7 @@ public class ModAuthMellonClientInstallation implements ClientInstallationProvid\nSamlClient samlClient = new SamlClient(client);\nByteArrayOutputStream baos = new ByteArrayOutputStream();\nZipOutputStream zip = new ZipOutputStream(baos);\n- String idpDescriptor = SamlIDPDescriptorClientInstallation.getIDPDescriptorForClient(session, realm, client, serverBaseUri);\n+ String idpDescriptor = SamlService.getIDPMetadataDescriptor(session.getContext().getUri(), session, realm);\nString spDescriptor = SamlSPDescriptorClientInstallation.getSPDescriptorForClient(client);\nString clientDirName = client.getClientId()\n.replace('/', '_')\n"
},
{
"change_type": "DELETE",
"old_path": "services/src/main/java/org/keycloak/protocol/saml/installation/SamlIDPDescriptorClientInstallation.java",
"new_path": null,
"diff": "-/*\n- * Copyright 2016 Red Hat, Inc. and/or its affiliates\n- * and other contributors as indicated by the @author tags.\n- *\n- * Licensed under the Apache License, Version 2.0 (the \"License\");\n- * you may not use this file except in compliance with the License.\n- * You may obtain a copy of the License at\n- *\n- * http://www.apache.org/licenses/LICENSE-2.0\n- *\n- * Unless required by applicable law or agreed to in writing, software\n- * distributed under the License is distributed on an \"AS IS\" BASIS,\n- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n- * See the License for the specific language governing permissions and\n- * limitations under the License.\n- */\n-\n-package org.keycloak.protocol.saml.installation;\n-\n-import org.keycloak.Config;\n-import org.keycloak.common.util.PemUtils;\n-import org.keycloak.crypto.KeyStatus;\n-import org.keycloak.dom.saml.v2.metadata.KeyTypes;\n-import org.keycloak.keys.RsaKeyMetadata;\n-import org.keycloak.models.ClientModel;\n-import org.keycloak.models.KeycloakSession;\n-import org.keycloak.models.KeycloakSessionFactory;\n-import org.keycloak.models.RealmModel;\n-import org.keycloak.protocol.ClientInstallationProvider;\n-import org.keycloak.protocol.saml.SamlClient;\n-import org.keycloak.protocol.saml.SamlProtocol;\n-import org.keycloak.saml.SPMetadataDescriptor;\n-import org.keycloak.services.resources.RealmsResource;\n-\n-import javax.ws.rs.core.MediaType;\n-import javax.ws.rs.core.Response;\n-import javax.ws.rs.core.UriBuilder;\n-import java.net.URI;\n-import java.util.Set;\n-import java.util.TreeSet;\n-\n-/**\n- * @author <a href=\"mailto:[email protected]\">Bill Burke</a>\n- * @version $Revision: 1 $\n- */\n-public class SamlIDPDescriptorClientInstallation implements ClientInstallationProvider {\n- public static String getIDPDescriptorForClient(KeycloakSession session, RealmModel realm, ClientModel client, URI serverBaseUri) {\n- SamlClient samlClient = new SamlClient(client);\n- String idpEntityId = RealmsResource.realmBaseUrl(UriBuilder.fromUri(serverBaseUri)).build(realm.getName()).toString();\n- String bindUrl = RealmsResource.protocolUrl(UriBuilder.fromUri(serverBaseUri)).build(realm.getName(), SamlProtocol.LOGIN_PROTOCOL).toString();\n- StringBuilder sb = new StringBuilder();\n- sb.append(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\"\n- + \"<EntityDescriptor entityID=\\\"\").append(idpEntityId).append(\"\\\"\\n\"\n- + \" xmlns=\\\"urn:oasis:names:tc:SAML:2.0:metadata\\\"\\n\"\n- + \" xmlns:dsig=\\\"http://www.w3.org/2000/09/xmldsig#\\\"\\n\"\n- + \" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\"\n- + \" <IDPSSODescriptor WantAuthnRequestsSigned=\\\"\")\n- .append(samlClient.requiresClientSignature())\n- .append(\"\\\"\\n\"\n- + \" protocolSupportEnumeration=\\\"urn:oasis:names:tc:SAML:2.0:protocol\\\">\\n\");\n-\n- // logout service\n- sb.append(\" <SingleLogoutService\\n\"\n- + \" Binding=\\\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST\\\"\\n\"\n- + \" Location=\\\"\").append(bindUrl).append(\"\\\" />\\n\");\n- if (! samlClient.forcePostBinding()) {\n- sb.append(\" <SingleLogoutService\\n\"\n- + \" Binding=\\\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect\\\"\\n\"\n- + \" Location=\\\"\").append(bindUrl).append(\"\\\" />\\n\");\n- }\n- // nameid format\n- if (samlClient.forceNameIDFormat() && samlClient.getNameIDFormat() != null) {\n- sb.append(\" <NameIDFormat>\").append(samlClient.getNameIDFormat()).append(\"</NameIDFormat>\\n\");\n- } else {\n- sb.append(\" <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat>\\n\"\n- + \" <NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>\\n\"\n- + \" <NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</NameIDFormat>\\n\"\n- + \" <NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</NameIDFormat>\\n\");\n- }\n- // sign on service\n- sb.append(\"\\n\"\n- + \" <SingleSignOnService Binding=\\\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST\\\"\\n\"\n- + \" Location=\\\"\").append(bindUrl).append(\"\\\" />\\n\");\n- if (! samlClient.forcePostBinding()) {\n- sb.append(\" <SingleSignOnService Binding=\\\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect\\\"\\n\"\n- + \" Location=\\\"\").append(bindUrl).append(\"\\\" />\\n\");\n-\n- }\n-\n- // keys\n- Set<RsaKeyMetadata> keys = new TreeSet<>((o1, o2) -> o1.getStatus() == o2.getStatus() // Status can be only PASSIVE OR ACTIVE, push PASSIVE to end of list\n- ? (int) (o2.getProviderPriority() - o1.getProviderPriority())\n- : (o1.getStatus() == KeyStatus.PASSIVE ? 1 : -1));\n- keys.addAll(session.keys().getRsaKeys(realm));\n- for (RsaKeyMetadata key : keys) {\n- addKeyInfo(sb, key, KeyTypes.SIGNING.value());\n- }\n-\n- sb.append(\" </IDPSSODescriptor>\\n\"\n- + \"</EntityDescriptor>\\n\");\n- return sb.toString();\n- }\n-\n- private static void addKeyInfo(StringBuilder target, RsaKeyMetadata key, String purpose) {\n- if (key == null) {\n- return;\n- }\n-\n- target.append(SPMetadataDescriptor.xmlKeyInfo(\" \", key.getKid(), PemUtils.encodeCertificate(key.getCertificate()), purpose, false));\n- }\n-\n- @Override\n- public Response generateInstallation(KeycloakSession session, RealmModel realm, ClientModel client, URI serverBaseUri) {\n- String descriptor = getIDPDescriptorForClient(session, realm, client, serverBaseUri);\n- return Response.ok(descriptor, MediaType.TEXT_PLAIN_TYPE).build();\n- }\n-\n- @Override\n- public String getProtocol() {\n- return SamlProtocol.LOGIN_PROTOCOL;\n- }\n-\n- @Override\n- public String getDisplayType() {\n- return \"SAML Metadata IDPSSODescriptor\";\n- }\n-\n- @Override\n- public String getHelpText() {\n- return \"SAML Metadata IDPSSODescriptor tailored for the client. This is special because not every client may require things like digital signatures\";\n- }\n-\n- @Override\n- public String getFilename() {\n- return \"client-tailored-saml-idp-metadata.xml\";\n- }\n-\n- public String getMediaType() {\n- return MediaType.APPLICATION_XML;\n- }\n-\n- @Override\n- public boolean isDownloadOnly() {\n- return false;\n- }\n-\n- @Override\n- public void close() {\n-\n- }\n-\n- @Override\n- public ClientInstallationProvider create(KeycloakSession session) {\n- return this;\n- }\n-\n- @Override\n- public void init(Config.Scope config) {\n-\n- }\n-\n- @Override\n- public void postInit(KeycloakSessionFactory factory) {\n-\n- }\n-\n- @Override\n- public String getId() {\n- return \"saml-idp-descriptor\";\n- }\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/resources/META-INF/services/org.keycloak.protocol.ClientInstallationProvider",
"new_path": "services/src/main/resources/META-INF/services/org.keycloak.protocol.ClientInstallationProvider",
"diff": "@@ -19,7 +19,6 @@ org.keycloak.protocol.oidc.installation.KeycloakOIDCClientInstallation\norg.keycloak.protocol.oidc.installation.KeycloakOIDCJbossSubsystemClientInstallation\norg.keycloak.protocol.saml.installation.KeycloakSamlClientInstallation\norg.keycloak.protocol.saml.installation.SamlSPDescriptorClientInstallation\n-org.keycloak.protocol.saml.installation.SamlIDPDescriptorClientInstallation\norg.keycloak.protocol.saml.installation.ModAuthMellonClientInstallation\norg.keycloak.protocol.saml.installation.KeycloakSamlSubsystemInstallation\norg.keycloak.protocol.docker.installation.DockerVariableOverrideInstallationProvider\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/InstallationTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/InstallationTest.java",
"diff": "@@ -27,6 +27,7 @@ import org.keycloak.testsuite.admin.ApiUtil;\nimport org.keycloak.testsuite.arquillian.AuthServerTestEnricher;\nimport org.keycloak.testsuite.util.AdminEventPaths;\n+import javax.ws.rs.NotFoundException;\nimport static org.junit.Assert.assertThat;\nimport static org.hamcrest.Matchers.*;\n@@ -139,13 +140,9 @@ public class InstallationTest extends AbstractClientTest {\nassertThat(config, containsString(authServerUrl()));\n}\n- @Test\n+ @Test(expected = NotFoundException.class)\npublic void testSamlMetadataIdpDescriptor() {\n- String xml = samlClient.getInstallationProvider(\"saml-idp-descriptor\");\n- assertThat(xml, containsString(\"<EntityDescriptor\"));\n- assertThat(xml, containsString(\"<IDPSSODescriptor\"));\n- assertThat(xml, containsString(ApiUtil.findActiveKey(testRealmResource()).getCertificate()));\n- assertThat(xml, containsString(samlUrl()));\n+ samlClient.getInstallationProvider(\"saml-idp-descriptor\");\n}\n@Test\n"
},
{
"change_type": "MODIFY",
"old_path": "themes/src/main/resources/theme/base/admin/messages/admin-messages_en.properties",
"new_path": "themes/src/main/resources/theme/base/admin/messages/admin-messages_en.properties",
"diff": "@@ -24,7 +24,9 @@ endpoints=Endpoints\n# Realm settings\nrealm-detail.enabled.tooltip=Users and clients can only access a realm if it's enabled\n-realm-detail.oidc-endpoints.tooltip=Shows the configuration of the OpenID Connect endpoints\n+realm-detail.protocol-endpoints.tooltip=Shows the configuration of the protocol endpoints\n+realm-detail.protocol-endpoints.oidc=OpenID Endpoint Configuration\n+realm-detail.protocol-endpoints.saml=SAML 2.0 Identity Provider Metadata\nrealm-detail.userManagedAccess.tooltip=If enabled, users are allowed to manage their resources and permissions using the Account Management Console.\nuserManagedAccess=User-Managed Access\nregistrationAllowed=User registration\n"
},
{
"change_type": "MODIFY",
"old_path": "themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html",
"new_path": "themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html",
"diff": "<div class=\"form-group\">\n<label class=\"col-md-2 control-label\">{{:: 'endpoints' | translate}}</label>\n<div class=\"col-md-6\">\n- <a class=\"form-control\" ng-href=\"{{authUrl}}/realms/{{realm.realm}}/.well-known/openid-configuration\" target=\"_blank\">OpenID Endpoint Configuration</a>\n+ <a class=\"form-control\" ng-href=\"{{authUrl}}/realms/{{realm.realm}}/.well-known/openid-configuration\" target=\"_blank\">{{:: 'realm-detail.protocol-endpoints.oidc' | translate}}</a>\n+\n+ <a class=\"form-control\" ng-href=\"{{authUrl}}/realms/{{realm.realm}}/protocol/saml/descriptor\" target=\"_blank\">{{:: 'realm-detail.protocol-endpoints.saml' | translate}}</a>\n</div>\n- <kc-tooltip>{{:: 'realm-detail.oidc-endpoints.tooltip' | translate}}</kc-tooltip>\n+ <kc-tooltip>{{:: 'realm-detail.protocol-endpoints.tooltip' | translate}}</kc-tooltip>\n</div>\n<div class=\"form-group\">\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-3373 Remove SAML IdP descriptor from client installation and publicize it in realm endpoint instead |
339,185 | 18.03.2019 21:27:06 | -3,600 | 25c07f78bce20587d0257b7f44ba43683a9c8a74 | Fix typo in SAML attribute name format | [
{
"change_type": "MODIFY",
"old_path": "saml-core-api/src/main/java/org/keycloak/saml/common/constants/JBossSAMLURIConstants.java",
"new_path": "saml-core-api/src/main/java/org/keycloak/saml/common/constants/JBossSAMLURIConstants.java",
"diff": "@@ -38,6 +38,7 @@ public enum JBossSAMLURIConstants {\nASSERTION_NSURI(\"urn:oasis:names:tc:SAML:2.0:assertion\"),\nATTRIBUTE_FORMAT_BASIC(\"urn:oasis:names:tc:SAML:2.0:attrname-format:basic\"),\nATTRIBUTE_FORMAT_URI(\"urn:oasis:names:tc:SAML:2.0:attrname-format:uri\"),\n+ ATTRIBUTE_FORMAT_UNSPECIFIED(\"urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified\"),\nCLAIMS_EMAIL_ADDRESS_2005(\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress\"),\nCLAIMS_EMAIL_ADDRESS(\"http://schemas.xmlsoap.org/claims/EmailAddress\"),\n"
},
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/protocol/saml/mappers/AttributeStatementHelper.java",
"new_path": "services/src/main/java/org/keycloak/protocol/saml/mappers/AttributeStatementHelper.java",
"diff": "@@ -67,8 +67,8 @@ public class AttributeStatementHelper {\nAttributeType attribute = new AttributeType(attributeName);\nString attributeType = mappingModel.getConfig().get(SAML_ATTRIBUTE_NAMEFORMAT);\nString attributeNameFormat = JBossSAMLURIConstants.ATTRIBUTE_FORMAT_BASIC.get();\n- if (\"URI Reference\".equals(attributeType)) attributeNameFormat = JBossSAMLURIConstants.ATTRIBUTE_FORMAT_URI.get();\n- else if (\"Unspecified\".equals(attributeType)) attributeNameFormat = \"urn:oasis:names:tc:SAML2.0:attrname-format:unspecified\";\n+ if (URI_REFERENCE.equals(attributeType)) attributeNameFormat = JBossSAMLURIConstants.ATTRIBUTE_FORMAT_URI.get();\n+ else if (UNSPECIFIED.equals(attributeType)) attributeNameFormat = JBossSAMLURIConstants.ATTRIBUTE_FORMAT_UNSPECIFIED.get();\nattribute.setNameFormat(attributeNameFormat);\nString friendlyName = mappingModel.getConfig().get(FRIENDLY_NAME);\nif (friendlyName != null && !friendlyName.trim().equals(\"\")) attribute.setFriendlyName(friendlyName);\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-9578 Fix typo in SAML attribute name format |
339,281 | 21.03.2019 10:06:57 | -3,600 | b7c5ca8b3899e730673253e45610dda3f5e37181 | Inconsistent SAML Logout endpoint handling | [
{
"change_type": "MODIFY",
"old_path": "services/src/main/java/org/keycloak/protocol/saml/installation/SamlSPDescriptorClientInstallation.java",
"new_path": "services/src/main/java/org/keycloak/protocol/saml/installation/SamlSPDescriptorClientInstallation.java",
"diff": "@@ -38,18 +38,34 @@ import org.keycloak.dom.saml.v2.metadata.KeyTypes;\n* @version $Revision: 1 $\n*/\npublic class SamlSPDescriptorClientInstallation implements ClientInstallationProvider {\n+\n+ public static final String SAML_CLIENT_INSTALATION_SP_DESCRIPTOR = \"saml-sp-descriptor\";\n+ private static final String FALLBACK_ERROR_URL_STRING = \"ERROR:ENDPOINT NOT SET\";\n+\npublic static String getSPDescriptorForClient(ClientModel client) {\nSamlClient samlClient = new SamlClient(client);\n- String assertionUrl = client.getAttribute(SamlProtocol.SAML_ASSERTION_CONSUMER_URL_POST_ATTRIBUTE);\n- if (assertionUrl == null) assertionUrl = client.getManagementUrl();\n- String logoutUrl = client.getAttribute(SamlProtocol.SAML_SINGLE_LOGOUT_SERVICE_URL_POST_ATTRIBUTE);\n- if (logoutUrl == null) logoutUrl = client.getManagementUrl();\n+ String assertionUrl;\n+ String logoutUrl;\n+ String binding;\n+ if (samlClient.forcePostBinding()) {\n+ assertionUrl = client.getAttribute(SamlProtocol.SAML_ASSERTION_CONSUMER_URL_POST_ATTRIBUTE);\n+ logoutUrl = client.getAttribute(SamlProtocol.SAML_SINGLE_LOGOUT_SERVICE_URL_POST_ATTRIBUTE);\n+ binding = JBossSAMLURIConstants.SAML_HTTP_POST_BINDING.get();\n+ } else { //redirect binding\n+ assertionUrl = client.getAttribute(SamlProtocol.SAML_ASSERTION_CONSUMER_URL_REDIRECT_ATTRIBUTE);\n+ logoutUrl = client.getAttribute(SamlProtocol.SAML_SINGLE_LOGOUT_SERVICE_URL_REDIRECT_ATTRIBUTE);\n+ binding = JBossSAMLURIConstants.SAML_HTTP_REDIRECT_BINDING.get();\n+ }\n+ if (assertionUrl == null || assertionUrl.isEmpty()) assertionUrl = client.getManagementUrl();\n+ if (assertionUrl == null || assertionUrl.isEmpty()) assertionUrl = FALLBACK_ERROR_URL_STRING;\n+ if (logoutUrl == null || assertionUrl.isEmpty()) logoutUrl = client.getManagementUrl();\n+ if (logoutUrl == null || assertionUrl.isEmpty()) logoutUrl = FALLBACK_ERROR_URL_STRING;\nString nameIdFormat = samlClient.getNameIDFormat();\nif (nameIdFormat == null) nameIdFormat = SamlProtocol.SAML_DEFAULT_NAMEID_FORMAT;\nString spCertificate = SPMetadataDescriptor.xmlKeyInfo(\" \", null, samlClient.getClientSigningCertificate(), KeyTypes.SIGNING.value(), true);\nString encCertificate = SPMetadataDescriptor.xmlKeyInfo(\" \", null, samlClient.getClientEncryptingCertificate(), KeyTypes.ENCRYPTION.value(), true);\n- return SPMetadataDescriptor.getSPDescriptor(JBossSAMLURIConstants.SAML_HTTP_POST_BINDING.get(), assertionUrl, logoutUrl,\n- samlClient.requiresClientSignature(), samlClient.requiresAssertionSignature(), samlClient.requiresEncryption(),\n+ return SPMetadataDescriptor.getSPDescriptor(binding, assertionUrl, logoutUrl, samlClient.requiresClientSignature(),\n+ samlClient.requiresAssertionSignature(), samlClient.requiresEncryption(),\nclient.getClientId(), nameIdFormat, spCertificate, encCertificate);\n}\n@@ -110,6 +126,6 @@ public class SamlSPDescriptorClientInstallation implements ClientInstallationPro\n@Override\npublic String getId() {\n- return \"saml-sp-descriptor\";\n+ return SAML_CLIENT_INSTALATION_SP_DESCRIPTOR;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/updaters/ServerResourceUpdater.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/updaters/ServerResourceUpdater.java",
"diff": "@@ -69,11 +69,10 @@ public abstract class ServerResourceUpdater<T extends ServerResourceUpdater, Res\n@Override\npublic void close() throws IOException {\n- if (! this.updated) {\n- throw new IOException(\"Attempt to revert changes that were never applied - have you called \" + this.getClass().getName() + \".update()?\");\n- }\n+ if (this.updated) {\nperformUpdate(rep, origRep);\n}\n+ }\n/**\n* This function performs a set of single {@code add} and {@code remove} operations that represent the changes needed to\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/AbstractClientTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/AbstractClientTest.java",
"diff": "@@ -126,7 +126,6 @@ public abstract class AbstractClientTest extends AbstractAuthTest {\nclientRep.setClientId(name);\nclientRep.setName(name);\nclientRep.setProtocol(\"saml\");\n- clientRep.setAdminUrl(\"samlEndpoint\");\nreturn createClient(clientRep);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/InstallationTest.java",
"new_path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/InstallationTest.java",
"diff": "package org.keycloak.testsuite.admin.client;\n+import java.io.IOException;\n+import java.io.StringReader;\n+import java.util.HashMap;\n+import java.util.Map;\n+import javax.xml.parsers.DocumentBuilder;\n+import javax.xml.parsers.DocumentBuilderFactory;\n+import javax.xml.parsers.ParserConfigurationException;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.keycloak.admin.client.resource.ClientResource;\nimport org.keycloak.events.admin.OperationType;\nimport org.keycloak.events.admin.ResourceType;\n+import org.keycloak.protocol.saml.SamlConfigAttributes;\n+import org.keycloak.protocol.saml.SamlProtocol;\n+import org.keycloak.protocol.saml.installation.SamlSPDescriptorClientInstallation;\n+import org.keycloak.saml.common.constants.JBossSAMLURIConstants;\nimport org.keycloak.testsuite.admin.ApiUtil;\nimport org.keycloak.testsuite.arquillian.AuthServerTestEnricher;\n+import org.keycloak.testsuite.updaters.ClientAttributeUpdater;\nimport org.keycloak.testsuite.util.AdminEventPaths;\n+import org.w3c.dom.Document;\n+import org.w3c.dom.Node;\n+import org.w3c.dom.NodeList;\n+import org.xml.sax.InputSource;\n+import org.xml.sax.SAXException;\nimport javax.ws.rs.NotFoundException;\nimport static org.junit.Assert.assertThat;\n@@ -156,7 +173,7 @@ public class InstallationTest extends AbstractClientTest {\n@Test\npublic void testSamlMetadataSpDescriptor() {\n- String xml = samlClient.getInstallationProvider(\"saml-sp-descriptor\");\n+ String xml = samlClient.getInstallationProvider(SamlSPDescriptorClientInstallation.SAML_CLIENT_INSTALATION_SP_DESCRIPTOR);\nassertThat(xml, containsString(\"<EntityDescriptor\"));\nassertThat(xml, containsString(\"<SPSSODescriptor\"));\nassertThat(xml, containsString(SAML_NAME));\n@@ -170,4 +187,113 @@ public class InstallationTest extends AbstractClientTest {\nassertThat(xml, not(containsString(ApiUtil.findActiveKey(testRealmResource()).getCertificate())));\nassertThat(xml, containsString(samlUrl()));\n}\n+\n+ @Test\n+ public void testSamlMetadataSpDescriptorPost() throws Exception {\n+ try (ClientAttributeUpdater updater = ClientAttributeUpdater.forClient(adminClient, getRealmId(), SAML_NAME)) {\n+\n+ assertThat(updater.getResource().toRepresentation().getAttributes().get(SamlConfigAttributes.SAML_FORCE_POST_BINDING), equalTo(\"true\"));\n+\n+ //error fallback\n+ Document doc = getDocumentFromXmlString(updater.getResource().getInstallationProvider(SamlSPDescriptorClientInstallation.SAML_CLIENT_INSTALATION_SP_DESCRIPTOR));\n+ Map<String, String> attrNamesAndValues = new HashMap<>();\n+ attrNamesAndValues.put(\"Binding\", JBossSAMLURIConstants.SAML_HTTP_POST_BINDING.get());\n+ attrNamesAndValues.put(\"Location\", \"ERROR:ENDPOINT NOT SET\");\n+ assertElements(doc, \"SingleLogoutService\", attrNamesAndValues);\n+ assertElements(doc, \"AssertionConsumerService\", attrNamesAndValues);\n+ attrNamesAndValues.clear();\n+\n+ //fallback to adminUrl\n+ updater.setAdminUrl(\"admin-url\").update();\n+ assertAdminEvents.assertEvent(getRealmId(), OperationType.UPDATE, AdminEventPaths.clientResourcePath(samlClientId), ResourceType.CLIENT);\n+ doc = getDocumentFromXmlString(updater.getResource().getInstallationProvider(SamlSPDescriptorClientInstallation.SAML_CLIENT_INSTALATION_SP_DESCRIPTOR));\n+ attrNamesAndValues.put(\"Binding\", JBossSAMLURIConstants.SAML_HTTP_POST_BINDING.get());\n+ attrNamesAndValues.put(\"Location\", \"admin-url\");\n+ assertElements(doc, \"SingleLogoutService\", attrNamesAndValues);\n+ assertElements(doc, \"AssertionConsumerService\", attrNamesAndValues);\n+ attrNamesAndValues.clear();\n+\n+ //fine grained\n+ updater.setAttribute(SamlProtocol.SAML_ASSERTION_CONSUMER_URL_POST_ATTRIBUTE, \"saml-assertion-post-url\")\n+ .setAttribute(SamlProtocol.SAML_SINGLE_LOGOUT_SERVICE_URL_POST_ATTRIBUTE, \"saml-logout-post-url\")\n+ .setAttribute(SamlProtocol.SAML_ASSERTION_CONSUMER_URL_REDIRECT_ATTRIBUTE, \"saml-assertion-redirect-url\")\n+ .setAttribute(SamlProtocol.SAML_SINGLE_LOGOUT_SERVICE_URL_REDIRECT_ATTRIBUTE, \"saml-logout-redirect-url\")\n+ .update();\n+ assertAdminEvents.assertEvent(getRealmId(), OperationType.UPDATE, AdminEventPaths.clientResourcePath(samlClientId), ResourceType.CLIENT);\n+\n+ doc = getDocumentFromXmlString(updater.getResource().getInstallationProvider(SamlSPDescriptorClientInstallation.SAML_CLIENT_INSTALATION_SP_DESCRIPTOR));\n+ attrNamesAndValues.put(\"Binding\", JBossSAMLURIConstants.SAML_HTTP_POST_BINDING.get());\n+ attrNamesAndValues.put(\"Location\", \"saml-logout-post-url\");\n+ assertElements(doc, \"SingleLogoutService\", attrNamesAndValues);\n+ attrNamesAndValues.clear();\n+ attrNamesAndValues.put(\"Binding\", JBossSAMLURIConstants.SAML_HTTP_POST_BINDING.get());\n+ attrNamesAndValues.put(\"Location\", \"saml-assertion-post-url\");\n+ assertElements(doc, \"AssertionConsumerService\", attrNamesAndValues);\n+ }\n+ assertAdminEvents.assertEvent(getRealmId(), OperationType.UPDATE, AdminEventPaths.clientResourcePath(samlClientId), ResourceType.CLIENT);\n+ }\n+\n+ @Test\n+ public void testSamlMetadataSpDescriptorRedirect() throws Exception {\n+ try (ClientAttributeUpdater updater = ClientAttributeUpdater.forClient(adminClient, getRealmId(), SAML_NAME)\n+ .setAttribute(SamlConfigAttributes.SAML_FORCE_POST_BINDING, \"false\")\n+ .update()) {\n+\n+ assertAdminEvents.assertEvent(getRealmId(), OperationType.UPDATE, AdminEventPaths.clientResourcePath(samlClientId), ResourceType.CLIENT);\n+ assertThat(updater.getResource().toRepresentation().getAttributes().get(SamlConfigAttributes.SAML_FORCE_POST_BINDING), equalTo(\"false\"));\n+\n+ //error fallback\n+ Document doc = getDocumentFromXmlString(updater.getResource().getInstallationProvider(SamlSPDescriptorClientInstallation.SAML_CLIENT_INSTALATION_SP_DESCRIPTOR));\n+ Map<String, String> attrNamesAndValues = new HashMap<>();\n+ attrNamesAndValues.put(\"Binding\", JBossSAMLURIConstants.SAML_HTTP_REDIRECT_BINDING.get());\n+ attrNamesAndValues.put(\"Location\", \"ERROR:ENDPOINT NOT SET\");\n+ assertElements(doc, \"SingleLogoutService\", attrNamesAndValues);\n+ assertElements(doc, \"AssertionConsumerService\", attrNamesAndValues);\n+ attrNamesAndValues.clear();\n+\n+ //fallback to adminUrl\n+ updater.setAdminUrl(\"admin-url\").update();\n+ assertAdminEvents.assertEvent(getRealmId(), OperationType.UPDATE, AdminEventPaths.clientResourcePath(samlClientId), ResourceType.CLIENT);\n+ doc = getDocumentFromXmlString(updater.getResource().getInstallationProvider(SamlSPDescriptorClientInstallation.SAML_CLIENT_INSTALATION_SP_DESCRIPTOR));\n+ attrNamesAndValues.put(\"Binding\", JBossSAMLURIConstants.SAML_HTTP_REDIRECT_BINDING.get());\n+ attrNamesAndValues.put(\"Location\", \"admin-url\");\n+ assertElements(doc, \"SingleLogoutService\", attrNamesAndValues);\n+ assertElements(doc, \"AssertionConsumerService\", attrNamesAndValues);\n+ attrNamesAndValues.clear();\n+\n+ //fine grained\n+ updater.setAttribute(SamlProtocol.SAML_ASSERTION_CONSUMER_URL_POST_ATTRIBUTE, \"saml-assertion-post-url\")\n+ .setAttribute(SamlProtocol.SAML_SINGLE_LOGOUT_SERVICE_URL_POST_ATTRIBUTE, \"saml-logout-post-url\")\n+ .setAttribute(SamlProtocol.SAML_ASSERTION_CONSUMER_URL_REDIRECT_ATTRIBUTE, \"saml-assertion-redirect-url\")\n+ .setAttribute(SamlProtocol.SAML_SINGLE_LOGOUT_SERVICE_URL_REDIRECT_ATTRIBUTE, \"saml-logout-redirect-url\")\n+ .update();\n+ assertAdminEvents.assertEvent(getRealmId(), OperationType.UPDATE, AdminEventPaths.clientResourcePath(samlClientId), ResourceType.CLIENT);\n+ doc = getDocumentFromXmlString(updater.getResource().getInstallationProvider(SamlSPDescriptorClientInstallation.SAML_CLIENT_INSTALATION_SP_DESCRIPTOR));\n+ attrNamesAndValues.put(\"Binding\", JBossSAMLURIConstants.SAML_HTTP_REDIRECT_BINDING.get());\n+ attrNamesAndValues.put(\"Location\", \"saml-logout-redirect-url\");\n+ assertElements(doc, \"SingleLogoutService\", attrNamesAndValues);\n+ attrNamesAndValues.clear();\n+ attrNamesAndValues.put(\"Binding\", JBossSAMLURIConstants.SAML_HTTP_REDIRECT_BINDING.get());\n+ attrNamesAndValues.put(\"Location\", \"saml-assertion-redirect-url\");\n+ assertElements(doc, \"AssertionConsumerService\", attrNamesAndValues);\n+ }\n+ assertAdminEvents.assertEvent(getRealmId(), OperationType.UPDATE, AdminEventPaths.clientResourcePath(samlClientId), ResourceType.CLIENT);\n+ }\n+\n+ private Document getDocumentFromXmlString(String xml) throws SAXException, ParserConfigurationException, IOException {\n+ DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();\n+ InputSource is = new InputSource();\n+ is.setCharacterStream(new StringReader(xml));\n+ return db.parse(is);\n+ }\n+\n+ private void assertElements(Document doc, String tagName, Map<String, String> attrNamesAndValues) {\n+ NodeList elementsByTagName = doc.getElementsByTagName(tagName);\n+ assertThat(\"Expected exactly one \" + tagName + \" element!\", elementsByTagName.getLength(), is(equalTo(1)));\n+ Node element = elementsByTagName.item(0);\n+\n+ for (String attrName : attrNamesAndValues.keySet()) {\n+ assertThat(element.getAttributes().getNamedItem(attrName).getNodeValue(), containsString(attrNamesAndValues.get(attrName)));\n+ }\n+ }\n}\n"
}
] | Java | Apache License 2.0 | keycloak/keycloak | KEYCLOAK-8535 Inconsistent SAML Logout endpoint handling |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.