# man > Authen::SASL::Perl::PLAIN

---
type: CommandReference
command: Authen::SASL::Perl::PLAIN
mode: perldoc
section: 3pm
source: perldoc
---

## Quick Reference

- `$sasl = Authen::SASL->new(mechanism => 'PLAIN', callback => { user => $user, pass => $pass })` — Create a PLAIN SASL client object with username and password.
- Server-side: `$sasl->callback(checkpass => \&check_credentials)` — Set a callback to validate credentials on the server.

## Name

Plain Login Authentication class

## Synopsis

perl
use Authen::SASL qw(Perl);

$sasl = Authen::SASL->new(
  mechanism => 'PLAIN',
  callback  => {
    user => $user,
    pass => $pass
  },
);
## Options

The PLAIN mechanism uses the following callbacks:

- `authname` — Authorization id to use after successful authentication (client)
- `user` — Username to be used for authentication (client)
- `pass` — User's password to be used for authentication (client)
- `checkpass(username, password, realm)` — Server callback: returns true if credentials are valid, false otherwise.

## Examples

**Client example** (from Synopsis):

perl
use Authen::SASL qw(Perl);

$sasl = Authen::SASL->new(
  mechanism => 'PLAIN',
  callback  => {
    user => $user,
    pass => $pass
  },
);
**Server example** (conceptual):

perl
$sasl->callback(
  checkpass => sub {
    my ($username, $password, $realm) = @_;
    return ($username eq 'admin' && $password eq 'secret') ? 1 : 0;
  }
);
## See Also

- [Authen::SASL](http://localhost/phpMan.php/perldoc/Authen%3A%3ASASL/markdown)
- [Authen::SASL::Perl](http://localhost/phpMan.php/perldoc/Authen%3A%3ASASL%3A%3APerl/markdown)