| |
Login context | page 8 of 13 |
A LoginContext is a Java class that is used to set up the login process, actually login, and get the Subject if the login is successful. It has four main methods, as follows: - LoginContext("JAASExample", newUsernamePasswoerdCallbackHandler()) is the constructor. It
takes the string used in the login.config file as its first parameter, and a callback handler, which does the real work, as its second parameter. (We'll discuss callback handlers next.)
- login() actually attempts the login, subject to the rules specified in the login.config file.
- getSubject() returns the authenticated Subject if the login was an overall success.
- logout() logs the Subject off of the LoginContext.
|