Class PrivateKeyJwkResolver
java.lang.Object
com.irurueta.authserver.serviceclient.infrastructure.resourceserver.PrivateKeyJwkResolver
- All Implemented Interfaces:
Function<org.springframework.security.oauth2.client.registration.ClientRegistration,com.nimbusds.jose.jwk.JWK>
@Component
public class PrivateKeyJwkResolver
extends Object
implements Function<org.springframework.security.oauth2.client.registration.ClientRegistration,com.nimbusds.jose.jwk.JWK>
Resolves the key that signs the
private_key_jwt assertion: the unencrypted PKCS#8 PEM RSA private key of
ServiceClientKeyProperties, with its public half derived from it and the RS256 algorithm. Neither
the messages nor the exceptions carry any part of the key.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringMarker of a PEM header or footer line.private static final StringHeader of a PKCS#1 key, which is not supported.private final ServiceClientKeyPropertiesSettings of the key. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
PEM_MARKER
Marker of a PEM header or footer line.- See Also:
-
PKCS1_HEADER
Header of a PKCS#1 key, which is not supported.- See Also:
-
properties
Settings of the key.
-
-
Constructor Details
-
PrivateKeyJwkResolver
public PrivateKeyJwkResolver()
-
-
Method Details
-
apply
public com.nimbusds.jose.jwk.JWK apply(org.springframework.security.oauth2.client.registration.ClientRegistration registration) Reads the key and builds its JWK.- Specified by:
applyin interfaceFunction<org.springframework.security.oauth2.client.registration.ClientRegistration,com.nimbusds.jose.jwk.JWK> - Parameters:
registration- the registration the assertion is for, which is not needed to choose the key.- Returns:
- the signing JWK.
- Throws:
IllegalStateException- if no key is configured or it cannot be read as an unencrypted PKCS#8 RSA key.
-
readPem
Reads the PEM text from the inline value or the file.- Returns:
- the PEM text.
-