Python PAM for py3/py2
Project description
python-pam
==========
Python pam module supporting py3 (and py2)
Commandline example:
```
[david@Scott python-pam]$ python pam.py
Username: david
Password:
0 Success
[david@Scott python-pam]$ python2 pam.py
Username: david
Password:
0 Success
```
Inline examples:
```
[david@Scott python-pam]$ python
Python 3.4.1 (default, May 19 2014, 17:23:49)
[GCC 4.9.0 20140507 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pam
>>> p = pam.pam()
>>> p.authenticate('david', 'correctpassword')
True
>>> p.authenticate('david', 'badpassword')
False
>>> p.authenticate('david', 'correctpassword', service='login')
True
>>> p.authenticate('david', 'correctpassword', service='unknownservice')
False
>>> p.authenticate('david', 'correctpassword', service='login', resetcreds=True)
True
>>> p.authenticate('david', 'correctpassword', encoding='latin-1')
True
>>> print('{} {}'.format(p.code, p.reason))
0 Success
>>> p.authenticate('david', 'badpassword')
False
>>> print('{} {}'.format(p.code, p.reason))
7 Authentication failure
>>>
```
==========
Python pam module supporting py3 (and py2)
Commandline example:
```
[david@Scott python-pam]$ python pam.py
Username: david
Password:
0 Success
[david@Scott python-pam]$ python2 pam.py
Username: david
Password:
0 Success
```
Inline examples:
```
[david@Scott python-pam]$ python
Python 3.4.1 (default, May 19 2014, 17:23:49)
[GCC 4.9.0 20140507 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pam
>>> p = pam.pam()
>>> p.authenticate('david', 'correctpassword')
True
>>> p.authenticate('david', 'badpassword')
False
>>> p.authenticate('david', 'correctpassword', service='login')
True
>>> p.authenticate('david', 'correctpassword', service='unknownservice')
False
>>> p.authenticate('david', 'correctpassword', service='login', resetcreds=True)
True
>>> p.authenticate('david', 'correctpassword', encoding='latin-1')
True
>>> print('{} {}'.format(p.code, p.reason))
0 Success
>>> p.authenticate('david', 'badpassword')
False
>>> print('{} {}'.format(p.code, p.reason))
7 Authentication failure
>>>
```
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python-pam-1.8.tar.gz
(3.9 kB
view details)
Built Distribution
python_pam-1.8-py3.4.egg
(7.1 kB
view details)
File details
Details for the file python-pam-1.8.tar.gz
.
File metadata
- Download URL: python-pam-1.8.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45588d01c822e0a3ac791e3303542ab16ff981c19c692cbc53ec9eb240afc08e |
|
MD5 | 31bbff2508e7fceb696ade3f47693187 |
|
BLAKE2b-256 | a136531614f60af7e599ff091f542a57368d8e1f8d9a112c2b2e2a05c20a5f91 |
File details
Details for the file python_pam-1.8-py3.4.egg
.
File metadata
- Download URL: python_pam-1.8-py3.4.egg
- Upload date:
- Size: 7.1 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be5b8855b0ee741f5fca460a6db2c081ae85d7684ccb7adb828f97dfae6132d7 |
|
MD5 | 2fb921881262faa6929dd4b5bab0d951 |
|
BLAKE2b-256 | 40984add89fce0062cb65d39012ed4f2143fb07a365f84506e0c6d75e4d000f4 |