public final class Subject extends Object implements AbacSupport
| Modifier and Type | Class and Description |
|---|---|
static class |
Subject.Builder
A fluent API builder for
Subject. |
AbacSupport.BasicAttributes| Modifier and Type | Method and Description |
|---|---|
Collection<String> |
abacAttributeNames()
A collection of all property names in this container.
|
Object |
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.
|
Subject |
combine(Subject another)
Will add all principals and credentials from another subject to this subject, will not replace
principals(). |
static Subject |
create(Principal principal)
Create a new subject for a principal.
|
<T extends Grant> |
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.
|
Principal |
principal()
Get the principal this subject is created for (e.g.
|
List<Principal> |
principals()
Get all principals of this subject (including the one returned by
principal()). |
<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.
|
Subject |
toJavaSubject()
Create a java
Subject from this subject. |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitabacAttributepublic static Subject.Builder builder()
public static Subject create(Principal principal)
Grants, public and/or private credentials, additional
Principals), please use fluent API builder().principal - principal this subject representspublic Principal principal()
public List<Principal> principals()
principal()).public <T extends Grant> List<T> grants(Class<T> grantType)
T - type of the grant's type (e.g. RolegrantType - type of grant (e.g. Role.class)public List<Grant> grantsByType(String grantType)
grantType - type of grant (e.g. "role" or "scope")public Object abacAttributeRaw(String key)
AbacSupportabacAttributeRaw in interface AbacSupportkey - key (name) of the propertypublic Collection<String> abacAttributeNames()
AbacSupportabacAttributeNames in interface AbacSupportpublic <T> Optional<T> publicCredential(Class<T> credential)
T - credential typecredential - credential type's classpublic <T> Optional<T> privateCredential(Class<T> credential)
T - credential typecredential - credential type's classpublic Subject toJavaSubject()
Subject from this subject.public Subject combine(Subject another)
principals().another - the other subject to combine with this subjectCopyright © 2018, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.