1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kim.client.acegi;
17
18 import org.acegisecurity.AuthenticationException;
19 import org.acegisecurity.userdetails.UserDetails;
20 import org.acegisecurity.userdetails.UserDetailsService;
21 import org.apache.commons.logging.Log;
22 import org.apache.commons.logging.LogFactory;
23 import org.springframework.util.Assert;
24
25
26
27
28
29
30
31
32
33 public class KualiCasAuthoritiesPopulatorImpl implements KualiCasAuthoritiesPopulator {
34 private KualiUserDetailsService userDetailsService;
35 private static final Log logger = LogFactory.getLog(KualiCasAuthoritiesPopulatorImpl.class);
36
37
38
39
40
41
42
43 public void afterPropertiesSet() throws Exception {
44 Assert.notNull(this.userDetailsService, "A UserDetailsService must be set");
45 }
46
47
48
49
50 public void setUserDetailsService(UserDetailsService userDetailsService) {
51 this.userDetailsService = (KualiUserDetailsService)userDetailsService;
52 }
53
54
55
56
57
58
59
60 public UserDetails getUserDetails(String casUserId)
61 throws AuthenticationException {
62 if (logger.isDebugEnabled()) {
63 logger.debug("getUserDetails(userID)");
64 }
65 return this.userDetailsService.loadUserByUsername(casUserId);
66 }
67
68
69
70
71
72
73
74 public UserDetails getUserDetails(KualiTicketResponse response)
75 throws AuthenticationException {
76 if (logger.isDebugEnabled()) {
77 logger.debug("getUserDetails(response)");
78 }
79 return this.userDetailsService.loadUserByTicketResponse(response);
80 }
81
82 }