📄 ssoprincipal.java
字号:
package dev.trade.cs.securityfilter;
import java.io.*;
import java.security.*;
import java.util.*;
import com.newland.security.usermgr.baseobj.UserInfo;
/**
* <p>Title: 权限过滤器</p>
*
* <p>Description: SSO Principal</p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @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);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -