net.sf.jpam
Class Pam

java.lang.Object
  extended by net.sf.jpam.Pam

public class Pam
extends java.lang.Object

The PAM bridging class. Most of the work is done here.

To see debugging output for this class and native code, set the installed logging toolkit level for this class to DEBUG or equivalent. The debugging output for the native code will be sent to STDOUT.

This class may be called directly, or by using JAAS, via the JpamLoginModule.

 

Field Summary
static java.lang.String DEFAULT_SERVICE_NAME
          The default service name of "net-sf-pam".
 
Constructor Summary
Pam()
          Creates a new Pam object configured to use the Pam.DEFAULT_SERVICE_NAME
Pam(java.lang.String serviceName)
          Creates a new PAM object configured with the specified service name.
 
Method Summary
 PamReturnValue authenticate(java.lang.String username, java.lang.String credentials)
          Sames as authenticateSuccessful, except a PamReturnValue is returned

This method is threadsafe.

 boolean authenticateSuccessful(java.lang.String username, java.lang.String credentials)
          Authenticates a user.
static java.lang.String getLibraryName()
           
 java.lang.String getServiceName()
           
static void main(java.lang.String[] args)
          A main method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SERVICE_NAME

public static final java.lang.String DEFAULT_SERVICE_NAME
The default service name of "net-sf-pam".

This service is expected to be configured in /etc/pam.d

See Also:
Constant Field Values
Constructor Detail

Pam

public Pam()
Creates a new Pam object configured to use the Pam.DEFAULT_SERVICE_NAME


Pam

public Pam(java.lang.String serviceName)
    throws java.lang.NullPointerException,
           java.lang.IllegalArgumentException
Creates a new PAM object configured with the specified service name.

A file with the same name must exist in /etc/pam.d

Parameters:
serviceName -
Throws:
java.lang.NullPointerException
java.lang.IllegalArgumentException
Method Detail

authenticateSuccessful

public boolean authenticateSuccessful(java.lang.String username,
                                      java.lang.String credentials)
Authenticates a user.

This method is threadsafe.

If the logging toolkit is set to DEBUG, the shared library will emit debug information to the console.

Parameters:
username - the username to be authenticated
credentials - the credentials to use in the authentication .e.g a password
Returns:
true if the PamReturnValue is PamReturnValue.PAM_SUCCESS

authenticate

public PamReturnValue authenticate(java.lang.String username,
                                   java.lang.String credentials)
                            throws java.lang.NullPointerException
Sames as authenticateSuccessful, except a PamReturnValue is returned

This method is threadsafe.

Parameters:
username -
credentials -
Returns:
a PAM specific return value
Throws:
java.lang.NullPointerException - if any of the parameters are null
See Also:
Pam.authenticateSuccessful(String, String)

main

public static void main(java.lang.String[] args)
A main method


getLibraryName

public static java.lang.String getLibraryName()
Returns:
the system dependent name of the shared library the Pam class is expecting.

getServiceName

public java.lang.String getServiceName()
Returns:
the servicename this PAM object is using