Record Class TotpEnrolment
java.lang.Object
java.lang.Record
com.iizix.user.TotpEnrolment
- Record Components:
account- The account name the authenticator app shows: the user name.issuer- The issuer the authenticator app shows: the application.setupKey- The Base32 shared secret, for an app that cannot scan the QR code.uri- Theotpauth://totp/URI: what the QR code holds, and the link that opens the authenticator app on the phone it is installed on.qrCode- The QR code as the source of an HTML image (the data URL of an SVG image), ornullwhen the image could not be made; the setup key is then shown alone.algorithm- The hashing algorithm as the URI names it, e.g.SHA1.digits- The number of digits of a code.period- The time in seconds a code is valid.
public record TotpEnrolment(String account, String issuer, String setupKey, String uri, String qrCode, String algorithm, int digits, int period) extends Record
What a user needs to enrol an authenticator app as the second factor: the QR code to scan, the link that opens the app on a phone, and the setup key for an app that does neither. It exists from
IUserAuthenticationSecondFactor.beginTotpEnrolment until the enrolment is confirmed with a first valid code, or abandoned; the setup key in it is shown to the user once and is never stored or logged in clear.- Author:
- Christopher Mindus
Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionaccount()Returns the value of theaccountrecord component.Returns the value of thealgorithmrecord component.intdigits()Returns the value of thedigitsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.issuer()Returns the value of theissuerrecord component.intperiod()Returns the value of theperiodrecord component.qrCode()Returns the value of theqrCoderecord component.setupKey()Returns the value of thesetupKeyrecord component.toString()Gets the enrolment without its secret, for a log or a debugger: the account, the issuer and the parameters.uri()Returns the value of theurirecord component.
Constructor Details
TotpEnrolment
public TotpEnrolment(String account, String issuer, String setupKey, String uri, String qrCode, String algorithm, int digits, int period) Creates an instance of aTotpEnrolmentrecord class.- Parameters:
account- the value for theaccountrecord componentissuer- the value for theissuerrecord componentsetupKey- the value for thesetupKeyrecord componenturi- the value for theurirecord componentqrCode- the value for theqrCoderecord componentalgorithm- the value for thealgorithmrecord componentdigits- the value for thedigitsrecord componentperiod- the value for theperiodrecord component
Method Details
toString
hashCode
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes.account
issuer
setupKey
uri
qrCode
algorithm
digits
period