- java.lang.Object
- 
- io.helidon.security.Subject
 
- 
- All Implemented Interfaces:
- AbacSupport
 
 public final class Subject extends Object implements AbacSupport A security subject, representing a user or a service.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classSubject.BuilderA fluent API builder forSubject.- 
Nested classes/interfaces inherited from interface io.helidon.security.util.AbacSupportAbacSupport.BasicAttributes
 
- 
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<String>abacAttributeNames()A collection of all property names in this container.ObjectabacAttributeRaw(String key)Return the actual property value or null if not present.static Subject.Builderbuilder()Creates a fluent API builder to build new instances of this class.Subjectcombine(Subject another)Will add all principals and credentials from another subject to this subject, will not replaceprincipals().static Subjectcreate(Principal principal)Create a new subject for a principal.<T extends Grant>
 List<T>grants(Class<T> grantType)Get all grants of a specific type determined by type's class.List<Grant>grantsByType(String grantType)Get all grants of a specific type determined by type's name.Principalprincipal()Get the principal this subject is created for (e.g.List<Principal>principals()Get all principals of this subject (including the one returned byprincipal()).<T> Optional<T>privateCredential(Class<T> credential)Get private credential for the specified type.<T> Optional<T>publicCredential(Class<T> credential)Get public credential for the specified type.SubjecttoJavaSubject()Create a javaSubjectfrom this subject.StringtoString()- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface io.helidon.security.util.AbacSupportabacAttribute
 
- 
 
- 
- 
- 
Method Detail- 
builderpublic static Subject.Builder builder() Creates a fluent API builder to build new instances of this class.- Returns:
- a new builder instance
 
 - 
createpublic static Subject create(Principal principal) Create a new subject for a principal. If you want to configure additional details (Grants, public and/or private credentials, additionalPrincipals), please use fluent APIbuilder().- Parameters:
- principal- principal this subject represents
- Returns:
- a new subject instance with the single principal
 
 - 
principalpublic Principal principal() Get the principal this subject is created for (e.g. the "main" principal of this subject).- Returns:
- principal
 
 - 
principalspublic List<Principal> principals() Get all principals of this subject (including the one returned byprincipal()).- Returns:
- all principals of this subject
 
 - 
grantspublic <T extends Grant> List<T> grants(Class<T> grantType) Get all grants of a specific type determined by type's class.- Type Parameters:
- T- type of the grant's type (e.g.- Role
- Parameters:
- grantType- type of grant (e.g.- Role.class)
- Returns:
- list of grants of the specific type associated with this subject (may be empty)
 
 - 
grantsByTypepublic List<Grant> grantsByType(String grantType) Get all grants of a specific type determined by type's name.- Parameters:
- grantType- type of grant (e.g. "role" or "scope")
- Returns:
- list of grants of the specific type associated with this subject (may be empty)
 
 - 
abacAttributeRawpublic Object abacAttributeRaw(String key) Description copied from interface:AbacSupportReturn the actual property value or null if not present. This is the only method that needs to be implemented.- Specified by:
- abacAttributeRawin interface- AbacSupport
- Parameters:
- key- key (name) of the property
- Returns:
- value of the property or null
 
 - 
abacAttributeNamespublic Collection<String> abacAttributeNames() Description copied from interface:AbacSupportA collection of all property names in this container.- Specified by:
- abacAttributeNamesin interface- AbacSupport
- Returns:
- collection of keys
 
 - 
publicCredentialpublic <T> Optional<T> publicCredential(Class<T> credential) Get public credential for the specified type.- Type Parameters:
- T- credential type
- Parameters:
- credential- credential type's class
- Returns:
- optional of public credential of the type defined
 
 - 
privateCredentialpublic <T> Optional<T> privateCredential(Class<T> credential) Get private credential for the specified type.- Type Parameters:
- T- credential type
- Parameters:
- credential- credential type's class
- Returns:
- optional of private credential of the type defined
 
 - 
toJavaSubjectpublic Subject toJavaSubject() Create a javaSubjectfrom this subject.- Returns:
- an instance of Subject
 
 - 
combinepublic Subject combine(Subject another) Will add all principals and credentials from another subject to this subject, will not replaceprincipals().- Parameters:
- another- the other subject to combine with this subject
- Returns:
- a new subject that is a combination of this subject and the other subject, this subject is more significant
 
 
- 
 
-