【仅供内部供应商使用,不提供对外解答和培训】
【仅供内部供应商使用,不提供对外解答和培训】
默认的http认证,局限性比较大,要求认证服务器比如返回字符串"false"用于表示认证失败,返回其他则表示认证通过,且返回的值为角色。而通过http认证处理接口,可以随意的根据需要判断认证成功和失败的条件,此外还提供一个方法用于修改密码。
package com.fr.stable.fun; import com.fr.stable.fun.mark.Immutable; import com.fr.stable.privilege.AuthenticationBridge; /** * @author richie * @date 2015-03-20 * @since 7.1.1 */ public interface HttpAuthProcessor extends Immutable { String MARK_STRING = "HttpAuthProcessor"; int CURRENT_LEVEL = 1; /** * 处理HTTP认证返回信息的接口 * @param authentication 保存认证信息的对象 * @param responseText 从HTTP请求返回的字符串 * @return 认证失败则返回false,否则返回true */ boolean process(AuthenticationBridge authentication, String responseText); /** * 重设密码 * @param username 用户名 * @param old 老密码 * @param nw 新密码 * @return 重设成功返回true,否则返回false */ boolean changePassword(String username, String old, String nw); }
示例代码
<extra-core> <HttpAuthProcessor class="com.fr.plugin.your.classNameXXX"> </extra-core>