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