Interface PrincipalProvider
-
- All Known Implementing Classes:
AbstractPrincipalProvider
,DefaultPrincipalProvider
,FallbackPrincipalProvider
public interface PrincipalProvider
This interface defines methods to provide access to sources ofPrincipal
s. This allows the security framework share any external sources for authorization and authentication, as may be used by a customLoginModule
for example.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canReadPrincipal(Session session, Principal principalToRead)
Tests if the provided session is allowed to read the given principal.void
close()
This is called when a provider is not longer used by the repository.PrincipalIterator
findPrincipals(String simpleFilter)
Searches forPrincipal
s that match the given String.PrincipalIterator
findPrincipals(String simpleFilter, int searchType)
Searches forPrincipal
s that match the given String.PrincipalIterator
getGroupMembership(Principal principal)
Returns an iterator over all group principals for which the given principal is either direct or indirect member of.Principal
getPrincipal(String principalName)
Returns the principal with the given name if is known to this providerPrincipalIterator
getPrincipals(int searchType)
Returns an iterator over all principals that match the given search type.void
init(Properties options)
Initialize this provider.
-
-
-
Method Detail
-
getPrincipal
Principal getPrincipal(String principalName)
Returns the principal with the given name if is known to this provider- Parameters:
principalName
- the name of the principal to retrieve- Returns:
- return the requested principal or
null
-
findPrincipals
PrincipalIterator findPrincipals(String simpleFilter)
Searches forPrincipal
s that match the given String. NOTE:Group
s are included in the search result.- Parameters:
simpleFilter
-- Returns:
- See Also:
findPrincipals(String,int)
-
findPrincipals
PrincipalIterator findPrincipals(String simpleFilter, int searchType)
Searches forPrincipal
s that match the given String.- Parameters:
simpleFilter
-searchType
- searchType Any of the following constants:- Returns:
- See Also:
findPrincipals(String)
-
getPrincipals
PrincipalIterator getPrincipals(int searchType)
Returns an iterator over all principals that match the given search type.- Parameters:
searchType
- searchType Any of the following constants:- Returns:
- an iterator over all principals that match the given search type.
-
getGroupMembership
PrincipalIterator getGroupMembership(Principal principal)
Returns an iterator over all group principals for which the given principal is either direct or indirect member of. If a principal is a direct member of a group, then
evaluates toGroupPrincipal.isMember(Principal)
true
. A principal is an indirect member of a group if any of its groups (to any degree of separation) is direct member of the group.Example:
If Principal is member of Group A, and Group A is member of Group B, this method will return Group A and Group B.- Parameters:
principal
- the principal to return it's membership from.- Returns:
- an iterator returning all groups the given principal is member of.
-
init
void init(Properties options)
Initialize this provider.- Parameters:
options
- the options that are set
-
close
void close()
This is called when a provider is not longer used by the repository. An implementation can then release any resources bound to this provider, eg. disconnect from a back end system.
-
canReadPrincipal
boolean canReadPrincipal(Session session, Principal principalToRead)
Tests if the provided session is allowed to read the given principal. Since the principal providers do not restrict the access on the principals they provide, this method is used by the PrincipalManger to ensure proper access rights for the client requesting the principals.- Parameters:
session
-principalToRead
- The principal to be accessed by the specified subject.- Returns:
true
if the session is allowed to read the principal;false
otherwise.
-
-