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

Matthias Piepkorn
2018-11-16 89e3d757b9f6893d16e5c3e49fc407aa1a003931
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 }