Realm Keystore Java Generated
Allows for creating and managing java-keystore
Realm keystores within Keycloak. A realm keystore manages generated key pairs that are used by Keycloak to perform cryptographic signatures and encryption.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as keycloak from "@pulumi/keycloak";
const realm = new keycloak.Realm("realm", {realm: "my-realm"});
const javaKeystore = new keycloak.RealmKeystoreJavaGenerated("java_keystore", {
name: "my-java-keystore",
realmId: realm.id,
enabled: true,
active: true,
keystore: "<path to your keystore>",
keystorePassword: "<password for keystore>",
keyAlias: "<alias for the private key>",
keyPassword: "<password for the private key>",
priority: 100,
algorithm: "RS256",
});
Content copied to clipboard
import pulumi
import pulumi_keycloak as keycloak
realm = keycloak.Realm("realm", realm="my-realm")
java_keystore = keycloak.RealmKeystoreJavaGenerated("java_keystore",
name="my-java-keystore",
realm_id=realm.id,
enabled=True,
active=True,
keystore="<path to your keystore>",
keystore_password="<password for keystore>",
key_alias="<alias for the private key>",
key_password="<password for the private key>",
priority=100,
algorithm="RS256")
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Keycloak = Pulumi.Keycloak;
return await Deployment.RunAsync(() =>
{
var realm = new Keycloak.Realm("realm", new()
{
RealmName = "my-realm",
});
var javaKeystore = new Keycloak.RealmKeystoreJavaGenerated("java_keystore", new()
{
Name = "my-java-keystore",
RealmId = realm.Id,
Enabled = true,
Active = true,
Keystore = "<path to your keystore>",
KeystorePassword = "<password for keystore>",
KeyAlias = "<alias for the private key>",
KeyPassword = "<password for the private key>",
Priority = 100,
Algorithm = "RS256",
});
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
realm, err := keycloak.NewRealm(ctx, "realm", &keycloak.RealmArgs{
Realm: pulumi.String("my-realm"),
})
if err != nil {
return err
}
_, err = keycloak.NewRealmKeystoreJavaGenerated(ctx, "java_keystore", &keycloak.RealmKeystoreJavaGeneratedArgs{
Name: pulumi.String("my-java-keystore"),
RealmId: realm.ID(),
Enabled: pulumi.Bool(true),
Active: pulumi.Bool(true),
Keystore: pulumi.String("<path to your keystore>"),
KeystorePassword: pulumi.String("<password for keystore>"),
KeyAlias: pulumi.String("<alias for the private key>"),
KeyPassword: pulumi.String("<password for the private key>"),
Priority: pulumi.Int(100),
Algorithm: pulumi.String("RS256"),
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.keycloak.Realm;
import com.pulumi.keycloak.RealmArgs;
import com.pulumi.keycloak.RealmKeystoreJavaGenerated;
import com.pulumi.keycloak.RealmKeystoreJavaGeneratedArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var realm = new Realm("realm", RealmArgs.builder()
.realm("my-realm")
.build());
var javaKeystore = new RealmKeystoreJavaGenerated("javaKeystore", RealmKeystoreJavaGeneratedArgs.builder()
.name("my-java-keystore")
.realmId(realm.id())
.enabled(true)
.active(true)
.keystore("<path to your keystore>")
.keystorePassword("<password for keystore>")
.keyAlias("<alias for the private key>")
.keyPassword("<password for the private key>")
.priority(100)
.algorithm("RS256")
.build());
}
}
Content copied to clipboard
resources:
realm:
type: keycloak:Realm
properties:
realm: my-realm
javaKeystore:
type: keycloak:RealmKeystoreJavaGenerated
name: java_keystore
properties:
name: my-java-keystore
realmId: ${realm.id}
enabled: true
active: true
keystore: <path to your keystore>
keystorePassword: <password for keystore>
keyAlias: <alias for the private key>
keyPassword: <password for the private key>
priority: 100
algorithm: RS256
Content copied to clipboard
Import
Realm keys can be imported using realm name and keystore id, you can find it in web UI. Example: bash
$ pulumi import keycloak:index/realmKeystoreJavaGenerated:RealmKeystoreJavaGenerated java_keystore my-realm/618cfba7-49aa-4c09-9a19-2f699b576f0b
Content copied to clipboard