org.jvnet.libpam

## Class PAM

- java.lang.Object
- - org.jvnet.libpam.PAM

    public class PAM
    extends 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:

- NetBSD PAM programming guide
- Linux PAM

Author:
  Kohsuke Kawaguchi

### Constructor Summary

Constructors
Constructor and Description
`PAM(String serviceName)` Creates a new authenticator.

### Method Summary

Methods
`UnixUser` `authenticate(String username, 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()`
`Set<String>` `getGroupsOfUser(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(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(String username,
                        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 Set<String> getGroupsOfUser(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 Throwable

Overrides:
  `finalize` in class `Object`
Throws:
  `Throwable`