Skip to content

Commit 2682966

Browse files
authored
Defined the standard profile and email client scopes in the realm (#6)
The schuly-app client referenced email, profile, roles and web-origins scopes that the realm never defined, so Keycloak ignored them on import and only groups survived — leaving the app's authorize request to fail with invalid_scope. Define profile (name, username, given/family name, picture) and email (email, email_verified) scopes, make them realm defaults, assign them to schuly-app, and request offline_access as an optional scope.
1 parent 302eb73 commit 2682966

1 file changed

Lines changed: 68 additions & 2 deletions

File tree

realms/schuly-realm.json

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
{ "name": "Teacher", "realmRoles": ["Teacher"] },
2323
{ "name": "Administrator", "realmRoles": ["Administrator"] }
2424
],
25-
"defaultDefaultClientScopes": ["groups"],
25+
"defaultDefaultClientScopes": ["groups", "profile", "email"],
2626
"clientScopes": [
2727
{
2828
"name": "groups",
@@ -44,6 +44,71 @@
4444
}
4545
}
4646
]
47+
},
48+
{
49+
"name": "profile",
50+
"protocol": "openid-connect",
51+
"description": "Standard OIDC profile claims (name, username, picture).",
52+
"attributes": { "include.in.token.scope": "true", "display.on.consent.screen": "false" },
53+
"protocolMappers": [
54+
{
55+
"name": "full name",
56+
"protocol": "openid-connect",
57+
"protocolMapper": "oidc-full-name-mapper",
58+
"consentRequired": false,
59+
"config": { "id.token.claim": "true", "access.token.claim": "true", "userinfo.token.claim": "true" }
60+
},
61+
{
62+
"name": "username",
63+
"protocol": "openid-connect",
64+
"protocolMapper": "oidc-usermodel-property-mapper",
65+
"consentRequired": false,
66+
"config": { "user.attribute": "username", "claim.name": "preferred_username", "jsonType.label": "String", "id.token.claim": "true", "access.token.claim": "true", "userinfo.token.claim": "true" }
67+
},
68+
{
69+
"name": "given name",
70+
"protocol": "openid-connect",
71+
"protocolMapper": "oidc-usermodel-property-mapper",
72+
"consentRequired": false,
73+
"config": { "user.attribute": "firstName", "claim.name": "given_name", "jsonType.label": "String", "id.token.claim": "true", "access.token.claim": "true", "userinfo.token.claim": "true" }
74+
},
75+
{
76+
"name": "family name",
77+
"protocol": "openid-connect",
78+
"protocolMapper": "oidc-usermodel-property-mapper",
79+
"consentRequired": false,
80+
"config": { "user.attribute": "lastName", "claim.name": "family_name", "jsonType.label": "String", "id.token.claim": "true", "access.token.claim": "true", "userinfo.token.claim": "true" }
81+
},
82+
{
83+
"name": "picture",
84+
"protocol": "openid-connect",
85+
"protocolMapper": "oidc-usermodel-attribute-mapper",
86+
"consentRequired": false,
87+
"config": { "user.attribute": "picture", "claim.name": "picture", "jsonType.label": "String", "id.token.claim": "true", "access.token.claim": "true", "userinfo.token.claim": "true" }
88+
}
89+
]
90+
},
91+
{
92+
"name": "email",
93+
"protocol": "openid-connect",
94+
"description": "Standard OIDC email claims.",
95+
"attributes": { "include.in.token.scope": "true", "display.on.consent.screen": "false" },
96+
"protocolMappers": [
97+
{
98+
"name": "email",
99+
"protocol": "openid-connect",
100+
"protocolMapper": "oidc-usermodel-property-mapper",
101+
"consentRequired": false,
102+
"config": { "user.attribute": "email", "claim.name": "email", "jsonType.label": "String", "id.token.claim": "true", "access.token.claim": "true", "userinfo.token.claim": "true" }
103+
},
104+
{
105+
"name": "email verified",
106+
"protocol": "openid-connect",
107+
"protocolMapper": "oidc-usermodel-property-mapper",
108+
"consentRequired": false,
109+
"config": { "user.attribute": "emailVerified", "claim.name": "email_verified", "jsonType.label": "boolean", "id.token.claim": "true", "access.token.claim": "true", "userinfo.token.claim": "true" }
110+
}
111+
]
47112
}
48113
],
49114
"clients": [
@@ -59,7 +124,8 @@
59124
"redirectUris": ["schulytest://callback", "schuly://callback"],
60125
"webOrigins": ["+"],
61126
"attributes": { "pkce.code.challenge.method": "S256" },
62-
"defaultClientScopes": ["groups", "email", "profile", "roles", "web-origins"]
127+
"defaultClientScopes": ["groups", "profile", "email"],
128+
"optionalClientScopes": ["offline_access"]
63129
}
64130
],
65131
"authenticationFlows": [

0 commit comments

Comments
 (0)