In jaas can we use an object of javax.security.auth.login.Configuration class as an alternative to LoginModule configuration using .config files

心已入冬 提交于 2019-12-12 03:08:19

问题


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


回答1:


Pass your Configuration at constructor of LoginContext.

See JavaDoc at LoginContext:

[...]

  1. 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


来源:https://stackoverflow.com/questions/28747711/in-jaas-can-we-use-an-object-of-javax-security-auth-login-configuration-class-as

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!