Skip to content

Package: AuthenticationParameters

AuthenticationParameters

nameinstructionbranchcomplexitylinemethod
AuthenticationParameters()
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%
credential(Credential)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
getCredential()
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%
isNewAuthentication()
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%
isRememberMe()
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%
newAuthentication(boolean)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
rememberMe(boolean)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setCredential(Credential)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setNewAuthentication(boolean)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setRememberMe(boolean)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
withParams()
M: 4 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, 2020 Oracle and/or its affiliates. All rights reserved.
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Public License v. 2.0, which is available at
6: * http://www.eclipse.org/legal/epl-2.0.
7: *
8: * This Source Code may also be made available under the following Secondary
9: * Licenses when the conditions for such availability set forth in the
10: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11: * version 2 with the GNU Classpath Exception, which is available at
12: * https://www.gnu.org/software/classpath/license.html.
13: *
14: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15: */
16:
17: package jakarta.security.enterprise.authentication.mechanism.http;
18:
19: import jakarta.security.enterprise.credential.Credential;
20: import jakarta.security.enterprise.identitystore.RememberMeIdentityStore;
21:
22: /**
23: * Parameters that are provided along with an authentication request.
24: *
25: */
26: public class AuthenticationParameters {
27:
28: private Credential credential;
29: private boolean newAuthentication;
30: private boolean rememberMe;
31:
32: /**
33: * Creates a new instance of AuthenticationParameters, useful for a fluent/builder
34: * style creation of parameters.
35: *
36: * @return a new AuthenticationParameters instance.
37: */
38: public static AuthenticationParameters withParams() {
39: return new AuthenticationParameters();
40: }
41:
42: /**
43: * Sets the credential to be used by the authentication mechanism responding
44: * to the authenticate call in which these AuthenticationParameters are passed.
45: *
46: * @param credential the credential to be used by the authentication mechanism
47: *
48: * @return the instance of AuthenticationParameters on which this call was made, useful for a fluent/builder
49: * style creation of parameters.
50: */
51: public AuthenticationParameters credential(Credential credential) {
52: setCredential(credential);
53: return this;
54: }
55:
56: /**
57: * Signal to the authentication mechanism responding to the authenticate call in which these
58: * AuthenticationParameters are passed, that an explicit new authentication dialog is required, as opposed to
59: * continuing a potentially existing one.
60: *
61: * @param newAuthentication whether a new authentication dialog is required to be started.
62: *
63: * @return the instance of AuthenticationParameters on which this call was made, useful for a fluent/builder
64: * style creation of parameters.
65: */
66: public AuthenticationParameters newAuthentication(boolean newAuthentication) {
67: setNewAuthentication(newAuthentication);
68: return this;
69: }
70:
71: /**
72: * Signals that for this call to the authentication mechanism "remember me" should be applied, IFF the
73: * "remember me" feature is configured for the authentication mechanism responding to the authenticate call.
74: *
75: * <p>
76: * If "remember me" is not configured, this parameter is silently ignored.
77: *
78: * @see RememberMe
79: * @see RememberMeIdentityStore
80: *
81: * @param rememberMe if <code>true</code> the "remember me" feature will be used if authentication succeeds and if so configured.
82: *
83: * @return the instance of AuthenticationParameters on which this call was made, useful for a fluent/builder
84: * style creation of parameters.
85: */
86: public AuthenticationParameters rememberMe(boolean rememberMe) {
87: setRememberMe(rememberMe);
88: return this;
89: }
90:
91: /**
92: * The credential set as parameter in this instance.
93: *
94: * @see AuthenticationParameters#credential(Credential)
95: *
96: * @return the credential set as parameter in this instance
97: */
98: public Credential getCredential() {
99: return credential;
100: }
101:
102: /**
103: * Sets the credential as parameter in this instance.
104: *
105: * @see AuthenticationParameters#credential(Credential)
106: *
107: * @param credential the credential to be set as parameter in this instance.
108: */
109: public void setCredential(Credential credential) {
110: this.credential = credential;
111: }
112:
113: /**
114: * Whether a new authentication dialog is required.
115: *
116: * @see AuthenticationParameters#newAuthentication(boolean)
117: *
118: * @return whether a new authentication dialog is required.
119: */
120: public boolean isNewAuthentication() {
121: return newAuthentication;
122: }
123:
124: /**
125: * Sets whether a new authentication dialog is required.
126: *
127: * @see AuthenticationParameters#newAuthentication(boolean)
128: *
129: * @param newAuthentication whether a new authentication dialog is required
130: */
131: public void setNewAuthentication(boolean newAuthentication) {
132: this.newAuthentication = newAuthentication;
133: }
134:
135: /**
136: * Whether "remember me" should be used.
137: *
138: * @see AuthenticationParameters#rememberMe(boolean)
139: *
140: * @return whether "remember me" should be used.
141: */
142: public boolean isRememberMe() {
143: return rememberMe;
144: }
145:
146: /**
147: * Sets whether "remember me" should be used.
148: *
149: * @see AuthenticationParameters#rememberMe(boolean)
150: *
151: * @param rememberMe whether "remember me" should be used.
152: */
153: public void setRememberMe(boolean rememberMe) {
154: this.rememberMe = rememberMe;
155: }
156:
157: }