2017 © Pedro Pelรกez
 

project pdo-authenticator

Generic PDO-Authentication

image

outermedia/pdo-authenticator

Generic PDO-Authentication

  • Tuesday, April 19, 2016
  • by sba-om
  • Repository
  • 3 Watchers
  • 0 Stars
  • 1,094 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 27 % Grown

The README.md

pdo-authenticator

General php authenticator based on PDO to check logins., (*1)

Installation

At first install or download composer.phar to your computer. Follow the instructions provided by getcomposer.org., (*2)

Step 1: Download the project

Create an intermediate directory, cd into it and download the latest distribution without tests:, (*3)

``` bash php ~/php/composer.phar --prefer-dist require outermedia/pdo-authenticator, (*4)


This creates files in your current working directory:

โ”œโ”€โ”€ composer.json โ”œโ”€โ”€ composer.lock โ””โ”€โ”€ vendor โ”‚ ... โ””โ”€โ”€ outermedia โ””โ”€โ”€ pdo-authenticator โ”œโ”€โ”€ LICENSE โ”œโ”€โ”€ README.md โ”œโ”€โ”€ composer.json โ”œโ”€โ”€ composer.lock โ””โ”€โ”€ src โ””โ”€โ”€ main โ””โ”€โ”€ webapp โ”œโ”€โ”€ Om โ”‚ โ””โ”€โ”€ Pdo โ”‚ โ””โ”€โ”€ Authenticator โ”‚ โ”œโ”€โ”€ DatabaseConfiguration.php โ”‚ โ”œโ”€โ”€ DatabaseQueryBuilder.php โ”‚ โ”œโ”€โ”€ PdoAuthenticator.php โ”‚ โ””โ”€โ”€ RequestHandler.php โ”œโ”€โ”€ dbconf.php.template โ””โ”€โ”€ index.php, (*5)


Hint: If you want to run the phpunit tests, additionally run (creates new directoy pdo-authenticator/):

php ~/php/composer.phar --prefer-source create-project outermedia/pdo-authenticator pushd pdo-authenticator && vendor/bin/phpunit src/test/php/ && popd, (*6)

Note: The dbunit tests require sqlite3.

###Step 2: Deploy the files

Now copy the files to your destination directory ($DEST)

cp -r vendor/outermedia/pdo-authenticator/src/main/webapp/* $DEST, (*7)


### Step 3: Rename the database settings template Rename the file dbconf.php.template:

mv $DEST/dbconf.php.template $DEST/dbconf.php, (*8)


### Step 4: Set your database options Edit dbconf.php. Options are: - __pdoUrl__ - a PDO connection URL e.g. for a local mysql and a database dbname1 "mysql:host=localhost;dbname=dbname1" - __dbUser__ - the username used for the database connection - __dbPassword__ - the password used for the database connection - __table__ - the database table name which holds the user information - __usernameColumn__ - the column name which stores the username (of __table__) - __passwordColumn__ - the column name which stores a user's password (of __table__) ### Step 5: Test you installation Two POST actions are supported: a) Get a user's salt ("user1"): Encode your form parameters with the specified charset!

curl -X POST -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" \ --data 'action=getsalt&login=user1' http://localhost/pdo-auth/index.php, (*9)

should return something like:

{"charset":"latin1","result":true,"salt":"$1$rasmusl1"}, (*10)

The charset used by the database table, the salt and a success flag ("result").

b) Check a user's login: pwd is the calculated hash.

curl -X POST -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" \ --data 'action=login&login=user1&pwd=$1$rasmusl1$2ASuKCrDVFQspP8.yIzVl.' \ http://localhost/pdo-auth/index.php, (*11)

The expected answer is e.g.

{"charset":"latin1","result":true} ``` The flag "result" indicates the success., (*12)

The Versions

19/04 2016

dev-master

9999999-dev http://www.outermedia.de

Generic PDO-Authentication

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

The Development Requires

authentication login

19/04 2016

v1.0.2

1.0.2.0 http://www.outermedia.de

Generic PDO-Authentication

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

The Development Requires

authentication login

19/04 2016

v1.0.1

1.0.1.0 http://www.outermedia.de

Generic PDO-Authentication

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

The Development Requires

authentication login

19/04 2016

v1.0

1.0.0.0 http://www.outermedia.de

Generic PDO-Authentication

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

The Development Requires

authentication login