java.lang.Object
io.helidon.security.Subject
- All Implemented Interfaces:
AbacSupport
A security subject, representing a user or a service.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.helidon.security.util.AbacSupport
AbacSupport.BasicAttributes
-
Method Summary
Modifier and TypeMethodDescriptionA collection of all property names in this container.abacAttributeRaw
(String key) Return the actual property value or null if not present.static Subject.Builder
builder()
Creates a fluent API builder to build new instances of this class.Will add all principals and credentials from another subject to this subject, will not replaceprincipals()
.static Subject
Create a new subject for a principal.Get all grants of a specific type determined by type's class.grantsByType
(String grantType) Get all grants of a specific type determined by type's name.Get the principal this subject is created for (e.g.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.Create a javaSubject
from this subject.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.helidon.security.util.AbacSupport
abacAttribute
-
Method Details
-
builder
Creates a fluent API builder to build new instances of this class.- Returns:
- a new builder instance
-
create
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
-
principal
Get the principal this subject is created for (e.g. the "main" principal of this subject).- Returns:
- principal
-
principals
Get all principals of this subject (including the one returned byprincipal()
).- Returns:
- all principals of this subject
-
grants
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)
-
grantsByType
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)
-
abacAttributeRaw
Description copied from interface:AbacSupport
Return the actual property value or null if not present. This is the only method that needs to be implemented.- Specified by:
abacAttributeRaw
in interfaceAbacSupport
- Parameters:
key
- key (name) of the property- Returns:
- value of the property or null
-
abacAttributeNames
Description copied from interface:AbacSupport
A collection of all property names in this container.- Specified by:
abacAttributeNames
in interfaceAbacSupport
- Returns:
- collection of keys
-
publicCredential
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
-
privateCredential
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
-
toJavaSubject
Create a javaSubject
from this subject.- Returns:
- an instance of Subject
-
combine
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
-
toString
-