Top Description Inners Fields Methods
javax.security.enterprise.identitystore

public Interface IdentityStore

Static Imports
java.lang.invoke.MethodType.methodType, java.util.Collections.emptySet, javax.security.enterprise.identitystore.CredentialValidationResult.NOT_VALIDATED_RESULT, .IdentityStore.ValidationType.PROVIDE_GROUPS, .IdentityStore.ValidationType.VALIDATE

IdentityStore is a mechanism for validating a caller's credentials and accessing a caller's identity attributes. It can be used by an authentication mechanism, such as a JSR 375 HttpAuthenticationMechanism or a JSR 196 (JASPIC) ServerAuthModule.

Stores which do only validation or only group lookup are allowed.

An IdentityStore obtains identity data from a persistent store, such as a database, LDAP server, or file.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
IdentityStore.ValidationType

Determines the type of validation (operations) that should be done by this store

Note

This does not set or determine what the IdentityStore is capable of, but only what the store is configured to be used for.

Field Summary

Modifier and TypeField and Description
public static final Set<IdentityStore.ValidationType>
DEFAULT_VALIDATION_TYPES

Default set of validation types.

Method Summary

Modifier and TypeMethod and Description
public default Set<String>

Returns:

The Set of groups found for the caller, if any, or an empty Set otherwise.
getCallerGroups
(CredentialValidationResult
The CredentialValidationResult returned by a previous call to validate(Credential).
validationResult
)

Returns groups for the caller, who is identified by the CallerPrincipal (and potentially other values) found in the validationResult parameter.

public default int

Returns:

The priority value. Lower values indicate higher priorities.
priority
()

Determines the order of invocation for multiple IdentityStores.

public default CredentialValidationResult

Returns:

The validation result.
validate
(Credential
The credential to validate.
credential
)

Validates the given credential.

public default Set<IdentityStore.ValidationType>

Returns:

Set containing the validation types enabled for the IdentityStore.
validationTypes
()

Determines the type of validation the IdentityStore should be used for.

Field Detail

DEFAULT_VALIDATION_TYPESback to summary
public static final Set<IdentityStore.ValidationType> DEFAULT_VALIDATION_TYPES

Default set of validation types. Contains VALIDATE and PROVIDE_GROUPS.

Method Detail

getCallerGroupsback to summary
public default Set<String> getCallerGroups(CredentialValidationResult validationResult)

Returns groups for the caller, who is identified by the CallerPrincipal (and potentially other values) found in the validationResult parameter.

Callers (i.e., IdentityStoreHandlers) should have IdentityStorePermission permission to invoke this method. Implementations should check for this permission before doing any work:

SecurityManager security = System.getSecurityManager();
if (security != null) {
    security.checkPermission(new IdentityStorePermission("getGroups");
}
 
Parameters
validationResult:CredentialValidationResult

The CredentialValidationResult returned by a previous call to validate(Credential).

Returns:Set<String>

The Set of groups found for the caller, if any, or an empty Set otherwise.

Exceptions
SecurityException:
May be thrown if the calling code does not have IdentityStorePermission.
priorityback to summary
public default int priority()

Determines the order of invocation for multiple IdentityStores. Stores with a lower priority value are consulted first.

Returns:int

The priority value. Lower values indicate higher priorities.

validateback to summary
public default CredentialValidationResult validate(Credential credential)

Validates the given credential.

As a convenience, a default implementation is provided that looks up an overload of this method that has, as its one and only parameter, a subclass of Credential. Here is an example of what an implementation of this interface looks like with such an overloaded method:

public class ExampleIdentityStore implements IdentityStore {

    public CredentialValidationResult validate(UsernamePasswordCredential usernamePasswordCredential) {
        // Implementation ...
        return INVALID_RESULT;
    }

}
 

Note that the overloaded method is only called when the actual type passed into this method will exactly match the parameter type of the overloaded method. There's no attempt being done to find the most specific overloaded method such as specified in JLS 15.2.

This method returns a CredentialValidationResult representing the result of the validation attempt: whether it succeeded or failed, and, for a successful validation, the CallerPrincipal, and possibly groups or other attributes, of the caller.

Parameters
credential:Credential

The credential to validate.

Returns:CredentialValidationResult

The validation result.

validationTypesback to summary
public default Set<IdentityStore.ValidationType> validationTypes()

Determines the type of validation the IdentityStore should be used for. By default, its used for credential validation AND providing groups.

Implementations of this API should not return a direct reference to a Set used internally to represent an IdentityStore's validation types, unless it is an immutable Set. Callers of the API should be aware that the returned Set may be immutable, or a copy, and that, in any case, it should not be modified by the caller.

Returns:Set<IdentityStore.ValidationType>

Set containing the validation types enabled for the IdentityStore.

javax.security.enterprise.identitystore back to summary

public final Enum IdentityStore.ValidationType

extends Enum<IdentityStore.ValidationType>
Class Inheritance

Determines the type of validation (operations) that should be done by this store

Note

This does not set or determine what the IdentityStore is capable of, but only what the store is configured to be used for.

Field Summary

Modifier and TypeField and Description
public static final IdentityStore.ValidationType
PROVIDE_GROUPS

Only groups for a principal, possibly established by another IdentityStore, are taken from this store.

public static final IdentityStore.ValidationType
VALIDATE

Only validation is performed, so no groups, are taken from this store.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static IdentityStore.ValidationType
public static IdentityStore.ValidationType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

PROVIDE_GROUPSback to summary
public static final IdentityStore.ValidationType PROVIDE_GROUPS

Only groups for a principal, possibly established by another IdentityStore, are taken from this store.

VALIDATEback to summary
public static final IdentityStore.ValidationType VALIDATE

Only validation is performed, so no groups, are taken from this store.

Constructor Detail

ValidationTypeback to summary
private ValidationType()

Method Detail

valueOfback to summary
public static IdentityStore.ValidationType valueOf(String name)
valuesback to summary
public static IdentityStore.ValidationType[] values()