mirror of https://github.com/jacekkow/keycloak-protocol-cas

Jacek Kowalski
2024-06-21 befd2a8cf0de1002dad1db7320fd1a2198b89b75
commit | author | age
0ad1a9 1 package org.keycloak.protocol.cas.mappers;
MP 2
3 import org.keycloak.models.ProtocolMapperModel;
4 import org.keycloak.protocol.cas.CASLoginProtocol;
5 import org.keycloak.protocol.oidc.mappers.OIDCAttributeMapperHelper;
6
7 import java.util.HashMap;
8 import java.util.Map;
9
10 public class CASAttributeMapperHelper {
11     public static ProtocolMapperModel createClaimMapper(String name,
12                                                         String tokenClaimName, String claimType,
13                                                         String mapperId) {
14         ProtocolMapperModel mapper = new ProtocolMapperModel();
15         mapper.setName(name);
16         mapper.setProtocolMapper(mapperId);
17         mapper.setProtocol(CASLoginProtocol.LOGIN_PROTOCOL);
18         Map<String, String> config = new HashMap<String, String>();
19         config.put(OIDCAttributeMapperHelper.TOKEN_CLAIM_NAME, tokenClaimName);
20         config.put(OIDCAttributeMapperHelper.JSON_TYPE, claimType);
21         mapper.setConfig(config);
22         return mapper;
23     }
24
25 }