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 AdminEventBuilderadminEventprotected StringattributePrefixstatic StringCERTIFICATE_PEMprotected org.keycloak.models.ClientModelclientstatic StringJSON_WEB_KEY_SETstatic StringPUBLIC_KEY_PEMprotected org.keycloak.models.RealmModelrealmprotected org.keycloak.models.KeycloakSessionsession
-
Constructor Summary
Constructors Constructor Description ClientAttributeCertificateResource(org.keycloak.models.RealmModel realm, AdminPermissionEvaluator auth, org.keycloak.models.ClientModel client, org.keycloak.models.KeycloakSession session, String attributePrefix, AdminEventBuilder adminEvent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.keycloak.representations.idm.CertificateRepresentationgenerate()Generate a new certificate with new key pairbyte[]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.CertificateRepresentationgetKeyInfo()Get key infobyte[]getKeystore(org.keycloak.representations.KeyStoreConfig config)Get a keystore file for the client, containing private key and public certificateorg.keycloak.representations.idm.CertificateRepresentationuploadJks(org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput input)Upload certificate and eventually private keyorg.keycloak.representations.idm.CertificateRepresentationuploadJksCertificate(org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput input)Upload only certificate, not private key
-
-
-
Field Detail
-
CERTIFICATE_PEM
public static final String CERTIFICATE_PEM
- See Also:
- Constant Field Values
-
PUBLIC_KEY_PEM
public static final String PUBLIC_KEY_PEM
- See Also:
- Constant Field Values
-
JSON_WEB_KEY_SET
public static final String JSON_WEB_KEY_SET
- See Also:
- Constant Field Values
-
realm
protected org.keycloak.models.RealmModel realm
-
client
protected org.keycloak.models.ClientModel client
-
session
protected org.keycloak.models.KeycloakSession session
-
adminEvent
protected AdminEventBuilder adminEvent
-
attributePrefix
protected String attributePrefix
-
-
Constructor Detail
-
ClientAttributeCertificateResource
public ClientAttributeCertificateResource(org.keycloak.models.RealmModel realm, AdminPermissionEvaluator auth, org.keycloak.models.ClientModel client, org.keycloak.models.KeycloakSession session, String attributePrefix, AdminEventBuilder adminEvent)
-
-
Method Detail
-
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(org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput input) throws IOExceptionUpload certificate and eventually private key- Parameters:
input-- Returns:
- Throws:
IOException
-
uploadJksCertificate
@POST @Path("upload-certificate") @Consumes("multipart/form-data") @Produces("application/json") public org.keycloak.representations.idm.CertificateRepresentation uploadJksCertificate(org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput input) throws IOExceptionUpload only certificate, not private key- Parameters:
input-- 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:
-
-