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 Details

  • 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:
      apply in interface Function<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

      private String readPem()
      Reads the PEM text from the inline value or the file.
      Returns:
      the PEM text.