Top Description Methods
jakarta.security.jacc

public Interface PrincipalMapper

Imports
java.security.Principal, java.util.Set, javax.security.auth.Subject

A PrincipalMapper is an object that maps from a collection of generic Principals or a Subject to well known entities in Jakarta EE.

The following target entities are supported:

A PrincipalMapper is intended to be used by a Policy, but should work outside a Policy (for instance, during request processing in a Servlet container).

Author
Arjan Tijms

Method Summary

Modifier and TypeMethod and Description
public Principal

Returns:

Principal representing the name of the current authenticated user, or null if not authenticated.
getCallerPrincipal
(Subject
the subject from which the caller principal is to be retrieved.
subject
)

Pick from the principals within the passed-in Subject the platform-specific java.security.Principal that represents the name of authenticated caller, or null if the current caller is not authenticated.

public default Principal

Returns:

Principal representing the name of the current authenticated user, or null if not authenticated.
getCallerPrincipal
(Set<Principal>
the set of principals from which the caller principal is to be retrieved.
principals
)

Pick from the principals within the passed-in set of principals the platform-specific java.security.Principal that represents the name of the authenticated caller, or null if the current caller is not authenticated.

public Set<String>

Returns:

a set of logical application roles associated with the caller principal.
getMappedRoles
(Subject
the subject from which the roles are to be retrieved.
subject
)

Pick from the principals within the passed-in Subject all application roles that are associated with the caller principal.

public default Set<String>

Returns:

a set of logical application roles associated with the caller principal.
getMappedRoles
(Set<Principal>
the set of principals from which the roles are to be retrieved.
principals
)

Pick from the principals within the passed-in set of principals all application roles that are associated with the caller principal.

public default boolean

Returns:

true if the special "**" role has been mapped to something else, false otherwise.
isAnyAuthenticatedUserRoleMapped
()

Jakarta Security defines the "any authenticated caller role" as "**" and allows an application specific mapping for this role to be established.

Method Detail

getCallerPrincipalback to summary
public Principal getCallerPrincipal(Subject subject)

Pick from the principals within the passed-in Subject the platform-specific java.security.Principal that represents the name of authenticated caller, or null if the current caller is not authenticated.

Parameters
subject:Subject

the subject from which the caller principal is to be retrieved.

Returns:Principal

Principal representing the name of the current authenticated user, or null if not authenticated.

getCallerPrincipalback to summary
public default Principal getCallerPrincipal(Set<Principal> principals)

Pick from the principals within the passed-in set of principals the platform-specific java.security.Principal that represents the name of the authenticated caller, or null if the current caller is not authenticated.

Parameters
principals:Set<Principal>

the set of principals from which the caller principal is to be retrieved.

Returns:Principal

Principal representing the name of the current authenticated user, or null if not authenticated.

getMappedRolesback to summary
public Set<String> getMappedRoles(Subject subject)

Pick from the principals within the passed-in Subject all application roles that are associated with the caller principal.

The roles returned here are the logical application roles. If the principals in the passed-in Subject represent non-application roles (called "groups"), the implementation must perform the group-to-role mapping. For instance, if a Principal representing the group "adm" is present in the Subject, and the group "adm" is mapped (in a implementation specific way) to "administrator", then "administrator" must be returned here.

Parameters
subject:Subject

the subject from which the roles are to be retrieved.

Returns:Set<String>

a set of logical application roles associated with the caller principal.

getMappedRolesback to summary
public default Set<String> getMappedRoles(Set<Principal> principals)

Pick from the principals within the passed-in set of principals all application roles that are associated with the caller principal.

The roles returned here are the logical application roles. If the principals in the passed-in Subject represent non-application roles (called "groups"), the implementation must perform the group-to-role mapping. For instance, if a Principal representing the group "adm" is present in the Subject, and the group "adm" is mapped (in a implementation specific way) to "administrator", then "administrator" must be returned here.

Parameters
principals:Set<Principal>

the set of principals from which the roles are to be retrieved.

Returns:Set<String>

a set of logical application roles associated with the caller principal.

isAnyAuthenticatedUserRoleMappedback to summary
public default boolean isAnyAuthenticatedUserRoleMapped()

Jakarta Security defines the "any authenticated caller role" as "**" and allows an application specific mapping for this role to be established. E.g. "**" could be mapped to the logical application role "admin".

This method is used to discover if such a mapping has indeed been done. If it has been done, "**" is a regular role name and we can no longer check for "any authenticated caller" using "**".

Returns:boolean

true if the special "**" role has been mapped to something else, false otherwise.