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

Matthias Piepkorn
2017-02-05 5a0869a771f65f87fa2a4ed402fb1f3597b92198
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                                                         boolean consentRequired, String consentText,
14                                                         String mapperId) {
15         ProtocolMapperModel mapper = new ProtocolMapperModel();
16         mapper.setName(name);
17         mapper.setProtocolMapper(mapperId);
18         mapper.setProtocol(CASLoginProtocol.LOGIN_PROTOCOL);
19         mapper.setConsentRequired(consentRequired);
20         mapper.setConsentText(consentText);
21         Map<String, String> config = new HashMap<String, String>();
22         config.put(OIDCAttributeMapperHelper.TOKEN_CLAIM_NAME, tokenClaimName);
23         config.put(OIDCAttributeMapperHelper.JSON_TYPE, claimType);
24         mapper.setConfig(config);
25         return mapper;
26     }
27
28 }