-
Notifications
You must be signed in to change notification settings - Fork 12
/
CustomScriptType.java
126 lines (107 loc) · 6.04 KB
/
CustomScriptType.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
* oxCore is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
*
* Copyright (c) 2014, Gluu
*/
package org.xdi.model.custom.script;
import org.gluu.site.ldap.persistence.annotation.LdapEnum;
import org.xdi.model.custom.script.model.CustomScript;
import org.xdi.model.custom.script.model.auth.AuthenticationCustomScript;
import org.xdi.model.custom.script.type.BaseExternalType;
import org.xdi.model.custom.script.type.auth.DummyPersonAuthenticationType;
import org.xdi.model.custom.script.type.auth.PersonAuthenticationType;
import org.xdi.model.custom.script.type.authz.ConsentGatheringType;
import org.xdi.model.custom.script.type.authz.DummyConsentGatheringType;
import org.xdi.model.custom.script.type.client.ClientRegistrationType;
import org.xdi.model.custom.script.type.client.DummyClientRegistrationType;
import org.xdi.model.custom.script.type.id.DummyIdGeneratorType;
import org.xdi.model.custom.script.type.id.IdGeneratorType;
import org.xdi.model.custom.script.type.introspection.DummyIntrospectionType;
import org.xdi.model.custom.script.type.introspection.IntrospectionType;
import org.xdi.model.custom.script.type.owner.DummyResourceOwnerPasswordCredentialsType;
import org.xdi.model.custom.script.type.owner.ResourceOwnerPasswordCredentialsType;
import org.xdi.model.custom.script.type.scim.DummyScimType;
import org.xdi.model.custom.script.type.scim.ScimType;
import org.xdi.model.custom.script.type.scope.DummyDynamicScopeType;
import org.xdi.model.custom.script.type.scope.DynamicScopeType;
import org.xdi.model.custom.script.type.session.ApplicationSessionType;
import org.xdi.model.custom.script.type.session.DummyApplicationSessionType;
import org.xdi.model.custom.script.type.uma.UmaClaimsGatheringType;
import org.xdi.model.custom.script.type.uma.UmaDummyClaimsGatheringType;
import org.xdi.model.custom.script.type.uma.UmaDummyRptPolicyType;
import org.xdi.model.custom.script.type.uma.UmaRptPolicyType;
import org.xdi.model.custom.script.type.user.*;
import java.util.HashMap;
import java.util.Map;
/**
* List of supported custom scripts
*
* @author Yuriy Movchan Date: 11/11/2014
*/
public enum CustomScriptType implements LdapEnum {
PERSON_AUTHENTICATION("person_authentication", "Person Authentication", PersonAuthenticationType.class, AuthenticationCustomScript.class, "PersonAuthentication", new DummyPersonAuthenticationType()),
INTROSPECTION("introspection", "Introspection", IntrospectionType.class, CustomScript.class, "Introspection", new DummyIntrospectionType()),
RESOURCE_OWNER_PASSWORD_CREDENTIALS("resource_owner_password_credentials", "Resource Owner Password Credentials", ResourceOwnerPasswordCredentialsType.class, CustomScript.class, "ResourceOwnerPasswordCredentials", new DummyResourceOwnerPasswordCredentialsType()),
APPLICATION_SESSION("application_session", "Application Session", ApplicationSessionType.class, CustomScript.class, "ApplicationSession", new DummyApplicationSessionType()),
CACHE_REFRESH("cache_refresh", "Cache Refresh", CacheRefreshType.class, CustomScript.class, "CacheRefresh", new DummyCacheRefreshType()),
UPDATE_USER("update_user", "Update User", UpdateUserType.class, CustomScript.class, "UpdateUser", new DummyUpdateUserType()),
USER_REGISTRATION("user_registration", "User Registration", UserRegistrationType.class, CustomScript.class, "UserRegistration", new DummyUserRegistrationType()),
CLIENT_REGISTRATION("client_registration", "Client Registration", ClientRegistrationType.class, CustomScript.class, "ClientRegistration", new DummyClientRegistrationType()),
ID_GENERATOR("id_generator", "Id Generator", IdGeneratorType.class, CustomScript.class, "IdGenerator", new DummyIdGeneratorType()),
UMA_RPT_POLICY("uma_rpt_policy", "UMA RPT Policies", UmaRptPolicyType.class, CustomScript.class, "UmaRptPolicy", new UmaDummyRptPolicyType()),
UMA_CLAIMS_GATHERING("uma_claims_gathering", "UMA Claims Gathering", UmaClaimsGatheringType.class, CustomScript.class, "UmaClaimsGathering", new UmaDummyClaimsGatheringType()),
CONSENT_GATHERING("consent_gathering", "Consent Gathering", ConsentGatheringType.class, CustomScript.class, "ConsentGathering", new DummyConsentGatheringType()),
DYNAMIC_SCOPE("dynamic_scope", "Dynamic Scopes", DynamicScopeType.class, CustomScript.class, "DynamicScope", new DummyDynamicScopeType()),
SCIM("scim", "SCIM", ScimType.class, CustomScript.class, "ScimEventHandler", new DummyScimType());
private String value;
private String displayName;
private Class<? extends BaseExternalType> customScriptType;
private Class<? extends CustomScript> customScriptModel;
private String pythonClass;
private BaseExternalType defaultImplementation;
private static Map<String, CustomScriptType> mapByValues = new HashMap<String, CustomScriptType>();
static {
for (CustomScriptType enumType : values()) {
mapByValues.put(enumType.getValue(), enumType);
}
}
private CustomScriptType(String value, String displayName, Class<? extends BaseExternalType> customScriptType, Class<? extends CustomScript> customScriptModel, String pythonClass, BaseExternalType defaultImplementation) {
this.displayName = displayName;
this.value = value;
this.customScriptType = customScriptType;
this.customScriptModel = customScriptModel;
this.pythonClass = pythonClass;
this.defaultImplementation = defaultImplementation;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getValue() {
return value;
}
public Class<? extends BaseExternalType> getCustomScriptType() {
return customScriptType;
}
public Class<? extends CustomScript> getCustomScriptModel() {
return customScriptModel;
}
public String getPythonClass() {
return pythonClass;
}
public BaseExternalType getDefaultImplementation() {
return defaultImplementation;
}
public static CustomScriptType getByValue(String value) {
return mapByValues.get(value);
}
public Enum<? extends LdapEnum> resolveByValue(String value) {
return getByValue(value);
}
@Override
public String toString() {
return value;
}
}