Top Description Inners Fields Constructors Methods
org.eclipse.jetty.security.jaas.spi

public abstract Class AbstractLoginModule

extends Object
implements LoginModule
Class Inheritance
All Implemented Interfaces
javax.security.auth.spi.LoginModule
Known Direct Subclasses
org.eclipse.jetty.security.jaas.spi.LdapLoginModule, org.eclipse.jetty.security.jaas.spi.PropertyFileLoginModule, org.eclipse.jetty.security.jaas.spi.AbstractDatabaseLoginModule
Imports
java.io.IOException, java.util.List, .Map, java.util.stream.Collectors, javax.security.auth.Subject, javax.security.auth.callback.Callback, .CallbackHandler, .NameCallback, .PasswordCallback, .UnsupportedCallbackException, javax.security.auth.login.FailedLoginException, .LoginException, javax.security.auth.spi.LoginModule, org.eclipse.jetty.security.UserPrincipal, org.eclipse.jetty.security.jaas.JAASRole, org.eclipse.jetty.security.jaas.callback.ObjectCallback

AbstractLoginModule Abstract base class for all LoginModules. Subclasses should implement getUser(String) method, and subclass JAASUser to implement JAASUser#doFetchRoles() method.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class

Field Summary

Modifier and TypeField and Description
private boolean
private CallbackHandler
private boolean
private AbstractLoginModule.JAASUser
private Subject

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
abort()

Implements javax.security.auth.spi.LoginModule.abort.

Method to abort the authentication process (phase 2).

public boolean

Returns:

true if committed, false if not (likely not authenticated)
commit
()

Implements javax.security.auth.spi.LoginModule.commit.

Method to commit the authentication process (phase 2).

public Callback[]
public CallbackHandler
public AbstractLoginModule.JAASUser
public Subject
public abstract AbstractLoginModule.JAASUser
getUser(String username)

public void
initialize(Subject
the subject
subject
,
CallbackHandler
the callback handler
callbackHandler
,
Map<String, ?>
the shared state map
sharedState
,
Map<String, ?>
the option map
options
)

Implements javax.security.auth.spi.LoginModule.initialize.

Initialize this LoginModule.

public boolean
public boolean
public boolean
public boolean

Returns:

true if is authenticated, false otherwise
login
()

Implements javax.security.auth.spi.LoginModule.login.

Method to authenticate a Subject (phase 1).

public boolean

Returns:

true always
logout
()

Implements javax.security.auth.spi.LoginModule.logout.

Method which logs out a Subject.

public void
setAuthenticated(boolean authState)

public void
public void
setCommitted(boolean commitState)

public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

authStateback to summary
private boolean authState
callbackHandlerback to summary
private CallbackHandler callbackHandler
commitStateback to summary
private boolean commitState
currentUserback to summary
private AbstractLoginModule.JAASUser currentUser
subjectback to summary
private Subject subject

Constructor Detail

AbstractLoginModuleback to summary
public AbstractLoginModule()

Method Detail

abortback to summary
public boolean abort() throws LoginException

Implements javax.security.auth.spi.LoginModule.abort.

Doc from javax.security.auth.spi.LoginModule.abort.

Method to abort the authentication process (phase 2).

This method is called if the LoginContext's overall authentication failed. (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules did not succeed).

If this LoginModule's own authentication attempt succeeded (checked by retrieving the private state saved by the login method), then this method cleans up any state that was originally saved.

Returns:boolean

true if this method succeeded, or false if this LoginModule should be ignored.

Annotations
@Override
Exceptions
LoginException:
if the abort fails
commitback to summary
public boolean commit() throws LoginException

Implements javax.security.auth.spi.LoginModule.commit.

Doc from javax.security.auth.spi.LoginModule.commit.

Method to commit the authentication process (phase 2).

This method is called if the LoginContext's overall authentication succeeded (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules succeeded).

If this LoginModule's own authentication attempt succeeded (checked by retrieving the private state saved by the login method), then this method associates relevant Principals and Credentials with the Subject located in the LoginModule. If this LoginModule's own authentication attempted failed, then this method removes/destroys any state that was originally saved.

Returns:boolean

true if committed, false if not (likely not authenticated)

