public final class Principals extends Object
Modifier and Type | Field and Description |
---|---|
static String |
FIRST_NAME |
static String |
FULL_NAME |
static String |
IDENTITY |
static String |
LAST_NAME |
static String |
LOCALE |
Modifier and Type | Method and Description |
---|---|
static SimplePrincipalProvider |
firstNamePrincipal(String firstName)
Simple principal to store the firstName as a string
|
static SimplePrincipalProvider |
fullNamePrincipal(String fullName)
Simple principal to store the fullName as a string
|
static <T extends Serializable> |
getOnePrincipalByType(Collection<PrincipalProvider<?>> principalProviders,
Class<T> principalClass)
Gets one PrincipalProvider corresponding to a type of PrincipalProvider.
For example, you can use this method to get the LDAPUser by calling : getOnePrincipalsByType(principals, LDAPUserPrincipalProvider.class) .Then : LDAPUser user =
ldapUserPrincipalProvider.getPrincipal() . |
static <T extends Serializable> |
getPrincipalsByType(Collection<PrincipalProvider<?>> principalProviders,
Class<T> principalClass)
Gets all the PrincipalProviders corresponding to a type of PrincipalProvider in a collection.
For example, you can use this method to get the LDAPUser by calling : getPrincipalsByType(principals, LDAPUserPrincipalProvider.class) .Then on the first element of the collection : LDAPUser user =
ldapUserPrincipalProvider.getPrincipal() . |
static SimplePrincipalProvider |
getSimplePrincipalByName(Collection<PrincipalProvider<?>> principalProviders,
String principalName)
Gives the simple principal with the given name from the given collection of principals
|
static Collection<SimplePrincipalProvider> |
getSimplePrincipals(Collection<PrincipalProvider<?>> principalProviders)
Extracts the simple principals of the collection of principals
|
static SimplePrincipalProvider |
identityPrincipal(String identity)
Simple principal to store the identity as a string
|
static SimplePrincipalProvider |
lastNamePrincipal(String lastName)
Simple principal to store the lastName as a string
|
static SimplePrincipalProvider |
localePrincipal(String locale)
Simple principal to store the locale as a string
|
public static final String IDENTITY
public static final String LOCALE
public static final String FIRST_NAME
public static final String LAST_NAME
public static final String FULL_NAME
public static SimplePrincipalProvider identityPrincipal(String identity)
identity
- the identitypublic static SimplePrincipalProvider localePrincipal(String locale)
locale
- the localepublic static SimplePrincipalProvider firstNamePrincipal(String firstName)
firstName
- the firstNamepublic static SimplePrincipalProvider lastNamePrincipal(String lastName)
lastName
- the lastNamepublic static SimplePrincipalProvider fullNamePrincipal(String fullName)
fullName
- the fullNamepublic static <T extends Serializable> Collection<PrincipalProvider<T>> getPrincipalsByType(Collection<PrincipalProvider<?>> principalProviders, Class<T> principalClass)
getPrincipalsByType(principals, LDAPUserPrincipalProvider.class)
.LDAPUser user =
ldapUserPrincipalProvider.getPrincipal()
.T
- type of the PrincipalProviderprincipalProviders
- the principals to find the type.principalClass
- the PrincipalProvider type, not nullpublic static <T extends Serializable> PrincipalProvider<T> getOnePrincipalByType(Collection<PrincipalProvider<?>> principalProviders, Class<T> principalClass)
getOnePrincipalsByType(principals, LDAPUserPrincipalProvider.class)
.LDAPUser user =
ldapUserPrincipalProvider.getPrincipal()
.T
- type of the PrincipalProviderprincipalProviders
- the principals to find the type.principalClass
- the PrincipalProvider type, not nullpublic static Collection<SimplePrincipalProvider> getSimplePrincipals(Collection<PrincipalProvider<?>> principalProviders)
principalProviders
- the principals to extract frompublic static SimplePrincipalProvider getSimplePrincipalByName(Collection<PrincipalProvider<?>> principalProviders, String principalName)
principalProviders
- the principals to searchprincipalName
- the name to searchCopyright © 2013-2018–2019 SeedStack. All rights reserved.