Record Class OttGenerationParameters
java.lang.Object
java.lang.Record
com.irurueta.authserver.authorization.api.web.ott.OttGenerationParameters
- Record Components:
channel- channel the token is delivered through.kind- whether the token is a numeric code or a magic link.purpose- whether the token signs the user in or is a second factor of a signed-in user.
public record OttGenerationParameters(OttChannel channel, OttKind kind, OttPurpose purpose)
extends Record
What a request to
POST /ott/generate asks for, read from its form fields: through which channel, a numeric
code or a magic link, and for a sign-in or as a second factor. Every unknown or missing value falls back to the
default (an e-mail code for a sign-in), so a malformed request is answered like any other.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final OttChannelThe field for thechannelrecord component.static final StringName of the field that holds the channel,email(default) orsms.private final OttKindThe field for thekindrecord component.static final StringName of the field that holds the kind of token,code(default) orlink.static final StringValue of the kind field that selects a magic link.private final OttPurposeThe field for thepurposerecord component.static final StringName of the field that holds the purpose,login(default) orsecond-factor.static final StringValue of the purpose field that selects the second factor.static final StringValue of the channel field that selects SMS.static final StringName of the field that holds the identifier (the user name) of a sign-in. -
Constructor Summary
ConstructorsConstructorDescriptionOttGenerationParameters(OttChannel channel, OttKind kind, OttPurpose purpose) Creates an instance of aOttGenerationParametersrecord class. -
Method Summary
Modifier and TypeMethodDescriptionchannel()Returns the value of thechannelrecord component.final booleanIndicates whether some other object is "equal to" this one.static OttGenerationParametersfrom(jakarta.servlet.http.HttpServletRequest request, org.springframework.security.core.Authentication current) Reads the parameters of a request.final inthashCode()Returns a hash code value for this object.(package private) static booleanisSignedIn(org.springframework.security.core.Authentication authentication) Tells whether an authentication is a signed-in user.kind()Returns the value of thekindrecord component.private static StringLower-cases a value, whatever the platform's locale is.purpose()Returns the value of thepurposerecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
channel
The field for thechannelrecord component. -
kind
The field for thekindrecord component. -
purpose
The field for thepurposerecord component. -
USERNAME_PARAMETER
Name of the field that holds the identifier (the user name) of a sign-in.- See Also:
-
CHANNEL_PARAMETER
Name of the field that holds the channel,email(default) orsms.- See Also:
-
KIND_PARAMETER
Name of the field that holds the kind of token,code(default) orlink.- See Also:
-
PURPOSE_PARAMETER
Name of the field that holds the purpose,login(default) orsecond-factor.- See Also:
-
SMS_VALUE
Value of the channel field that selects SMS.- See Also:
-
LINK_VALUE
Value of the kind field that selects a magic link.- See Also:
-
SECOND_FACTOR_VALUE
Value of the purpose field that selects the second factor.- See Also:
-
-
Constructor Details
-
Method Details
-
from
public static OttGenerationParameters from(jakarta.servlet.http.HttpServletRequest request, org.springframework.security.core.Authentication current) Reads the parameters of a request. A magic link is only sent by e-mail, so an SMS request is always a code, and a second factor is only possible for a user who is signed in: for anybody else the request is a sign-in.- Parameters:
request- the request.current- the authentication of the request, ornull.- Returns:
- the parameters.
-
isSignedIn
static boolean isSignedIn(org.springframework.security.core.Authentication authentication) Tells whether an authentication is a signed-in user.- Parameters:
authentication- the authentication, ornull.- Returns:
truewhen it is authenticated and not anonymous.
-
lowerCase
Lower-cases a value, whatever the platform's locale is.- Parameters:
value- the value, ornull.- Returns:
- the value in lower case; the empty text for
null.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
channel
Returns the value of thechannelrecord component.- Returns:
- the value of the
channelrecord component
-
kind
Returns the value of thekindrecord component.- Returns:
- the value of the
kindrecord component
-
purpose
Returns the value of thepurposerecord component.- Returns:
- the value of the
purposerecord component
-