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> <parent>
<artifactId>openid-connect-parent</artifactId> <artifactId>openid-connect-parent</artifactId>
<groupId>org.mitre</groupId> <groupId>org.mitre</groupId>
<version>1.3.3.cnaf.rc0</version> <version>1.3.4.cnaf-SNAPSHOT</version>
<relativePath>..</relativePath> <relativePath>..</relativePath>
</parent> </parent>
<artifactId>openid-connect-client</artifactId> <artifactId>openid-connect-client</artifactId>

View File

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

View File

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

View File

@ -233,6 +233,10 @@ public class DynamicClientRegistrationEndpoint {
newClient.setRefreshTokenValiditySeconds(null); // refresh tokens good until revoked 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) // this client has been dynamically registered (obviously)
newClient.setDynamicallyRegistered(true); newClient.setDynamicallyRegistered(true);
@ -354,6 +358,7 @@ public class DynamicClientRegistrationEndpoint {
newClient.setAccessTokenValiditySeconds(oldClient.getAccessTokenValiditySeconds()); newClient.setAccessTokenValiditySeconds(oldClient.getAccessTokenValiditySeconds());
newClient.setIdTokenValiditySeconds(oldClient.getIdTokenValiditySeconds()); newClient.setIdTokenValiditySeconds(oldClient.getIdTokenValiditySeconds());
newClient.setRefreshTokenValiditySeconds(oldClient.getRefreshTokenValiditySeconds()); newClient.setRefreshTokenValiditySeconds(oldClient.getRefreshTokenValiditySeconds());
newClient.setDeviceCodeValiditySeconds(oldClient.getDeviceCodeValiditySeconds());
newClient.setDynamicallyRegistered(true); // it's still dynamically registered newClient.setDynamicallyRegistered(true); // it's still dynamically registered
newClient.setAllowIntrospection(false); // dynamically registered clients can't do introspection -- use the resource registration instead newClient.setAllowIntrospection(false); // dynamically registered clients can't do introspection -- use the resource registration instead
newClient.setAuthorities(oldClient.getAuthorities()); newClient.setAuthorities(oldClient.getAuthorities());
@ -390,6 +395,7 @@ public class DynamicClientRegistrationEndpoint {
newClient.getGrantTypes().addAll(oldClientGrantedGrantTypes); newClient.getGrantTypes().addAll(oldClientGrantedGrantTypes);
} }
// save the client // save the client
ClientDetailsEntity savedClient = clientService.updateClient(oldClient, newClient); ClientDetailsEntity savedClient = clientService.updateClient(oldClient, newClient);

View File

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