1 |
|
package net.sourceforge.pebble.security; |
2 |
|
|
3 |
|
import org.acegisecurity.userdetails.UserDetails; |
4 |
|
import org.acegisecurity.userdetails.UserDetailsService; |
5 |
|
import org.acegisecurity.userdetails.UsernameNotFoundException; |
6 |
|
import org.apache.commons.logging.Log; |
7 |
|
import org.apache.commons.logging.LogFactory; |
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
@author |
14 |
|
|
|
|
| 92,3% |
Uncovered Elements: 1 (13) |
Complexity: 5 |
Complexity Density: 0,62 |
|
15 |
|
public class DefaultUserDetailsService implements UserDetailsService { |
16 |
|
|
17 |
|
private static final Log log = LogFactory.getLog(DefaultUserDetailsService.class); |
18 |
|
|
19 |
|
private SecurityRealm securityRealm; |
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
@param |
25 |
|
@return |
26 |
|
@throws |
27 |
|
|
|
|
| 87,5% |
Uncovered Elements: 1 (8) |
Complexity: 3 |
Complexity Density: 0,5 |
|
28 |
4
|
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {... |
29 |
4
|
try { |
30 |
4
|
PebbleUserDetails user = securityRealm.getUser(username); |
31 |
4
|
if (user == null) { |
32 |
2
|
throw new UsernameNotFoundException("A user with username " + username + " does not exist"); |
33 |
|
} else { |
34 |
2
|
return user; |
35 |
|
} |
36 |
|
} catch (SecurityRealmException e) { |
37 |
0
|
throw new UsernameNotFoundException("User details not found", e); |
38 |
|
} |
39 |
|
} |
40 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
41 |
2
|
public SecurityRealm getSecurityRealm() {... |
42 |
2
|
return securityRealm; |
43 |
|
} |
44 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
45 |
6
|
public void setSecurityRealm(SecurityRealm securityRealm) {... |
46 |
6
|
this.securityRealm = securityRealm; |
47 |
|
} |
48 |
|
|
49 |
|
} |