com.sap.security.auth.login

## Class LoginContextFactory

- java.lang.Object
- - com.sap.security.auth.login.LoginContextFactory

-     public abstract class LoginContextFactory
      extends Object

  The factory of JAAS login contexts can be used to instantiate login contexts with the correct class loading environment for the configured login modules. Each create method corresponds to a constructor of javax.security.auth.login.LoginContext
  See Also:
    `LoginContext`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LoginContextFactory()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static LoginContext` | `createLoginContext()` Construct a prepared login context for the configuration of the current application.
    `static LoginContext` | `createLoginContext(String authenticationStack)` Construct a login context for an already configured authentication stack with the given name.
    `static LoginContext` | `createLoginContext(String authenticationStack, CallbackHandler callbackHandler)` Construct a login context for an already configured authentication stack with the given name and call-back handler.
    `static LoginContext` | `createLoginContext(String authenticationStack, Subject subject)` Construct a login context for an already configured authentication stack with the given name and a Subject object.
    `static LoginContext` | `createLoginContext(String authenticationStack, Subject subject, CallbackHandler callbackHandler)` Construct a login context using the given authentication configuration and call-back handler.
    `static LoginContext` | `createLoginContext(String authenticationStack, Subject subject, CallbackHandler callbackHandler, Configuration configuration)` Construct a login context using the given authentication configuration and call-back handler.
    `static Configuration` | `getConfiguration()` Returns the login configuration associated to the current request processing or the default installed configuration.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LoginContextFactory

          public LoginContextFactory()

  - ### Method Detail

    - #### createLoginContext

          public static LoginContext createLoginContext()
                                                 throws LoginException

      Construct a prepared login context for the configuration of the current application.
      Returns:
        - an instance of LoginContext that can be used for authentication
      Throws:
        `LoginException` - - thrown in case the login context cannot be constructed, e.g. there is no current application, or the authentication stack is unknown.

    - #### createLoginContext

          public static LoginContext createLoginContext(String authenticationStack)
                                                 throws LoginException

      Construct a login context for an already configured authentication stack with the given name.
      Parameters:
        `authenticationStack` - - the name of the configuration for the authentication stack.
      Returns:
        - an instance of LoginContext that can be used for authentication
      Throws:
        `LoginException` - - thrown in case the login context cannot be constructed, e.g. the authentication stack is unknown.

    - #### createLoginContext

          public static LoginContext createLoginContext(String authenticationStack,
                                        CallbackHandler callbackHandler)
                                                 throws LoginException

      Construct a login context for an already configured authentication stack with the given name and call-back handler.
      Parameters:
        `authenticationStack` - - the name of the configuration for the authentication stack.
        `callbackHandler` - - an instance of JAAS call-back handler for the use of the authentication process. It can be `null` in case the current thread of control processes a request with associated call-back hander.
      Returns:
        - an instance of LoginContext that can be used for authentication
      Throws:
        `LoginException` - - thrown in case the login context cannot be constructed, e.g. the authentication stack is unknown.

    - #### createLoginContext

          public static LoginContext createLoginContext(String authenticationStack,
                                        Subject subject)
                                                 throws LoginException

      Construct a login context for an already configured authentication stack with the given name and a Subject object.
      Parameters:
        `authenticationStack` - - the name of the configuration for the authentication stack.
        `subject` - - the subject to authenticate. If `null` the authentication framework will use a new one.
      Returns:
        - an instance of LoginContext that can be used for authentication
      Throws:
        `LoginException` - - thrown in case the login context cannot be constructed, e.g. the authentication stack is unknown.

    - #### createLoginContext

          public static LoginContext createLoginContext(String authenticationStack,
                                        Subject subject,
                                        CallbackHandler callbackHandler)
                                                 throws LoginException

      Construct a login context using the given authentication configuration and call-back handler.
      Parameters:
        `authenticationStack` - - the name of the authentication stack, used only for logging purposes
        `subject` - - the subject to authenticate. If `null` the authentication framework will use a new one.
        `callbackHandler` - - an instance of JAAS call-back handler for the use of the authentication process. It can be null in case the current thread of control processes a request with associated call-back hander.
      Returns:
        - an instance of LoginContext that can be used for authentication
      Throws:
        `LoginException` - - thrown in case the login context cannot be constructed, e.g. the authentication stack is unknown.

    - #### createLoginContext

          public static LoginContext createLoginContext(String authenticationStack,
                                        Subject subject,
                                        CallbackHandler callbackHandler,
                                        Configuration configuration)
                                                 throws LoginException

      Construct a login context using the given authentication configuration and call-back handler.
      Parameters:
        `authenticationStack` - - the name of the authentication stack, used only for logging purposes
        `subject` - - the subject to authenticate. If `null` the authentication framework will use a new one.
        `callbackHandler` - - an instance of JAAS call-back handler for the use of the authentication process. It can be null in case the current thread of control processes a request with associated call-back hander.
        `configuration` - - the configuration of authentication stack to be used.
      Returns:
        - an instance of LoginContext that can be used for authentication
      Throws:
        `LoginException` - - thrown in case the login context cannot be constructed, e.g. the authentication stack is unknown.

    - #### getConfiguration

          public static Configuration getConfiguration()
                                                throws LoginException

      Returns the login configuration associated to the current request processing or the default installed configuration.
      Returns:
        - the login configuration
      Throws:
        `LoginException` - - thrown in case the configuration cannot be obtained

Copyright © 2016 SAP. All Rights Reserved.