abstractpreandpostprocessingauthenticationhandler.java
来自「CAS在Tomcat中实现单点登录项目,单点登录(Single Sign On 」· Java 代码 · 共 66 行
JAVA
66 行
/* * Copyright 2007 The JA-SIG Collaborative. All rights reserved. See license * distributed with this file and available online at * http://www.uportal.org/license.html */package org.jasig.cas.authentication.handler.support;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.jasig.cas.authentication.handler.AuthenticationException;import org.jasig.cas.authentication.handler.AuthenticationHandler;import org.jasig.cas.authentication.principal.Credentials;/** * Abstract authentication handler that allows deployers to utilize the bundled * AuthenticationHandlers while providing a mechanism to perform tasks before * and after authentication. * * @author Scott Battaglia * @version $Revision: 42053 $ $Date: 2007-06-10 09:17:55 -0400 (Sun, 10 Jun 2007) $ * @since 3.1 */public abstract class AbstractPreAndPostProcessingAuthenticationHandler implements AuthenticationHandler { /** Instance of logging for subclasses. */ protected Log log = LogFactory.getLog(this.getClass()); /** * Method to execute before authentication occurs. * * @param credentials the Credentials supplied * @return true if authentication should continue, false otherwise. */ protected boolean preAuthenticate(final Credentials credentials) { return true; } /** * Method to execute after authentication occurs. * * @param credentials the supplied credentials * @param authenticated the result of the authentication attempt. * @return true if the handler should return true, false otherwise. */ protected boolean postAuthenticate(final Credentials credentials, final boolean authenticated) { return authenticated; } public final boolean authenticate(final Credentials credentials) throws AuthenticationException { if (!preAuthenticate(credentials)) { return false; } final boolean authenticated = doAuthentication(credentials); return postAuthenticate(credentials, authenticated); } protected abstract boolean doAuthentication(final Credentials credentials) throws AuthenticationException;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?