Keycloak: Difference between revisions
Fix for running http only |
m Reword note about 25.05 |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 17: | Line 17: | ||
</syntaxhighlight>After applying the configuration the Keycloak management interface will be available at http://localhost. Login with username <code>admin</code> and password <code>changeme</code>. | </syntaxhighlight>After applying the configuration the Keycloak management interface will be available at http://localhost. Login with username <code>admin</code> and password <code>changeme</code>. | ||
== Configuration == | |||
=== Importing realms === | |||
{{Note|This module requires NixOS 25.05}}Using the realmFiles option, it is possible provision a realm from a JSON file or previous JSON export.<syntaxhighlight lang="nix"> | |||
{ ... }: let | |||
realm = { | |||
realm = "OIDCDemo"; | |||
enabled = true; | |||
clients = [{ | |||
clientId = "mydemo"; | |||
rootUrl = "http://localhost:8080"; | |||
}]; | |||
users = [{ | |||
enabled = true; | |||
firstName = "Christian"; | |||
lastName = "Bauer"; | |||
username = "cbauer"; | |||
email = "cbauer@localhost"; | |||
credentials = [{ | |||
type = "password"; | |||
temporary = false; | |||
value = "changeme"; | |||
}]; | |||
}]; | |||
}; | |||
in { | |||
services.keycloak = { | |||
realmFiles = [ | |||
(pkgs.writeText "OIDCDemo.json" (builtins.toJSON realm)) | |||
]; | |||
}; | |||
} | |||
</syntaxhighlight> | |||
== Tips and tricks == | == Tips and tricks == | ||