01: /*
02: * JFolder, Copyright 2001-2006 Gary Steinmetz
03: *
04: * Distributable under LGPL license.
05: * See terms of license at gnu.org.
06: */
07:
08: package org.jfolder.security.model;
09:
10: //base classes
11:
12: //project specific classes
13: import org.jfolder.security.model.UserIdentity;
14:
15: //other classes
16:
17: public class SimpleUserIdentity implements UserIdentity {
18:
19: //
20: private String name = null;
21: private String securityType = null;
22: private boolean valid = false;
23: private boolean anonymous = false;
24:
25: private SimpleUserIdentity(String inName, String inSecurityType,
26: boolean inValid, boolean inAnonymous) {
27: //
28: this .name = inName;
29: this .securityType = inSecurityType;
30: this .valid = inValid;
31: this .anonymous = inAnonymous;
32: }
33:
34: //
35: public final static SimpleUserIdentity newInstance(String inName,
36: String inSecurityType, boolean inValid, boolean inAnonymous) {
37:
38: SimpleUserIdentity outValue = null;
39:
40: outValue = new SimpleUserIdentity(inName, inSecurityType,
41: inValid, inAnonymous);
42:
43: return outValue;
44: }
45:
46: //
47: public String getName() {
48: return this .name;
49: }
50:
51: public String getSecurityType() {
52: return this .securityType;
53: }
54:
55: public boolean isValid() {
56: return this .valid;
57: }
58:
59: public boolean isAnonymous() {
60: return this .anonymous;
61: }
62:
63: //
64: public String toString() {
65: return ("UserIdentity(user = '" + this .name
66: + "', securityType = '" + this .securityType
67: //+ "', securityClass = '" + this.securityClass
68: + "', valid = '" + this .valid + "', anonymous = '"
69: + this .anonymous + "')");
70: }
71:
72: //
73: public int hashCode() {
74: return UserIdentityHelper.getUserIdentityHashCode(this );
75: }
76:
77: public boolean equals(Object inObject) {
78:
79: boolean outValue = false;
80:
81: if (inObject instanceof UserIdentity) {
82: outValue = UserIdentityHelper.isSameUserIdentity(this ,
83: (UserIdentity) inObject);
84: }
85:
86: return outValue;
87: }
88: }
|