Annotations
@Override
Exceptions
LoginException:
if unable to commit
See Also
LoginModule#commit()
configureCallbacksback to summary
public Callback[] configureCallbacks()
getCallbackHandlerback to summary
public CallbackHandler getCallbackHandler()
getCurrentUserback to summary
public AbstractLoginModule.JAASUser getCurrentUser()
getSubjectback to summary
public Subject getSubject()
getUserback to summary
public abstract AbstractLoginModule.JAASUser getUser(String username) throws Exception
initializeback to summary
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options)

Implements javax.security.auth.spi.LoginModule.initialize.

Doc from javax.security.auth.spi.LoginModule.initialize.

Initialize this LoginModule.

This method is called by the LoginContext after this LoginModule has been instantiated. The purpose of this method is to initialize this LoginModule with the relevant information. If this LoginModule does not understand any of the data stored in sharedState or options parameters, they can be ignored.

Parameters
subject:Subject

the subject

callbackHandler:CallbackHandler

the callback handler

sharedState:Map<String, ?>

the shared state map

options:Map<String, ?>

the option map

Annotations
@Override
See Also
LoginModule#initialize(Subject, CallbackHandler, Map, Map)
isAuthenticatedback to summary
public boolean isAuthenticated()
isCommittedback to summary
public boolean isCommitted()
isIgnoredback to summary
public boolean isIgnored()
loginback to summary
public boolean login() throws LoginException

Implements javax.security.auth.spi.LoginModule.login.

Doc from javax.security.auth.spi.LoginModule.login.

Method to authenticate a Subject (phase 1).

The implementation of this method authenticates a Subject. For example, it may prompt for Subject information such as a username and password and then attempt to verify the password. This method saves the result of the authentication attempt as private state within the LoginModule.

Returns:boolean

true if is authenticated, false otherwise

Annotations
@Override
Exceptions
LoginException:
if unable to login
See Also
LoginModule#login()
logoutback to summary
public boolean logout() throws LoginException

Implements javax.security.auth.spi.LoginModule.logout.

Doc from javax.security.auth.spi.LoginModule.logout.

Method which logs out a Subject.

An implementation of this method might remove/destroy a Subject's Principals and Credentials.

Returns:boolean

true always

Annotations
@Override
Exceptions
LoginException:
if unable to logout
See Also
LoginModule#logout()
setAuthenticatedback to summary
public void setAuthenticated(boolean authState)
setCallbackHandlerback to summary
public void setCallbackHandler(CallbackHandler h)
setCommittedback to summary
public void setCommitted(boolean commitState)
setCurrentUserback to summary
public void setCurrentUser(AbstractLoginModule.JAASUser u)
setSubjectback to summary
public void setSubject(Subject s)
org.eclipse.jetty.security.jaas.spi back to summary

public abstract Class AbstractLoginModule.JAASUser

extends Object
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.security.jaas.spi.AbstractLoginModule.JAASUser
Known Direct Subclasses
org.eclipse.jetty.security.jaas.spi.LdapLoginModule.LDAPUser, org.eclipse.jetty.security.jaas.spi.LdapLoginModule.LDAPBindingUser, org.eclipse.jetty.security.jaas.spi.AbstractDatabaseLoginModule.JDBCUser

Field Summary

Modifier and TypeField and Description
private List<JAASRole>
private final UserPrincipal

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
checkCredential(Object suppliedCredential)

public abstract List<String>
public void
public String
public void
setJAASInfo(Subject
The subject
subject
)

public void
unsetJAASInfo(Subject
The subject
subject
)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_rolesback to summary
private List<JAASRole> _roles
_userback to summary
private final UserPrincipal _user

Constructor Detail

JAASUserback to summary
public JAASUser(UserPrincipal u)

Method Detail

checkCredentialback to summary
public boolean checkCredential(Object suppliedCredential)
doFetchRolesback to summary
public abstract List<String> doFetchRoles() throws Exception
fetchRolesback to summary
public void fetchRoles() throws Exception
getUserNameback to summary
public String getUserName()
setJAASInfoback to summary
public void setJAASInfo(Subject subject)
Parameters
subject:Subject

The subject

unsetJAASInfoback to summary
public void unsetJAASInfo(Subject subject)
Parameters
subject:Subject

The subject