1 10 package org.mmbase.security; 11 12 26 public class BasicUser implements UserContext { 27 28 protected String authenticationType; 29 30 31 public BasicUser(String authenticationType) { 32 this.authenticationType = authenticationType; 33 } 34 35 41 public String getIdentifier() { 42 return "anonymous"; 43 } 44 45 51 public String getOwnerField() { 52 return getIdentifier(); 53 } 54 55 59 public Rank getRank() throws org.mmbase.security.SecurityException { 60 return Rank.ADMIN; 62 } 63 64 68 public String toString() { 69 return getIdentifier() + " (" + getRank() + ")"; 70 } 71 72 public boolean isValid() { 73 return org.mmbase.module.core.MMBase.getMMBase().getMMBaseCop().getAuthentication().isValid(this); 74 } 75 76 public String getAuthenticationType() { 77 return authenticationType; 78 } 79 80 public boolean equals(Object o) { 81 if (o instanceof BasicUser) { 82 BasicUser ou = (BasicUser) o; 83 return 84 (authenticationType == null ? ou.authenticationType == null : authenticationType.equals(ou.authenticationType)) && 85 getIdentifier().equals(ou.getIdentifier()) && 86 getRank().equals(ou.getRank()); 87 } else { 88 return false; 89 } 90 } 91 92 public int hashCode() { 93 int result = 0; 94 result = org.mmbase.util.HashCodeUtil.hashCode(result, authenticationType); 95 return result; 96 } 97 98 } 99 | Popular Tags |