View Javadoc

1   /*
2    * Copyright 2004-2006 the Seasar Foundation and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.seasar.tuigwaa.security.auth;
17  
18  import java.util.Arrays;
19  import java.util.List;
20  
21  /***
22   * @author someda
23   */
24  public class TgwUser extends TgwPrincipal{
25  
26  	private String password;
27  	private String[] roles;
28  	private String otherattributes;
29  	private String description;
30  	
31  	private String dn;
32  	
33  	private boolean admin = false;
34  	
35  	public TgwUser(String name){
36  		super(name);
37  	}
38  	
39  	public TgwUser(){
40  		super();
41  	}
42  
43  	public String getDn() {
44  		return dn;
45  	}
46  
47  	public void setDn(String dn) {
48  		this.dn = dn;
49  	}
50  
51  	public void setName(String name) {
52  		this.name = name;
53  	}
54  
55  	public String getPassword() {
56  		return password;
57  	}
58  
59  	public void setPassword(String password) {
60  		this.password = password;
61  	}
62  
63  	public String[] getRoles() {
64  		return roles;
65  	}
66  
67  	public void setRoles(String[] roles) {
68  		this.roles = roles;
69  	}
70  	
71  	public List getRolesAsList(){
72  		return Arrays.asList(roles);
73  	}
74  
75  	public String getDescription() {
76  		return description;
77  	}
78  
79  	public void setDescription(String description) {
80  		this.description = description;
81  	}
82  
83  	public String getOtherattributes() {
84  		return otherattributes;
85  	}
86  
87  	public void setOtherattributes(String otherattributes) {
88  		this.otherattributes = otherattributes;
89  	}
90  
91  	public boolean isAdmin() {
92  		return admin;
93  	}
94  
95  	public void setAdmin(boolean admin) {
96  		this.admin = admin;
97  	}
98  		
99  	public int hashCode(){
100 		return getName().hashCode();
101 	}
102 	
103 	public boolean equals(Object o){
104 		if(!(o instanceof TgwUser)) return false;
105 		TgwUser obj = (TgwUser) o;
106 		
107 		return obj.getName().equals(this.getName());				
108 	}	
109 	
110 	
111 }