APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.security.auth.module

public Class UnixLoginModule

extends Object
implements LoginModule
Class Inheritance
All Implemented Interfaces
javax.security.auth.spi.LoginModule
Imports
java.util.*, javax.security.auth.*, javax.security.auth.callback.*, javax.security.auth.login.*, javax.security.auth.spi.*, com.sun.security.auth.UnixPrincipal, .UnixNumericUserPrincipal, .UnixNumericGroupPrincipal, jdk.internal.util.OperatingSystem

This LoginModule imports a user's Unix Principal information (UnixPrincipal, UnixNumericUserPrincipal, and UnixNumericGroupPrincipal) and associates them with the current Subject.

This LoginModule recognizes the debug option. If set to true in the login Configuration, debug messages will be output to the output stream, System.out.

Since
1.4

Field Summary

Modifier and TypeField and Description
private CallbackHandler
private boolean
private boolean
private UnixNumericGroupPrincipal
private Map<String, ?>
private Map<String, ?>
private UnixSystem
private Subject
private boolean
private LinkedList<UnixNumericGroupPrincipal>
private UnixNumericUserPrincipal
private UnixPrincipal

Constructor Summary

AccessConstructor and Description
public
UnixLoginModule()

Creates a UnixLoginModule.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

false if this LoginModule's own login and/or commit attempts failed, and true otherwise.
abort
()

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

Abort the authentication (second phase).

public boolean

Returns:

true if this LoginModule's own login and commit attempts succeeded, or false otherwise.
commit
()

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

Commit the authentication (second phase).

public void
initialize(Subject
the Subject to be authenticated.
subject
,
CallbackHandler
a CallbackHandler for communicating with the end user (prompting for usernames and passwords, for example).
callbackHandler
,
Map<String, ?>
shared LoginModule state.
sharedState
,
Map<String, ?>
options specified in the login Configuration for this particular LoginModule.
options
)

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

Initialize this LoginModule.

public boolean

Returns:

true in all cases (this LoginModule should not be ignored).
login
()

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

Authenticate the user (first phase).

public boolean

Returns:

true in all cases (this LoginModule should not be ignored).
logout
()

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

Logout the user

This method removes the Principals associated with the Subject.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

callbackHandlerback to summary
private CallbackHandler callbackHandler
commitSucceededback to summary
private boolean commitSucceeded
debugback to summary
private boolean debug
GIDPrincipalback to summary
private UnixNumericGroupPrincipal GIDPrincipal
optionsback to summary
private Map<String, ?> options
sharedStateback to summary
private Map<String, ?> sharedState
ssback to summary
private UnixSystem ss
subjectback to summary
private Subject subject
succeededback to summary
private boolean succeeded
supplementaryGroupsback to summary
private LinkedList<UnixNumericGroupPrincipal> supplementaryGroups
UIDPrincipalback to summary
private UnixNumericUserPrincipal UIDPrincipal
userPrincipalback to summary
private UnixPrincipal userPrincipal

Constructor Detail

UnixLoginModuleback to summary
public UnixLoginModule()

Creates a UnixLoginModule.

Method Detail

abortback to summary
public boolean abort() throws LoginException

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

Abort the authentication (second phase).

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

This method cleans up any state that was originally saved as part of the authentication attempt from the login and commit methods.

Returns:boolean

false if this LoginModule's own login and/or commit attempts failed, and true otherwise.

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

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

Commit the authentication (second phase).

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 (the importing of the Unix authentication information succeeded), then this method associates the Unix Principals with the Subject currently tied to the LoginModule. If this LoginModule's authentication attempted failed, then this method removes any state that was originally saved.

Returns:boolean

true if this LoginModule's own login and commit attempts succeeded, or false otherwise.

Exceptions
LoginException:
if the commit fails
initializeback to summary
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options)

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

Initialize this LoginModule.

Parameters
subject:Subject

the Subject to be authenticated.

callbackHandler:CallbackHandler

a CallbackHandler for communicating with the end user (prompting for usernames and passwords, for example).

sharedState:Map<String, ?>

shared LoginModule state.

options:Map<String, ?>

options specified in the login Configuration for this particular LoginModule.

loginback to summary
public boolean login() throws LoginException

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

Authenticate the user (first phase).

The implementation of this method attempts to retrieve the user's Unix Subject information by making a native Unix system call.

Returns:boolean

true in all cases (this LoginModule should not be ignored).

Exceptions
LoginException:

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

if the authentication fails

FailedLoginException:
if attempts to retrieve the underlying system information fail.
logoutback to summary
public boolean logout() throws LoginException

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

Logout the user

This method removes the Principals associated with the Subject.

Returns:boolean

true in all cases (this LoginModule should not be ignored).

Exceptions
LoginException:
if the logout fails