Organized ClientDetailsEntity, updated JPA annotations. Updated sql files to match. Naming conventions: table and column names with multiple words should be seperated by underscores; table and column names should be singular.
parent
15428a875e
commit
a68a4f9796
|
@ -25,6 +25,7 @@ import java.util.Set;
|
||||||
|
|
||||||
import javax.persistence.Basic;
|
import javax.persistence.Basic;
|
||||||
import javax.persistence.CollectionTable;
|
import javax.persistence.CollectionTable;
|
||||||
|
import javax.persistence.Column;
|
||||||
import javax.persistence.ElementCollection;
|
import javax.persistence.ElementCollection;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
|
@ -266,7 +267,6 @@ public class ClientDetailsEntity implements ClientDetails {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @return the id
|
* @return the id
|
||||||
*/
|
*/
|
||||||
@Id
|
@Id
|
||||||
|
@ -283,109 +283,6 @@ public class ClientDetailsEntity implements ClientDetails {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the clientId
|
|
||||||
*/
|
|
||||||
@Basic
|
|
||||||
public String getClientId() {
|
|
||||||
return clientId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param clientId The OAuth2 client_id, must be unique to this client
|
|
||||||
*/
|
|
||||||
public void setClientId(String clientId) {
|
|
||||||
this.clientId = clientId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the clientSecret
|
|
||||||
*/
|
|
||||||
@Basic
|
|
||||||
public String getClientSecret() {
|
|
||||||
return clientSecret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param clientSecret the OAuth2 client_secret (optional)
|
|
||||||
*/
|
|
||||||
public void setClientSecret(String clientSecret) {
|
|
||||||
this.clientSecret = clientSecret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the scope
|
|
||||||
*/
|
|
||||||
@ElementCollection(fetch = FetchType.EAGER)
|
|
||||||
@CollectionTable(
|
|
||||||
name="scope",
|
|
||||||
joinColumns=@JoinColumn(name="owner_id")
|
|
||||||
)
|
|
||||||
public Set<String> getScope() {
|
|
||||||
return scope;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param scope the set of scopes allowed to be issued to this client
|
|
||||||
*/
|
|
||||||
public void setScope(Set<String> scope) {
|
|
||||||
this.scope = scope;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the authorizedGrantTypes
|
|
||||||
*/
|
|
||||||
@ElementCollection(fetch = FetchType.EAGER)
|
|
||||||
@CollectionTable(
|
|
||||||
name="authorizedgranttypes",
|
|
||||||
joinColumns=@JoinColumn(name="owner_id")
|
|
||||||
)
|
|
||||||
public Set<String> getAuthorizedGrantTypes() {
|
|
||||||
return authorizedGrantTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param authorizedGrantTypes the OAuth2 grant types that this client is allowed to use
|
|
||||||
*/
|
|
||||||
public void setAuthorizedGrantTypes(Set<String> authorizedGrantTypes) {
|
|
||||||
this.authorizedGrantTypes = authorizedGrantTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the authorities
|
|
||||||
*/
|
|
||||||
@ElementCollection(fetch = FetchType.EAGER)
|
|
||||||
@CollectionTable(
|
|
||||||
name="authorities",
|
|
||||||
joinColumns=@JoinColumn(name="owner_id")
|
|
||||||
)
|
|
||||||
public Set<GrantedAuthority> getAuthorities() {
|
|
||||||
return authorities;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param authorities the Spring Security authorities this client is given
|
|
||||||
*/
|
|
||||||
public void setAuthorities(Set<GrantedAuthority> authorities) {
|
|
||||||
this.authorities = authorities;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If the clientSecret is not null, then it is always required.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean isSecretRequired() {
|
|
||||||
return getClientSecret() != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If the scope list is not null or empty, then this client has been scoped.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean isScoped() {
|
|
||||||
return getScope() != null && !getScope().isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the clientDescription
|
* @return the clientDescription
|
||||||
*/
|
*/
|
||||||
|
@ -415,6 +312,140 @@ public class ClientDetailsEntity implements ClientDetails {
|
||||||
public void setAllowRefresh(Boolean allowRefresh) {
|
public void setAllowRefresh(Boolean allowRefresh) {
|
||||||
this.allowRefresh = allowRefresh;
|
this.allowRefresh = allowRefresh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
public Boolean isAllowMultipleAccessTokens() {
|
||||||
|
return allowMultipleAccessTokens;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllowMultipleAccessTokens(Boolean allowMultipleAccessTokens) {
|
||||||
|
this.allowMultipleAccessTokens = allowMultipleAccessTokens;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Basic
|
||||||
|
public Boolean isReuseRefreshToken() {
|
||||||
|
return reuseRefreshToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReuseRefreshToken(Boolean reuseRefreshToken) {
|
||||||
|
this.reuseRefreshToken = reuseRefreshToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the clientSecret is not null, then it is always required.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transient
|
||||||
|
public boolean isSecretRequired() {
|
||||||
|
return getClientSecret() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the scope list is not null or empty, then this client has been scoped.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transient
|
||||||
|
public boolean isScoped() {
|
||||||
|
return getScope() != null && !getScope().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the clientId
|
||||||
|
*/
|
||||||
|
@Basic
|
||||||
|
@Override
|
||||||
|
public String getClientId() {
|
||||||
|
return clientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param clientId The OAuth2 client_id, must be unique to this client
|
||||||
|
*/
|
||||||
|
public void setClientId(String clientId) {
|
||||||
|
this.clientId = clientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the clientSecret
|
||||||
|
*/
|
||||||
|
@Basic
|
||||||
|
@Override
|
||||||
|
public String getClientSecret() {
|
||||||
|
return clientSecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param clientSecret the OAuth2 client_secret (optional)
|
||||||
|
*/
|
||||||
|
public void setClientSecret(String clientSecret) {
|
||||||
|
this.clientSecret = clientSecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the scope
|
||||||
|
*/
|
||||||
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
|
@CollectionTable(
|
||||||
|
name="scope",
|
||||||
|
joinColumns=@JoinColumn(name="owner_id")
|
||||||
|
)
|
||||||
|
@Override
|
||||||
|
public Set<String> getScope() {
|
||||||
|
return scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param scope the set of scopes allowed to be issued to this client
|
||||||
|
*/
|
||||||
|
public void setScope(Set<String> scope) {
|
||||||
|
this.scope = scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the authorizedGrantTypes
|
||||||
|
*/
|
||||||
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
|
@CollectionTable(
|
||||||
|
name="authorized_grant_type",
|
||||||
|
joinColumns=@JoinColumn(name="owner_id")
|
||||||
|
)
|
||||||
|
@Override
|
||||||
|
@Column(name="authorized_grant_type")
|
||||||
|
public Set<String> getAuthorizedGrantTypes() {
|
||||||
|
return authorizedGrantTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param authorizedGrantTypes the OAuth2 grant types that this client is allowed to use
|
||||||
|
*/
|
||||||
|
public void setAuthorizedGrantTypes(Set<String> authorizedGrantTypes) {
|
||||||
|
this.authorizedGrantTypes = authorizedGrantTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the authorities
|
||||||
|
*/
|
||||||
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
|
@CollectionTable(
|
||||||
|
name="authority",
|
||||||
|
joinColumns=@JoinColumn(name="owner_id")
|
||||||
|
)
|
||||||
|
@Override
|
||||||
|
@Column(name="authority")
|
||||||
|
public Set<GrantedAuthority> getAuthorities() {
|
||||||
|
return authorities;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param authorities the Spring Security authorities this client is given
|
||||||
|
*/
|
||||||
|
public void setAuthorities(Set<GrantedAuthority> authorities) {
|
||||||
|
this.authorities = authorities;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Basic
|
@Basic
|
||||||
|
@ -429,7 +460,6 @@ public class ClientDetailsEntity implements ClientDetails {
|
||||||
this.accessTokenValiditySeconds = accessTokenValiditySeconds;
|
this.accessTokenValiditySeconds = accessTokenValiditySeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Basic
|
@Basic
|
||||||
public Integer getRefreshTokenValiditySeconds() {
|
public Integer getRefreshTokenValiditySeconds() {
|
||||||
|
@ -443,25 +473,15 @@ public class ClientDetailsEntity implements ClientDetails {
|
||||||
this.refreshTokenValiditySeconds = refreshTokenValiditySeconds;
|
this.refreshTokenValiditySeconds = refreshTokenValiditySeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We're not using this field, so it is not stored with JPA.
|
|
||||||
*
|
|
||||||
* @return an empty map
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transient
|
|
||||||
public Map<String, Object> getAdditionalInformation() {
|
|
||||||
return this.additionalInformation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the registeredRedirectUri
|
* @return the registeredRedirectUri
|
||||||
*/
|
*/
|
||||||
@ElementCollection(fetch = FetchType.EAGER)
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
@CollectionTable(
|
@CollectionTable(
|
||||||
name="redirect_uris",
|
name="redirect_uri",
|
||||||
joinColumns=@JoinColumn(name="owner_id")
|
joinColumns=@JoinColumn(name="owner_id")
|
||||||
)
|
)
|
||||||
|
@Column(name="redirect_uri")
|
||||||
public Set<String> getRegisteredRedirectUri() {
|
public Set<String> getRegisteredRedirectUri() {
|
||||||
return registeredRedirectUri;
|
return registeredRedirectUri;
|
||||||
}
|
}
|
||||||
|
@ -481,6 +501,7 @@ public class ClientDetailsEntity implements ClientDetails {
|
||||||
name="resource_ids",
|
name="resource_ids",
|
||||||
joinColumns=@JoinColumn(name="owner_id")
|
joinColumns=@JoinColumn(name="owner_id")
|
||||||
)
|
)
|
||||||
|
@Column(name="resource_id")
|
||||||
public Set<String> getResourceIds() {
|
public Set<String> getResourceIds() {
|
||||||
return resourceIds;
|
return resourceIds;
|
||||||
}
|
}
|
||||||
|
@ -492,23 +513,21 @@ public class ClientDetailsEntity implements ClientDetails {
|
||||||
this.resourceIds = resourceIds;
|
this.resourceIds = resourceIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Basic
|
|
||||||
public Boolean isAllowMultipleAccessTokens() {
|
/**
|
||||||
return allowMultipleAccessTokens;
|
* This library does not make use of this field, so it is not
|
||||||
|
* stored using our persistence layer.
|
||||||
|
*
|
||||||
|
* @return an empty map
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transient
|
||||||
|
public Map<String, Object> getAdditionalInformation() {
|
||||||
|
return this.additionalInformation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAllowMultipleAccessTokens(Boolean allowMultipleAccessTokens) {
|
|
||||||
this.allowMultipleAccessTokens = allowMultipleAccessTokens;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Basic
|
|
||||||
public Boolean isReuseRefreshToken() {
|
|
||||||
return reuseRefreshToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReuseRefreshToken(Boolean reuseRefreshToken) {
|
|
||||||
this.reuseRefreshToken = reuseRefreshToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Basic
|
@Basic
|
||||||
public AppType getApplicationType() {
|
public AppType getApplicationType() {
|
||||||
|
@ -546,7 +565,12 @@ public class ClientDetailsEntity implements ClientDetails {
|
||||||
this.userIdType = userIdType;
|
this.userIdType = userIdType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Basic
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
|
@CollectionTable(
|
||||||
|
name="contact",
|
||||||
|
joinColumns=@JoinColumn(name="owner_id")
|
||||||
|
)
|
||||||
|
@Column(name="contact")
|
||||||
public Set<String> getContacts() {
|
public Set<String> getContacts() {
|
||||||
return contacts;
|
return contacts;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
CREATE TABLE authorities (
|
|
||||||
owner_id VARCHAR(4096),
|
|
||||||
authorities LONGBLOB
|
|
||||||
);
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
CREATE TABLE authority (
|
||||||
|
owner_id VARCHAR(4096),
|
||||||
|
authority LONGBLOB
|
||||||
|
);
|
|
@ -0,0 +1,4 @@
|
||||||
|
CREATE TABLE authorized_grant_type (
|
||||||
|
owner_id VARCHAR(256),
|
||||||
|
authorized_grant_type VARCHAR(2000)
|
||||||
|
);
|
|
@ -1,11 +1,41 @@
|
||||||
CREATE TABLE clientdetails (
|
CREATE TABLE clientdetails (
|
||||||
id VARCHAR(256),
|
id VARCHAR(256),
|
||||||
|
clientDescription VARCHAR(256),
|
||||||
|
allowRefresh TINYINT,
|
||||||
|
allowMultipleAccessTokens TINYINT,
|
||||||
|
reuseRefreshTokens TINYINT,
|
||||||
|
|
||||||
clientId VARCHAR(256),
|
clientId VARCHAR(256),
|
||||||
clientSecret VARCHAR(2000),
|
clientSecret VARCHAR(2000),
|
||||||
clientName VARCHAR(256),
|
|
||||||
clientDescription VARCHAR(2000),
|
|
||||||
allowRefresh TINYINT,
|
|
||||||
accessTokenValiditySeconds BIGINT,
|
accessTokenValiditySeconds BIGINT,
|
||||||
refreshTokenValiditySeconds BIGINT,
|
refreshTokenValiditySeconds BIGINT,
|
||||||
owner VARCHAR(256)
|
|
||||||
|
applicationType VARCHAR(256),
|
||||||
|
applicationName VARCHAR(256),
|
||||||
|
tokenEndpointAuthType VARCHAR(256),
|
||||||
|
userIdType VARCHAR(256),
|
||||||
|
|
||||||
|
logoUrl VARCHAR(256),
|
||||||
|
policyUrl VARCHAR(256),
|
||||||
|
jwkUrl VARCHAR(256),
|
||||||
|
jwkEncryptionUrl VARCHAR(256),
|
||||||
|
x509Url VARCHAR(256)
|
||||||
|
x509EncryptionUrl VARCHAR(256),
|
||||||
|
sectorIdentifierUrl VARCHAR(256),
|
||||||
|
|
||||||
|
requreSignedRequestObject VARCHAR(256),
|
||||||
|
|
||||||
|
userInfoSignedResponseAlg VARCHAR(256),
|
||||||
|
userInfoEncryptedResponseAlg VARCHAR(256),
|
||||||
|
userInfoEncryptedResponseEnc VARCHAR(256),
|
||||||
|
userInfoEncryptedResponseInt VARCHAR(256),
|
||||||
|
|
||||||
|
idTokenSignedResponseAlg VARCHAR(256),
|
||||||
|
idTokenEncryptedResponseAlg VARCHAR(256),
|
||||||
|
idTokenEncryptedResponseEnc VARCHAR(256),
|
||||||
|
idTokenEncryptedResponseInt VARCHAR(256),
|
||||||
|
|
||||||
|
defaultMaxAge BIGINT,
|
||||||
|
requireAuthTime TINYINT,
|
||||||
|
defaultACR VARCHAR(256)
|
||||||
);
|
);
|
|
@ -0,0 +1,4 @@
|
||||||
|
CREATE TABLE contact {
|
||||||
|
owner_id VARCHAR(256),
|
||||||
|
contact VARCHAR(256)
|
||||||
|
}
|
|
@ -1,4 +0,0 @@
|
||||||
CREATE TABLE authorizedgranttypes (
|
|
||||||
owner_id VARCHAR(256),
|
|
||||||
authorizedgranttypes VARCHAR(2000)
|
|
||||||
);
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
CREATE TABLE redirect_uri (
|
||||||
|
owner_id VARCHAR(256),
|
||||||
|
redirect_uri VARCHAR(2000)
|
||||||
|
);
|
|
@ -1,4 +0,0 @@
|
||||||
CREATE TABLE redirect_uris (
|
|
||||||
owner_id VARCHAR(256),
|
|
||||||
registeredRedirectUri VARCHAR(2000)
|
|
||||||
);
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
CREATE TABLE resource_id (
|
||||||
|
owner_id VARCHAR(256),
|
||||||
|
resource_id VARCHAR(256)
|
||||||
|
);
|
|
@ -1,4 +0,0 @@
|
||||||
CREATE TABLE resource_ids (
|
|
||||||
owner_id VARCHAR(256),
|
|
||||||
resourceids VARCHAR(256)
|
|
||||||
);
|
|
Loading…
Reference in New Issue