Skip to content

Package: IdentityStoreHandler

IdentityStoreHandler

Coverage

1: /*
2: * Copyright (c) 2023 Contributors to Eclipse Foundation.
3: * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.
4: *
5: * This program and the accompanying materials are made available under the
6: * terms of the Eclipse Public License v. 2.0, which is available at
7: * http://www.eclipse.org/legal/epl-2.0.
8: *
9: * This Source Code may also be made available under the following Secondary
10: * Licenses when the conditions for such availability set forth in the
11: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
12: * version 2 with the GNU Classpath Exception, which is available at
13: * https://www.gnu.org/software/classpath/license.html.
14: *
15: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16: */
17:
18: package jakarta.security.enterprise.identitystore;
19:
20: import jakarta.security.auth.message.module.ServerAuthModule;
21:
22: import jakarta.security.enterprise.authentication.mechanism.http.HttpAuthenticationMechanism;
23: import jakarta.security.enterprise.credential.Credential;
24:
25: /**
26: * <code>IdentityStoreHandler</code> is a mechanism for validating a caller's
27: * credentials, and accessing a caller's identity attributes, by consulting
28: * a set of one or more {@link IdentityStore}s.
29: * <p>
30: * It is intended for use by an authentication mechanism, such as an
31: * {@link HttpAuthenticationMechanism} (Jakarta Security) or a {@link ServerAuthModule}
32: * (Jakarta Authentication).
33: * <p>
34: * Beans should inject only this handler, and not {@link IdentityStore}
35: * directly, as multiple stores may exist.
36: * <p>
37: * Implementations of Jakarta Security must supply a default implementation of
38: * {@code IdentityStoreHandler} that behaves as described in the Jakarta Security
39: * specification document.
40: * Applications do not need to supply an {@code IdentityStoreHandler}
41: * unless application-specific behavior is desired.
42: */
43: public interface IdentityStoreHandler {
44:
45: /**
46: * Validate the given {@link Credential} and return the identity and attributes
47: * of the caller it represents.
48: * <p>
49: * Implementations of this method will typically invoke the {@code validate()}
50: * and {@code getCallerGroups()} methods of one or more {@link IdentityStore}s
51: * and return an aggregated result.
52: *
53: * @param credential The credential to validate.
54: * @return The validation result.
55: */
56: CredentialValidationResult validate(Credential credential);
57: }