Package com.irurueta.authserver.authorization.infrastructure.keys
package com.irurueta.authserver.authorization.infrastructure.keys
Signing keys of the authorization server: key encryption and generation, the JWK sources and the signed token
service built on them.
-
ClassDescriptionEncrypts and decrypts the private half of signing keys with AES-256-GCM (Spring Security's
Encryptors.stronger).TotpSecretCipherthat encrypts TOTP secrets with AES-256 in GCM mode.A JSON Web Key set loaded lazily and kept in memory for a short time, so that verifying or signing a token does not read the database every time.Serves the signing keys kept by the key use cases.Provides the key-encryption inputs when thedevprofile is active, so a developer does not have to configure anything: a random passphrase and salt are generated once per machine, stored in a file under~/.irurueta-auth-server/that only the owner can read, and reused at every start, which keeps the signing keys persisted in the development database decryptable across restarts.TrustedDeviceTokenSignerthat signs the trusted-device cookie with HMAC-SHA256, under a key derived from the key-encryption secret for this purpose only (PurposeKeyDerivation).Drops every cached JWK set when the signing keys rotate, so the next token or JWKS request sees the new keys without waiting for the cache to expire.Reads the key-encryption inputs from configuration (authserver.keys.encryption.passwordandauthserver.keys.encryption.salt, taken from the environment in production).Inputs of the encryption of private signing keys at rest.Issues and verifies purpose-bound tokens as JWTs signed with the active signing key and verified against the published keys.Derives, from the key-encryption secret (KeyEncryptionProperties), a distinct salt and key for each purpose other than the encryption of signing keys, so no two uses share a key: a key exposed or misused for one purpose says nothing about the others.Generates RSA signing keys for theRS256algorithm.TokenGeneratorthat creates tokens from aSecureRandomand hashes them with SHA-256.Maps the domainSigningKeyonto Nimbus JSON Web Keys: the public set lists the public half of every key it is given, whereas the signing set holds the single active key with its private half, decrypted with theAesGcmKeyCipher.