@NotThreadSafe @Entity public abstract class BasicSecurityPrincipal<T extends com.foreach.across.modules.hibernate.business.SettableIdBasedEntity<?>> extends com.foreach.across.modules.hibernate.business.SettableIdBasedEntity<T> implements IdBasedSecurityPrincipal, com.foreach.across.modules.hibernate.business.Auditable<String>
| Constructor and Description |
|---|
BasicSecurityPrincipal() |
| Modifier and Type | Method and Description |
|---|---|
void |
addRole(Role role) |
protected void |
buildAuthoritySet(Set<org.springframework.security.core.GrantedAuthority> authorities) |
Collection<? extends org.springframework.security.core.GrantedAuthority> |
getAuthorities() |
String |
getCreatedBy() |
Date |
getCreatedDate() |
Long |
getId() |
String |
getLastModifiedBy() |
Date |
getLastModifiedDate() |
String |
getPrincipalName() |
Set<Role> |
getRoles() |
UserDirectory |
getUserDirectory() |
boolean |
hasPermission(Permission permission) |
boolean |
hasPermission(String authority)
Does the user have a permission with the requested authority string.
|
boolean |
hasRole(Role role) |
boolean |
hasRole(String authority)
Does the user have a role with the given authority string.
|
void |
removeRole(Role role) |
void |
setCreatedBy(String createdBy) |
void |
setCreatedDate(Date createdDate) |
void |
setId(Long id) |
void |
setLastModifiedBy(String lastModifiedBy) |
void |
setLastModifiedDate(Date lastModifiedDate) |
protected void |
setPrincipalName(String principalName) |
void |
setRoles(Collection<Role> roles) |
void |
setUserDirectory(UserDirectory userDirectory) |
String |
toString() |
static String |
uniquePrincipalName(String name,
UserDirectory userDirectory)
Converts a partial principal name to a globally unique principal name including the user directory.
|
equals, getNewEntityId, hashCode, isNew, setNewEntityId, toDtopublic String getPrincipalName()
getPrincipalName in interface com.foreach.across.modules.spring.security.infrastructure.business.SecurityPrincipalprotected void setPrincipalName(String principalName)
public Long getId()
getId in interface com.foreach.across.modules.hibernate.business.IdBasedEntitygetId in interface org.springframework.data.domain.Persistable<Long>public void setId(Long id)
setId in class com.foreach.across.modules.hibernate.business.SettableIdBasedEntity<T extends com.foreach.across.modules.hibernate.business.SettableIdBasedEntity<?>>public UserDirectory getUserDirectory()
public void setUserDirectory(UserDirectory userDirectory)
public String getCreatedBy()
getCreatedBy in interface com.foreach.across.modules.hibernate.business.Auditable<String>public void setCreatedBy(String createdBy)
setCreatedBy in interface com.foreach.across.modules.hibernate.business.Auditable<String>public Date getCreatedDate()
getCreatedDate in interface com.foreach.across.modules.hibernate.business.Auditable<String>public void setCreatedDate(Date createdDate)
setCreatedDate in interface com.foreach.across.modules.hibernate.business.Auditable<String>public String getLastModifiedBy()
getLastModifiedBy in interface com.foreach.across.modules.hibernate.business.Auditable<String>public void setLastModifiedBy(String lastModifiedBy)
setLastModifiedBy in interface com.foreach.across.modules.hibernate.business.Auditable<String>public Date getLastModifiedDate()
getLastModifiedDate in interface com.foreach.across.modules.hibernate.business.Auditable<String>public void setLastModifiedDate(Date lastModifiedDate)
setLastModifiedDate in interface com.foreach.across.modules.hibernate.business.Auditable<String>public void setRoles(Collection<Role> roles)
public boolean hasRole(String authority)
authority - string the role should havetrue if a role with that authority was presentpublic boolean hasRole(Role role)
public void addRole(Role role)
public void removeRole(Role role)
public boolean hasPermission(String authority)
authority - string to checktrue if permission is presentpublic boolean hasPermission(Permission permission)
public Collection<? extends org.springframework.security.core.GrantedAuthority> getAuthorities()
getAuthorities in interface com.foreach.across.modules.spring.security.infrastructure.business.SecurityPrincipalprotected void buildAuthoritySet(Set<org.springframework.security.core.GrantedAuthority> authorities)
public final String toString()
public static String uniquePrincipalName(String name, UserDirectory userDirectory)
name - current or partial principal nameuserDirectory - user directoryCopyright © 2020. All rights reserved.