📄 genericprincipal.java
字号:
//// ____.// __/\ ______| |__/\. _______// __ .____| | \ | +----+ \// _______| /--| | | - \ _ | : - \_________// \\______: :---| : : | : | \________>// |__\---\_____________:______: :____|____:_____\// /_____|//// . . . i n j a h i a w e t r u s t . . .////// NK 12.04.2001 - Added to support Multi Site and Servlet APIpackage org.jahia.services.usermanager;import java.security.Principal;/** * The minimal implementation of a Principal * Used in Servlet Request Wrapper getUserPrincipal(). * It's a wrapper around a JahiaUser but its getName() return the login username, * not the jahia user internal key. * * @author NK */public class GenericPrincipal implements Principal { private JahiaUser mUser; private GenericPrincipal(){}; public GenericPrincipal( JahiaUser user ){ mUser = user; } public String getName () { if ( mUser == null ){ return ""; } return mUser.getUsername(); } public boolean equals (Object another){ if ( mUser == null ){ return false; } if (another instanceof Principal) { if (another != null) { return (mUser.getName().equals (((Principal)another).getName())); } } return false; } public int hashCode () { if ( mUser == null ){ return -1; } return mUser.hashCode(); } public String toString () { if ( mUser == null ){ return ""; } StringBuffer output = new StringBuffer ("Detail of user ["+mUser.getUsername()+"]\n"); output.append (" - ID ["+Integer.toString (mUser.hashCode())+"]"); return output.toString(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -