1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.opensaml.saml2.metadata.impl;
18
19 import java.util.ArrayList;
20 import java.util.Collections;
21 import java.util.List;
22
23 import org.opensaml.common.impl.AbstractSAMLObject;
24 import org.opensaml.saml2.metadata.EncryptionMethod;
25 import org.opensaml.saml2.metadata.KeyDescriptor;
26 import org.opensaml.xml.XMLObject;
27 import org.opensaml.xml.security.credential.UsageType;
28 import org.opensaml.xml.signature.KeyInfo;
29 import org.opensaml.xml.util.XMLObjectChildrenList;
30
31
32
33
34 public class KeyDescriptorImpl extends AbstractSAMLObject implements KeyDescriptor {
35
36
37 private UsageType keyUseType;
38
39
40 private KeyInfo keyInfo;
41
42
43 private final XMLObjectChildrenList<EncryptionMethod> encryptionMethods;
44
45
46
47
48
49
50
51
52 protected KeyDescriptorImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
53 super(namespaceURI, elementLocalName, namespacePrefix);
54 encryptionMethods = new XMLObjectChildrenList<EncryptionMethod>(this);
55 keyUseType = UsageType.UNSPECIFIED;
56 }
57
58
59 public UsageType getUse() {
60 return keyUseType;
61 }
62
63
64 public void setUse(UsageType newType) {
65 if (newType != null) {
66 keyUseType = prepareForAssignment(keyUseType, newType);
67 } else {
68 keyUseType = prepareForAssignment(keyUseType, UsageType.UNSPECIFIED);
69 }
70 }
71
72
73 public KeyInfo getKeyInfo() {
74 return keyInfo;
75 }
76
77
78 public void setKeyInfo(KeyInfo newKeyInfo) {
79 keyInfo = prepareForAssignment(keyInfo, newKeyInfo);
80 }
81
82
83 public List<EncryptionMethod> getEncryptionMethods() {
84 return encryptionMethods;
85 }
86
87
88 public List<XMLObject> getOrderedChildren() {
89 ArrayList<XMLObject> children = new ArrayList<XMLObject>();
90
91 children.add(keyInfo);
92 children.addAll(encryptionMethods);
93
94 return Collections.unmodifiableList(children);
95 }
96 }