8000 Add organization id claim to the access token by mzvankovich · Pull Request #32807 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/src/main/java/org/keycloak/OAuth2Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public interface OAuth2Constants {
String SCOPE_PHONE = "phone";

String ORGANIZATION = "organization";
String ORGANIZATION_ID = "id";

String UI_LOCALES_PARAM = "ui_locales";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,15 @@ private Object resolveValue(ProtocolMapperModel model, List<OrganizationModel> o
continue;
}

Map<String, Object> attributes = Map.of();
Map<String, Object> claims = new HashMap<>();

claims.put(OAuth2Constants.ORGANIZATION_ID, o.getId());

if (isAddOrganizationAttributes(model)) {
attributes = new HashMap<>(o.getAttributes());
claims.putAll(o.getAttributes());
}

value.put(o.getAlias(), attributes);
value.put(o.getAlias(), claims);
}

if (value.isEmpty()) {
Expand Down
0