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.ArrayList;
20
21 import org.opensaml.ws.security.SecurityPolicyRule;
22 import org.springframework.beans.factory.config.AbstractFactoryBean;
23
24 import edu.internet2.middleware.shibboleth.common.security.ShibbolethSecurityPolicy;
25
26
27
28
29 public class ShibbolethSecurityPolicyFactoryBean extends AbstractFactoryBean {
30
31
32 private String policyId;
33
34
35 private ArrayList<SecurityPolicyRule> policyRules;
36
37
38 public Class getObjectType() {
39 return ShibbolethSecurityPolicy.class;
40 }
41
42
43
44
45
46
47 public String getPolicyId() {
48 return policyId;
49 }
50
51
52
53
54
55
56 public void setPolicyId(String id) {
57 policyId = id;
58 }
59
60
61
62
63
64
65 public ArrayList<SecurityPolicyRule> getPolicyRules() {
66 return policyRules;
67 }
68
69
70
71
72
73
74 public void setPolicyRules(ArrayList<SecurityPolicyRule> rules) {
75 policyRules = rules;
76 }
77
78
79 protected Object createInstance() throws Exception {
80 ShibbolethSecurityPolicy policy = new ShibbolethSecurityPolicy(getPolicyId());
81 if (getPolicyRules() != null) {
82 policy.getPolicyRules().addAll(getPolicyRules());
83 }
84
85 return policy;
86 }
87 }