File tree 4 files changed +12
-1
lines changed
src/main/java/info/unterrainer/commons/httpserver
4 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 17
17
18
18
<modelVersion >4.0.0</modelVersion >
19
19
<artifactId >http-server</artifactId >
20
- <version >0.2.6 </version >
20
+ <version >0.2.7 </version >
21
21
<name >HttpServer</name >
22
22
<packaging >jar</packaging >
23
23
Original file line number Diff line number Diff line change @@ -168,6 +168,9 @@ private TokenVerifier<AccessToken> persistUserInfoInContext(final Context ctx) {
168
168
ctx .attribute (Attribute .USER_EMAIL_VERIFIED , token .getEmailVerified ());
169
169
ctx .attribute (Attribute .USER_REALM_ROLES , token .getRealmAccess ().getRoles ());
170
170
171
+ String tenant = (String ) token .getOtherClaims ().get ("tenant" );
172
+ ctx .attribute (Attribute .USER_CLIENT_ATTRIBUTE_TENANT , tenant );
173
+
171
174
Set <String > clientRoles = Set .of ();
172
175
String key = token .getIssuedFor ();
173
176
if (token .getResourceAccess ().containsKey (key ))
@@ -185,6 +188,7 @@ private TokenVerifier<AccessToken> persistUserInfoInContext(final Context ctx) {
185
188
.email (token .getEmail ())
186
189
.emailVerified (token .getEmailVerified ())
187
190
.realmRoles (token .getRealmAccess ().getRoles ())
191
+ .tenant (tenant )
188
192
.clientRoles (clientRoles )
189
193
.isActive (token .isActive ())
190
194
.isBearer (token .getType ().equalsIgnoreCase ("bearer" ))
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ public class Attribute {
15
15
public static final String USER_CLIENT = "user_client" ;
16
16
public static final String USER_CLIENT_ROLES = "user_client_roles" ;
17
17
public static final String USER_REALM_ROLES = "user_realm_roles" ;
18
+ public static final String USER_CLIENT_ATTRIBUTE_TENANT = "user_client_attribute_tenant" ;
18
19
19
20
public static final String KEYCLOAK_TOKEN_REJECTION_REASON = "kc_token_rejection_reason" ;
20
21
}
Original file line number Diff line number Diff line change @@ -22,6 +22,12 @@ public class UserDataJson {
22
22
23
23
private Set <String > realmRoles ;
24
24
private Set <String > clientRoles ;
25
+ /**
26
+ * Is the custom Keycloak-attribute 'tenant' that has to be set under
27
+ * user/attributes within Keycloak and then mapped using an AttributeMapper
28
+ * within Keycloak as well. Is a comma-separated list of tenant-IDs.
29
+ */
30
+ private String tenant ;
25
31
26
32
private boolean isActive ;
27
33
private boolean isBearer ;
You can’t perform that action at this time.
0 commit comments