Compare commits
240
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd48b01d83 | ||
|
|
f548c210e3 | ||
|
|
4569fb761d | ||
|
|
930da93182 | ||
|
|
05ae84d533 | ||
|
|
59674e44bf | ||
|
|
efaa88b4e3 | ||
|
|
f55a526ebb | ||
|
|
ccb9433e5c | ||
|
|
9d79a847c8 | ||
|
|
1630b9a20c | ||
|
|
65befb16fd | ||
|
|
e8f99a2109 | ||
|
|
7af16fc747 | ||
|
|
84f5c0926b | ||
|
|
11245701d2 | ||
|
|
5c45c5e6e4 | ||
|
|
04ee5ca7c1 | ||
|
|
df5d37a8d9 | ||
|
|
55a86dc0f4 | ||
|
|
fa8f60a5f0 | ||
|
|
2a5c778af5 | ||
|
|
f24d73e8d6 | ||
|
|
6d40e0dd07 | ||
|
|
529ef3a425 | ||
|
|
36bb94afb8 | ||
|
|
4fd0238ca9 | ||
|
|
76e1160b36 | ||
|
|
df3079852e | ||
|
|
71b648a9b6 | ||
|
|
ab7bb21991 | ||
|
|
348e0b6226 | ||
|
|
44b7210af7 | ||
|
|
f726caea9b | ||
|
|
16282aeb7b | ||
|
|
d2c546bdc2 | ||
|
|
1f27fc9e4b | ||
|
|
7c292b1213 | ||
|
|
3b9a6b32e1 | ||
|
|
b0bb0d36ab | ||
|
|
cdda19d1f8 | ||
|
|
759747ab5c | ||
|
|
01e48dc4b8 | ||
|
|
61b93c318f | ||
|
|
3f35234cf5 | ||
|
|
da135389c7 | ||
|
|
b3d7d48ec8 | ||
|
|
5a015a6518 | ||
|
|
7912bd4dae | ||
|
|
c860d03a60 | ||
|
|
1b2a5eda32 | ||
|
|
517413d38e | ||
|
|
fd25dbcb5c | ||
|
|
bdbc4e1f6d | ||
|
|
eebd496c2f | ||
|
|
15d31a202f | ||
|
|
6714c1a136 | ||
|
|
ca6d1f3c48 | ||
|
|
c5a149a892 | ||
|
|
b33648cc29 | ||
|
|
4a583712b8 | ||
|
|
5d20651c66 | ||
|
|
a49a288bbe | ||
|
|
fbace351b3 | ||
|
|
fbb2dfcf59 | ||
|
|
05813832fc | ||
|
|
e67f8c7a61 | ||
|
|
7a66b055be | ||
|
|
e3ddc5a639 | ||
|
|
8c5b1e4892 | ||
|
|
ad1d3adb9e | ||
|
|
e18f3edbcd | ||
|
|
6ede760725 | ||
|
|
db0f05fb86 | ||
|
|
03c05bd72b | ||
|
|
c867fcf9e7 | ||
|
|
22e85b11eb | ||
|
|
39fe439573 | ||
|
|
fc6b7ea8ee | ||
|
|
0e1edb3d7a | ||
|
|
7a77055e58 | ||
|
|
d9e95455a2 | ||
|
|
f5b4efc080 | ||
|
|
b1a233e41f | ||
|
|
4d6e656b02 | ||
|
|
3354e7c98e | ||
|
|
05fe17be4f | ||
|
|
2e9f14dfd8 | ||
|
|
404aa69adb | ||
|
|
a24a43c4be | ||
|
|
892d5fd1b7 | ||
|
|
258f7c8d60 | ||
|
|
b17bd9e660 | ||
|
|
43d23835d0 | ||
|
|
d11efa363c | ||
|
|
8f0afb2551 | ||
|
|
c874f96228 | ||
|
|
ce78cc1d1c | ||
|
|
599c69a2a3 | ||
|
|
9daced953e | ||
|
|
1b085d3e13 | ||
|
|
1bea93b1e1 | ||
|
|
16bd2fb8f8 | ||
|
|
e8efe10fc8 | ||
|
|
73bcfba5f3 | ||
|
|
02f28a7e8e | ||
|
|
5a4bb5f3f0 | ||
|
|
235623301e | ||
|
|
f4aee129e4 | ||
|
|
a7f9a6e095 | ||
|
|
539d9863aa | ||
|
|
4f51b7b34c | ||
|
|
0e5af3710e | ||
|
|
a462dd78bb | ||
|
|
ec5289b5c8 | ||
|
|
2a29f2a9c6 | ||
|
|
9ffd6548ce | ||
|
|
cfd41fbc8b | ||
|
|
4c2cca4672 | ||
|
|
53557d9cfd | ||
|
|
a0054bd77f | ||
|
|
099de9e6e3 | ||
|
|
cfd61dc359 | ||
|
|
99f453b25c | ||
|
|
d138b19adb | ||
|
|
345163994a | ||
|
|
09090cec24 | ||
|
|
3abcf713e5 | ||
|
|
e4d97485ec | ||
|
|
1489bd734a | ||
|
|
ef442cae92 | ||
|
|
3493aa4ab7 | ||
|
|
3be47dee37 | ||
|
|
494d9973a6 | ||
|
|
e28a3750cd | ||
|
|
014c8e068f | ||
|
|
3890867383 | ||
|
|
d499b8a489 | ||
|
|
352602da39 | ||
|
|
c333d1eaa9 | ||
|
|
c522a20ab9 | ||
|
|
ee66cb51da | ||
|
|
93d65fa895 | ||
|
|
6aafde7819 | ||
|
|
365a1b66c8 | ||
|
|
fa1fb3a3a9 | ||
|
|
b109ce14b0 | ||
|
|
561661d726 | ||
|
|
6592014707 | ||
|
|
4cd0a8e894 | ||
|
|
6c44e9befa | ||
|
|
8e9cfc4a28 | ||
|
|
d20d5ce2d7 | ||
|
|
243c8cc2cd | ||
|
|
7d444c8b13 | ||
|
|
be83e2fb6b | ||
|
|
b34acd4cc2 | ||
|
|
85ac784fd0 | ||
|
|
ab2368be34 | ||
|
|
ba076ad159 | ||
|
|
a8d2b810cf | ||
|
|
285a99d903 | ||
|
|
fd983690e2 | ||
|
|
006a0f856e | ||
|
|
bfe10e34e7 | ||
|
|
2cba13db9c | ||
|
|
3eb9134e02 | ||
|
|
b7f2e0b5ff | ||
|
|
27187c11f1 | ||
|
|
0030df060b | ||
|
|
f6f587e472 | ||
|
|
841c6b619a | ||
|
|
e0d70a35d6 | ||
|
|
0520d465c1 | ||
|
|
a8fb988e31 | ||
|
|
c34d175572 | ||
|
|
9c7442c75b | ||
|
|
de888fc8a1 | ||
|
|
4d8e19eb7c | ||
|
|
2df7d6252e | ||
|
|
d52e043322 | ||
|
|
6c8d55d534 | ||
|
|
26bc07b2c4 | ||
|
|
7f6fc170dc | ||
|
|
741bbf471f | ||
|
|
70eb27ec83 | ||
|
|
96b729886f | ||
|
|
530870f05e | ||
|
|
1633f062d5 | ||
|
|
ff703f935f | ||
|
|
4974079794 | ||
|
|
d94515cdae | ||
|
|
f838c697d1 | ||
|
|
d14de43ac7 | ||
|
|
e198e7e0b9 | ||
|
|
83306963e8 | ||
|
|
65e2f127c9 | ||
|
|
64c2077c0b | ||
|
|
9be6777685 | ||
|
|
f14f303dfe | ||
|
|
33d7d89ad9 | ||
|
|
65c49c39f4 | ||
|
|
6c0f685c39 | ||
|
|
e0a59baaf2 | ||
|
|
6a797a61a9 | ||
|
|
e49afb2d83 | ||
|
|
0d225f44de | ||
|
|
586f6eeece | ||
|
|
f91907c8f9 | ||
|
|
9e0667bc11 | ||
|
|
a3ffb32532 | ||
|
|
1e7cf9fb3f | ||
|
|
f75c0d3e61 | ||
|
|
534ee2e50c | ||
|
|
70722d0d3d | ||
|
|
0292acd5e2 | ||
|
|
bf3541414c | ||
|
|
9242e972c0 | ||
|
|
57a96fa6aa | ||
|
|
7f08717dfb | ||
|
|
9365a40426 | ||
|
|
ae58d64741 | ||
|
|
4a8b4bcdec | ||
|
|
e3aec098a2 | ||
|
|
3b9b673e5e | ||
|
|
17e75950fe | ||
|
|
1c75b03e59 | ||
|
|
d64e7394a7 | ||
|
|
a8a77add39 | ||
|
|
5facec73e4 | ||
|
|
91a267a0d8 | ||
|
|
0147fbe489 | ||
|
|
e04ad9d7b6 | ||
|
|
79c7203fe8 | ||
|
|
8ad3c3fb03 | ||
|
|
5011960cac | ||
|
|
2b3859f462 | ||
|
|
535a0763fc | ||
|
|
283581f920 | ||
|
|
e2ad7608c8 |
No files matched your search
+8
-1
@@ -1,5 +1,12 @@
|
||||
language: java
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.m2
|
||||
|
||||
before_cache:
|
||||
- rm -rf $HOME/.m2/repository/org/keycloak
|
||||
|
||||
env:
|
||||
global:
|
||||
- MAVEN_SKIP_RC=true
|
||||
@@ -12,7 +19,7 @@ before_script:
|
||||
- export MAVEN_SKIP_RC=true
|
||||
|
||||
install:
|
||||
- ( mvn install -Pdistribution -DskipTests=true -B -V -q ) & ( MYPID=$!; while [ $(ps -ef | grep $MYPID | grep -v grep | wc -l) -gt 0 ]; do sleep 10; date; done; )
|
||||
- travis_wait 30 mvn install -Pdistribution -DskipTests=true -B -V -q
|
||||
|
||||
script:
|
||||
- mvn test -B
|
||||
|
||||
@@ -65,6 +65,7 @@ Contributing
|
||||
* [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)
|
||||
* [Database Testing](misc/DatabaseTesting.md) - How to do testing of Keycloak on different databases
|
||||
* [Updating Database](misc/UpdatingDatabaseSchema.md) - How to change the Keycloak database
|
||||
* [Changing the Default keycloak-subsystem Configuration](misc/UpdatingServerConfig.md) - How to update the default keycloak-subsystem config
|
||||
* [Developer Mailing List](https://lists.jboss.org/mailman/listinfo/keycloak-dev) - Mailing list to discuss development of Keycloak
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
+2
-1
@@ -32,6 +32,7 @@ import org.keycloak.representations.adapters.config.PolicyEnforcerConfig.PathCon
|
||||
import org.keycloak.representations.idm.authorization.Permission;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -55,7 +56,7 @@ public abstract class AbstractPolicyEnforcer {
|
||||
this.enforcerConfig = policyEnforcer.getEnforcerConfig();
|
||||
this.authzClient = policyEnforcer.getClient();
|
||||
this.pathMatcher = new PathMatcher();
|
||||
this.paths = policyEnforcer.getPaths();
|
||||
this.paths = new ArrayList<>(policyEnforcer.getPaths());
|
||||
}
|
||||
|
||||
public AuthorizationContext authorize(OIDCHttpFacade httpFacade) {
|
||||
|
||||
+22
-4
@@ -33,8 +33,12 @@ import org.keycloak.representations.adapters.config.PolicyEnforcerConfig.PathCon
|
||||
import org.keycloak.representations.idm.authorization.Permission;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -95,8 +99,8 @@ public class PolicyEnforcer {
|
||||
return authzClient;
|
||||
}
|
||||
|
||||
List<PathConfig> getPaths() {
|
||||
return paths;
|
||||
public List<PathConfig> getPaths() {
|
||||
return Collections.unmodifiableList(paths);
|
||||
}
|
||||
|
||||
KeycloakDeployment getDeployment() {
|
||||
@@ -154,13 +158,27 @@ public class PolicyEnforcer {
|
||||
|
||||
pathConfig.setId(registrationResponse.getId());
|
||||
} else {
|
||||
throw new RuntimeException("Could not find matching resource on server with uri [" + path + "] or name [" + resourceName + ". Make sure you have created a resource on the server that matches with the path configuration.");
|
||||
throw new RuntimeException("Could not find matching resource on server with uri [" + path + "] or name [" + resourceName + "]. Make sure you have created a resource on the server that matches with the path configuration.");
|
||||
}
|
||||
} else {
|
||||
pathConfig.setId(search.iterator().next());
|
||||
}
|
||||
|
||||
paths.add(pathConfig);
|
||||
PathConfig existingPath = null;
|
||||
|
||||
for (PathConfig current : paths) {
|
||||
if (current.getId().equals(pathConfig.getId()) && current.getPath().equals(pathConfig.getPath())) {
|
||||
existingPath = current;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (existingPath == null) {
|
||||
paths.add(pathConfig);
|
||||
} else {
|
||||
existingPath.getMethods().addAll(pathConfig.getMethods());
|
||||
existingPath.getScopes().addAll(pathConfig.getScopes());
|
||||
}
|
||||
}
|
||||
|
||||
return paths;
|
||||
|
||||
+7
-6
@@ -43,6 +43,7 @@ import org.keycloak.common.VerificationException;
|
||||
import org.keycloak.adapters.authentication.ClientCredentialsProviderUtils;
|
||||
import org.keycloak.constants.ServiceUrlConstants;
|
||||
import org.keycloak.representations.AccessTokenResponse;
|
||||
import org.keycloak.representations.idm.OAuth2ErrorRepresentation;
|
||||
import org.keycloak.util.JsonSerialization;
|
||||
import org.keycloak.common.util.KeycloakUriBuilder;
|
||||
|
||||
@@ -102,9 +103,9 @@ public class DirectAccessGrantsLoginModule extends AbstractKeycloakLoginModule {
|
||||
StringBuilder errorBuilder = new StringBuilder("Login failed. Invalid status: " + status);
|
||||
if (entity != null) {
|
||||
InputStream is = entity.getContent();
|
||||
Map<String, String> errors = (Map<String, String>) JsonSerialization.readValue(is, Map.class);
|
||||
errorBuilder.append(", OAuth2 error. Error: " + errors.get(OAuth2Constants.ERROR))
|
||||
.append(", Error description: " + errors.get(OAuth2Constants.ERROR_DESCRIPTION));
|
||||
OAuth2ErrorRepresentation errorRep = JsonSerialization.readValue(is, OAuth2ErrorRepresentation.class);
|
||||
errorBuilder.append(", OAuth2 error. Error: " + errorRep.getError())
|
||||
.append(", Error description: " + errorRep.getErrorDescription());
|
||||
}
|
||||
String error = errorBuilder.toString();
|
||||
log.warn(error);
|
||||
@@ -161,9 +162,9 @@ public class DirectAccessGrantsLoginModule extends AbstractKeycloakLoginModule {
|
||||
if (entity != null) {
|
||||
InputStream is = entity.getContent();
|
||||
if (status == 400) {
|
||||
Map<String, String> errors = (Map<String, String>) JsonSerialization.readValue(is, Map.class);
|
||||
errorBuilder.append(", OAuth2 error. Error: " + errors.get(OAuth2Constants.ERROR))
|
||||
.append(", Error description: " + errors.get(OAuth2Constants.ERROR_DESCRIPTION));
|
||||
OAuth2ErrorRepresentation errorRep = JsonSerialization.readValue(is, OAuth2ErrorRepresentation.class);
|
||||
errorBuilder.append(", OAuth2 error. Error: " + errorRep.getError())
|
||||
.append(", Error description: " + errorRep.getErrorDescription());
|
||||
|
||||
} else {
|
||||
if (is != null) is.close();
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-as7-integration-pom</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-as7-integration-pom</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-as7-integration-pom</artifactId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<name>Keycloak AS7 / JBoss EAP 6 Integration</name>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<name>Keycloak Jetty Integration</name>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -154,21 +154,31 @@
|
||||
return;
|
||||
} else if (initOptions) {
|
||||
if (initOptions.token || initOptions.refreshToken) {
|
||||
setToken(initOptions.token, initOptions.refreshToken, initOptions.idToken, false);
|
||||
setToken(initOptions.token, initOptions.refreshToken, initOptions.idToken);
|
||||
kc.timeSkew = initOptions.timeSkew || 0;
|
||||
|
||||
if (loginIframe.enable) {
|
||||
setupCheckLoginIframe().success(function() {
|
||||
checkLoginIframe().success(function () {
|
||||
kc.onAuthSuccess && kc.onAuthSuccess();
|
||||
initPromise.setSuccess();
|
||||
}).error(function () {
|
||||
kc.onAuthError && kc.onAuthError();
|
||||
if (initOptions.onLoad) {
|
||||
onLoad();
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
initPromise.setSuccess();
|
||||
kc.updateToken(-1).success(function() {
|
||||
kc.onAuthSuccess && kc.onAuthSuccess();
|
||||
initPromise.setSuccess();
|
||||
}).error(function() {
|
||||
kc.onAuthError && kc.onAuthError();
|
||||
if (initOptions.onLoad) {
|
||||
onLoad();
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (initOptions.onLoad) {
|
||||
onLoad();
|
||||
@@ -368,7 +378,7 @@
|
||||
minValidity = minValidity || 5;
|
||||
|
||||
var exec = function() {
|
||||
if (!kc.isTokenExpired(minValidity)) {
|
||||
if (minValidity >= 0 && !kc.isTokenExpired(minValidity)) {
|
||||
promise.setSuccess(false);
|
||||
} else {
|
||||
var params = 'grant_type=refresh_token&' + 'refresh_token=' + kc.refreshToken;
|
||||
@@ -380,6 +390,7 @@
|
||||
var req = new XMLHttpRequest();
|
||||
req.open('POST', url, true);
|
||||
req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
||||
req.withCredentials = true;
|
||||
|
||||
if (kc.clientId && kc.clientSecret) {
|
||||
req.setRequestHeader('Authorization', 'Basic ' + btoa(kc.clientId + ':' + kc.clientSecret));
|
||||
@@ -395,10 +406,10 @@
|
||||
timeLocal = (timeLocal + new Date().getTime()) / 2;
|
||||
|
||||
var tokenResponse = JSON.parse(req.responseText);
|
||||
setToken(tokenResponse['access_token'], tokenResponse['refresh_token'], tokenResponse['id_token'], true);
|
||||
|
||||
kc.timeSkew = Math.floor(timeLocal / 1000) - kc.tokenParsed.iat;
|
||||
|
||||
setToken(tokenResponse['access_token'], tokenResponse['refresh_token'], tokenResponse['id_token']);
|
||||
|
||||
kc.onAuthRefreshSuccess && kc.onAuthRefreshSuccess();
|
||||
for (var p = refreshQueue.pop(); p != null; p = refreshQueue.pop()) {
|
||||
p.setSuccess(true);
|
||||
@@ -433,7 +444,7 @@
|
||||
|
||||
kc.clearToken = function() {
|
||||
if (kc.token) {
|
||||
setToken(null, null, null, true);
|
||||
setToken(null, null, null);
|
||||
kc.onAuthLogout && kc.onAuthLogout();
|
||||
if (kc.loginRequired) {
|
||||
kc.login();
|
||||
@@ -514,7 +525,7 @@
|
||||
function authSuccess(accessToken, refreshToken, idToken, fulfillPromise) {
|
||||
timeLocal = (timeLocal + new Date().getTime()) / 2;
|
||||
|
||||
setToken(accessToken, refreshToken, idToken, true);
|
||||
setToken(accessToken, refreshToken, idToken);
|
||||
|
||||
if ((kc.tokenParsed && kc.tokenParsed.nonce != oauth.storedNonce) ||
|
||||
(kc.refreshTokenParsed && kc.refreshTokenParsed.nonce != oauth.storedNonce) ||
|
||||
@@ -598,7 +609,7 @@
|
||||
return promise.promise;
|
||||
}
|
||||
|
||||
function setToken(token, refreshToken, idToken, useTokenTime) {
|
||||
function setToken(token, refreshToken, idToken) {
|
||||
if (kc.tokenTimeoutHandle) {
|
||||
clearTimeout(kc.tokenTimeoutHandle);
|
||||
kc.tokenTimeoutHandle = null;
|
||||
@@ -618,9 +629,12 @@
|
||||
kc.resourceAccess = kc.tokenParsed.resource_access;
|
||||
|
||||
if (kc.onTokenExpired) {
|
||||
var start = useTokenTime ? kc.tokenParsed.iat : (new Date().getTime() / 1000);
|
||||
var expiresIn = kc.tokenParsed.exp - start;
|
||||
kc.tokenTimeoutHandle = setTimeout(kc.onTokenExpired, expiresIn * 1000);
|
||||
var expiresIn = (kc.tokenParsed['exp'] - (new Date().getTime() / 1000) + kc.timeSkew) * 1000;
|
||||
if (expiresIn <= 0) {
|
||||
kc.onTokenExpired();
|
||||
} else {
|
||||
kc.tokenTimeoutHandle = setTimeout(kc.onTokenExpired, expiresIn);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -1055,7 +1069,7 @@
|
||||
if (!(this instanceof CookieStorage)) {
|
||||
return new CookieStorage();
|
||||
}
|
||||
|
||||
|
||||
var cs = this;
|
||||
|
||||
cs.get = function(state) {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<name>Keycloak OIDC Client Adapter Modules</name>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
+47
-7
@@ -47,6 +47,7 @@ import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||
@@ -56,10 +57,18 @@ public class KeycloakOIDCFilter implements Filter {
|
||||
protected AdapterDeploymentContext deploymentContext;
|
||||
protected SessionIdMapper idMapper = new InMemorySessionIdMapper();
|
||||
protected NodesRegistrationManagement nodesRegistrationManagement;
|
||||
protected Pattern skipPattern;
|
||||
|
||||
private final static Logger log = Logger.getLogger(""+KeycloakOIDCFilter.class);
|
||||
|
||||
@Override
|
||||
public void init(final FilterConfig filterConfig) throws ServletException {
|
||||
|
||||
String skipPatternDefinition = filterConfig.getInitParameter("keycloak.config.skipPattern");
|
||||
if (skipPatternDefinition != null) {
|
||||
skipPattern = Pattern.compile(skipPatternDefinition, Pattern.DOTALL);
|
||||
}
|
||||
|
||||
String configResolverClass = filterConfig.getInitParameter("keycloak.config.resolver");
|
||||
if (configResolverClass != null) {
|
||||
try {
|
||||
@@ -85,13 +94,7 @@ public class KeycloakOIDCFilter implements Filter {
|
||||
if (pathParam != null) path = pathParam;
|
||||
is = filterConfig.getServletContext().getResourceAsStream(path);
|
||||
}
|
||||
KeycloakDeployment kd;
|
||||
if (is == null) {
|
||||
log.fine("No adapter configuration. Keycloak is unconfigured and will deny all requests.");
|
||||
kd = new KeycloakDeployment();
|
||||
} else {
|
||||
kd = KeycloakDeploymentBuilder.build(is);
|
||||
}
|
||||
KeycloakDeployment kd = createKeycloakDeploymentFrom(is);
|
||||
deploymentContext = new AdapterDeploymentContext(kd);
|
||||
log.fine("Keycloak is using a per-deployment configuration.");
|
||||
}
|
||||
@@ -99,13 +102,30 @@ public class KeycloakOIDCFilter implements Filter {
|
||||
nodesRegistrationManagement = new NodesRegistrationManagement();
|
||||
}
|
||||
|
||||
private KeycloakDeployment createKeycloakDeploymentFrom(InputStream is) {
|
||||
|
||||
if (is == null) {
|
||||
log.fine("No adapter configuration. Keycloak is unconfigured and will deny all requests.");
|
||||
return new KeycloakDeployment();
|
||||
}
|
||||
|
||||
return KeycloakDeploymentBuilder.build(is);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
|
||||
|
||||
log.fine("Keycloak OIDC Filter");
|
||||
//System.err.println("Keycloak OIDC Filter: " + ((HttpServletRequest)req).getRequestURL().toString());
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
HttpServletResponse response = (HttpServletResponse) res;
|
||||
|
||||
if (shouldSkip(request)) {
|
||||
chain.doFilter(req, res);
|
||||
return;
|
||||
}
|
||||
|
||||
OIDCServletHttpFacade facade = new OIDCServletHttpFacade(request, response);
|
||||
KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade);
|
||||
if (deployment == null || !deployment.isConfigured()) {
|
||||
@@ -171,6 +191,26 @@ public class KeycloakOIDCFilter implements Filter {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Decides whether this {@link Filter} should skip the given {@link HttpServletRequest} based on the configured {@link KeycloakOIDCFilter#skipPattern}.
|
||||
* Patterns are matched against the {@link HttpServletRequest#getRequestURI() requestURI} of a request without the context-path.
|
||||
* A request for {@code /myapp/index.html} would be tested with {@code /index.html} against the skip pattern.
|
||||
* Skipped requests will not be processed further by {@link KeycloakOIDCFilter} and immediately delegated to the {@link FilterChain}.
|
||||
*
|
||||
* @param request the request to check
|
||||
* @return {@code true} if the request should not be handled,
|
||||
* {@code false} otherwise.
|
||||
*/
|
||||
private boolean shouldSkip(HttpServletRequest request) {
|
||||
|
||||
if (skipPattern == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String requestPath = request.getRequestURI().substring(request.getContextPath().length());
|
||||
return skipPattern.matcher(requestPath).matches();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
-1
@@ -69,6 +69,5 @@ public class HttpSessionManager implements HttpSessionListener, UserSessionManag
|
||||
session.invalidate();
|
||||
}
|
||||
}
|
||||
sessions.clear();
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<name>Keycloak Tomcat Integration</name>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<name>Keycloak WildFly Integration</name>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<name>Keycloak Integration</name>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-saml-eap-integration-pom</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<name>Keycloak SAML EAP Integration</name>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-saml-eap-integration-pom</artifactId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<name>Keycloak SAML Jetty Integration</name>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<name>Keycloak SAML Client Adapter Modules</name>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<name>Keycloak SAML Tomcat Integration</name>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-saml-tomcat-integration-pom</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-saml-tomcat-integration-pom</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-saml-tomcat-integration-pom</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-saml-tomcat-integration-pom</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<name>Keycloak SAML Wildfly Integration</name>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<name>Keycloak Client Adapter SPI Modules</name>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-authz-parent</artifactId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<parent>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-authz-provider-parent</artifactId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
+3
-5
@@ -37,12 +37,10 @@ public class TimePolicyAdminResource implements PolicyProviderAdminService {
|
||||
String nbf = policy.getConfig().get("nbf");
|
||||
String noa = policy.getConfig().get("noa");
|
||||
|
||||
if (nbf == null && noa == null) {
|
||||
throw new RuntimeException("You must provide NotBefore, NotOnOrAfter or both.");
|
||||
if (nbf != null && noa != null) {
|
||||
validateFormat(nbf);
|
||||
validateFormat(noa);
|
||||
}
|
||||
|
||||
validateFormat(nbf);
|
||||
validateFormat(noa);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+39
-3
@@ -22,8 +22,11 @@ import org.keycloak.authorization.policy.evaluation.Evaluation;
|
||||
import org.keycloak.authorization.policy.provider.PolicyProvider;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
import static com.sun.corba.se.spi.activation.IIOP_CLEAR_TEXT.value;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
|
||||
*/
|
||||
@@ -45,9 +48,7 @@ public class TimePolicyProvider implements PolicyProvider {
|
||||
public void evaluate(Evaluation evaluation) {
|
||||
try {
|
||||
String notBefore = this.policy.getConfig().get("nbf");
|
||||
|
||||
if (notBefore != null) {
|
||||
|
||||
if (this.currentDate.before(this.dateFormat.parse(format(notBefore)))) {
|
||||
evaluation.deny();
|
||||
return;
|
||||
@@ -55,7 +56,6 @@ public class TimePolicyProvider implements PolicyProvider {
|
||||
}
|
||||
|
||||
String notOnOrAfter = this.policy.getConfig().get("noa");
|
||||
|
||||
if (notOnOrAfter != null) {
|
||||
if (this.currentDate.after(this.dateFormat.parse(format(notOnOrAfter)))) {
|
||||
evaluation.deny();
|
||||
@@ -63,12 +63,48 @@ public class TimePolicyProvider implements PolicyProvider {
|
||||
}
|
||||
}
|
||||
|
||||
if (isInvalid(Calendar.DAY_OF_MONTH, "dayMonth")
|
||||
|| isInvalid(Calendar.MONTH, "month")
|
||||
|| isInvalid(Calendar.YEAR, "year")
|
||||
|| isInvalid(Calendar.HOUR_OF_DAY, "hour")
|
||||
|| isInvalid(Calendar.MINUTE, "minute")) {
|
||||
evaluation.deny();
|
||||
return;
|
||||
}
|
||||
|
||||
evaluation.grant();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not evaluate time-based policy [" + this.policy.getName() + "].", e);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isInvalid(int timeConstant, String configName) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
calendar.setTime(this.currentDate);
|
||||
|
||||
int dateField = calendar.get(timeConstant);
|
||||
|
||||
if (Calendar.MONTH == timeConstant) {
|
||||
dateField++;
|
||||
}
|
||||
|
||||
String start = this.policy.getConfig().get(configName);
|
||||
if (start != null) {
|
||||
String end = this.policy.getConfig().get(configName + "End");
|
||||
if (end != null) {
|
||||
if (dateField < Integer.parseInt(start) || dateField > Integer.parseInt(end)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (dateField != Integer.parseInt(start)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static String format(String notBefore) {
|
||||
String trimmed = notBefore.trim();
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-authz-provider-parent</artifactId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-authz-parent</artifactId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||
* and other contributors as indicated by the @author tags.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.keycloak.common.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||
* @version $Revision: 1 $
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ConcurrentMultivaluedHashMap<K, V> extends ConcurrentHashMap<K, List<V>>
|
||||
{
|
||||
public void putSingle(K key, V value)
|
||||
{
|
||||
List<V> list = new CopyOnWriteArrayList<>();
|
||||
list.add(value);
|
||||
put(key, list);
|
||||
}
|
||||
|
||||
public void addAll(K key, V... newValues)
|
||||
{
|
||||
for (V value : newValues)
|
||||
{
|
||||
add(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void addAll(K key, List<V> valueList)
|
||||
{
|
||||
for (V value : valueList)
|
||||
{
|
||||
add(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void addFirst(K key, V value)
|
||||
{
|
||||
List<V> list = get(key);
|
||||
if (list == null)
|
||||
{
|
||||
add(key, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
list.add(0, value);
|
||||
}
|
||||
}
|
||||
public final void add(K key, V value)
|
||||
{
|
||||
getList(key).add(value);
|
||||
}
|
||||
|
||||
|
||||
public final void addMultiple(K key, Collection<V> values)
|
||||
{
|
||||
getList(key).addAll(values);
|
||||
}
|
||||
|
||||
public V getFirst(K key)
|
||||
{
|
||||
List<V> list = get(key);
|
||||
return list == null ? null : list.get(0);
|
||||
}
|
||||
|
||||
public final List<V> getList(K key)
|
||||
{
|
||||
List<V> list = get(key);
|
||||
if (list == null)
|
||||
put(key, list = new CopyOnWriteArrayList<V>());
|
||||
return list;
|
||||
}
|
||||
|
||||
public void addAll(ConcurrentMultivaluedHashMap<K, V> other)
|
||||
{
|
||||
for (Entry<K, List<V>> entry : other.entrySet())
|
||||
{
|
||||
getList(entry.getKey()).addAll(entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -42,6 +42,10 @@ public interface OAuth2Constants {
|
||||
|
||||
String RESPONSE_TYPE = "response_type";
|
||||
|
||||
String ACCESS_TOKEN = "access_token";
|
||||
|
||||
String ID_TOKEN = "id_token";
|
||||
|
||||
String REFRESH_TOKEN = "refresh_token";
|
||||
|
||||
String AUTHORIZATION_CODE = "authorization_code";
|
||||
|
||||
@@ -37,12 +37,18 @@ public class OAuthErrorException extends Exception {
|
||||
public static final String REQUEST_NOT_SUPPORTED = "request_not_supported";
|
||||
public static final String REQUEST_URI_NOT_SUPPORTED = "request_uri_not_supported";
|
||||
|
||||
// OAuth2 Bearer Token Usage
|
||||
public static final String INVALID_TOKEN = "invalid_token";
|
||||
public static final String INSUFFICIENT_SCOPE = "insufficient_scope";
|
||||
|
||||
// OIDC Dynamic Client Registration
|
||||
public static final String INVALID_REDIRECT_URI = "invalid_redirect_uri";
|
||||
public static final String INVALID_CLIENT_METADATA = "invalid_client_metadata";
|
||||
|
||||
// Others
|
||||
public static final String INVALID_CLIENT = "invalid_client";
|
||||
public static final String INVALID_GRANT = "invalid_grant";
|
||||
public static final String UNSUPPORTED_GRANT_TYPE = "unsupported_grant_type";
|
||||
public static final String INVALID_TOKEN = "invalid_token";
|
||||
public static final String INSUFFICIENT_SCOPE = "insufficient_scope";
|
||||
|
||||
public OAuthErrorException(String error, String description, String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.keycloak.protocol.oidc.representations;
|
||||
package org.keycloak.jose.jwk;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.keycloak.jose.jwk.JWK;
|
||||
@@ -37,8 +37,20 @@ public class JWK {
|
||||
|
||||
public static final String PUBLIC_KEY_USE = "use";
|
||||
|
||||
public static final String SIG_USE = "sig";
|
||||
public static final String ENCRYPTION_USE = "enc";
|
||||
public enum Use {
|
||||
SIG("sig"),
|
||||
ENCRYPTION("enc");
|
||||
|
||||
private String str;
|
||||
|
||||
Use(String str) {
|
||||
this.str = str;
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@JsonProperty(KEY_ID)
|
||||
private String keyId;
|
||||
|
||||
@@ -67,7 +67,7 @@ public class JWKParser {
|
||||
|
||||
public PublicKey toPublicKey() {
|
||||
String algorithm = jwk.getKeyType();
|
||||
if (RSAPublicJWK.RSA.equals(algorithm)) {
|
||||
if (isAlgorithmSupported(algorithm)) {
|
||||
BigInteger modulus = new BigInteger(1, Base64Url.decode(jwk.getOtherClaims().get(RSAPublicJWK.MODULUS).toString()));
|
||||
BigInteger publicExponent = new BigInteger(1, Base64Url.decode(jwk.getOtherClaims().get(RSAPublicJWK.PUBLIC_EXPONENT).toString()));
|
||||
|
||||
@@ -81,4 +81,8 @@ public class JWKParser {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAlgorithmSupported(String algorithm) {
|
||||
return RSAPublicJWK.RSA.equals(algorithm);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -108,43 +108,29 @@ public class JWSBuilder {
|
||||
return encodeAll(buffer, null);
|
||||
}
|
||||
|
||||
public String rsa256(PrivateKey privateKey) {
|
||||
public String sign(Algorithm algorithm, PrivateKey privateKey) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
byte[] data = marshalContent();
|
||||
encode(Algorithm.RS256, data, buffer);
|
||||
encode(algorithm, data, buffer);
|
||||
byte[] signature = null;
|
||||
try {
|
||||
signature = RSAProvider.sign(buffer.toString().getBytes("UTF-8"), Algorithm.RS256, privateKey);
|
||||
signature = RSAProvider.sign(buffer.toString().getBytes("UTF-8"), algorithm, privateKey);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return encodeAll(buffer, signature);
|
||||
}
|
||||
|
||||
public String rsa256(PrivateKey privateKey) {
|
||||
return sign(Algorithm.RS256, privateKey);
|
||||
}
|
||||
|
||||
public String rsa384(PrivateKey privateKey) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
byte[] data = marshalContent();
|
||||
encode(Algorithm.RS384, data, buffer);
|
||||
byte[] signature = null;
|
||||
try {
|
||||
signature = RSAProvider.sign(buffer.toString().getBytes("UTF-8"), Algorithm.RS384, privateKey);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return encodeAll(buffer, signature);
|
||||
return sign(Algorithm.RS384, privateKey);
|
||||
}
|
||||
|
||||
public String rsa512(PrivateKey privateKey) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
byte[] data = marshalContent();
|
||||
encode(Algorithm.RS512, data, buffer);
|
||||
byte[] signature = null;
|
||||
try {
|
||||
signature = RSAProvider.sign(buffer.toString().getBytes("UTF-8"), Algorithm.RS512, privateKey);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return encodeAll(buffer, signature);
|
||||
return sign(Algorithm.RS512, privateKey);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||
* and other contributors as indicated by the @author tags.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.keycloak.jose.jws.crypto;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.keycloak.common.util.Base64Url;
|
||||
import org.keycloak.jose.jws.Algorithm;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||
*/
|
||||
public class HashProvider {
|
||||
|
||||
// See "at_hash" and "c_hash" in OIDC specification
|
||||
public static String oidcHash(Algorithm jwtAlgorithm, String input) {
|
||||
byte[] digest = digest(jwtAlgorithm, input);
|
||||
|
||||
int hashLength = digest.length / 2;
|
||||
byte[] hashInput = Arrays.copyOf(digest, hashLength);
|
||||
|
||||
return Base64Url.encode(hashInput);
|
||||
}
|
||||
|
||||
private static byte[] digest(Algorithm algorithm, String input) {
|
||||
String digestAlg = getJavaDigestAlgorithm(algorithm);
|
||||
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance(digestAlg);
|
||||
md.update(input.getBytes("UTF-8"));
|
||||
return md.digest();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static String getJavaDigestAlgorithm(Algorithm alg) {
|
||||
switch (alg) {
|
||||
case RS256:
|
||||
return "SHA-256";
|
||||
case RS384:
|
||||
return "SHA-384";
|
||||
case RS512:
|
||||
return "SHA-512";
|
||||
default:
|
||||
throw new IllegalArgumentException("Not an RSA Algorithm");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,6 +27,8 @@ public class IDToken extends JsonWebToken {
|
||||
public static final String NONCE = "nonce";
|
||||
public static final String AUTH_TIME = "auth_time";
|
||||
public static final String SESSION_STATE = "session_state";
|
||||
public static final String AT_HASH = "at_hash";
|
||||
public static final String C_HASH = "c_hash";
|
||||
public static final String NAME = "name";
|
||||
public static final String GIVEN_NAME = "given_name";
|
||||
public static final String FAMILY_NAME = "family_name";
|
||||
@@ -60,6 +62,12 @@ public class IDToken extends JsonWebToken {
|
||||
@JsonProperty(SESSION_STATE)
|
||||
protected String sessionState;
|
||||
|
||||
@JsonProperty(AT_HASH)
|
||||
protected String accessTokenHash;
|
||||
|
||||
@JsonProperty(C_HASH)
|
||||
protected String codeHash;
|
||||
|
||||
@JsonProperty(NAME)
|
||||
protected String name;
|
||||
|
||||
@@ -147,6 +155,22 @@ public class IDToken extends JsonWebToken {
|
||||
this.sessionState = sessionState;
|
||||
}
|
||||
|
||||
public String getAccessTokenHash() {
|
||||
return accessTokenHash;
|
||||
}
|
||||
|
||||
public void setAccessTokenHash(String accessTokenHash) {
|
||||
this.accessTokenHash = accessTokenHash;
|
||||
}
|
||||
|
||||
public String getCodeHash() {
|
||||
return codeHash;
|
||||
}
|
||||
|
||||
public void setCodeHash(String codeHash) {
|
||||
this.codeHash = codeHash;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@@ -16,12 +16,31 @@
|
||||
*/
|
||||
package org.keycloak.representations;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import org.keycloak.json.StringOrArrayDeserializer;
|
||||
import org.keycloak.json.StringOrArraySerializer;
|
||||
|
||||
/**
|
||||
* @author pedroigor
|
||||
*/
|
||||
public class UserInfo {
|
||||
|
||||
// Should be in signed UserInfo response
|
||||
@JsonProperty("iss")
|
||||
protected String issuer;
|
||||
@JsonProperty("aud")
|
||||
@JsonSerialize(using = StringOrArraySerializer.class)
|
||||
@JsonDeserialize(using = StringOrArrayDeserializer.class)
|
||||
protected String[] audience;
|
||||
|
||||
@JsonProperty("sub")
|
||||
protected String sub;
|
||||
|
||||
@@ -85,6 +104,34 @@ public class UserInfo {
|
||||
@JsonProperty("claims_locales")
|
||||
protected String claimsLocales;
|
||||
|
||||
protected Map<String, Object> otherClaims = new HashMap<>();
|
||||
|
||||
public String getIssuer() {
|
||||
return issuer;
|
||||
}
|
||||
|
||||
public void setIssuer(String issuer) {
|
||||
this.issuer = issuer;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String[] getAudience() {
|
||||
return audience;
|
||||
}
|
||||
|
||||
public boolean hasAudience(String audience) {
|
||||
for (String a : this.audience) {
|
||||
if (a.equals(audience)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setAudience(String... audience) {
|
||||
this.audience = audience;
|
||||
}
|
||||
|
||||
public String getSubject() {
|
||||
return this.sub;
|
||||
}
|
||||
@@ -260,4 +307,19 @@ public class UserInfo {
|
||||
public void setClaimsLocales(String claimsLocales) {
|
||||
this.claimsLocales = claimsLocales;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a map of any other claims and data that might be in the UserInfo. Could be custom claims set up by the auth server
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JsonAnyGetter
|
||||
public Map<String, Object> getOtherClaims() {
|
||||
return otherClaims;
|
||||
}
|
||||
|
||||
@JsonAnySetter
|
||||
public void setOtherClaims(String name, Object value) {
|
||||
otherClaims.put(name, value);
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,6 @@
|
||||
package org.keycloak.representations.idm;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan Silvert ssilvert@redhat.com (C) 2016 Red Hat Inc.
|
||||
*/
|
||||
public class AdminEventRepresentation {
|
||||
@@ -27,6 +26,7 @@ public class AdminEventRepresentation {
|
||||
private String realmId;
|
||||
private AuthDetailsRepresentation authDetails;
|
||||
private String operationType;
|
||||
private String resourceType;
|
||||
private String resourcePath;
|
||||
private String representation;
|
||||
private String error;
|
||||
@@ -63,6 +63,14 @@ public class AdminEventRepresentation {
|
||||
this.operationType = operationType;
|
||||
}
|
||||
|
||||
public String getResourceType() {
|
||||
return resourceType;
|
||||
}
|
||||
|
||||
public void setResourceType(String resourceType) {
|
||||
this.resourceType = resourceType;
|
||||
}
|
||||
|
||||
public String getResourcePath() {
|
||||
return resourcePath;
|
||||
}
|
||||
@@ -86,5 +94,4 @@ public class AdminEventRepresentation {
|
||||
public void setError(String error) {
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,6 +25,7 @@ package org.keycloak.representations.idm;
|
||||
public class CertificateRepresentation {
|
||||
|
||||
protected String privateKey;
|
||||
protected String publicKey;
|
||||
protected String certificate;
|
||||
|
||||
public String getPrivateKey() {
|
||||
@@ -35,6 +36,14 @@ public class CertificateRepresentation {
|
||||
this.privateKey = privateKey;
|
||||
}
|
||||
|
||||
public String getPublicKey() {
|
||||
return publicKey;
|
||||
}
|
||||
|
||||
public void setPublicKey(String publicKey) {
|
||||
this.publicKey = publicKey;
|
||||
}
|
||||
|
||||
public String getCertificate() {
|
||||
return certificate;
|
||||
}
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||
* and other contributors as indicated by the @author tags.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.keycloak.representations.idm;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||
*/
|
||||
public class ClientRegistrationTrustedHostRepresentation {
|
||||
|
||||
String hostName;
|
||||
Integer count;
|
||||
Integer remainingCount;
|
||||
|
||||
public static ClientRegistrationTrustedHostRepresentation create(String hostName, int count, int remainingCount) {
|
||||
ClientRegistrationTrustedHostRepresentation rep = new ClientRegistrationTrustedHostRepresentation();
|
||||
rep.setHostName(hostName);
|
||||
rep.setCount(count);
|
||||
rep.setRemainingCount(remainingCount);
|
||||
return rep;
|
||||
}
|
||||
|
||||
public String getHostName() {
|
||||
return hostName;
|
||||
}
|
||||
|
||||
public void setHostName(String hostName) {
|
||||
this.hostName = hostName;
|
||||
}
|
||||
|
||||
public Integer getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(Integer count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public Integer getRemainingCount() {
|
||||
return remainingCount;
|
||||
}
|
||||
|
||||
public void setRemainingCount(Integer remainingCount) {
|
||||
this.remainingCount = remainingCount;
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
package org.keycloak.representations.idm;
|
||||
|
||||
import org.keycloak.representations.idm.authorization.ResourceServerRepresentation;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -62,6 +64,7 @@ public class ClientRepresentation {
|
||||
private Boolean useTemplateConfig;
|
||||
private Boolean useTemplateScope;
|
||||
private Boolean useTemplateMappers;
|
||||
private ResourceServerRepresentation authorizationSettings;
|
||||
|
||||
|
||||
public String getId() {
|
||||
@@ -241,6 +244,9 @@ public class ClientRepresentation {
|
||||
}
|
||||
|
||||
public Boolean getAuthorizationServicesEnabled() {
|
||||
if (authorizationSettings != null) {
|
||||
return true;
|
||||
}
|
||||
return authorizationServicesEnabled;
|
||||
}
|
||||
|
||||
@@ -353,4 +359,11 @@ public class ClientRepresentation {
|
||||
this.useTemplateMappers = useTemplateMappers;
|
||||
}
|
||||
|
||||
public ResourceServerRepresentation getAuthorizationSettings() {
|
||||
return authorizationSettings;
|
||||
}
|
||||
|
||||
public void setAuthorizationSettings(ResourceServerRepresentation authorizationSettings) {
|
||||
this.authorizationSettings = authorizationSettings;
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||
* and other contributors as indicated by the @author tags.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.keycloak.representations.idm;
|
||||
|
||||
import org.keycloak.common.util.MultivaluedHashMap;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||
*/
|
||||
public class ComponentExportRepresentation {
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
private String providerId;
|
||||
private MultivaluedHashMap<String, ComponentExportRepresentation> subComponents = new MultivaluedHashMap<>();
|
||||
private MultivaluedHashMap<String, String> config = new MultivaluedHashMap<>();
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getProviderId() {
|
||||
return providerId;
|
||||
}
|
||||
|
||||
public void setProviderId(String providerId) {
|
||||
this.providerId = providerId;
|
||||
}
|
||||
|
||||
public MultivaluedHashMap<String, String> getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public void setConfig(MultivaluedHashMap<String, String> config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public MultivaluedHashMap<String, ComponentExportRepresentation> getSubComponents() {
|
||||
return subComponents;
|
||||
}
|
||||
|
||||
public void setSubComponents(MultivaluedHashMap<String, ComponentExportRepresentation> subComponents) {
|
||||
this.subComponents = subComponents;
|
||||
}
|
||||
}
|
||||
+5
@@ -123,10 +123,15 @@ public class IdentityProviderRepresentation {
|
||||
this.updateProfileFirstLoginMode = updateProfileFirstLoginMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Replaced by configuration option in identity provider authenticator
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isAuthenticateByDefault() {
|
||||
return authenticateByDefault;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setAuthenticateByDefault(boolean authenticateByDefault) {
|
||||
this.authenticateByDefault = authenticateByDefault;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||
* and other contributors as indicated by the @author tags.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.keycloak.representations.idm;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.keycloak.OAuth2Constants;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||
*/
|
||||
public class OAuth2ErrorRepresentation {
|
||||
|
||||
private String error;
|
||||
private String errorDescription;
|
||||
|
||||
public OAuth2ErrorRepresentation() {
|
||||
}
|
||||
|
||||
public OAuth2ErrorRepresentation(String error, String errorDescription) {
|
||||
this.error = error;
|
||||
this.errorDescription = errorDescription;
|
||||
}
|
||||
|
||||
@JsonProperty(OAuth2Constants.ERROR)
|
||||
public String getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
public void setError(String error) {
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
@JsonProperty(OAuth2Constants.ERROR_DESCRIPTION)
|
||||
public String getErrorDescription() {
|
||||
return errorDescription;
|
||||
}
|
||||
|
||||
public void setErrorDescription(String errorDescription) {
|
||||
this.errorDescription = errorDescription;
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
package org.keycloak.representations.idm;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.keycloak.common.util.MultivaluedHashMap;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -109,6 +110,7 @@ public class RealmRepresentation {
|
||||
private List<IdentityProviderRepresentation> identityProviders;
|
||||
private List<IdentityProviderMapperRepresentation> identityProviderMappers;
|
||||
private List<ProtocolMapperRepresentation> protocolMappers;
|
||||
private MultivaluedHashMap<String, ComponentExportRepresentation> components;
|
||||
protected Boolean internationalizationEnabled;
|
||||
protected Set<String> supportedLocales;
|
||||
protected String defaultLocale;
|
||||
@@ -121,6 +123,8 @@ public class RealmRepresentation {
|
||||
protected String resetCredentialsFlow;
|
||||
protected String clientAuthenticationFlow;
|
||||
|
||||
protected Map<String, String> attributes;
|
||||
|
||||
protected String keycloakVersion;
|
||||
|
||||
@Deprecated
|
||||
@@ -849,9 +853,25 @@ public class RealmRepresentation {
|
||||
this.clientTemplates = clientTemplates;
|
||||
}
|
||||
|
||||
public MultivaluedHashMap<String, ComponentExportRepresentation> getComponents() {
|
||||
return components;
|
||||
}
|
||||
|
||||
public void setComponents(MultivaluedHashMap<String, ComponentExportRepresentation> components) {
|
||||
this.components = components;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public boolean isIdentityFederationEnabled() {
|
||||
return identityProviders != null && !identityProviders.isEmpty();
|
||||
}
|
||||
|
||||
public void setAttributes(Map<String, String> attributes) {
|
||||
this.attributes = attributes;
|
||||
}
|
||||
|
||||
public Map<String, String> getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
}
|
||||
+202
-6
@@ -18,6 +18,7 @@
|
||||
package org.keycloak.representations.oidc;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import org.keycloak.jose.jwk.JSONWebKeySet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -27,14 +28,20 @@ import java.util.List;
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
public class OIDCClientRepresentation {
|
||||
|
||||
// OIDC Dynamic client registration properties
|
||||
|
||||
private List<String> redirect_uris;
|
||||
|
||||
private String token_endpoint_auth_method;
|
||||
|
||||
private String token_endpoint_auth_signing_alg;
|
||||
|
||||
private List<String> grant_types;
|
||||
|
||||
private List<String> response_types;
|
||||
|
||||
private String application_type;
|
||||
|
||||
private String client_id;
|
||||
|
||||
private String client_secret;
|
||||
@@ -47,7 +54,7 @@ public class OIDCClientRepresentation {
|
||||
|
||||
private String scope;
|
||||
|
||||
private String contacts;
|
||||
private List<String> contacts;
|
||||
|
||||
private String tos_uri;
|
||||
|
||||
@@ -55,12 +62,49 @@ public class OIDCClientRepresentation {
|
||||
|
||||
private String jwks_uri;
|
||||
|
||||
private String jwks;
|
||||
private JSONWebKeySet jwks;
|
||||
|
||||
private String sector_identifier_uri;
|
||||
|
||||
private String subject_type;
|
||||
|
||||
private String id_token_signed_response_alg;
|
||||
|
||||
private String id_token_encrypted_response_alg;
|
||||
|
||||
private String id_token_encrypted_response_enc;
|
||||
|
||||
private String userinfo_signed_response_alg;
|
||||
|
||||
private String userinfo_encrypted_response_alg;
|
||||
|
||||
private String userinfo_encrypted_response_enc;
|
||||
|
||||
private String request_object_signing_alg;
|
||||
|
||||
private String request_object_encryption_alg;
|
||||
|
||||
private String request_object_encryption_enc;
|
||||
|
||||
private Integer default_max_age;
|
||||
|
||||
private Boolean require_auth_time;
|
||||
|
||||
private List<String> default_acr_values;
|
||||
|
||||
private String initiate_login_uri;
|
||||
|
||||
private List<String> request_uris;
|
||||
|
||||
// OIDC Session Management
|
||||
private List<String> post_logout_redirect_uris;
|
||||
|
||||
// Not sure from which specs this comes
|
||||
private String software_id;
|
||||
|
||||
private String software_version;
|
||||
|
||||
// OIDC Dynamic Client Registration Response
|
||||
private Integer client_id_issued_at;
|
||||
|
||||
private Integer client_secret_expires_at;
|
||||
@@ -85,6 +129,14 @@ public class OIDCClientRepresentation {
|
||||
this.token_endpoint_auth_method = token_endpoint_auth_method;
|
||||
}
|
||||
|
||||
public String getTokenEndpointAuthSigningAlg() {
|
||||
return token_endpoint_auth_signing_alg;
|
||||
}
|
||||
|
||||
public void setTokenEndpointAuthSigningAlg(String token_endpoint_auth_signing_alg) {
|
||||
this.token_endpoint_auth_signing_alg = token_endpoint_auth_signing_alg;
|
||||
}
|
||||
|
||||
public List<String> getGrantTypes() {
|
||||
return grant_types;
|
||||
}
|
||||
@@ -101,6 +153,14 @@ public class OIDCClientRepresentation {
|
||||
this.response_types = responseTypes;
|
||||
}
|
||||
|
||||
public String getApplicationType() {
|
||||
return application_type;
|
||||
}
|
||||
|
||||
public void setApplicationType(String applicationType) {
|
||||
this.application_type = applicationType;
|
||||
}
|
||||
|
||||
public String getClientId() {
|
||||
return client_id;
|
||||
}
|
||||
@@ -149,11 +209,11 @@ public class OIDCClientRepresentation {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public String getContacts() {
|
||||
public List<String> getContacts() {
|
||||
return contacts;
|
||||
}
|
||||
|
||||
public void setContacts(String contacts) {
|
||||
public void setContacts(List<String> contacts) {
|
||||
this.contacts = contacts;
|
||||
}
|
||||
|
||||
@@ -181,14 +241,150 @@ public class OIDCClientRepresentation {
|
||||
this.jwks_uri = jwks_uri;
|
||||
}
|
||||
|
||||
public String getJwks() {
|
||||
public JSONWebKeySet getJwks() {
|
||||
return jwks;
|
||||
}
|
||||
|
||||
public void setJwks(String jwks) {
|
||||
public void setJwks(JSONWebKeySet jwks) {
|
||||
this.jwks = jwks;
|
||||
}
|
||||
|
||||
public String getSectorIdentifierUri() {
|
||||
return sector_identifier_uri;
|
||||
}
|
||||
|
||||
public void setSectorIdentifierUri(String sectorIdentifierUri) {
|
||||
this.sector_identifier_uri = sectorIdentifierUri;
|
||||
}
|
||||
|
||||
public String getSubjectType() {
|
||||
return subject_type;
|
||||
}
|
||||
|
||||
public void setSubjectType(String subjectType) {
|
||||
this.subject_type = subjectType;
|
||||
}
|
||||
|
||||
public String getIdTokenSignedResponseAlg() {
|
||||
return id_token_signed_response_alg;
|
||||
}
|
||||
|
||||
public void setIdTokenSignedResponseAlg(String idTokenSignedResponseAlg) {
|
||||
this.id_token_signed_response_alg = idTokenSignedResponseAlg;
|
||||
}
|
||||
|
||||
public String getIdTokenEncryptedResponseAlg() {
|
||||
return id_token_encrypted_response_alg;
|
||||
}
|
||||
|
||||
public void setIdTokenEncryptedResponseAlg(String idTokenEncryptedResponseAlg) {
|
||||
this.id_token_encrypted_response_alg = idTokenEncryptedResponseAlg;
|
||||
}
|
||||
|
||||
public String getIdTokenEncryptedResponseEnc() {
|
||||
return id_token_encrypted_response_enc;
|
||||
}
|
||||
|
||||
public void setIdTokenEncryptedResponseEnc(String idTokenEncryptedResponseEnc) {
|
||||
this.id_token_encrypted_response_enc = idTokenEncryptedResponseEnc;
|
||||
}
|
||||
|
||||
public String getUserinfoSignedResponseAlg() {
|
||||
return userinfo_signed_response_alg;
|
||||
}
|
||||
|
||||
public void setUserinfoSignedResponseAlg(String userinfo_signed_response_alg) {
|
||||
this.userinfo_signed_response_alg = userinfo_signed_response_alg;
|
||||
}
|
||||
|
||||
public String getUserinfoEncryptedResponseAlg() {
|
||||
return userinfo_encrypted_response_alg;
|
||||
}
|
||||
|
||||
public void setUserinfoEncryptedResponseAlg(String userinfo_encrypted_response_alg) {
|
||||
this.userinfo_encrypted_response_alg = userinfo_encrypted_response_alg;
|
||||
}
|
||||
|
||||
public String getUserinfoEncryptedResponseEnc() {
|
||||
return userinfo_encrypted_response_enc;
|
||||
}
|
||||
|
||||
public void setUserinfoEncryptedResponseEnc(String userinfo_encrypted_response_enc) {
|
||||
this.userinfo_encrypted_response_enc = userinfo_encrypted_response_enc;
|
||||
}
|
||||
|
||||
public String getRequestObjectSigningAlg() {
|
||||
return request_object_signing_alg;
|
||||
}
|
||||
|
||||
public void setRequestObjectSigningAlg(String request_object_signing_alg) {
|
||||
this.request_object_signing_alg = request_object_signing_alg;
|
||||
}
|
||||
|
||||
public String getRequestObjectEncryptionAlg() {
|
||||
return request_object_encryption_alg;
|
||||
}
|
||||
|
||||
public void setRequestObjectEncryptionAlg(String request_object_encryption_alg) {
|
||||
this.request_object_encryption_alg = request_object_encryption_alg;
|
||||
}
|
||||
|
||||
public String getRequestObjectEncryptionEnc() {
|
||||
return request_object_encryption_enc;
|
||||
}
|
||||
|
||||
public void setRequestObjectEncryptionEnc(String request_object_encryption_enc) {
|
||||
this.request_object_encryption_enc = request_object_encryption_enc;
|
||||
}
|
||||
|
||||
public Integer getDefaultMaxAge() {
|
||||
return default_max_age;
|
||||
}
|
||||
|
||||
public void setDefaultMaxAge(Integer default_max_age) {
|
||||
this.default_max_age = default_max_age;
|
||||
}
|
||||
|
||||
public Boolean getRequireAuthTime() {
|
||||
return require_auth_time;
|
||||
}
|
||||
|
||||
public void setRequireAuthTime(Boolean require_auth_time) {
|
||||
this.require_auth_time = require_auth_time;
|
||||
}
|
||||
|
||||
public List<String> getDefaultAcrValues() {
|
||||
return default_acr_values;
|
||||
}
|
||||
|
||||
public void setDefaultAcrValues(List<String> default_acr_values) {
|
||||
this.default_acr_values = default_acr_values;
|
||||
}
|
||||
|
||||
public String getInitiateLoginUri() {
|
||||
return initiate_login_uri;
|
||||
}
|
||||
|
||||
public void setInitiateLoginUri(String initiate_login_uri) {
|
||||
this.initiate_login_uri = initiate_login_uri;
|
||||
}
|
||||
|
||||
public List<String> getRequestUris() {
|
||||
return request_uris;
|
||||
}
|
||||
|
||||
public void setRequestUris(List<String> requestUris) {
|
||||
this.request_uris = requestUris;
|
||||
}
|
||||
|
||||
public List<String> getPostLogoutRedirectUris() {
|
||||
return post_logout_redirect_uris;
|
||||
}
|
||||
|
||||
public void setPostLogoutRedirectUris(List<String> post_logout_redirect_uris) {
|
||||
this.post_logout_redirect_uris = post_logout_redirect_uris;
|
||||
}
|
||||
|
||||
public String getSoftwareId() {
|
||||
return software_id;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||
* and other contributors as indicated by the @author tags.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.keycloak;
|
||||
|
||||
import java.security.Security;
|
||||
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.keycloak.jose.jws.Algorithm;
|
||||
import org.keycloak.jose.jws.crypto.HashProvider;
|
||||
|
||||
/**
|
||||
* See "at_hash" in OIDC specification
|
||||
*
|
||||
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
|
||||
*/
|
||||
public class AtHashTest {
|
||||
|
||||
static {
|
||||
if (Security.getProvider("BC") == null) Security.addProvider(new BouncyCastleProvider());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAtHash() throws Exception {
|
||||
verifyHash("jHkWEdUXMU1BwAsC4vtUsZwnNvTIxEl0z9K3vx5KF0Y", "77QmUPtjPfzWtF2AnpK9RQ");
|
||||
verifyHash("ya29.eQETFbFOkAs8nWHcmYXKwEi0Zz46NfsrUU_KuQLOLTwWS40y6Fb99aVzEXC0U14m61lcPMIr1hEIBA", "aUAkJG-u6x4RTWuILWy-CA");
|
||||
}
|
||||
|
||||
private void verifyHash(String accessToken, String expectedAtHash) {
|
||||
String atHash = HashProvider.oidcHash(Algorithm.RS256, accessToken);
|
||||
Assert.assertEquals(expectedAtHash, atHash);
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ import org.junit.Test;
|
||||
import org.keycloak.representations.IDToken;
|
||||
import org.keycloak.representations.JsonWebToken;
|
||||
import org.keycloak.representations.adapters.config.AdapterConfig;
|
||||
import org.keycloak.representations.oidc.OIDCClientRepresentation;
|
||||
import org.keycloak.util.JsonSerialization;
|
||||
|
||||
/**
|
||||
@@ -125,4 +126,23 @@ public class JsonParserTest {
|
||||
System.out.println(sb.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadOIDCClientRep() throws IOException {
|
||||
String stringRep = "{\"subject_type\": \"public\", \"jwks_uri\": \"https://op.certification.openid.net:60720/export/jwk_60720.json\", \"contacts\": [\"roland.hedberg@umu.se\"], \"application_type\": \"web\", \"grant_types\": [\"authorization_code\"], \"post_logout_redirect_uris\": [\"https://op.certification.openid.net:60720/logout\"], \"redirect_uris\": [\"https://op.certification.openid.net:60720/authz_cb\"], \"response_types\": [\"code\"], \"require_auth_time\": true, \"default_max_age\": 3600}";
|
||||
OIDCClientRepresentation clientRep = JsonSerialization.readValue(stringRep, OIDCClientRepresentation.class);
|
||||
Assert.assertEquals("public", clientRep.getSubjectType());
|
||||
Assert.assertTrue(clientRep.getRequireAuthTime());
|
||||
Assert.assertEquals(3600, clientRep.getDefaultMaxAge().intValue());
|
||||
Assert.assertEquals(1, clientRep.getRedirectUris().size());
|
||||
Assert.assertEquals("https://op.certification.openid.net:60720/authz_cb", clientRep.getRedirectUris().get(0));
|
||||
Assert.assertNull(clientRep.getJwks());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadOIDCClientRepWithJWKS() throws IOException {
|
||||
String stringRep = "{\"token_endpoint_auth_method\": \"private_key_jwt\", \"subject_type\": \"public\", \"jwks_uri\": null, \"jwks\": {\"keys\": [{\"use\": \"enc\", \"e\": \"AQAB\", \"d\": \"lZQv0_81euRLeUYU84Aodh0ar7ymDlzWP5NMra4Jklkb-lTBWkI-u4RMsPqGYyW3KHRoL_pgzZXSzQx8RLQfER6timRWb--NxMMKllZubByU3RqH2ooNuocJurspYiXkznPW1Mg9DaNXL0C2hwWPQHTeUVISpjgi5TCOV1ccWVyksFruya_VNL1CIByB-L0GL1rqbKv32cDwi2A3_jJa61cpzfLSIBe-lvCO6tuiDsR4qgJnUwnndQFwEI_4mLmD3iNWXrc8N-poleV8mBfMqBB5fWwy_ZTFCpmQ5AywGmctaik_wNhMoWuA4tUfY6_1LdKld-5Cjq55eLtuJjtvuQ\", \"n\": \"tx3Hjdbc19lkTiohbJrNj4jf2_90MEE122CRrwtFu6saDywKcG7Bi7w2FMAK2oTkuWfqhWRb5BEGmnSXdiCEPO5d-ytqP3nwlZXHaCDYscpP8bB4YLhvCn7R8Efw6gwQle24QPRP3lYoFeuUbDUq7GKA5SfaZUvWoeWjqyLIaBspKQsC26_Umx1E4IXLrMSL6nkRnrYcVZBAXrYCeTP1XtsV38_lZVJfHSaJaUy4PKaj3yvgm93EV2CXybPti7CCMXZ34VqqWiF64pQjZsPu3ZTr7ha_TTQq499-zYRQNDvIVsBDLQQIgrbctuGqj6lrXb31Jj3JIEYqH_4h5X9d0Q\", \"q\": \"1q-r-bmMFbIzrLK2U3elksZq8CqUqZxlSfkGMZuVkxgYMS-e4FPzEp2iirG-eO11aa0cpMMoBdTnVdGJ_ZUR93w0lGf9XnQAJqxP7eOsrUoiW4VWlWH4WfOiLgpO-pFtyTz_JksYYaotc_Z3Zy-Szw6a39IDbuYGy1qL-15oQuc\", \"p\": \"2lrYPppRbcQWu4LtWN6tOVUrtCOPv1eLTKTc7q8vCMcem1Ox5QFB7KnUtNZ5Ni7wnZUeVDfimNebtjNsGvDSrpgIlo9dEnFBQsQIkzZ2SkoYfgmF8hNdi6P-BfRjdgYouy4c6xAnGDgSMTip1YnPRyvbMaoYT9E_tEcBW5wOeoc\", \"kid\": \"a0\", \"kty\": \"RSA\"}, {\"use\": \"sig\", \"e\": \"AQAB\", \"d\": \"DodXDEtkovWWGsMEXYy_nEEMCWyROMOebCnCv0ey3i4M4bh2dmwqgz0e-IKQAFlGiMkidGL1lNbq0uFS04FbuRAR06dYw1cbrNbDdhrWFxKTd1L5D9p-x-gW-YDWhpI8rUGRa76JXkOSxZUbg09_QyUd99CXAHh-FXi_ZkIKD8hK6FrAs68qhLf8MNkUv63DTduw7QgeFfQivdopePxyGuMk5n8veqwsUZsklQkhNlTYQqeM1xb2698ZQcNYkl0OssEsSJKRjXt-LRPowKrdvTuTo2p--HMI0pIEeFs7H_u5OW3jihjvoFClGPynHQhgWmQzlQRvWRXh6FhDVqFeGQ\", \"n\": \"zfZzttF7HmnTYwSMPdxKs5AoczbNS2mOPz-tN1g4ljqI_F1DG8cgQDcN_VDufxoFGRERo2FK6WEN41LhbGEyP6uL6wW6Cy29qE9QZcvY5mXrncndRSOkNcMizvuEJes_fMYrmP_lPiC6kWiqItTk9QBWqJfiYKhCx9cSDXsBmJXn3KWQCVHvj1ANFWW0CWLMKlWN-_NMNLIWJN_pEAocTZMzxSFBK1b5_5J8ZS7hfWRF6MQmjsJcz2jzA21SQZNpre3kwnTGRSwo05sAS-TyeadDqQPWgbqX69UzcGq5irhzN8cpZ_JaTk3Y_uV6owanTZLVvCgdjaAnMYeZhb0KFw\", \"q\": \"5E5XKK5njT-zzRqqTeY2tgP9PJBACeaH_xQRHZ_1ydE7tVd7HdgdaEHfQ1jvKIHFkknWWOBAY1mlBc4YDirLShB_voShD8C-Hx3nF5sne5fleVfU-sZy6Za4B2U75PcE62oZgCPauOTAEm9Xuvrt5aMMovyzR8ecJZhm9bw7naU\", \"p\": \"5vJHCSM3H3q4RltYzENC9RyZZV8EUmpkv9moyguT5t-BUGA-T4W_FGIxzOPXRWOckIplKkoDKhavUeNmTZMCUcue0nkICSJpvNE4Nb2p5PZk_QqSdQNvCasQtdojEG0AmfVD85SU551CYxJdLdDFOqyK2entpMr8lhokem189As\", \"kid\": \"a1\", \"kty\": \"RSA\"}, {\"d\": \"S4_OufhLBgXFMgIDMI1zlVe2uCExpcEAQ80J_lXfS8I\", \"use\": \"sig\", \"crv\": \"P-256\", \"kty\": \"EC\", \"y\": \"DBdNyq30mXmUs_BIvKMqaTTNO7HDhCi0YiC8GciwNYk\", \"x\": \"cYwzBoyjRjxj334bRTqanONf7DUYK-6TgiuN0DixJAk\", \"kid\": \"a2\"}, {\"d\": \"33TnYgdJtWAiVosKqUnz0zSmvWTbsx5-6pceynW6Xck\", \"use\": \"enc\", \"crv\": \"P-256\", \"kty\": \"EC\", \"y\": \"Cula95Eix1Ia77St3OULe6-UKWs5I06nmdfUzhXUQTs\", \"x\": \"wk8HBVxNNzj1gJBxPmmx9XYW1L61ObBGzxpRa6_OqWU\", \"kid\": \"a3\"}]}, \"application_type\": \"web\", \"contacts\": [\"roland.hedberg@umu.se\"], \"post_logout_redirect_uris\": [\"https://op.certification.openid.net:60784/logout\"], \"redirect_uris\": [\"https://op.certification.openid.net:60784/authz_cb\"], \"response_types\": [\"code\"], \"require_auth_time\": true, \"grant_types\": [\"authorization_code\"], \"default_max_age\": 3600}";
|
||||
OIDCClientRepresentation clientRep = JsonSerialization.readValue(stringRep, OIDCClientRepresentation.class);
|
||||
Assert.assertNotNull(clientRep.getJwks());
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+1
-1
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
Vendored
+7
-2
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<artifactId>keycloak-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>2.1.0.Final</version>
|
||||
<version>2.2.0.Final</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -83,7 +83,6 @@
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-kerberos-federation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- saml -->
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
@@ -110,6 +109,12 @@
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Dependencies for RHEL IdM -->
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>keycloak-sssd-federation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Built-in Authorization Policy Providers -->
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
|
||||
Loaded 100 of 1059 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user