Record Class SigningKey
java.lang.Object
java.lang.Record
com.irurueta.authserver.authorization.domain.keys.SigningKey
- Record Components:
kid- key identifier, published in thekidheader of signed tokens.alg- JWS algorithm the key is used with, for exampleRS256.publicJwk- the public key as a JSON Web Key.encryptedPrivateJwk- the private key as a JSON Web Key, encrypted.status- lifecycle state.createdAt- instant at which the key was generated.activatedAt- instant at which the key started signing;nulluntil then.retiredAt- instant at which the key stopped signing;nulluntil then.
public record SigningKey(String kid, String alg, String publicJwk, String encryptedPrivateJwk, SigningKeyStatus status, Instant createdAt, Instant activatedAt, Instant retiredAt)
extends Record
An asymmetric key pair used to sign tokens. The private half is only ever kept encrypted.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final InstantThe field for theactivatedAtrecord component.private final StringThe field for thealgrecord component.private final InstantThe field for thecreatedAtrecord component.private final StringThe field for theencryptedPrivateJwkrecord component.private final StringThe field for thekidrecord component.private final StringThe field for thepublicJwkrecord component.private final InstantThe field for theretiredAtrecord component.private final SigningKeyStatusThe field for thestatusrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionSigningKey(String kid, String alg, String publicJwk, String encryptedPrivateJwk, SigningKeyStatus status, Instant createdAt, Instant activatedAt, Instant retiredAt) Validates the key. -
Method Summary
Modifier and TypeMethodDescriptionCreates the key as it is once it starts signing.Returns the value of theactivatedAtrecord component.alg()Returns the value of thealgrecord component.Returns the value of thecreatedAtrecord component.Returns the value of theencryptedPrivateJwkrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.kid()Returns the value of thekidrecord component.Returns the value of thepublicJwkrecord component.Creates the key as it is once it stops signing.Returns the value of theretiredAtrecord component.status()Returns the value of thestatusrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
kid
The field for thekidrecord component. -
alg
The field for thealgrecord component. -
publicJwk
The field for thepublicJwkrecord component. -
encryptedPrivateJwk
The field for theencryptedPrivateJwkrecord component. -
status
The field for thestatusrecord component. -
createdAt
The field for thecreatedAtrecord component. -
activatedAt
The field for theactivatedAtrecord component. -
retiredAt
The field for theretiredAtrecord component.
-
-
Constructor Details
-
SigningKey
public SigningKey(String kid, String alg, String publicJwk, String encryptedPrivateJwk, SigningKeyStatus status, Instant createdAt, Instant activatedAt, Instant retiredAt) Validates the key.- Throws:
IllegalArgumentException- if a text is null or blank, or the status or creation instant is null.
-
-
Method Details
-
activate
Creates the key as it is once it starts signing.- Parameters:
now- instant at which it starts signing.- Returns:
- the active key.
-
retire
Creates the key as it is once it stops signing.- Parameters:
now- instant at which it stops signing.- Returns:
- the retired key.
-
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). -
kid
Returns the value of thekidrecord component.- Returns:
- the value of the
kidrecord component
-
alg
Returns the value of thealgrecord component.- Returns:
- the value of the
algrecord component
-
publicJwk
Returns the value of thepublicJwkrecord component.- Returns:
- the value of the
publicJwkrecord component
-
encryptedPrivateJwk
Returns the value of theencryptedPrivateJwkrecord component.- Returns:
- the value of the
encryptedPrivateJwkrecord component
-
status
Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-
createdAt
Returns the value of thecreatedAtrecord component.- Returns:
- the value of the
createdAtrecord component
-
activatedAt
Returns the value of theactivatedAtrecord component.- Returns:
- the value of the
activatedAtrecord component
-
retiredAt
Returns the value of theretiredAtrecord component.- Returns:
- the value of the
retiredAtrecord component
-