|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| package org.acegisecurity.providers.cas.proxy; |
|
17 |
| |
|
18 |
| import java.util.List; |
|
19 |
| |
|
20 |
| import org.acegisecurity.AcegiMessageSource; |
|
21 |
| import org.acegisecurity.providers.cas.CasProxyDecider; |
|
22 |
| import org.acegisecurity.providers.cas.ProxyUntrustedException; |
|
23 |
| import org.apache.commons.logging.Log; |
|
24 |
| import org.apache.commons.logging.LogFactory; |
|
25 |
| import org.springframework.beans.factory.InitializingBean; |
|
26 |
| import org.springframework.context.MessageSource; |
|
27 |
| import org.springframework.context.MessageSourceAware; |
|
28 |
| import org.springframework.context.support.MessageSourceAccessor; |
|
29 |
| import org.springframework.util.Assert; |
|
30 |
| |
|
31 |
| |
|
32 |
| |
|
33 |
| |
|
34 |
| |
|
35 |
| |
|
36 |
| |
|
37 |
| |
|
38 |
| |
|
39 |
| |
|
40 |
| public class RejectProxyTickets implements CasProxyDecider, MessageSourceAware, |
|
41 |
| InitializingBean { |
|
42 |
| |
|
43 |
| |
|
44 |
| private static final Log logger = LogFactory.getLog(RejectProxyTickets.class); |
|
45 |
| |
|
46 |
| |
|
47 |
| |
|
48 |
| protected MessageSourceAccessor messages = AcegiMessageSource.getAccessor(); |
|
49 |
| |
|
50 |
| |
|
51 |
| |
|
52 |
0
| public void afterPropertiesSet() throws Exception {
|
|
53 |
0
| Assert.notNull(this.messages, "A message source must be set");
|
|
54 |
| } |
|
55 |
| |
|
56 |
3
| public void confirmProxyListTrusted(List proxyList)
|
|
57 |
| throws ProxyUntrustedException { |
|
58 |
3
| Assert.notNull(proxyList, "proxyList cannot be null");
|
|
59 |
| |
|
60 |
2
| if (proxyList.size() == 0) {
|
|
61 |
| |
|
62 |
1
| return;
|
|
63 |
| } |
|
64 |
| |
|
65 |
1
| if (logger.isDebugEnabled()) {
|
|
66 |
0
| logger.debug("Proxies are unacceptable; proxy list provided: "
|
|
67 |
| + proxyList.toString()); |
|
68 |
| } |
|
69 |
| |
|
70 |
1
| throw new ProxyUntrustedException(messages.getMessage(
|
|
71 |
| "RejectProxyTickets.reject", "Proxy tickets are rejected")); |
|
72 |
| } |
|
73 |
| |
|
74 |
0
| public void setMessageSource(MessageSource messageSource) {
|
|
75 |
0
| this.messages = new MessageSourceAccessor(messageSource);
|
|
76 |
| } |
|
77 |
| } |