Class ClientAttributeCertificateResource
java.lang.Object
org.keycloak.services.resources.admin.ClientAttributeCertificateResource
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Field Summary
Modifier and TypeFieldDescriptionprotected final AdminEventBuilder
protected final String
static final String
protected final ClientModel
static final String
static final String
protected final RealmModel
protected final KeycloakSession
-
Constructor Summary
ConstructorDescriptionClientAttributeCertificateResource
(AdminPermissionEvaluator auth, ClientModel client, KeycloakSession session, String attributePrefix, AdminEventBuilder adminEvent) -
Method Summary
Modifier and TypeMethodDescriptiongenerate()
Generate a new certificate with new key pairbyte[]
generateAndGetKeystore
(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.Get key infobyte[]
getKeystore
(KeyStoreConfig config) Get a keystore file for the client, containing private key and public certificateUpload certificate and eventually private keyUpload only certificate, not private key
-
Field Details
-
CERTIFICATE_PEM
- See Also:
-
PUBLIC_KEY_PEM
- See Also:
-
JSON_WEB_KEY_SET
- See Also:
-
realm
-
client
-
session
-
adminEvent
-
attributePrefix
-
-
Constructor Details
-
ClientAttributeCertificateResource
public ClientAttributeCertificateResource(AdminPermissionEvaluator auth, ClientModel client, KeycloakSession session, String attributePrefix, AdminEventBuilder adminEvent)
-
-
Method Details
-
getKeyInfo
Get key info- Returns:
-
generate
Generate a new certificate with new key pair- Returns:
-
uploadJks
@POST @Path("upload") @Consumes("multipart/form-data") @Produces("application/json") public CertificateRepresentation uploadJks() throws IOExceptionUpload certificate and eventually private key- Returns:
- Throws:
IOException
-
uploadJksCertificate
@POST @Path("upload-certificate") @Consumes("multipart/form-data") @Produces("application/json") public CertificateRepresentation uploadJksCertificate() throws IOExceptionUpload 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(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(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:
-