Skip to content

Package: AutoApplySession$Literal

AutoApplySession$Literal

nameinstructionbranchcomplexitylinemethod
AutoApplySession.Literal()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
static {...}
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (c) 2015, 2021 Oracle and/or its affiliates and others. All rights reserved.
3: * Copyright (c) 2021 Contributors to Eclipse Foundation.
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: package jakarta.security.enterprise.authentication.mechanism.http;
18:
19: import static java.lang.annotation.ElementType.TYPE;
20: import static java.lang.annotation.RetentionPolicy.RUNTIME;
21:
22: import java.lang.annotation.Inherited;
23: import java.lang.annotation.Retention;
24: import java.lang.annotation.Target;
25:
26: import jakarta.enterprise.util.AnnotationLiteral;
27: import jakarta.interceptor.InterceptorBinding;
28:
29: /**
30: * The AutoApplySession annotation provides an application the ability to declaratively designate
31: * that an authentication mechanism uses the <code>jakarta.servlet.http.registerSession</code>
32: * and auto applies this for every request.
33: *
34: * <p>
35: * See the Jakarta Authentication spec for further details on <code>jakarta.servlet.http.registerSession</code>.
36: *
37: * <p>
38: * This support is provided via an implementation of a Jakarta Interceptors interceptor that conducts the
39: * necessary logic.
40: *
41: * <p>
42: * Example:
43: *
44: * <pre>
45: * <code>
46: * {@literal @}RequestScoped
47: * {@literal @}AutoApplySession
48: * public class CustomAuthenticationMechanism implements HttpAuthenticationMechanism {
49: * // ...
50: * }
51: * </code>
52: * </pre>
53: *
54: */
55: @Inherited
56: @InterceptorBinding
57: @Retention(RUNTIME)
58: @Target(TYPE)
59: public @interface AutoApplySession {
60:
61: /**
62: * Supports inline instantiation of the AutoApplySession annotation.
63: *
64: * @since 3.0
65: */
66: public static final class Literal extends AnnotationLiteral<AutoApplySession> implements AutoApplySession {
67: private static final long serialVersionUID = 1L;
68:
69: /**
70: * Instance of the {@link AutoApplySession} Interceptor Binding.
71: */
72: public static final Literal INSTANCE = new Literal();
73: }
74: }