Some tiny technical changes to controllers
[proteocache.git] / server / compbio / spring / security / PCacheLDAPAuthority.java
1 package compbio.spring.security;
2
3 import org.springframework.security.core.GrantedAuthority;
4 import org.springframework.util.Assert;
5
6 /**
7  * The class implements the standard granted authority for Spring Security Not
8  * used in the current version of ProteoCache
9  * 
10  * @version 1.0 January 2014
11  * 
12  * @author Alexaner Sherstnev
13  */
14
15 public final class PCacheLDAPAuthority implements GrantedAuthority {
16
17         private static final long serialVersionUID = 1;
18
19         private String role = "ROLE_LDAP_USER";
20
21         public PCacheLDAPAuthority(String role) {
22                 Assert.hasText(role, "A text representation of the granted authority is required");
23                 this.role = role;
24         }
25
26         public String getAuthority() {
27                 return role;
28         }
29
30         public boolean equals(Object obj) {
31                 if (this == obj) {
32                         return true;
33                 }
34                 if (obj instanceof PCacheLDAPAuthority) {
35                         return role.equals(((PCacheLDAPAuthority) obj).role);
36                 }
37                 return false;
38         }
39
40         public int hashCode() {
41                 return this.role.hashCode();
42         }
43
44         public String toString() {
45                 return this.role;
46         }
47 }