在 jaas 中,我们可以使用 javax.security.auth.login.Configuration 类的对象作为使用 .config 文件的 LoginModule 配置的替代方案吗? [英] In jaas can we use an object of javax.security.auth.login.Configuration class as an alternative to LoginModule configuration using .config files

查看:91
本文介绍了在 jaas 中,我们可以使用 javax.security.auth.login.Configuration 类的对象作为使用 .config 文件的 LoginModule 配置的替代方案吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在执行 JAAS 身份验证时,我不想使用 .config 文件进行 LoginModule 查找/配置.我的问题是;有没有办法在不使用 .config 文件的情况下做到这一点?或者我们可以为此目的使用 javax.security.auth.login.Configuration 对象,因为在阅读 Oracle javadoc http://docs.oracle.com/javase/8/docs/api/javax/security/auth/login/Configuration.html

While performing JAAS authentication I do not want to use a .config file for LoginModule lookup/configuration. My question is; is there a way to do this with out using a .config file? or can we use javax.security.auth.login.Configuration object for this purpose because it not clear to me after reading Oracle javadoc http://docs.oracle.com/javase/8/docs/api/javax/security/auth/login/Configuration.html

推荐答案

传递你的 Configuration登录上下文.

请参阅 LoginContext:

[...]

  1. 配置

如果构造函数有一个 Configuration 输入参数并且调用者指定了一个非空的 Configuration,则 LoginContext 使用调用者指定的 Configuration.

If the constructor has a Configuration input parameter and the caller specifies a non-null Configuration, the LoginContext uses the caller-specified Configuration.

[...]

public LoginContext(String name,
                    Subject subject,
                    CallbackHandler callbackHandler,
                    Configuration config)
             throws LoginException

这篇关于在 jaas 中,我们可以使用 javax.security.auth.login.Configuration 类的对象作为使用 .config 文件的 LoginModule 配置的替代方案吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