简体   繁体   中英

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM