defaultauthenticator.java

来自「这个weblogging 设计得比较精巧」· Java 代码 · 共 31 行

JAVA
31
字号
package org.roller.presentation;import java.security.Principal;import javax.servlet.http.HttpServletRequest;/** Class used by Roller to check user authentication and role */public class DefaultAuthenticator implements Authenticator{    /** Return the name of the request's authenticated user, or null if none */    public String getAuthenticatedUserName( HttpServletRequest req )    {        String ret = null;        Principal prince = req.getUserPrincipal();         if ( prince != null )        {            ret = prince.getName();        }        return ret;    }    /** Return true if authenticated user is in the specified role */    public boolean isAuthenticatedUserInRole(HttpServletRequest req,String role)    {        return req.isUserInRole( role );    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?