⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 passwordauthmodule.java

📁 GridSphere 门户 提供一个基于 portlet 的高级开放源代码门户。GridSphere 是在欧盟提供基金的 GridLab 项目下开发的
💻 JAVA
字号:
/** * @author <a href="mailto:novotny@gridsphere.org">Jason Novotny</a> * @version $Id: PasswordAuthModule.java 5032 2006-08-17 18:15:06Z novotny $ */package org.gridsphere.services.core.security.auth.modules.impl;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.gridsphere.services.core.user.User;import org.gridsphere.portlet.service.spi.PortletServiceFactory;import org.gridsphere.services.core.security.auth.AuthenticationException;import org.gridsphere.services.core.security.auth.modules.LoginAuthModule;import org.gridsphere.services.core.security.auth.modules.impl.descriptor.AuthModuleDefinition;import org.gridsphere.services.core.security.password.InvalidPasswordException;import org.gridsphere.services.core.security.password.PasswordManagerService;public class PasswordAuthModule extends BaseAuthModule implements LoginAuthModule {    private PasswordManagerService passwordManager = null;    private Log log = LogFactory.getLog(PasswordAuthModule.class);    public PasswordAuthModule(AuthModuleDefinition moduleDef) {        super(moduleDef);        // Get instance of password manager service        try {            this.passwordManager = (PasswordManagerService)PortletServiceFactory.createPortletService(PasswordManagerService.class, true);        } catch (Exception e) {            log.error("Unable to get instance of password manager service!", e);        }    }    public void checkAuthentication(User user, String password) throws AuthenticationException {        log.debug("Entering authenticate");        // Check that password is not null        if (password == null) {            log.debug("Password is not provided.");            throw new AuthenticationException("key1");        }        // Check that password maps to the given user        try {            this.passwordManager.validateSuppliedPassword(user, password);        } catch (InvalidPasswordException e) {            log.debug("Incorrect password provided.");            throw new AuthenticationException("key2");        }    }}

⌨️ 快捷键说明

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