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

Matthias Piepkorn
2017-07-26 f75caf002c2014cd1dd875225417f2a5de1af9d0
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 }