www.pudn.com > SecurityFilter.rar > SSOPrincipal.java
package dev.trade.cs.securityfilter; import java.io.*; import java.security.*; import java.util.*; import com.newland.security.usermgr.baseobj.UserInfo; /** *Title: 权限过滤器
* *Description: SSO Principal
* *Copyright: Copyright (c) 2006
* *Company:
* * @author Zheng YanNan * @version 1.0 */ public class SSOPrincipal implements Principal, Serializable { UserInfo userInfo = null; public SSOPrincipal(UserInfo userInfo) { this.userInfo = userInfo; } public UserInfo getUserInfo(){ return userInfo; } /** * Compares this principal to the specified object. * * @param obj object to compare with. * * @return true if the object passed in is a SimplePrincipal with the same name. */ public boolean equals(Object obj) { if (obj instanceof SSOPrincipal) { return userInfo.equals(((SSOPrincipal)obj).getUserInfo()); } return false; } /** * Returns a string representation of this principal. * * @return a string representation of this principal. */ public String toString() { return "SSOPrincipal[User = \'" + getName() + "\']"; } /** * Returns a hashcode for this principal. * * @return a hashcode for this principal. */ public int hashCode() { return userInfo.hashCode(); } /** * 获取用户id * @return String,用户id */ public String getUserId() { return (userInfo == null)?"":userInfo.getProperty(UserInfo.User_Id); } /** * 获取用户名称 * @return String,用户名称 */ public String getName() { return (userInfo == null)?"":userInfo.getProperty(UserInfo.Login_Name); } /** * 获取用户所在地市 * @return String,用户地市 */ public String getUserCity() { return (userInfo == null)?"":userInfo.getProperty(UserInfo.Area); } }