Set device code validity in seconds for dynreg clients

pull/1611/head
Andrea Ceccanti 2018-04-27 19:35:03 +02:00
parent 92c47c5449
commit 2eb5d1b3e2
5 changed files with 11 additions and 5 deletions

View File

@ -22,7 +22,7 @@
<parent>
<artifactId>openid-connect-parent</artifactId>
<groupId>org.mitre</groupId>
<version>1.3.3.cnaf.rc0</version>
<version>1.3.4.cnaf-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>openid-connect-client</artifactId>

View File

@ -22,7 +22,7 @@
<parent>
<artifactId>openid-connect-parent</artifactId>
<groupId>org.mitre</groupId>
<version>1.3.3.cnaf.rc0</version>
<version>1.3.4.cnaf-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>openid-connect-common</artifactId>

View File

@ -23,7 +23,7 @@
<parent>
<groupId>org.mitre</groupId>
<artifactId>openid-connect-parent</artifactId>
<version>1.3.3.cnaf.rc0</version>
<version>1.3.4.cnaf-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<build>

View File

@ -232,7 +232,11 @@ public class DynamicClientRegistrationEndpoint {
newClient.setIdTokenValiditySeconds((int)TimeUnit.MINUTES.toSeconds(10)); // id tokens good for 10min
newClient.setRefreshTokenValiditySeconds(null); // refresh tokens good until revoked
}
if (newClient.getGrantTypes().contains("urn:ietf:params:oauth:grant-type:device_code")) {
newClient.setDeviceCodeValiditySeconds(600);
}
// this client has been dynamically registered (obviously)
newClient.setDynamicallyRegistered(true);
@ -354,6 +358,7 @@ public class DynamicClientRegistrationEndpoint {
newClient.setAccessTokenValiditySeconds(oldClient.getAccessTokenValiditySeconds());
newClient.setIdTokenValiditySeconds(oldClient.getIdTokenValiditySeconds());
newClient.setRefreshTokenValiditySeconds(oldClient.getRefreshTokenValiditySeconds());
newClient.setDeviceCodeValiditySeconds(oldClient.getDeviceCodeValiditySeconds());
newClient.setDynamicallyRegistered(true); // it's still dynamically registered
newClient.setAllowIntrospection(false); // dynamically registered clients can't do introspection -- use the resource registration instead
newClient.setAuthorities(oldClient.getAuthorities());
@ -390,6 +395,7 @@ public class DynamicClientRegistrationEndpoint {
newClient.getGrantTypes().addAll(oldClientGrantedGrantTypes);
}
// save the client
ClientDetailsEntity savedClient = clientService.updateClient(oldClient, newClient);

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.mitre</groupId>
<artifactId>openid-connect-parent</artifactId>
<version>1.3.3.cnaf.rc0</version>
<version>1.3.4.cnaf-SNAPSHOT</version>
<name>MITREid Connect</name>
<packaging>pom</packaging>
<parent>