public final class Subject extends java.lang.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 |
|---|---|
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
getPrincipals(). |
static Subject |
create(Principal principal)
Create a new subject for a principal.
|
java.util.Collection<java.lang.String> |
getAttributeNames()
A collection of all property names in this container.
|
java.lang.Object |
getAttributeRaw(java.lang.String key)
Return the actual property value or null if not present.
|
<T extends Grant> |
getGrants(java.lang.Class<T> grantType)
Get all grants of a specific type determined by type's class.
|
java.util.List<Grant> |
getGrantsByType(java.lang.String grantType)
Get all grants of a specific type determined by type's name.
|
Principal |
getPrincipal()
Get the principal this subject is created for (e.g.
|
java.util.List<Principal> |
getPrincipals()
Get all principals of this subject (including the one returned by
getPrincipal()). |
<T> java.util.Optional<T> |
getPrivateCredential(java.lang.Class<T> credential)
Get private credential for the specified type.
|
<T> java.util.Optional<T> |
getPublicCredential(java.lang.Class<T> credential)
Get public credential for the specified type.
|
javax.security.auth.Subject |
toJavaSubject()
Create a java
Subject from this subject. |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetAttributepublic 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 getPrincipal()
public java.util.List<Principal> getPrincipals()
getPrincipal()).public <T extends Grant> java.util.List<T> getGrants(java.lang.Class<T> grantType)
T - type of the grant's type (e.g. RolegrantType - type of grant (e.g. Role.class)public java.util.List<Grant> getGrantsByType(java.lang.String grantType)
grantType - type of grant (e.g. "role" or "scope")public java.lang.Object getAttributeRaw(java.lang.String key)
AbacSupportgetAttributeRaw in interface AbacSupportkey - key (name) of the propertypublic java.util.Collection<java.lang.String> getAttributeNames()
AbacSupportgetAttributeNames in interface AbacSupportpublic <T> java.util.Optional<T> getPublicCredential(java.lang.Class<T> credential)
T - credential typecredential - credential type's classpublic <T> java.util.Optional<T> getPrivateCredential(java.lang.Class<T> credential)
T - credential typecredential - credential type's classpublic javax.security.auth.Subject toJavaSubject()
Subject from this subject.public Subject combine(Subject another)
getPrincipals().another - the other subject to combine with this subjectpublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2018, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.