1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.ksb.service;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.springframework.beans.factory.InitializingBean;
20
21
22
23
24
25
26 public class BasicAuthenticationCredentials implements InitializingBean {
27
28 private BasicAuthenticationService authenticationService;
29 private String serviceNameSpaceURI;
30 private String localServiceName;
31 private String username;
32 private String password;
33
34
35
36
37
38
39 public void afterPropertiesSet() throws Exception {
40 if (this.validate()) {
41 this.getAuthenticationService().registerServiceCredentials(this);
42 }
43 }
44
45
46
47
48
49
50 public BasicAuthenticationService getAuthenticationService() {
51 if (this.authenticationService == null) {
52 this.authenticationService = KSBServiceLocator.getBasicAuthenticationService();
53 }
54 return authenticationService;
55 }
56
57
58
59
60
61
62 public void setAuthenticationService(BasicAuthenticationService authenticationService) {
63 this.authenticationService = authenticationService;
64 }
65
66
67
68
69
70
71 public String getServiceNameSpaceURI() {
72 return serviceNameSpaceURI;
73 }
74
75
76
77
78
79
80 public void setServiceNameSpaceURI(String serviceNameSpaceURI) {
81 this.serviceNameSpaceURI = serviceNameSpaceURI;
82 }
83
84
85
86
87
88
89 public String getLocalServiceName() {
90 return localServiceName;
91 }
92
93
94
95
96
97
98 public void setLocalServiceName(String localServiceName) {
99 this.localServiceName = localServiceName;
100 }
101
102
103
104
105
106
107 public String getUsername() {
108 return username;
109 }
110
111
112
113
114
115
116 public void setUsername(String username) {
117 this.username = username;
118 }
119
120
121
122
123
124
125 public String getPassword() {
126 return password;
127 }
128
129
130
131
132
133
134 public void setPassword(String password) {
135 this.password = password;
136 }
137
138
139
140
141
142
143
144 protected boolean validate() {
145 return this.getAuthenticationService() != null &&
146 StringUtils.isNotBlank(this.getServiceNameSpaceURI()) &&
147 StringUtils.isNotBlank(this.getLocalServiceName()) &&
148 StringUtils.isNotBlank(this.getUsername()) &&
149 StringUtils.isNotBlank(this.getPassword());
150 }
151 }