1 23 24 package org.infoglue.cms.security; 25 26 import java.io.Serializable ; 27 import java.security.Principal ; 28 import java.util.List ; 29 30 31 36 37 public class InfoGluePrincipal implements Principal , Serializable 38 { 39 private static final long serialVersionUID = 7252014421006767620L; 40 41 private final String name; 42 private final String firstName; 43 private final String lastName; 44 private final String email; 45 private final List roles; 46 private final List groups; 47 private final boolean isAdministrator; 48 private final AuthorizationModule autorizationModule; 49 50 public InfoGluePrincipal(String name, String firstName, String lastName, String email, List roles, List groups, boolean isAdministrator, AuthorizationModule autorizationModule) 51 { 52 this.name = name; 53 this.firstName = firstName; 54 this.lastName = lastName; 55 this.email = email; 56 this.roles = roles; 57 this.groups = groups; 58 this.isAdministrator = isAdministrator; 59 this.autorizationModule = autorizationModule; 60 } 61 62 public String getName() 63 { 64 return name; 65 } 66 67 public String getFirstName() 68 { 69 return firstName; 70 } 71 72 public String getLastName() 73 { 74 return lastName; 75 } 76 77 public String getEmail() 78 { 79 return email; 80 } 81 82 public List getRoles() 83 { 84 return roles; 85 } 86 87 public List getGroups() 88 { 89 return groups; 90 } 91 92 public boolean getIsAdministrator() 93 { 94 return isAdministrator; 95 } 96 97 public String toString() 98 { 99 return name; 100 111 } 112 113 public boolean equals(Object obj) 114 { 115 if (obj == null) 116 return false; 117 if (obj == this) 118 return true; 119 if (!(obj instanceof InfoGluePrincipal)) 120 return false; 121 122 InfoGluePrincipal another = (InfoGluePrincipal)obj; 123 return name.equals(another.getName()); 124 } 125 126 public int hasCode() 127 { 128 return name.hashCode(); 129 } 130 131 public AuthorizationModule getAutorizationModule() 132 { 133 return autorizationModule; 134 } 135 } 136 137 | Popular Tags |