Record Class PendingOtt
java.lang.Object
java.lang.Record
com.irurueta.authserver.authorization.api.web.ott.PendingOtt
- Record Components:
identifier- identifier (the user name) the token was requested for, as the user typed it.bindingId- random identifier that ties the numeric code to this session.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.channel- channel the token is delivered through.
- All Implemented Interfaces:
Serializable
public record PendingOtt(String identifier, String bindingId, OttKind kind, OttPurpose purpose, OttChannel channel)
extends Record
implements Serializable
The one-time token a browser has asked for and not used yet, kept in its session: for whom, through which channel,
of which kind and for what purpose, and the binding id the numeric code was stored with. A code only works in the
browser that holds its binding id, which is what makes a code typed in another browser worthless. The session holds
one pending token: asking again replaces it (and so invalidates the previous code).
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final StringName of the session attribute that holds the pending token.private final StringThe field for thebindingIdrecord component.private final OttChannelThe field for thechannelrecord component.private final StringThe field for theidentifierrecord component.private final OttKindThe field for thekindrecord component.private final OttPurposeThe field for thepurposerecord component.private static final longSerialization version. -
Constructor Summary
ConstructorsConstructorDescriptionPendingOtt(String identifier, String bindingId, OttKind kind, OttPurpose purpose, OttChannel channel) Creates an instance of aPendingOttrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thebindingIdrecord component.channel()Returns the value of thechannelrecord component.static voidclear(jakarta.servlet.http.HttpServletRequest request) Forgets the pending token of the session of a request, once it has been used.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theidentifierrecord component.kind()Returns the value of thekindrecord component.static Optional<PendingOtt> of(jakarta.servlet.http.HttpServletRequest request) Finds the pending token of the session of a request, without creating a session.purpose()Returns the value of thepurposerecord component.voidsaveTo(jakarta.servlet.http.HttpSession session) Keeps this pending token in a session, replacing the previous one.toString()Describes the pending token without the binding id, which authorizes a code.
-
Field Details
-
identifier
The field for theidentifierrecord component. -
bindingId
The field for thebindingIdrecord component. -
kind
The field for thekindrecord component. -
purpose
The field for thepurposerecord component. -
channel
The field for thechannelrecord component. -
serialVersionUID
private static final long serialVersionUIDSerialization version.- See Also:
-
ATTRIBUTE
Name of the session attribute that holds the pending token.
-
-
Constructor Details
-
PendingOtt
public PendingOtt(String identifier, String bindingId, OttKind kind, OttPurpose purpose, OttChannel channel) Creates an instance of aPendingOttrecord class.- Parameters:
identifier- the value for theidentifierrecord componentbindingId- the value for thebindingIdrecord componentkind- the value for thekindrecord componentpurpose- the value for thepurposerecord componentchannel- the value for thechannelrecord component
-
-
Method Details
-
saveTo
public void saveTo(jakarta.servlet.http.HttpSession session) Keeps this pending token in a session, replacing the previous one.- Parameters:
session- the session.
-
of
Finds the pending token of the session of a request, without creating a session.- Parameters:
request- the request.- Returns:
- the pending token, or empty when the request has no session or the session holds none.
-
clear
public static void clear(jakarta.servlet.http.HttpServletRequest request) Forgets the pending token of the session of a request, once it has been used.- Parameters:
request- the request.
-
toString
Describes the pending token without the binding id, which authorizes a code. -
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). -
identifier
Returns the value of theidentifierrecord component.- Returns:
- the value of the
identifierrecord component
-
bindingId
Returns the value of thebindingIdrecord component.- Returns:
- the value of the
bindingIdrecord 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
-
channel
Returns the value of thechannelrecord component.- Returns:
- the value of the
channelrecord component
-