Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 22 additions & 164 deletions applications/accounts/deploy/resources/realm.json
Original file line number Diff line number Diff line change
@@ -1,177 +1,24 @@
{{- define "deploy_accounts_utils.role" }}
{
"id": {{ uuidv4 | quote }},
"name": {{ .role| quote }},
"composite": false,
"clientRole": true,
"containerId": {{ .app.harness.name | quote }},
"attributes": {}
}
{{- end}}
{{- define "deploy_accounts_utils.user" }}
{
"username": {{ .user.username | default .user.email | quote }},
"email": {{ .user.email | default .user.username | quote }},
"enabled": true,
"firstName": {{ .user.firstName | default "Test" | quote }},
"lastName": {{ .user.lastName | default "User" | quote }},
"credentials": [
{
"type": "password",
"value": {{ .user.password | default "test" | quote }}
}
],
"realmRoles": {{ .user.realmRoles | toJson }},
"clientRoles": {
{{ .app.harness.name | quote }}: {{ .user.clientRoles | toJson }}
}
}

{{- end}}
{
"id": {{ .Values.namespace | quote }},
"realm": {{ .Values.namespace | quote }},
"enabled": true,
"sslRequired": {{ ternary "none" "external" (not .Values.tls) | quote }},
"loginTheme": "keycloak",
"accountTheme": "keycloak",
"adminTheme": "keycloak",
"emailTheme": "keycloak",
"registrationAllowed": true,
"registrationEmailAsUsername": false,
"loginTheme": {{ .Values.apps.accounts.theme.login | default "keycloak" | quote }},
"accountTheme": {{ .Values.apps.accounts.theme.account | default "keycloak" | quote }},
"adminTheme": {{ .Values.apps.accounts.theme.admin | default "keycloak" | quote }},
"emailTheme": {{ .Values.apps.accounts.theme.email | default "keycloak" | quote }},
"registrationAllowed": {{ .Values.apps.accounts.registrationAllowed | default true }},
"registrationEmailAsUsername": {{ .Values.apps.accounts.registrationEmailAsUsername | default false }},
"rememberMe": true,
"verifyEmail": false,
"loginWithEmailAllowed": true,
"duplicateEmailsAllowed": false,
"resetPasswordAllowed": true,
"editUsernameAllowed": true,
"components": {
"org.keycloak.userprofile.UserProfileProvider": [
{
"id": "002b69df-9702-40dd-b73e-3a66d161bf11",
"providerId": "declarative-user-profile",
"subComponents": {},
"config": {
"kc.user.profile.config": [
"{\"attributes\":[{\"name\":\"username\",\"displayName\":\"${username}\",\"validations\":{\"length\":{\"min\":3,\"max\":255},\"username-prohibited-characters\":{},\"up-username-not-idn-homograph\":{}},\"permissions\":{\"view\":[\"admin\",\"user\"],\"edit\":[\"admin\",\"user\"]},\"multivalued\":false},{\"name\":\"email\",\"displayName\":\"${email}\",\"validations\":{\"email\":{},\"length\":{\"max\":255}},\"annotations\":{},\"permissions\":{\"view\":[\"admin\",\"user\"],\"edit\":[\"admin\",\"user\"]},\"multivalued\":false},{\"name\":\"firstName\",\"displayName\":\"${firstName}\",\"validations\":{\"length\":{\"max\":255},\"person-name-prohibited-characters\":{}},\"annotations\":{},\"permissions\":{\"view\":[\"admin\",\"user\"],\"edit\":[\"admin\",\"user\"]},\"multivalued\":false},{\"name\":\"lastName\",\"displayName\":\"${lastName}\",\"validations\":{\"length\":{\"max\":255},\"person-name-prohibited-characters\":{}},\"annotations\":{},\"permissions\":{\"view\":[\"admin\",\"user\"],\"edit\":[\"admin\",\"user\"]},\"multivalued\":false}],\"groups\":[{\"name\":\"user-metadata\",\"displayHeader\":\"User metadata\",\"displayDescription\":\"Attributes, which refer to user metadata\"}]}"
]
}
}
],
"org.keycloak.keys.KeyProvider": [
{
"id": "e632ce46-36ad-421a-b1a5-776383cc1565",
"name": "rsa-generated",
"providerId": "rsa-generated",
"subComponents": {},
"config": {
"priority": [
"100"
]
}
},
{
"id": "b68bee45-a8f0-46ca-b7d9-0df90189736a",
"name": "hmac-generated-hs512",
"providerId": "hmac-generated",
"subComponents": {},
"config": {
"priority": [
"100"
],
"algorithm": [
"HS512"
]
}
},
{
"id": "55960a57-af77-4f4c-8b6e-925c74bb44db",
"name": "aes-generated",
"providerId": "aes-generated",
"subComponents": {},
"config": {
"priority": [
"100"
]
}
},
{
"id": "ce068675-5cae-434e-851f-09f653ccc604",
"name": "rsa-enc-generated",
"providerId": "rsa-enc-generated",
"subComponents": {},
"config": {
"priority": [
"100"
],
"algorithm": [
"RSA-OAEP"
]
}
}
]
},
"users": [
{{- $j := 0}}
{{- range $app := .Values.apps }}
{{- if (hasKey $app.harness "accounts") }}
{{- if $j}},{{end}}
{{- if $app.harness.accounts.users}}
{{- $j = add1 $j }}
{{- end }}
{{- range $i, $user := $app.harness.accounts.users }}{{if $i}},{{end}}
{{ include "deploy_accounts_utils.user" (dict "root" $ "app" $app "user" $user) }}
{{- end }}
{{- end }}

{{- end }}
],
"roles": {
"realm": [
{
"id": "70835ad6-1454-4bc5-86a4-f1597e776b75",
"name": {{ .Values.apps.accounts.admin.role | quote }},
"composite": false,
"clientRole": false,
"containerId": {{ .Values.namespace | quote }},
"attributes": {}
},
{
"id": "498353dd-88eb-4a5e-99b8-d912e0f20f23",
"name": "uma_authorization",
"description": "${role_uma_authorization}",
"composite": false,
"clientRole": false,
"containerId": {{ .Values.namespace | quote }},
"attributes": {}
},
{
"id": "f99970f1-958b-4bb8-8b39-0d7498b0ecc4",
"name": "offline_access",
"description": "${role_offline-access}",
"composite": false,
"clientRole": false,
"containerId": {{ .Values.namespace | quote }},
"attributes": {}
}
],
"client": {
{{- $k := 0}}
{{- range $app := .Values.apps }}

{{- if (hasKey $app.harness "accounts") }}
{{- if $k}},{{end}}
{{ $app.harness.name | quote }}: [
{{- range $i, $role := $app.harness.accounts.roles }}
{{if $i}},{{end}}
{{- include "deploy_accounts_utils.role" (dict "root" $ "app" $app "role" $role) }}
{{- end }}
]
{{- $k = add1 $k }}
{{- end }}
{{- end }}
}
},
"editUsernameAllowed": {{ .Values.apps.accounts.editUsernameAllowed }},
{{- include "deploy_accounts_utils.events" (dict "app" .Values.apps.accounts) | indent 8 -}}
{{- include "deploy_accounts_utils.identity_providers" (dict "app" .Values.apps.accounts) | indent 8 -}}
{{- include "deploy_accounts_utils.components" . | indent 8 -}}
{{- include "deploy_accounts_utils.users_roles" (dict "Values" .Values) | indent 8 -}}
"clientScopeMappings": {
"account": [
{
Expand Down Expand Up @@ -775,6 +622,17 @@
"jsonType.label": "String"
}
},
{
"id": "0b8d0cf7-eebc-4c51-892e-2b65212856b4",
"name": "sub",
"protocol": "openid-connect",
"protocolMapper": "oidc-sub-mapper",
"consentRequired": false,
"config": {
"introspection.token.claim": "true",
"access.token.claim": "true"
}
},
{
"id": "3d763f84-d417-4b4e-99e4-2b0e05bf861a",
"name": "family name",
Expand Down
75 changes: 75 additions & 0 deletions applications/accounts/deploy/templates/_components.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{{- define "deploy_accounts_utils.user_profile_provider_component" -}}
"org.keycloak.userprofile.UserProfileProvider": [
{
"id": "002b69df-9702-40dd-b73e-3a66d161bf11",
"providerId": "declarative-user-profile",
"subComponents": {},
"config": {
"kc.user.profile.config": [
"{\"attributes\":[{\"name\":\"username\",\"displayName\":\"${username}\",\"validations\":{\"length\":{\"min\":3,\"max\":255},\"username-prohibited-characters\":{},\"up-username-not-idn-homograph\":{}},\"permissions\":{\"view\":[\"admin\",\"user\"],\"edit\":[\"admin\",\"user\"]},\"multivalued\":false},{\"name\":\"email\",\"displayName\":\"${email}\",\"validations\":{\"email\":{},\"length\":{\"max\":255}},\"annotations\":{},\"permissions\":{\"view\":[\"admin\",\"user\"],\"edit\":[\"admin\",\"user\"]},\"multivalued\":false},{\"name\":\"firstName\",\"displayName\":\"${firstName}\",\"validations\":{\"length\":{\"max\":255},\"person-name-prohibited-characters\":{}},\"annotations\":{},\"permissions\":{\"view\":[\"admin\",\"user\"],\"edit\":[\"admin\",\"user\"]},\"multivalued\":false},{\"name\":\"lastName\",\"displayName\":\"${lastName}\",\"validations\":{\"length\":{\"max\":255},\"person-name-prohibited-characters\":{}},\"annotations\":{},\"permissions\":{\"view\":[\"admin\",\"user\"],\"edit\":[\"admin\",\"user\"]},\"multivalued\":false}],\"groups\":[{\"name\":\"user-metadata\",\"displayHeader\":\"User metadata\",\"displayDescription\":\"Attributes, which refer to user metadata\"}],\"unmanagedAttributePolicy\":\"ENABLED\"}"
]
}
}
]
{{- end -}}
{{- define "deploy_accounts_utils.key_provider_component" -}}
"org.keycloak.keys.KeyProvider": [
{
"id": "e632ce46-36ad-421a-b1a5-776383cc1565",
"name": "rsa-generated",
"providerId": "rsa-generated",
"subComponents": {},
"config": {
"priority": [
"100"
]
}
},
{
"id": "b68bee45-a8f0-46ca-b7d9-0df90189736a",
"name": "hmac-generated-hs512",
"providerId": "hmac-generated",
"subComponents": {},
"config": {
"priority": [
"100"
],
"algorithm": [
"HS512"
]
}
},
{
"id": "55960a57-af77-4f4c-8b6e-925c74bb44db",
"name": "aes-generated",
"providerId": "aes-generated",
"subComponents": {},
"config": {
"priority": [
"100"
]
}
},
{
"id": "ce068675-5cae-434e-851f-09f653ccc604",
"name": "rsa-enc-generated",
"providerId": "rsa-enc-generated",
"subComponents": {},
"config": {
"priority": [
"100"
],
"algorithm": [
"RSA-OAEP"
]
}
}
]
{{- end -}}
#
{{- define "deploy_accounts_utils.components" -}}
"components": {
{{template "deploy_accounts_utils.user_profile_provider_component" }},
{{template "deploy_accounts_utils.key_provider_component" }}
},
{{- end -}}
100 changes: 100 additions & 0 deletions applications/accounts/deploy/templates/_events.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Accounts _helper.tpl
{{- define "deploy_accounts_utils.event_listeners" -}}
"eventsListeners": [
"metacell-admin-event-listener",
"jboss-logging"
],
{{- end -}}
#
{{- define "deploy_accounts_utils.event_types" -}}
"enabledEventTypes": [
"SEND_RESET_PASSWORD",
"UPDATE_CONSENT_ERROR",
"GRANT_CONSENT",
"VERIFY_PROFILE_ERROR",
"REMOVE_TOTP",
"REVOKE_GRANT",
"UPDATE_TOTP",
"LOGIN_ERROR",
"CLIENT_LOGIN",
"RESET_PASSWORD_ERROR",
"IMPERSONATE_ERROR",
"CODE_TO_TOKEN_ERROR",
"CUSTOM_REQUIRED_ACTION",
"OAUTH2_DEVICE_CODE_TO_TOKEN_ERROR",
"RESTART_AUTHENTICATION",
"IMPERSONATE",
"UPDATE_PROFILE_ERROR",
"LOGIN",
"OAUTH2_DEVICE_VERIFY_USER_CODE",
"UPDATE_PASSWORD_ERROR",
"CLIENT_INITIATED_ACCOUNT_LINKING",
"TOKEN_EXCHANGE",
"AUTHREQID_TO_TOKEN",
"LOGOUT",
"REGISTER",
"DELETE_ACCOUNT_ERROR",
"CLIENT_REGISTER",
"IDENTITY_PROVIDER_LINK_ACCOUNT",
"DELETE_ACCOUNT",
"UPDATE_PASSWORD",
"CLIENT_DELETE",
"FEDERATED_IDENTITY_LINK_ERROR",
"IDENTITY_PROVIDER_FIRST_LOGIN",
"CLIENT_DELETE_ERROR",
"VERIFY_EMAIL",
"CLIENT_LOGIN_ERROR",
"RESTART_AUTHENTICATION_ERROR",
"EXECUTE_ACTIONS",
"REMOVE_FEDERATED_IDENTITY_ERROR",
"TOKEN_EXCHANGE_ERROR",
"PERMISSION_TOKEN",
"SEND_IDENTITY_PROVIDER_LINK_ERROR",
"EXECUTE_ACTION_TOKEN_ERROR",
"SEND_VERIFY_EMAIL",
"OAUTH2_DEVICE_AUTH",
"EXECUTE_ACTIONS_ERROR",
"REMOVE_FEDERATED_IDENTITY",
"OAUTH2_DEVICE_CODE_TO_TOKEN",
"IDENTITY_PROVIDER_POST_LOGIN",
"IDENTITY_PROVIDER_LINK_ACCOUNT_ERROR",
"OAUTH2_DEVICE_VERIFY_USER_CODE_ERROR",
"UPDATE_EMAIL",
"REGISTER_ERROR",
"REVOKE_GRANT_ERROR",
"EXECUTE_ACTION_TOKEN",
"LOGOUT_ERROR",
"UPDATE_EMAIL_ERROR",
"CLIENT_UPDATE_ERROR",
"AUTHREQID_TO_TOKEN_ERROR",
"UPDATE_PROFILE",
"CLIENT_REGISTER_ERROR",
"FEDERATED_IDENTITY_LINK",
"SEND_IDENTITY_PROVIDER_LINK",
"SEND_VERIFY_EMAIL_ERROR",
"RESET_PASSWORD",
"CLIENT_INITIATED_ACCOUNT_LINKING_ERROR",
"OAUTH2_DEVICE_AUTH_ERROR",
"UPDATE_CONSENT",
"REMOVE_TOTP_ERROR",
"VERIFY_EMAIL_ERROR",
"SEND_RESET_PASSWORD_ERROR",
"CLIENT_UPDATE",
"CUSTOM_REQUIRED_ACTION_ERROR",
"IDENTITY_PROVIDER_POST_LOGIN_ERROR",
"UPDATE_TOTP_ERROR",
"CODE_TO_TOKEN",
"VERIFY_PROFILE",
"GRANT_CONSENT_ERROR",
"IDENTITY_PROVIDER_FIRST_LOGIN_ERROR"
],
{{- end -}}
#
{{- define "deploy_accounts_utils.events" -}}
{{- if eq .app.useEvents true }}
{{template "deploy_accounts_utils.event_listeners" }}
{{template "deploy_accounts_utils.event_types" }}
"adminEventsEnabled": true,
"adminEventsDetailsEnabled": true,
{{- end }}
{{- end -}}
Empty file.
Loading
Loading