org.jvnet.libpam
Class PAM

java.lang.Object
  extended by org.jvnet.libpam.PAM

public class PAM
extends java.lang.Object

PAM authenticator.

Instances are thread unsafe and non reentrant. An instace cannot be reused to authenticate multiple users.

For an overview of PAM programming, refer to the following resources:

Author:
Kohsuke Kawaguchi

Constructor Summary
PAM(java.lang.String serviceName)
          Creates a new authenticator.
 
Method Summary
 UnixUser authenticate(java.lang.String username, java.lang.String password)
          Authenticate the user with a password.
 void dispose()
          Performs an early disposal of the object, instead of letting this GC-ed.
protected  void finalize()
           
 java.util.Set<java.lang.String> getGroupsOfUser(java.lang.String username)
          Deprecated. Pointless and ugly convenience method.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PAM

public PAM(java.lang.String serviceName)
    throws PAMException
Creates a new authenticator.

Parameters:
serviceName - PAM service name. This corresponds to the service name that shows up in the PAM configuration,
Throws:
PAMException
Method Detail

authenticate

public UnixUser authenticate(java.lang.String username,
                             java.lang.String password)
                      throws PAMException
Authenticate the user with a password.

Returns:
Upon a successful authentication, return information about the user.
Throws:
PAMException - If the authentication fails.

getGroupsOfUser

public java.util.Set<java.lang.String> getGroupsOfUser(java.lang.String username)
                                                throws PAMException
Deprecated. Pointless and ugly convenience method.

Returns the groups a user belongs to

Parameters:
username -
Returns:
Set of group names
Throws:
PAMException

dispose

public void dispose()
Performs an early disposal of the object, instead of letting this GC-ed. Since PAM may hold on to native resources that don't put pressure on Java GC, doing this is a good idea.

This method is called by finalize(), too, so it's not required to call this method explicitly, however.


finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable


Copyright © 2012. All Rights Reserved.