added device code validity seconds to client model

pull/1161/merge
Justin Richer 8 years ago
parent a5b4115169
commit 9cb5377ce8

@ -145,6 +145,7 @@ public class ClientDetailsEntity implements ClientDetails {
private Integer idTokenValiditySeconds; //timeout for id tokens
private Date createdAt; // time the client was created
private boolean clearAccessTokensOnRefresh = true; // do we clear access tokens on refresh?
private Integer deviceCodeValiditySeconds; // timeout for device codes
/** fields for UMA */
private Set<String> claimsRedirectUris;
@ -1032,4 +1033,20 @@ public class ClientDetailsEntity implements ClientDetails {
this.codeChallengeMethod = codeChallengeMethod;
}
/**
* @return the deviceCodeValiditySeconds
*/
@Basic
@Column(name="device_code_validity_seconds")
public Integer getDeviceCodeValiditySeconds() {
return deviceCodeValiditySeconds;
}
/**
* @param deviceCodeValiditySeconds the deviceCodeValiditySeconds to set
*/
public void setDeviceCodeValiditySeconds(Integer deviceCodeValiditySeconds) {
this.deviceCodeValiditySeconds = deviceCodeValiditySeconds;
}
}

@ -846,6 +846,22 @@ public class RegisteredClient {
this.src = src;
}
/**
* @return
* @see org.mitre.oauth2.model.ClientDetailsEntity#getDeviceCodeValiditySeconds()
*/
public Integer getDeviceCodeValiditySeconds() {
return client.getDeviceCodeValiditySeconds();
}
/**
* @param deviceCodeValiditySeconds
* @see org.mitre.oauth2.model.ClientDetailsEntity#setDeviceCodeValiditySeconds(java.lang.Integer)
*/
public void setDeviceCodeValiditySeconds(Integer deviceCodeValiditySeconds) {
client.setDeviceCodeValiditySeconds(deviceCodeValiditySeconds);
}
}

@ -131,6 +131,7 @@ CREATE TABLE IF NOT EXISTS client_details (
dynamically_registered BOOLEAN DEFAULT false NOT NULL,
allow_introspection BOOLEAN DEFAULT false NOT NULL,
id_token_validity_seconds BIGINT DEFAULT 600 NOT NULL,
device_code_validity_seconds BIGINT DEFAULT 600 NOT NULL,
client_id VARCHAR(256),
client_secret VARCHAR(2048),

@ -117,6 +117,7 @@ public class MITREidDataService_1_3 extends MITREidDataServiceSupport implements
private static final String REFRESH_TOKEN_VALIDITY_SECONDS = "refreshTokenValiditySeconds";
private static final String ACCESS_TOKEN_VALIDITY_SECONDS = "accessTokenValiditySeconds";
private static final String ID_TOKEN_VALIDITY_SECONDS = "idTokenValiditySeconds";
private static final String DEVICE_CODE_VALIDITY_SECONDS = "deviceCodeValiditySeconds";
private static final String SECRET = "secret";
private static final String URI = "uri";
private static final String CREATOR_USER_ID = "creatorUserId";
@ -452,6 +453,7 @@ public class MITREidDataService_1_3 extends MITREidDataServiceSupport implements
writer.name(ACCESS_TOKEN_VALIDITY_SECONDS).value(client.getAccessTokenValiditySeconds());
writer.name(REFRESH_TOKEN_VALIDITY_SECONDS).value(client.getRefreshTokenValiditySeconds());
writer.name(ID_TOKEN_VALIDITY_SECONDS).value(client.getIdTokenValiditySeconds());
writer.name(DEVICE_CODE_VALIDITY_SECONDS).value(client.getDeviceCodeValiditySeconds());
writer.name(REDIRECT_URIS);
writeNullSafeArray(writer, client.getRedirectUris());
writer.name(CLAIMS_REDIRECT_URIS);
@ -1056,6 +1058,8 @@ public class MITREidDataService_1_3 extends MITREidDataServiceSupport implements
client.setRefreshTokenValiditySeconds(reader.nextInt());
} else if (name.equals(ID_TOKEN_VALIDITY_SECONDS)) {
client.setIdTokenValiditySeconds(reader.nextInt());
} else if (name.equals(DEVICE_CODE_VALIDITY_SECONDS)) {
client.setDeviceCodeValiditySeconds(reader.nextInt());
} else if (name.equals(REDIRECT_URIS)) {
Set<String> redirectUris = readSet(reader);
client.setRedirectUris(redirectUris);

Loading…
Cancel
Save