1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.opensaml.saml2.metadata.impl;
22
23 import java.util.ArrayList;
24 import java.util.Collections;
25 import java.util.List;
26
27 import javax.xml.namespace.QName;
28
29 import org.opensaml.saml2.metadata.ArtifactResolutionService;
30 import org.opensaml.saml2.metadata.Endpoint;
31 import org.opensaml.saml2.metadata.ManageNameIDService;
32 import org.opensaml.saml2.metadata.NameIDFormat;
33 import org.opensaml.saml2.metadata.SSODescriptor;
34 import org.opensaml.saml2.metadata.SingleLogoutService;
35 import org.opensaml.xml.XMLObject;
36 import org.opensaml.xml.util.XMLObjectChildrenList;
37
38
39
40
41 public abstract class SSODescriptorImpl extends RoleDescriptorImpl implements SSODescriptor {
42
43
44 private final XMLObjectChildrenList<ArtifactResolutionService> artifactResolutionServices;
45
46
47 private final XMLObjectChildrenList<SingleLogoutService> singleLogoutServices;
48
49
50 private final XMLObjectChildrenList<ManageNameIDService> manageNameIDServices;
51
52
53 private final XMLObjectChildrenList<NameIDFormat> nameIDFormats;
54
55
56
57
58
59
60
61
62 protected SSODescriptorImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
63 super(namespaceURI, elementLocalName, namespacePrefix);
64 artifactResolutionServices = new XMLObjectChildrenList<ArtifactResolutionService>(this);
65 singleLogoutServices = new XMLObjectChildrenList<SingleLogoutService>(this);
66 manageNameIDServices = new XMLObjectChildrenList<ManageNameIDService>(this);
67 nameIDFormats = new XMLObjectChildrenList<NameIDFormat>(this);
68 }
69
70
71 public List<ArtifactResolutionService> getArtifactResolutionServices() {
72 return artifactResolutionServices;
73 }
74
75
76 public ArtifactResolutionService getDefaultArtificateResolutionService(){
77 for(ArtifactResolutionService service : artifactResolutionServices){
78 if(service.isDefault()){
79 return service;
80 }
81 }
82
83 return null;
84 }
85
86
87 public List<SingleLogoutService> getSingleLogoutServices() {
88 return singleLogoutServices;
89 }
90
91
92 public List<ManageNameIDService> getManageNameIDServices() {
93 return manageNameIDServices;
94 }
95
96
97 public List<NameIDFormat> getNameIDFormats() {
98 return nameIDFormats;
99 }
100
101
102 public List<Endpoint> getEndpoints() {
103 List<Endpoint> endpoints = new ArrayList<Endpoint>();
104 endpoints.addAll(artifactResolutionServices);
105 endpoints.addAll(singleLogoutServices);
106 endpoints.addAll(manageNameIDServices);
107 return Collections.unmodifiableList(endpoints);
108 }
109
110
111 public List<Endpoint> getEndpoints(QName type) {
112 if(type.equals(ArtifactResolutionService.DEFAULT_ELEMENT_NAME)){
113 return Collections.unmodifiableList(new ArrayList<Endpoint>(artifactResolutionServices));
114 }else if(type.equals(SingleLogoutService.DEFAULT_ELEMENT_NAME)){
115 return Collections.unmodifiableList(new ArrayList<Endpoint>(singleLogoutServices));
116 }else if(type.equals(ManageNameIDService.DEFAULT_ELEMENT_NAME)){
117 return Collections.unmodifiableList(new ArrayList<Endpoint>(manageNameIDServices));
118 }
119
120 return null;
121 }
122
123
124 public List<XMLObject> getOrderedChildren() {
125 ArrayList<XMLObject> children = new ArrayList<XMLObject>();
126
127 children.addAll(super.getOrderedChildren());
128 children.addAll(artifactResolutionServices);
129 children.addAll(singleLogoutServices);
130 children.addAll(manageNameIDServices);
131 children.addAll(nameIDFormats);
132
133 return Collections.unmodifiableList(children);
134 }
135 }