commit | author | age
|
7f7e0c
|
1 |
package org.keycloak.protocol.cas.mappers; |
MP |
2 |
|
|
3 |
import org.keycloak.protocol.oidc.mappers.OIDCAttributeMapperHelper; |
|
4 |
import org.keycloak.provider.ProviderConfigProperty; |
|
5 |
|
|
6 |
import java.util.ArrayList; |
|
7 |
import java.util.List; |
|
8 |
|
|
9 |
public class HardcodedClaim extends AbstractCASProtocolMapper { |
|
10 |
private static final List<ProviderConfigProperty> configProperties = new ArrayList<ProviderConfigProperty>(); |
|
11 |
|
|
12 |
public static final String CLAIM_VALUE = "claim.value"; |
|
13 |
|
|
14 |
static { |
|
15 |
OIDCAttributeMapperHelper.addTokenClaimNameConfig(configProperties); |
|
16 |
|
|
17 |
ProviderConfigProperty property = new ProviderConfigProperty(); |
|
18 |
property.setName(CLAIM_VALUE); |
|
19 |
property.setLabel("Claim value"); |
|
20 |
property.setType(ProviderConfigProperty.STRING_TYPE); |
|
21 |
property.setHelpText("Value of the claim you want to hard code. 'true' and 'false can be used for boolean values."); |
|
22 |
configProperties.add(property); |
|
23 |
|
|
24 |
OIDCAttributeMapperHelper.addJsonTypeConfig(configProperties); |
|
25 |
} |
|
26 |
|
|
27 |
public static final String PROVIDER_ID = "cas-hardcoded-claim-mapper"; |
|
28 |
|
|
29 |
|
|
30 |
@Override |
|
31 |
public List<ProviderConfigProperty> getConfigProperties() { |
|
32 |
return configProperties; |
|
33 |
} |
|
34 |
|
|
35 |
@Override |
|
36 |
public String getId() { |
|
37 |
return PROVIDER_ID; |
|
38 |
} |
|
39 |
|
|
40 |
@Override |
|
41 |
public String getDisplayType() { |
|
42 |
return "Hardcoded claim"; |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
public String getHelpText() { |
|
47 |
return "Hardcode a claim into the token."; |
|
48 |
} |
|
49 |
|
|
50 |
} |