All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.featherfly.permission.web.authentication.ValidateCodeAuthenticator Maven / Gradle / Ivy

The newest version!

package cn.featherfly.permission.web.authentication;

import javax.servlet.http.HttpServletRequest;

import cn.featherfly.common.lang.LangUtils;
import cn.featherfly.permission.authentication.AuthenticationException;
import cn.featherfly.permission.core.PermissionActor;

/**
 * 

* 验证码验证器 *

* * @param 类型 * @author 钟冀 */ public class ValidateCodeAuthenticator implements WebAuthenticator{ private String validateCodeName = "validateCode"; /** */ public ValidateCodeAuthenticator() { } /** * {@inheritDoc} */ @Override public void authenticate(A actor, HttpServletRequest request) { String validateCode = request.getParameter(validateCodeName); if (LangUtils.isNotEmpty(validateCode)) { if (validateCode.equals(request.getSession().getAttribute(validateCodeName))) { return; } } throw new AuthenticationException("@permission#validateCode.error"); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy