Skip to content

Commit ea68a10

Browse files
Update keycloak scenario to show case variable expansion
on scopes
1 parent e1b9593 commit ea68a10

File tree

3 files changed

+56
-29
lines changed

3 files changed

+56
-29
lines changed

bin/deploy-rabbit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ source $SCRIPT/common
1111
MODE=${MODE:-uaa}
1212
OAUTH_PROVIDER=${OAUTH_PROVIDER:-$MODE}
1313
ADVANCED=${ADVANCED:-advanced.config}
14-
IMAGE_TAG=${IMAGE_TAG:-4.0.8-management}
14+
IMAGE_TAG=${IMAGE_TAG:-4.1.1-management}
1515
IMAGE=${IMAGE:-rabbitmq}
1616
RABBITMQ_CONF=${RABBITMQ_CONF:-rabbitmq.conf}
1717

bin/keycloak/deploy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,9 @@ docker run \
3232
--https-certificate-file=/opt/keycloak/certs/server_keycloak_certificate.pem \
3333
--https-certificate-key-file=/opt/keycloak/certs/server_keycloak_key.pem
3434

35+
36+
print " Note: If you modify keycloak configuration. Make sure to run the following command to export the configuration."
37+
print " docker exec -it keycloak /opt/keycloak/bin/kc.sh export --users realm_file --realm test --dir /opt/keycloak/data/import/"
38+
3539
wait_for_message keycloak "Running the server"
3640
print "keycloak is running"

conf/keycloak/import/test-realm.json

