1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package edu.internet2.middleware.shibboleth.common.config.security;
18
19 import java.util.Collections;
20 import java.util.List;
21 import java.util.Set;
22
23 import org.opensaml.xml.security.x509.PKIXValidationInformation;
24 import org.opensaml.xml.security.x509.PKIXX509CredentialTrustEngine;
25 import org.opensaml.xml.security.x509.StaticPKIXValidationInformationResolver;
26 import org.springframework.beans.factory.config.AbstractFactoryBean;
27
28
29
30
31
32 public class StaticPKIXX509CredentialTrustEngineFactoryBean extends AbstractFactoryBean {
33
34
35 private List<PKIXValidationInformation> pkixInfo;
36
37
38 private Set<String> trustedNames;
39
40
41
42
43
44
45 public List<PKIXValidationInformation> getPKIXInfo() {
46 return pkixInfo;
47 }
48
49
50
51
52
53
54 public void setPKIXInfo(List<PKIXValidationInformation> newPKIXInfo) {
55 pkixInfo = newPKIXInfo;
56 }
57
58
59
60
61
62
63 public Set<String> getTrustedNames() {
64 return trustedNames;
65 }
66
67
68
69
70
71
72 public void setTrustedNames(Set<String> newTrustedNames) {
73 trustedNames = newTrustedNames;
74 }
75
76
77 public Class getObjectType() {
78 return PKIXX509CredentialTrustEngine.class;
79 }
80
81
82 protected Object createInstance() throws Exception {
83 Set<String> names = getTrustedNames();
84 if (names == null) {
85 names = Collections.emptySet();
86 }
87 StaticPKIXValidationInformationResolver pkixResolver =
88 new StaticPKIXValidationInformationResolver(getPKIXInfo(), names);
89
90 return new PKIXX509CredentialTrustEngine(pkixResolver);
91 }
92 }