public class SubjectPrincipalAnalyzer extends Object
Constructor and Description |
---|
SubjectPrincipalAnalyzer(Subject subject) |
Modifier and Type | Method and Description |
---|---|
<T extends Principal> |
findPrincipal(Class<T> principalClass,
String name)
Gets fist principal of given class with given name.
|
List<Attribute> |
getAttributes()
Creates a list of
Attribute s within the subject. |
AttributeValue |
getComplexAttributeValue(String attributeName)
Retrieves the
AttributeValue of the first AttributePrincipal with a given name. |
Map<String,AttributeValue> |
getComplexAttributeValues(Subject subject)
Creates a map of all attributes with (the last) values as
AttributeValue . |
<T extends Principal> |
getPrincipal(Class<T> principalClass)
Gets first principal of given class.
|
<T extends Principal> |
getPrincipals(Class<T> principalClass) |
Set<String> |
getRoles()
Retrieves all RolePrincipal names form the subject.
|
String[] |
getRolesAsArray()
Retrieves all RolePrincipal names form the subject.
|
Map<String,String> |
getSimpleAttributeValues()
Creates a map of all attributes with (the last) values as string.
|
String |
getSingleAttributeValue(String attributeName)
Retrieves the value of the first
AttributePrincipal with a given name. |
Subject |
getSubject() |
String |
getUsername()
Retrieves the username of the subject.
|
boolean |
isInRole(String role)
Responsible for checking if a user has a given role.
|
void |
removePrincipal(Principal principal) |
public SubjectPrincipalAnalyzer(Subject subject)
public String getSingleAttributeValue(String attributeName)
AttributePrincipal
with a given name.subject
- subject containing the attribute informationattributeName
- the name of the attribute that contains the information.AttributePrincipal
of the subject
where NamePrincipal.getName()
equals attributeName
, null
if no
such exists.public AttributeValue getComplexAttributeValue(String attributeName)
AttributeValue
of the first AttributePrincipal
with a given name.subject
- subject containing the attribute informationattributeName
- the name of the attribute that contains the information.AttributePrincipal
of the subject
where NamePrincipal.getName()
equals attributeName
, null
if no
such exists.public Map<String,String> getSimpleAttributeValues()
public Map<String,AttributeValue> getComplexAttributeValues(Subject subject)
AttributeValue
.AttributeValue
>public List<Attribute> getAttributes()
Attribute
s within the subject.subject
- public String[] getRolesAsArray()
subject
- the current subject.public Set<String> getRoles()
subject
- the current subject.public boolean isInRole(String role)
subject
- the current subject.role
- a role name.public String getUsername()
subject
- containing the username information.UsernameIDPrincipal
found, null
otherwise.public <T extends Principal> T findPrincipal(Class<T> principalClass, String name)
public <T extends Principal> T getPrincipal(Class<T> principalClass)
public void removePrincipal(Principal principal)
public Subject getSubject()
Copyright © 2004–2018 52north.org. All rights reserved.