Class ClientAttributeCertificateResource

java.lang.Object
org.keycloak.services.resources.admin.ClientAttributeCertificateResource

public class ClientAttributeCertificateResource extends Object
Version:
$Revision: 1 $
Author:
Bill Burke
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final AdminEventBuilder
     
    protected final String
     
    protected final org.keycloak.models.ClientModel
     
    protected final org.keycloak.models.RealmModel
     
    protected final org.keycloak.models.KeycloakSession
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ClientAttributeCertificateResource(AdminPermissionEvaluator auth, org.keycloak.models.ClientModel client, org.keycloak.models.KeycloakSession session, String attributePrefix, AdminEventBuilder adminEvent)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.keycloak.representations.idm.CertificateRepresentation
    Generate a new certificate with new key pair
    byte[]
    generateAndGetKeystore(org.keycloak.representations.KeyStoreConfig config)
    Generate a new keypair and certificate, and get the private key file Generates a keypair and certificate and serves the private key in a specified keystore format.
    org.keycloak.representations.idm.CertificateRepresentation
    Get key info
    byte[]
    getKeystore(org.keycloak.representations.KeyStoreConfig config)
    Get a keystore file for the client, containing private key and public certificate
    org.keycloak.representations.idm.CertificateRepresentation
    Upload certificate and eventually private key
    org.keycloak.representations.idm.CertificateRepresentation
    Upload only certificate, not private key

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • realm

      protected final org.keycloak.models.RealmModel realm
    • client

      protected final org.keycloak.models.ClientModel client
    • session

      protected final org.keycloak.models.KeycloakSession session
    • adminEvent

      protected final AdminEventBuilder adminEvent
    • attributePrefix

      protected final String attributePrefix
  • Constructor Details

    • ClientAttributeCertificateResource

      public ClientAttributeCertificateResource(AdminPermissionEvaluator auth, org.keycloak.models.ClientModel client, org.keycloak.models.KeycloakSession session, String attributePrefix, AdminEventBuilder adminEvent)
  • Method Details

    • getKeyInfo

      @GET @Produces("application/json") public org.keycloak.representations.idm.CertificateRepresentation getKeyInfo()
      Get key info
      Returns:
    • generate

      @POST @Path("generate") @Produces("application/json") public org.keycloak.representations.idm.CertificateRepresentation generate()
      Generate a new certificate with new key pair
      Returns:
    • uploadJks

      @POST @Path("upload") @Consumes("multipart/form-data") @Produces("application/json") public org.keycloak.representations.idm.CertificateRepresentation uploadJks() throws IOException
      Upload certificate and eventually private key
      Returns:
      Throws:
      IOException
    • uploadJksCertificate

      @POST @Path("upload-certificate") @Consumes("multipart/form-data") @Produces("application/json") public org.keycloak.representations.idm.CertificateRepresentation uploadJksCertificate() throws IOException
      Upload only certificate, not private key
      Returns:
      information extracted from uploaded certificate - not necessarily the new state of certificate on the server
      Throws:
      IOException
    • getKeystore

      @POST @Path("/download") @Produces("application/octet-stream") @Consumes("application/json") public byte[] getKeystore(org.keycloak.representations.KeyStoreConfig config)
      Get a keystore file for the client, containing private key and public certificate
      Parameters:
      config - Keystore configuration as JSON
      Returns:
    • generateAndGetKeystore

      @POST @Path("/generate-and-download") @Produces("application/octet-stream") @Consumes("application/json") public byte[] generateAndGetKeystore(org.keycloak.representations.KeyStoreConfig config)
      Generate a new keypair and certificate, and get the private key file Generates a keypair and certificate and serves the private key in a specified keystore format. Only generated public certificate is saved in Keycloak DB - the private key is not.
      Parameters:
      config - Keystore configuration as JSON
      Returns: