/
TranslateAttributesContext.java
93 lines (69 loc) · 2.48 KB
/
TranslateAttributesContext.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
package org.gluu.idp.externalauth;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.IdPAttributeValue;
import net.shibboleth.idp.attribute.StringAttributeValue;
import org.gluu.idp.service.GluuAttributeMappingService;
import org.gluu.oxauth.client.auth.user.UserProfile;
/**
* Translate attributes context
*
* @author Yuriy Movchan
* @version 0.1, 06/22/2020
*/
public class TranslateAttributesContext implements Serializable {
private static final long serialVersionUID = 1922377169827670256L;
private HttpServletRequest request;
private HttpServletResponse response;
private UserProfile userProfile;
private String authenticationKey;
private List<IdPAttribute> idpAttributes;
private GluuAttributeMappingService gluuAttributeMappingService;
public TranslateAttributesContext(HttpServletRequest request, HttpServletResponse response, UserProfile userProfile,
String authenticationKey, List<IdPAttribute> idpAttributes) {
this.request = request;
this.response = response;
this.userProfile = userProfile;
this.authenticationKey = authenticationKey;
this.idpAttributes = idpAttributes;
this.gluuAttributeMappingService = null;
}
public HttpServletRequest getRequest() {
return request;
}
public HttpServletResponse getResponse() {
return response;
}
public UserProfile getUserProfile() {
return userProfile;
}
public String getAuthenticationKey() {
return authenticationKey;
}
public GluuAttributeMappingService getGluuAttributeMappingService() {
return this.gluuAttributeMappingService;
}
public void setGluuAttributeMappingService(GluuAttributeMappingService gluuAttributeMappingService) {
this.gluuAttributeMappingService = gluuAttributeMappingService;
}
public void addIdpAttribute(IdPAttribute idpAttribute) {
this.idpAttributes.add(idpAttribute);
}
public void addIdpAttribute(String id, List<IdPAttributeValue> values) {
IdPAttribute newAttribute = new IdPAttribute(id);
newAttribute.setValues(values);
this.idpAttributes.add(newAttribute);
}
public void addIdpStringAttribute(String id, String value) {
List<IdPAttributeValue> values = new ArrayList<IdPAttributeValue>();
values.add(new StringAttributeValue(value));
addIdpAttribute(id,values);
}
public List<IdPAttribute> getIdpAttributes() {
return this.idpAttributes;
}
}