1 /*
2  * @(#) $Id: JSTKUserPrincipal.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 JSTKUserPrincipal implements Principal {
15    String loginName;
16    String userName;
17
18    public JSTKUserPrincipal(String loginName, String userName){
19        this.loginName = loginName;
20        this.userName = userName;
21    }
22    public boolean equals(Object another){
23        if (another instanceof JSTKUserPrincipal){
24            return loginName.equals(((JSTKUserPrincipal)another).getName());
25        }
26        return false;
27    }
28    public String getName(){
29        return loginName;
30    }
31    public int hashCode(){
32        return loginName.hashCode();
33    }
34    public String toString(){
35        return "[" + this.getClass().getName() + "]" + "login: " + loginName + ", user: " + userName;
36    }
37}