Keycloak
61 строка · 4.0 Кб
1embed-server --server-config=${server.config:standalone.xml}
2
3if (outcome != success) of /extension=org.keycloak.keycloak-saml-adapter-subsystem:read-resource
4/extension=org.keycloak.keycloak-saml-adapter-subsystem/:add(module=org.keycloak.keycloak-saml-adapter-subsystem)
5else
6echo Keycloak SAML Extension already installed
7end-if
8
9if (outcome != success) of /subsystem=keycloak-saml:read-resource
10/subsystem=keycloak-saml:add
11else
12echo Keycloak SAML Subsystem already installed
13end-if
14
15if (outcome != success) of /subsystem=elytron/custom-realm=KeycloakSAMLRealm:read-resource
16/subsystem=elytron/custom-realm=KeycloakSAMLRealm:add(class-name=org.keycloak.adapters.saml.elytron.KeycloakSecurityRealm, module=org.keycloak.keycloak-saml-wildfly-elytron-adapter)
17else
18echo Keycloak SAML Realm already installed
19end-if
20
21if (outcome != success) of /subsystem=elytron/security-domain=KeycloakDomain:read-resource
22/subsystem=elytron/security-domain=KeycloakDomain:add(default-realm=KeycloakSAMLRealm,permission-mapper=default-permission-mapper,security-event-listener=local-audit,realms=[{realm=KeycloakSAMLRealm}])
23else
24echo Keycloak Security Domain already installed. Trying to install Keycloak SAML Realm.
25/subsystem=elytron/security-domain=KeycloakDomain:list-add(name=realms, value={realm=KeycloakSAMLRealm})
26end-if
27
28if (outcome != success) of /subsystem=elytron/constant-realm-mapper=keycloak-saml-realm-mapper:read-resource
29/subsystem=elytron/constant-realm-mapper=keycloak-saml-realm-mapper:add(realm-name=KeycloakSAMLRealm)
30else
31echo Keycloak SAML Realm Mapper already installed
32end-if
33
34if (outcome != success) of /subsystem=elytron/service-loader-http-server-mechanism-factory=keycloak-saml-http-server-mechanism-factory:read-resource
35/subsystem=elytron/service-loader-http-server-mechanism-factory=keycloak-saml-http-server-mechanism-factory:add(module=org.keycloak.keycloak-saml-wildfly-elytron-adapter)
36else
37echo Keycloak SAML HTTP Mechanism Factory already installed
38end-if
39
40if (outcome != success) of /subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:read-resource
41/subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:add(http-server-mechanism-factories=[keycloak-saml-http-server-mechanism-factory, global])
42else
43echo Keycloak HTTP Mechanism Factory already installed. Trying to install Keycloak SAML HTTP Mechanism Factory.
44/subsystem=elytron/aggregate-http-server-mechanism-factory=keycloak-http-server-mechanism-factory:list-add(name=http-server-mechanism-factories, value=keycloak-saml-http-server-mechanism-factory)
45end-if
46
47if (outcome != success) of /subsystem=elytron/http-authentication-factory=keycloak-http-authentication:read-resource
48/subsystem=elytron/http-authentication-factory=keycloak-http-authentication:add(security-domain=KeycloakDomain,http-server-mechanism-factory=keycloak-http-server-mechanism-factory,mechanism-configurations=[{mechanism-name=KEYCLOAK-SAML,mechanism-realm-configurations=[{realm-name=KeycloakSAMLCRealm,realm-mapper=keycloak-saml-realm-mapper}]}])
49else
50echo Keycloak HTTP Authentication Factory already installed. Trying to install Keycloak SAML Mechanism Configuration
51/subsystem=elytron/http-authentication-factory=keycloak-http-authentication:list-add(name=mechanism-configurations, value={mechanism-name=KEYCLOAK-SAML,mechanism-realm-configurations=[{realm-name=KeycloakSAMLRealm,realm-mapper=keycloak-saml-realm-mapper}]})
52end-if
53
54if (outcome != success) of /subsystem=undertow/application-security-domain=other:read-resource
55/subsystem=undertow/application-security-domain=other:add(http-authentication-factory=keycloak-http-authentication)
56else
57batch
58/subsystem=undertow/application-security-domain=other:undefine-attribute(name=security-domain)
59/subsystem=undertow/application-security-domain=other:write-attribute(name=http-authentication-factory,value=keycloak-http-authentication)
60run-batch
61end-if
62