From a81264f4647a5f0490a8f9e659a91914deb4c366 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 30 Jul 2022 08:51:24 +0000 Subject: [PATCH] Update to Keycloak 19.0.1 --- src/main/java/org/keycloak/protocol/cas/mappers/AbstractCASProtocolMapper.java | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/src/main/java/org/keycloak/protocol/cas/mappers/AbstractCASProtocolMapper.java b/src/main/java/org/keycloak/protocol/cas/mappers/AbstractCASProtocolMapper.java index 2c19433..6838f6d 100644 --- a/src/main/java/org/keycloak/protocol/cas/mappers/AbstractCASProtocolMapper.java +++ b/src/main/java/org/keycloak/protocol/cas/mappers/AbstractCASProtocolMapper.java @@ -3,8 +3,12 @@ import org.keycloak.Config; import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSessionFactory; +import org.keycloak.models.ProtocolMapperModel; import org.keycloak.protocol.ProtocolMapper; import org.keycloak.protocol.cas.CASLoginProtocol; +import org.keycloak.protocol.oidc.mappers.OIDCAttributeMapperHelper; + +import java.util.Map; public abstract class AbstractCASProtocolMapper implements ProtocolMapper, CASAttributeMapper { public static final String TOKEN_MAPPER_CATEGORY = "Token mapper"; @@ -35,4 +39,16 @@ public String getDisplayCategory() { return TOKEN_MAPPER_CATEGORY; } + + protected void setMappedAttribute(Map<String, Object> attributes, ProtocolMapperModel mappingModel, Object attributeValue) { + setPlainAttribute(attributes, mappingModel, OIDCAttributeMapperHelper.mapAttributeValue(mappingModel, attributeValue)); + } + + protected void setPlainAttribute(Map<String, Object> attributes, ProtocolMapperModel mappingModel, Object attributeValue) { + String protocolClaim = mappingModel.getConfig().get(OIDCAttributeMapperHelper.TOKEN_CLAIM_NAME); + if (protocolClaim == null || attributeValue == null) { + return; + } + attributes.put(protocolClaim, attributeValue); + } } -- Gitblit v1.9.1