Make some entity classes serializable
DeviceCode not being serializable causes issues when externalizing sessions to Redis.pull/1611/head
parent
5b96fb6512
commit
c8e2752ffa
|
@ -58,9 +58,12 @@ import org.springframework.security.oauth2.provider.OAuth2Request;
|
||||||
"a.id not in (select r.authenticationHolder.id from OAuth2RefreshTokenEntity r) and " +
|
"a.id not in (select r.authenticationHolder.id from OAuth2RefreshTokenEntity r) and " +
|
||||||
"a.id not in (select c.authenticationHolder.id from AuthorizationCodeEntity c)")
|
"a.id not in (select c.authenticationHolder.id from AuthorizationCodeEntity c)")
|
||||||
})
|
})
|
||||||
public class AuthenticationHolderEntity {
|
public class AuthenticationHolderEntity implements Serializable {
|
||||||
|
|
||||||
public static final String QUERY_GET_UNUSED = "AuthenticationHolderEntity.getUnusedAuthenticationHolders";
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
public static final String QUERY_GET_UNUSED =
|
||||||
|
"AuthenticationHolderEntity.getUnusedAuthenticationHolders";
|
||||||
public static final String QUERY_ALL = "AuthenticationHolderEntity.getAll";
|
public static final String QUERY_ALL = "AuthenticationHolderEntity.getAll";
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.mitre.oauth2.model;
|
package org.mitre.oauth2.model;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import javax.persistence.Basic;
|
import javax.persistence.Basic;
|
||||||
|
@ -44,9 +45,11 @@ import javax.persistence.Temporal;
|
||||||
@NamedQuery(name = AuthorizationCodeEntity.QUERY_BY_VALUE, query = "select a from AuthorizationCodeEntity a where a.code = :code"),
|
@NamedQuery(name = AuthorizationCodeEntity.QUERY_BY_VALUE, query = "select a from AuthorizationCodeEntity a where a.code = :code"),
|
||||||
@NamedQuery(name = AuthorizationCodeEntity.QUERY_EXPIRATION_BY_DATE, query = "select a from AuthorizationCodeEntity a where a.expiration <= :" + AuthorizationCodeEntity.PARAM_DATE)
|
@NamedQuery(name = AuthorizationCodeEntity.QUERY_EXPIRATION_BY_DATE, query = "select a from AuthorizationCodeEntity a where a.expiration <= :" + AuthorizationCodeEntity.PARAM_DATE)
|
||||||
})
|
})
|
||||||
public class AuthorizationCodeEntity {
|
public class AuthorizationCodeEntity implements Serializable {
|
||||||
|
|
||||||
public static final String QUERY_BY_VALUE = "AuthorizationCodeEntity.getByValue";
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public static final String QUERY_BY_VALUE = "AuthorizationCodeEntity.getByValue";
|
||||||
public static final String QUERY_EXPIRATION_BY_DATE = "AuthorizationCodeEntity.expirationByDate";
|
public static final String QUERY_EXPIRATION_BY_DATE = "AuthorizationCodeEntity.expirationByDate";
|
||||||
|
|
||||||
public static final String PARAM_DATE = "date";
|
public static final String PARAM_DATE = "date";
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package org.mitre.oauth2.model;
|
package org.mitre.oauth2.model;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -44,191 +45,192 @@ import javax.persistence.Temporal;
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "device_code")
|
@Table(name = "device_code")
|
||||||
@NamedQueries({
|
@NamedQueries({
|
||||||
@NamedQuery(name = DeviceCode.QUERY_BY_USER_CODE, query = "select d from DeviceCode d where d.userCode = :" + DeviceCode.PARAM_USER_CODE),
|
@NamedQuery(name = DeviceCode.QUERY_BY_USER_CODE,
|
||||||
@NamedQuery(name = DeviceCode.QUERY_BY_DEVICE_CODE, query = "select d from DeviceCode d where d.deviceCode = :" + DeviceCode.PARAM_DEVICE_CODE),
|
query = "select d from DeviceCode d where d.userCode = :" + DeviceCode.PARAM_USER_CODE),
|
||||||
@NamedQuery(name = DeviceCode.QUERY_EXPIRED_BY_DATE, query = "select d from DeviceCode d where d.expiration <= :" + DeviceCode.PARAM_DATE)
|
@NamedQuery(name = DeviceCode.QUERY_BY_DEVICE_CODE,
|
||||||
})
|
query = "select d from DeviceCode d where d.deviceCode = :" + DeviceCode.PARAM_DEVICE_CODE),
|
||||||
public class DeviceCode {
|
@NamedQuery(name = DeviceCode.QUERY_EXPIRED_BY_DATE,
|
||||||
|
query = "select d from DeviceCode d where d.expiration <= :" + DeviceCode.PARAM_DATE)})
|
||||||
|
public class DeviceCode implements Serializable {
|
||||||
|
|
||||||
public static final String QUERY_BY_USER_CODE = "DeviceCode.queryByUserCode";
|
private static final long serialVersionUID = 1L;
|
||||||
public static final String QUERY_BY_DEVICE_CODE = "DeviceCode.queryByDeviceCode";
|
|
||||||
public static final String QUERY_EXPIRED_BY_DATE = "DeviceCode.queryExpiredByDate";
|
|
||||||
|
|
||||||
public static final String PARAM_USER_CODE = "userCode";
|
public static final String QUERY_BY_USER_CODE = "DeviceCode.queryByUserCode";
|
||||||
public static final String PARAM_DEVICE_CODE = "deviceCode";
|
public static final String QUERY_BY_DEVICE_CODE = "DeviceCode.queryByDeviceCode";
|
||||||
public static final String PARAM_DATE = "date";
|
public static final String QUERY_EXPIRED_BY_DATE = "DeviceCode.queryExpiredByDate";
|
||||||
|
|
||||||
private Long id;
|
public static final String PARAM_USER_CODE = "userCode";
|
||||||
private String deviceCode;
|
public static final String PARAM_DEVICE_CODE = "deviceCode";
|
||||||
private String userCode;
|
public static final String PARAM_DATE = "date";
|
||||||
private Set<String> scope;
|
|
||||||
private Date expiration;
|
|
||||||
private String clientId;
|
|
||||||
private Map<String, String> requestParameters;
|
|
||||||
private boolean approved;
|
|
||||||
private AuthenticationHolderEntity authenticationHolder;
|
|
||||||
|
|
||||||
public DeviceCode() {
|
private Long id;
|
||||||
|
private String deviceCode;
|
||||||
|
private String userCode;
|
||||||
|
private Set<String> scope;
|
||||||
|
private Date expiration;
|
||||||
|
private String clientId;
|
||||||
|
private Map<String, String> requestParameters;
|
||||||
|
private boolean approved;
|
||||||
|
private AuthenticationHolderEntity authenticationHolder;
|
||||||
|
|
||||||
}
|
public DeviceCode() {
|
||||||
|
|
||||||
public DeviceCode(String deviceCode, String userCode, Set<String> scope, String clientId, Map<String, String> params) {
|
}
|
||||||
this.deviceCode = deviceCode;
|
|
||||||
this.userCode = userCode;
|
|
||||||
this.scope = scope;
|
|
||||||
this.clientId = clientId;
|
|
||||||
this.requestParameters = params;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public DeviceCode(String deviceCode, String userCode, Set<String> scope, String clientId,
|
||||||
* @return the id
|
Map<String, String> params) {
|
||||||
*/
|
this.deviceCode = deviceCode;
|
||||||
@Id
|
this.userCode = userCode;
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
this.scope = scope;
|
||||||
@Column(name = "id")
|
this.clientId = clientId;
|
||||||
public Long getId() {
|
this.requestParameters = params;
|
||||||
return id;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param id the id to set
|
* @return the id
|
||||||
*/
|
*/
|
||||||
public void setId(Long id) {
|
@Id
|
||||||
this.id = id;
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
}
|
@Column(name = "id")
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the deviceCode
|
* @param id the id to set
|
||||||
*/
|
*/
|
||||||
@Basic
|
public void setId(Long id) {
|
||||||
@Column(name = "device_code")
|
this.id = id;
|
||||||
public String getDeviceCode() {
|
}
|
||||||
return deviceCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param deviceCode the deviceCode to set
|
* @return the deviceCode
|
||||||
*/
|
*/
|
||||||
public void setDeviceCode(String deviceCode) {
|
@Basic
|
||||||
this.deviceCode = deviceCode;
|
@Column(name = "device_code")
|
||||||
}
|
public String getDeviceCode() {
|
||||||
|
return deviceCode;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the userCode
|
* @param deviceCode the deviceCode to set
|
||||||
*/
|
*/
|
||||||
@Basic
|
public void setDeviceCode(String deviceCode) {
|
||||||
@Column(name = "user_code")
|
this.deviceCode = deviceCode;
|
||||||
public String getUserCode() {
|
}
|
||||||
return userCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param userCode the userCode to set
|
* @return the userCode
|
||||||
*/
|
*/
|
||||||
public void setUserCode(String userCode) {
|
@Basic
|
||||||
this.userCode = userCode;
|
@Column(name = "user_code")
|
||||||
}
|
public String getUserCode() {
|
||||||
|
return userCode;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the scope
|
* @param userCode the userCode to set
|
||||||
*/
|
*/
|
||||||
@ElementCollection(fetch = FetchType.EAGER)
|
public void setUserCode(String userCode) {
|
||||||
@CollectionTable(
|
this.userCode = userCode;
|
||||||
name="device_code_scope",
|
}
|
||||||
joinColumns=@JoinColumn(name="owner_id")
|
|
||||||
)
|
|
||||||
@Column(name="scope")
|
|
||||||
public Set<String> getScope() {
|
|
||||||
return scope;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param scope the scope to set
|
* @return the scope
|
||||||
*/
|
*/
|
||||||
public void setScope(Set<String> scope) {
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
this.scope = scope;
|
@CollectionTable(name = "device_code_scope", joinColumns = @JoinColumn(name = "owner_id"))
|
||||||
}
|
@Column(name = "scope")
|
||||||
|
public Set<String> getScope() {
|
||||||
|
return scope;
|
||||||
|
}
|
||||||
|
|
||||||
@Basic
|
/**
|
||||||
@Temporal(javax.persistence.TemporalType.TIMESTAMP)
|
* @param scope the scope to set
|
||||||
@Column(name = "expiration")
|
*/
|
||||||
public Date getExpiration() {
|
public void setScope(Set<String> scope) {
|
||||||
return expiration;
|
this.scope = scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExpiration(Date expiration) {
|
@Basic
|
||||||
this.expiration = expiration;
|
@Temporal(javax.persistence.TemporalType.TIMESTAMP)
|
||||||
}
|
@Column(name = "expiration")
|
||||||
|
public Date getExpiration() {
|
||||||
|
return expiration;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
public void setExpiration(Date expiration) {
|
||||||
* @return the clientId
|
this.expiration = expiration;
|
||||||
*/
|
}
|
||||||
@Basic
|
|
||||||
@Column(name = "client_id")
|
|
||||||
public String getClientId() {
|
|
||||||
return clientId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param clientId the clientId to set
|
* @return the clientId
|
||||||
*/
|
*/
|
||||||
public void setClientId(String clientId) {
|
@Basic
|
||||||
this.clientId = clientId;
|
@Column(name = "client_id")
|
||||||
}
|
public String getClientId() {
|
||||||
|
return clientId;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the params
|
* @param clientId the clientId to set
|
||||||
*/
|
*/
|
||||||
@ElementCollection(fetch = FetchType.EAGER)
|
public void setClientId(String clientId) {
|
||||||
@CollectionTable(
|
this.clientId = clientId;
|
||||||
name="device_code_request_parameter",
|
}
|
||||||
joinColumns=@JoinColumn(name="owner_id")
|
|
||||||
)
|
|
||||||
@Column(name="val")
|
|
||||||
@MapKeyColumn(name="param")
|
|
||||||
public Map<String, String> getRequestParameters() {
|
|
||||||
return requestParameters;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param params the params to set
|
* @return the params
|
||||||
*/
|
*/
|
||||||
public void setRequestParameters(Map<String, String> params) {
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
this.requestParameters = params;
|
@CollectionTable(name = "device_code_request_parameter",
|
||||||
}
|
joinColumns = @JoinColumn(name = "owner_id"))
|
||||||
|
@Column(name = "val")
|
||||||
|
@MapKeyColumn(name = "param")
|
||||||
|
public Map<String, String> getRequestParameters() {
|
||||||
|
return requestParameters;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the approved
|
* @param params the params to set
|
||||||
*/
|
*/
|
||||||
@Basic
|
public void setRequestParameters(Map<String, String> params) {
|
||||||
@Column(name = "approved")
|
this.requestParameters = params;
|
||||||
public boolean isApproved() {
|
}
|
||||||
return approved;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param approved the approved to set
|
* @return the approved
|
||||||
*/
|
*/
|
||||||
public void setApproved(boolean approved) {
|
@Basic
|
||||||
this.approved = approved;
|
@Column(name = "approved")
|
||||||
}
|
public boolean isApproved() {
|
||||||
|
return approved;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The authentication in place when this token was created.
|
* @param approved the approved to set
|
||||||
* @return the authentication
|
*/
|
||||||
*/
|
public void setApproved(boolean approved) {
|
||||||
@ManyToOne
|
this.approved = approved;
|
||||||
@JoinColumn(name = "auth_holder_id")
|
}
|
||||||
public AuthenticationHolderEntity getAuthenticationHolder() {
|
|
||||||
return authenticationHolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param authentication the authentication to set
|
* The authentication in place when this token was created.
|
||||||
*/
|
*
|
||||||
public void setAuthenticationHolder(AuthenticationHolderEntity authenticationHolder) {
|
* @return the authentication
|
||||||
this.authenticationHolder = authenticationHolder;
|
*/
|
||||||
}
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "auth_holder_id")
|
||||||
|
public AuthenticationHolderEntity getAuthenticationHolder() {
|
||||||
|
return authenticationHolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param authentication the authentication to set
|
||||||
|
*/
|
||||||
|
public void setAuthenticationHolder(AuthenticationHolderEntity authenticationHolder) {
|
||||||
|
this.authenticationHolder = authenticationHolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue