AuthenticationManager源码分析

AuthenticationManager类

AuthenticationManager类主要负责认证管理的部分。其初始化时,从配置文件中读取进行身份验证的类。如果没有则是默认的身份验证处理类(org.apache.sqoop.security.authentication.SimpleAuthenticationHandler)。

初始化

初始化的源代码如下:

public synchronized void initialize() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        if(LOG.isTraceEnabled()) {
            LOG.trace("Begin authentication manager initialization");
        }

        String handler = SqoopConfiguration.getInstance().getContext().getString("org.apache.sqoop.security.authentication.handler", "org.apache.sqoop.security.authentication.SimpleAuthenticationHandler").trim();
        authenticationHandler = SecurityFactory.getAuthenticationHandler(handler);
        authenticationHandler.doInitialize();
        authenticationHandler.secureLogin();
        if(LOG.isInfoEnabled()) {
            LOG.info("Authentication loaded.");
        }

    }

authenticationHandler类

authenticationHandler类是对AuthenticationProvider类的封装。目前实现的子类有:

AuthenticationProvider类

AuthenticationProvider类 提供了用户的Name, 和相应的Group信息。
AuthenticationProvider类提供了对SimpleAuthenticationHandler, 以及KerberosAuthenticationHandler两个子类。

public abstract class AuthenticationProvider {
    public AuthenticationProvider() {

    public abstract String getUserName();

    public abstract String[] getGroupNames();
}

目前AuthenticationProvider的子类共有:DefaultAuthenticationProvider类。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,937评论 18 139
  • 这篇文章介绍了Mobile BI(移动商务智能)使用过程中涉及的各种身份认证的方式,主要目的是对这些方式的原理进行...
    雨_树阅读 2,060评论 1 2
  • Spring Boot 参考指南 介绍 转载自:https://www.gitbook.com/book/qbgb...
    毛宇鹏阅读 46,958评论 6 342
  • 官方文档 初始化 Initialization是为准备使用类,结构体或者枚举实例的一个过程。这个过程涉及了在实例里...
    hrscy阅读 1,149评论 0 1
  • Web应用被应用开发者创建,这些开发者给予、卖应用,或者为了安装到一个运行时环境,把应用转移应用到一个部署者。应用...
    Lucky_Micky阅读 2,602评论 0 1