Lines changed: 51 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@
9696
"clientRole" : false,
9797
"containerId" : "test",
9898
"attributes" : { }
99+
}, {
100+
"id" : "70200494-09ed-425c-bee5-ba8730612f8b",
101+
"name" : "test-var-expansion",
102+
"description" : "",
103+
"composite" : false,
104+
"clientRole" : false,
105+
"containerId" : "test",
106+
"attributes" : { }
99107
}, {
100108
"id" : "af1bc955-6d4d-42e9-b0d4-343e7eb075d0",
101109
"name" : "rabbitmq-role",
@@ -502,7 +510,7 @@
502510
} ],
503511
"disableableCredentialTypes" : [ ],
504512
"requiredActions" : [ ],
505-
"realmRoles" : [ "rabbitmq.tag:administrator", "default-roles-test" ],
513+
"realmRoles" : [ "rabbitmq.tag:administrator", "test-var-expansion", "default-roles-test" ],
506514
"notBefore" : 0,
507515
"groups" : [ ]
508516
}, {
@@ -643,6 +651,9 @@
643651
}, {
644652
"clientScope" : "rabbitmq.tag:management",
645653
"roles" : [ "rabbitmq.tag:management" ]
654+
}, {
655+
"clientScope" : "rabbitmq.configure:*/q-{user_name}",
656+
"roles" : [ "test-var-expansion" ]
646657
} ],
647658
"clientScopeMappings" : {
648659
"account" : [ {
@@ -1612,7 +1623,7 @@
16121623
"jsonType.label" : "String"
16131624
}
16141625
} ],
1615-
"defaultClientScopes" : [ "web-origins", "acr", "rabbitmq.tag:administrator", "profile", "roles", "rabbitmq.tag:management", "email" ],
1626+
"defaultClientScopes" : [ "web-origins", "rabbitmq.configure:*/q-{user_name}", "acr", "rabbitmq.tag:administrator", "profile", "roles", "rabbitmq.tag:management", "email" ],
16161627
"optionalClientScopes" : [ "address", "phone", "offline_access", "microprofile-jwt" ]
16171628
}, {
16181629
"id" : "c265f3db-ed3a-4898-8800-af044b3c30f5",
@@ -1773,7 +1784,8 @@
17731784
"included.client.audience" : "rabbitmq-proxy-client-tls",
17741785
"id.token.claim" : "true",
17751786
"access.token.claim" : "true",
1776-
"included.custom.audience" : "rabbitmq"
1787+
"included.custom.audience" : "rabbitmq",
1788+
"userinfo.token.claim" : "true"
17771789
}
17781790
} ],
17791791
"defaultClientScopes" : [ "rabbitmq.read:*/*", "web-origins", "acr", "rabbitmq.write:*/*", "rabbitmq.tag:administrator", "profile", "roles", "rabbitmq.tag:management", "email", "rabbitmq.configure:*/*" ],
@@ -2349,8 +2361,19 @@
23492361
"include.in.token.scope" : "true",
23502362
"display.on.consent.screen" : "true"
23512363
}
2364+
}, {
2365+
"id" : "f2495e2f-2d9a-44e2-b8da-a46b464f9534",
2366+
"name" : "rabbitmq.configure:*/q-{user_name}",
2367+
"description" : "",
2368+
"protocol" : "openid-connect",
2369+
"attributes" : {
2370+
"include.in.token.scope" : "true",
2371+
"display.on.consent.screen" : "true",
2372+
"gui.order" : "",
2373+
"consent.screen.text" : ""
2374+
}
23522375
} ],
2353-
"defaultDefaultClientScopes" : [ "role_list", "profile", "email", "roles", "web-origins", "acr" ],
2376+
"defaultDefaultClientScopes" : [ "role_list", "profile", "email", "roles", "web-origins", "acr", "rabbitmq.configure:*/q-{user_name}" ],
23542377
"defaultOptionalClientScopes" : [ "offline_access", "address", "phone", "microprofile-jwt" ],
23552378
"browserSecurityHeaders" : {
23562379
"contentSecurityPolicyReportOnly" : "",
@@ -2402,7 +2425,7 @@
24022425
"subType" : "authenticated",
24032426
"subComponents" : { },
24042427
"config" : {
2405-
"allowed-protocol-mapper-types" : [ "saml-user-attribute-mapper", "oidc-full-name-mapper", "oidc-usermodel-attribute-mapper", "oidc-address-mapper", "saml-role-list-mapper", "oidc-usermodel-property-mapper", "oidc-sha256-pairwise-sub-mapper", "saml-user-property-mapper" ]
2428+
"allowed-protocol-mapper-types" : [ "oidc-address-mapper", "saml-user-attribute-mapper", "oidc-usermodel-property-mapper", "oidc-sha256-pairwise-sub-mapper", "saml-user-property-mapper", "saml-role-list-mapper", "oidc-usermodel-attribute-mapper", "oidc-full-name-mapper" ]
24062429
}
24072430
}, {
24082431
"id" : "693f0625-c453-40c0-b38e-80b7b7deaefa",
@@ -2427,7 +2450,7 @@
24272450
"subType" : "anonymous",
24282451
"subComponents" : { },
24292452
"config" : {
2430-
"allowed-protocol-mapper-types" : [ "oidc-usermodel-attribute-mapper", "saml-role-list-mapper", "oidc-usermodel-property-mapper", "oidc-full-name-mapper", "oidc-sha256-pairwise-sub-mapper", "saml-user-property-mapper", "oidc-address-mapper", "saml-user-attribute-mapper" ]
2453+
"allowed-protocol-mapper-types" : [ "oidc-full-name-mapper", "oidc-sha256-pairwise-sub-mapper", "saml-role-list-mapper", "oidc-usermodel-attribute-mapper", "oidc-address-mapper", "saml-user-property-mapper", "oidc-usermodel-property-mapper", "saml-user-attribute-mapper" ]
24312454
}
24322455
}, {
24332456
"id" : "bbadf932-a286-4841-be1b-ed845e2131cb",
@@ -2502,7 +2525,7 @@
25022525
"internationalizationEnabled" : false,
25032526
"supportedLocales" : [ ],
25042527
"authenticationFlows" : [ {
2505-
"id" : "be2bb3e6-7347-4288-8e6f-80e365f327da",
2528+
"id" : "bdf050d4-f291-4fae-a62e-b598ca97e9c2",
25062529
"alias" : "Account verification options",
25072530
"description" : "Method with which to verity the existing account",
25082531
"providerId" : "basic-flow",
@@ -2524,7 +2547,7 @@
25242547
"userSetupAllowed" : false
25252548
} ]
25262549
}, {
2527-
"id" : "f674fbae-3b22-4b4d-bb3a-6c4fba089bc3",
2550+
"id" : "b3e1a4e8-4298-4cbf-840f-c2e261bd591b",
25282551
"alias" : "Authentication Options",
25292552
"description" : "Authentication options.",
25302553
"providerId" : "basic-flow",
@@ -2553,7 +2576,7 @@
25532576
"userSetupAllowed" : false
25542577
} ]
25552578
}, {
2556-
"id" : "d6d44af2-d504-4a75-9c1c-8671bbe04a29",
2579+
"id" : "4b376432-ad1a-4dbf-97a1-a80aee954058",
25572580
"alias" : "Browser - Conditional OTP",
25582581
"description" : "Flow to determine if the OTP is required for the authentication",
25592582
"providerId" : "basic-flow",
@@ -2575,7 +2598,7 @@
25752598
"userSetupAllowed" : false
25762599
} ]
25772600
}, {
2578-
"id" : "3cb21e93-de30-4306-a208-7326d3d3f709",
2601+
"id" : "9aef4f2b-fe33-4d0a-8984-fab8ec95bdb2",
25792602
"alias" : "Direct Grant - Conditional OTP",
25802603
"description" : "Flow to determine if the OTP is required for the authentication",
25812604
"providerId" : "basic-flow",
@@ -2597,7 +2620,7 @@
25972620
"userSetupAllowed" : false
25982621
} ]
25992622
}, {
2600-
"id" : "a776d57f-2fc3-4a54-9e79-681bbb8eb3c5",
2623+
"id" : "1cb1c93e-e587-4745-a8c7-95bb2d066adf",
26012624
"alias" : "First broker login - Conditional OTP",
26022625
"description" : "Flow to determine if the OTP is required for the authentication",
26032626
"providerId" : "basic-flow",
@@ -2619,7 +2642,7 @@
26192642
"userSetupAllowed" : false
26202643
} ]
26212644
}, {
2622-
"id" : "98790c20-1602-4bac-adf8-13eeab9ff4e8",
2645+
"id" : "4bac0f5f-92b2-45ad-be0b-ac65a6c6cffd",
26232646
"alias" : "Handle Existing Account",
26242647
"description" : "Handle what to do if there is existing account with same email/username like authenticated identity provider",
26252648
"providerId" : "basic-flow",
@@ -2641,7 +2664,7 @@
26412664
"userSetupAllowed" : false
26422665
} ]
26432666
}, {
2644-
"id" : "990ea7fd-9e81-4dc0-af94-aed81cde301a",
2667+
"id" : "64c0df59-8a6e-4235-a157-ca516be788fc",
26452668
"alias" : "Reset - Conditional OTP",
26462669
"description" : "Flow to determine if the OTP should be reset or not. Set to REQUIRED to force.",
26472670
"providerId" : "basic-flow",
@@ -2663,7 +2686,7 @@
26632686
"userSetupAllowed" : false
26642687
} ]
26652688
}, {
2666-
"id" : "22291265-d0e0-4025-b47b-05ac0eb2c55f",
2689+
"id" : "fbd90ff6-7774-40d6-befd-edcfbe947f9c",
26672690
"alias" : "User creation or linking",
26682691
"description" : "Flow for the existing/non-existing user alternatives",
26692692
"providerId" : "basic-flow",
@@ -2686,7 +2709,7 @@
26862709
"userSetupAllowed" : false
26872710
} ]
26882711
}, {
2689-
"id" : "e00ed2ea-ffa9-4968-8e13-5cf54acd7c7b",
2712+
"id" : "554c9592-7549-40c2-b58b-d60b8bba4e4e",
26902713
"alias" : "Verify Existing Account by Re-authentication",
26912714
"description" : "Reauthentication of existing account",
26922715
"providerId" : "basic-flow",
@@ -2708,7 +2731,7 @@
27082731
"userSetupAllowed" : false
27092732
} ]
27102733
}, {
2711-
"id" : "e77e6f3a-2805-4de9-9594-47f90cdce595",
2734+
"id" : "44c9e3f9-81f1-47c3-86e6-47a7cdf61496",
27122735
"alias" : "browser",
27132736
"description" : "browser based authentication",
27142737
"providerId" : "basic-flow",
@@ -2744,7 +2767,7 @@
27442767
"userSetupAllowed" : false
27452768
} ]
27462769
}, {
2747-
"id" : "8e0f1d4a-2900-4e4d-9ca3-6615beb8f5e2",
2770+
"id" : "f7f65924-cd05-4290-9227-eafa6c6b03e0",
27482771
"alias" : "clients",
27492772
"description" : "Base authentication for clients",
27502773
"providerId" : "client-flow",
@@ -2780,7 +2803,7 @@
27802803
"userSetupAllowed" : false
27812804
} ]
27822805
}, {
2783-
"id" : "a2a83467-001b-4901-84ae-f0860de14f87",
2806+
"id" : "6ada5ab6-f4ec-4893-b68d-41d940f59c40",
27842807
"alias" : "direct grant",
27852808
"description" : "OpenID Connect Resource Owner Grant",
27862809
"providerId" : "basic-flow",
@@ -2809,7 +2832,7 @@
28092832
"userSetupAllowed" : false
28102833
} ]
28112834
}, {
2812-
"id" : "c4400c90-aa92-4457-a10e-b8367fe73613",
2835+
"id" : "bf07a663-bfa0-4f34-89a7-2fa0b64a87db",
28132836
"alias" : "docker auth",
28142837
"description" : "Used by Docker clients to authenticate against the IDP",
28152838
"providerId" : "basic-flow",
@@ -2824,7 +2847,7 @@
28242847
"userSetupAllowed" : false
28252848
} ]
28262849
}, {
2827-
"id" : "c0b8513a-e649-4c38-b12a-2edfc943304c",
2850+
"id" : "88204ddd-cacd-4217-9f1d-7f8a86212d5e",
28282851
"alias" : "first broker login",
28292852
"description" : "Actions taken after first broker login with identity provider account, which is not yet linked to any Keycloak account",
28302853
"providerId" : "basic-flow",
@@ -2847,7 +2870,7 @@
28472870
"userSetupAllowed" : false
28482871
} ]
28492872
}, {
2850-
"id" : "5b11a603-4c38-42e3-9e36-ba7e0747426f",
2873+
"id" : "6c40488b-1f9c-4bf5-a17e-8835a98d3b45",
28512874
"alias" : "forms",
28522875
"description" : "Username, password, otp and other auth forms.",
28532876
"providerId" : "basic-flow",
@@ -2869,7 +2892,7 @@
28692892
"userSetupAllowed" : false
28702893
} ]
28712894
}, {
2872-
"id" : "31ba8ec1-4570-4a5f-9e10-2ca96c58b106",
2895+
"id" : "d1a5b9f1-79aa-4d5c-acb8-3bbbd403af49",
28732896
"alias" : "http challenge",
28742897
"description" : "An authentication flow based on challenge-response HTTP Authentication Schemes",
28752898
"providerId" : "basic-flow",
@@ -2891,7 +2914,7 @@
28912914
"userSetupAllowed" : false
28922915
} ]
28932916
}, {
2894-
"id" : "d4184222-8914-483a-8900-f62152f6795e",
2917+
"id" : "aa794af8-1f60-4d11-a18c-22a5854f1348",
28952918
"alias" : "registration",
28962919
"description" : "registration flow",
28972920
"providerId" : "basic-flow",
@@ -2907,7 +2930,7 @@
29072930
"userSetupAllowed" : false
29082931
} ]
29092932
}, {
2910-
"id" : "39140565-94dc-4caf-ade4-f2c6a0278f18",
2933+
"id" : "e20f9717-c513-41e7-bda1-9b69dccff4da",
29112934
"alias" : "registration form",
29122935
"description" : "registration form",
29132936
"providerId" : "form-flow",
@@ -2943,7 +2966,7 @@
29432966
"userSetupAllowed" : false
29442967
} ]
29452968
}, {
2946-
"id" : "f447139b-b24d-4f8a-9010-085aa3a343b2",
2969+
"id" : "b5687c8c-4556-4408-a352-f6d555b735ec",
29472970
"alias" : "reset credentials",
29482971
"description" : "Reset credentials for a user if they forgot their password or something",
29492972
"providerId" : "basic-flow",
@@ -2979,7 +3002,7 @@
29793002
"userSetupAllowed" : false
29803003
} ]
29813004
}, {
2982-
"id" : "00e0dac8-643a-42fd-b138-924a9bd61c96",
3005+
"id" : "ac887ee0-ce92-4647-adbf-1179990f6109",
29833006
"alias" : "saml ecp",
29843007
"description" : "SAML ECP Profile Authentication Flow",
29853008
"providerId" : "basic-flow",
@@ -2995,13 +3018,13 @@
29953018
} ]
29963019
} ],
29973020
"authenticatorConfig" : [ {
2998-
"id" : "ff1eb3ea-3997-4e4b-a458-e74640323fb0",
3021+
"id" : "d73de415-1126-4af9-924a-f425f59a453b",
29993022
"alias" : "create unique user config",
30003023
"config" : {
30013024
"require.password.update.after.registration" : "false"
30023025
}
30033026
}, {
3004-
"id" : "e92aaa2a-1315-40e6-a148-74a271189c45",
3027+
"id" : "194f7674-33ec-4ff9-9e7b-25b9e68cdd29",
30053028
"alias" : "review profile config",
30063029
"config" : {
30073030
"update.profile.on.first.login" : "missing"

0 commit comments

Comments
 (0)