Class KeycloakPublicKeyService

  • All Implemented Interfaces:
    PublicKeyService

    @Singleton
    @Context
    public class KeycloakPublicKeyService
    extends java.lang.Object
    implements PublicKeyService
    Service that retrieves a set of JWK from Keycloak (using HTTP), that can eager or lazy load them at initialization time. Requires three properties: * keycloak.base-url * keycloak.realm-id * keycloak.eager-load-public-keys
    • Method Summary

      Modifier and Type Method Description
      java.util.Optional<java.security.PublicKey> findPublicKey​(java.lang.String kid)
      This method finds a public key identified by an identifier, generally stored in a JWT header.
      void initialize()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • findPublicKey

        public java.util.Optional<java.security.PublicKey> findPublicKey​(java.lang.String kid)
        Description copied from interface: PublicKeyService
        This method finds a public key identified by an identifier, generally stored in a JWT header.
        Specified by:
        findPublicKey in interface PublicKeyService
        Parameters:
        kid - a key id
        Returns:
        the public key identified by kid ; or return empty() is the public key has not been found.
      • initialize

        @PostConstruct
        public void initialize()