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