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

github-actions
2021-07-31 8f4a9340f5da87670a2236155fdf826aa84526f0
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 }