be.personify.iam.model.authentication.OAUTHClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of personify-model Show documentation
Show all versions of personify-model Show documentation
a possible model for personify
package be.personify.iam.model.authentication;
import java.io.Serializable;
import java.util.Map;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.MapKeyColumn;
import javax.persistence.Table;
import be.personify.iam.model.util.Persisted;
import be.personify.util.generator.MetaInfo;
import be.personify.util.http.HttpMethod;
@Entity
@MetaInfo( name="OAUTHClient", group="authentication", frontendGroup = "Authentication", description="A OAUTH client", iconClass = "clock", number=1,
addable = true,
deletable = false,
showInMenu = true,
showDeleteButtonOnSearchResult = false
)
@Table(name="oauthclient")
public class OAUTHClient extends Persisted implements Serializable{
private static final long serialVersionUID = 7652173889132159224L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@MetaInfo(name="id", description="The id of the object", showInSearchResultGrid = false)
private long id;
@MetaInfo(name="name", description="The name of the client, used to identify", showInSearchResultGrid = true )
private String name;
@MetaInfo(name="description", description="The description of the client", showInSearchResultGrid = false, customRenderer = "text_area|rows:3", searchable = false )
private String description;
@MetaInfo(name="active", description="The active state of the client", showInSearchResultGrid = true )
private boolean active;
@MetaInfo(name="clientId", description="The clientId of the client", showInSearchResultGrid = false, searchable = false )
private String clientId;
@Convert(converter=be.personify.iam.model.util.PasswordConverter.class)
@MetaInfo( name="clientSecret", description="The clientSecret of the client", customRenderer = "password|(?=^.{8,}$)", searchable=false, showInSearchResultGrid=false, viewable=false )
private String clientSecret;
@MetaInfo( name="showOnLoginPage", description="The showOnLoginPage of the client", searchable=false, showInSearchResultGrid=true )
private boolean showOnLoginPage;
@MetaInfo(name="authorizationServerUri", description="The authorizationServerUri of the client", showInSearchResultGrid = false, searchable = false )
private String authorizationServerUri;
@MetaInfo(name="authorizationServerTokenUri", description="The authorizationServerTokenUri of the client ( where the code can be exchanged for a accesstoken )", showInSearchResultGrid = false, searchable = false )
private String authorizationServerTokenUri;
@MetaInfo(name="authorizationServerTokenHttpMethod", description="The httpmethod used to call the token endpoint : both POST (google) and GET (facebook) seem to be supported", showInSearchResultGrid = false, searchable = false )
@Enumerated(EnumType.STRING)
private HttpMethod authorizationServerTokenHttpMethod;
@MetaInfo(name="authorizationServerUserInfoUri", description="The authorizationServerUserInfoUri of the client ( where the accesstoken can be exchanged for user information )", showInSearchResultGrid = false, searchable = false )
private String authorizationServerUserInfoUri;
@MetaInfo(name="redirectUri", description="The redirectUri of the client,separated by spaces", showInSearchResultGrid = false, searchable = false )
private String redirectUri;
@MetaInfo(name="grantType", description="The grantType of the client,separated by spaces", showInSearchResultGrid = false, searchable = false, required = false )
private String grantType;
@MetaInfo(name="scopes", description="The scopes of the client,separated by spaces", showInSearchResultGrid = false, searchable = false )
private String scopes;
@MetaInfo(name="accessType", description="The accessType of the client ( online / offline )", showInSearchResultGrid = false, searchable = false, required = false )
private String accessType;
@MetaInfo(name="imageUrl", description="The url containing a image referring to the client", showInSearchResultGrid = false, searchable = false )
private String imageUrl;
@MetaInfo(name="mapping", description = "the mapping of the client", searchable=false, showInSearchResultGrid=false)
@ElementCollection(fetch = FetchType.EAGER)
@JoinTable(name="oauthclient_mapping", joinColumns=@JoinColumn(name="id"))
@MapKeyColumn (name="mapping_id")
@Column(name="value")
private Map mapping;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isActive() {
return active;
}
public void setActive(boolean active) {
this.active = active;
}
public String getAuthorizationServerUri() {
return authorizationServerUri;
}
public void setAuthorizationServerUri(String authorizationServerUri) {
this.authorizationServerUri = authorizationServerUri;
}
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
public String getClientSecret() {
return clientSecret;
}
public void setClientSecret(String clientSecret) {
this.clientSecret = clientSecret;
}
public String getGrantType() {
return grantType;
}
public void setGrantType(String grantType) {
this.grantType = grantType;
}
public String getRedirectUri() {
return redirectUri;
}
public void setRedirectUri(String redirectUri) {
this.redirectUri = redirectUri;
}
public String getScopes() {
return scopes;
}
public void setScopes(String scopes) {
this.scopes = scopes;
}
public String getAccessType() {
return accessType;
}
public void setAccessType(String accessType) {
this.accessType = accessType;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getAuthorizationServerTokenUri() {
return authorizationServerTokenUri;
}
public void setAuthorizationServerTokenUri(String authorizationServerTokenUri) {
this.authorizationServerTokenUri = authorizationServerTokenUri;
}
public String getAuthorizationServerUserInfoUri() {
return authorizationServerUserInfoUri;
}
public void setAuthorizationServerUserInfoUri(String authorizationServerUserInfoUri) {
this.authorizationServerUserInfoUri = authorizationServerUserInfoUri;
}
public HttpMethod getAuthorizationServerTokenHttpMethod() {
return authorizationServerTokenHttpMethod;
}
public void setAuthorizationServerTokenHttpMethod(HttpMethod authorizationServerTokenHttpMethod) {
this.authorizationServerTokenHttpMethod = authorizationServerTokenHttpMethod;
}
public Map getMapping() {
return mapping;
}
public void setMapping(Map mapping) {
this.mapping = mapping;
}
public boolean isShowOnLoginPage() {
return showOnLoginPage;
}
public void setShowOnLoginPage(boolean showOnLoginPage) {
this.showOnLoginPage = showOnLoginPage;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((accessType == null) ? 0 : accessType.hashCode());
result = prime * result + (active ? 1231 : 1237);
result = prime * result
+ ((authorizationServerTokenHttpMethod == null) ? 0 : authorizationServerTokenHttpMethod.hashCode());
result = prime * result + ((authorizationServerTokenUri == null) ? 0 : authorizationServerTokenUri.hashCode());
result = prime * result + ((authorizationServerUri == null) ? 0 : authorizationServerUri.hashCode());
result = prime * result
+ ((authorizationServerUserInfoUri == null) ? 0 : authorizationServerUserInfoUri.hashCode());
result = prime * result + ((clientId == null) ? 0 : clientId.hashCode());
result = prime * result + ((clientSecret == null) ? 0 : clientSecret.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((grantType == null) ? 0 : grantType.hashCode());
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + ((imageUrl == null) ? 0 : imageUrl.hashCode());
result = prime * result + ((mapping == null) ? 0 : mapping.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((redirectUri == null) ? 0 : redirectUri.hashCode());
result = prime * result + ((scopes == null) ? 0 : scopes.hashCode());
result = prime * result + (showOnLoginPage ? 1231 : 1237);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
OAUTHClient other = (OAUTHClient) obj;
if (accessType == null) {
if (other.accessType != null)
return false;
} else if (!accessType.equals(other.accessType))
return false;
if (active != other.active)
return false;
if (authorizationServerTokenHttpMethod != other.authorizationServerTokenHttpMethod)
return false;
if (authorizationServerTokenUri == null) {
if (other.authorizationServerTokenUri != null)
return false;
} else if (!authorizationServerTokenUri.equals(other.authorizationServerTokenUri))
return false;
if (authorizationServerUri == null) {
if (other.authorizationServerUri != null)
return false;
} else if (!authorizationServerUri.equals(other.authorizationServerUri))
return false;
if (authorizationServerUserInfoUri == null) {
if (other.authorizationServerUserInfoUri != null)
return false;
} else if (!authorizationServerUserInfoUri.equals(other.authorizationServerUserInfoUri))
return false;
if (clientId == null) {
if (other.clientId != null)
return false;
} else if (!clientId.equals(other.clientId))
return false;
if (clientSecret == null) {
if (other.clientSecret != null)
return false;
} else if (!clientSecret.equals(other.clientSecret))
return false;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (grantType == null) {
if (other.grantType != null)
return false;
} else if (!grantType.equals(other.grantType))
return false;
if (id != other.id)
return false;
if (imageUrl == null) {
if (other.imageUrl != null)
return false;
} else if (!imageUrl.equals(other.imageUrl))
return false;
if (mapping == null) {
if (other.mapping != null)
return false;
} else if (!mapping.equals(other.mapping))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if (redirectUri == null) {
if (other.redirectUri != null)
return false;
} else if (!redirectUri.equals(other.redirectUri))
return false;
if (scopes == null) {
if (other.scopes != null)
return false;
} else if (!scopes.equals(other.scopes))
return false;
if (showOnLoginPage != other.showOnLoginPage)
return false;
return true;
}
}