public class JaasUtils extends Object
| Constructor and Description |
|---|
JaasUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Subject |
getCurrentSubject()
Get the current subject.
|
static <P extends Principal> |
getPrincipal(Class<P> principalClass)
Get a principal off of the current subject.
|
static <T> T |
getPrivateCredential(Class<T> credentialClass)
Get a private credential off of the current subject.
|
static boolean |
hasPrincipal(Class<? extends Principal> principalClass)
Determine whether or not the given principal is one the current subject.
|
public static Subject getCurrentSubject()
Subject.IllegalStateException - If there is no subject within the current context.public static <P extends Principal> P getPrincipal(Class<P> principalClass)
P - The type of the principal.principalClass - The Class of the Principal to be retrieved.IllegalArgumentException - If the given class is null or no principals of the requested type are found on the current
subject.getCurrentSubject()public static <T> T getPrivateCredential(Class<T> credentialClass)
T - The type of the credential to get.credentialClass - The Class of the credential to be retrieved.IllegalArgumentException - If the given credential class is null or the current subject has no credentials of the given
class.getCurrentSubject()public static boolean hasPrincipal(Class<? extends Principal> principalClass)
principalClass - The Class of the principal whose presence is to be determined.true if the current subject has the request principal attached to it; false if not.Copyright © 2019. All rights reserved.