1 /*
2  * @(#) $Id: JSTKRolePrincipal.java,v 1.2 2003/07/08 08:13:53 pankaj Exp $
3  *
4  * Copyright (c) 2002-03 by Pankaj Kumar (http://www.pankaj-k.net). 
5  * All rights reserved.
6  *
7  * The license governing the use of this file can be found in the 
8  * root directory of the containing software.
9  */
10package org.jstk.uam;
11
12import java.security.Principal;
13
14public class JSTKRolePrincipal implements Principal {
15    String roleName;
16    String roleDesc;
17
18    public JSTKRolePrincipal(String roleName, String roleDesc){
19        this.roleName = roleName;
20        this.roleDesc = roleDesc;
21    }
22    public boolean equals(Object another){
23        if (another instanceof JSTKRolePrincipal){
24            return roleName.equals(((JSTKRolePrincipal)another).getName());
25        }
26        return false;
27    }
28    public String getName(){
29        return roleName;
30    }
31    public int hashCode(){
32        return roleName.hashCode();
33    }
34    public String toString(){
35        return "[" + this.getClass().getName() + "]" + "role: " + roleName + ", desc: " + roleDesc;
36    }
37}