added extra client fields to DB model, moved services to use new client model object

pull/306/merge
Justin Richer 2013-03-04 14:22:42 -05:00
parent 3f8d7d70e5
commit 5c044b9eff
5 changed files with 49 additions and 10 deletions

View File

@ -18,6 +18,7 @@
*/
package org.mitre.oauth2.model;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@ -118,7 +119,7 @@ public class ClientDetailsEntity implements ClientDetails {
private boolean dynamicallyRegistered = false; // was this client dynamically registered?
private boolean allowIntrospection = false; // do we let this client call the introspection endpoint?
private Integer idTokenValiditySeconds; //timeout for id tokens
private Date createdAt; // time the client was created
public enum AuthMethod {
SECRET_POST("client_secret_post"),
@ -850,4 +851,18 @@ public class ClientDetailsEntity implements ClientDetails {
this.requestUris = requestUris;
}
/**
* @return the createdAt
*/
public Date getCreatedAt() {
return createdAt;
}
/**
* @param createdAt the createdAt to set
*/
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
}

View File

@ -170,12 +170,12 @@ public class ConnectAuthorizationRequestManager implements AuthorizationRequestM
ClientDetailsEntity client = clientDetailsService.loadClientByClientId(clientId);
if (client.getJwkUrl() == null) {
if (client.getJwksUri() == null) {
throw new InvalidClientException("Client must have a JWK URI registered to use request objects.");
}
// check JWT signature
JwtSigningAndValidationService validator = validators.get(client.getJwkUrl());
JwtSigningAndValidationService validator = validators.get(client.getJwksUri());
if (validator == null) {
throw new InvalidClientException("Client must have a JWK URI registered to use request objects.");
}

View File

@ -66,7 +66,7 @@ public class JwtBearerAuthenticationProvider implements AuthenticationProvider {
// check the signature with nimbus
if (jwt instanceof SignedJWT) {
SignedJWT jws = (SignedJWT)jwt;
JwtSigningAndValidationService validator = validators.get(client.getJwkUrl());
JwtSigningAndValidationService validator = validators.get(client.getJwksUri());
if (validator == null || !validator.validateSignature(jws)) {
throw new AuthenticationServiceException("Invalid signature");
}

View File

@ -109,15 +109,27 @@ CREATE TABLE IF NOT EXISTS client_details (
default_max_age BIGINT,
require_auth_time BOOLEAN NOT NULL DEFAULT FALSE,
default_acr VARCHAR(256)
created_at TIMESTAMP,
initiate_login_uri VARCHAR(2048),
post_logout_redirect_uri VARCHAR(2048)
);
CREATE TABLE IF NOT EXISTS client_request_uri (
owner_id BIGINT,
request_uri VARCHAR(2000)
);
CREATE TABLE IF NOT EXISTS client_default_acr_value (
owner_id BIGINT,
default_acr_value VARCHAR(2000)
);
CREATE TABLE IF NOT EXISTS client_nonce (
id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY,
value VARCHAR(256),
client_id VARCHAR(256),
use_date DATE,
expire_date DATE
use_date TIMESTAMP,
expire_date TIMESTAMP
);
CREATE TABLE IF NOT EXISTS client_contact (

View File

@ -109,15 +109,27 @@ CREATE TABLE IF NOT EXISTS client_details (
default_max_age BIGINT,
require_auth_time BOOLEAN NOT NULL DEFAULT 0,
default_acr VARCHAR(256)
created_at TIMESTAMP NULL,
initiate_login_uri VARCHAR(2048),
post_logout_redirect_uri VARCHAR(2048)
);
CREATE TABLE IF NOT EXISTS client_request_uri (
owner_id BIGINT,
request_uri VARCHAR(2000)
);
CREATE TABLE IF NOT EXISTS client_default_acr_value (
owner_id BIGINT,
default_acr_value VARCHAR(2000)
);
CREATE TABLE IF NOT EXISTS client_nonce (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
value VARCHAR(256),
client_id VARCHAR(256),
use_date DATE,
expire_date DATE
use_date TIMESTAMP NULL,
expire_date TIMESTAMP NULL
);
CREATE TABLE IF NOT EXISTS client_contact (