1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.core.security.credentials; |
17 | |
|
18 | |
import java.util.HashMap; |
19 | |
import java.util.List; |
20 | |
import java.util.Map; |
21 | |
|
22 | |
import org.apache.commons.logging.Log; |
23 | |
import org.apache.commons.logging.LogFactory; |
24 | |
import org.kuali.rice.core.security.credentials.CredentialsSource.CredentialsType; |
25 | |
import org.springframework.beans.factory.InitializingBean; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | 0 | public final class CredentialsSourceFactory implements InitializingBean { |
39 | |
|
40 | 0 | private final Log log = LogFactory.getLog(this.getClass()); |
41 | |
|
42 | |
private List<CredentialsSource> credentialsSources; |
43 | |
|
44 | 0 | private Map<CredentialsType, CredentialsSource> credentialsSourcesByType = new HashMap<CredentialsType, CredentialsSource>(); |
45 | |
|
46 | |
public CredentialsSource getCredentialsForType( |
47 | |
final CredentialsType credentialsType) { |
48 | 0 | return credentialsSourcesByType.get(credentialsType); |
49 | |
} |
50 | |
|
51 | |
public void afterPropertiesSet() throws Exception { |
52 | 0 | if (credentialsSources != null) { |
53 | 0 | for (final CredentialsSource credentialsSource : this.credentialsSources) { |
54 | 0 | this.credentialsSourcesByType.put(credentialsSource |
55 | |
.getSupportedCredentialsType(), credentialsSource); |
56 | |
} |
57 | |
} else { |
58 | 0 | log |
59 | |
.warn("No CredentialsSources set. No security will be provided on the bus."); |
60 | |
} |
61 | 0 | } |
62 | |
|
63 | |
public void setCredentialsSources( |
64 | |
final List<CredentialsSource> credentialsSources) { |
65 | 0 | this.credentialsSources = credentialsSources; |
66 | 0 | } |
67 | |
} |