outermedia/pdo-authenticator 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

outermedia/pdo-authenticator

Composer 安装命令:

composer create-project outermedia/pdo-authenticator

包简介

Generic PDO-Authentication

README 文档

README

General php authenticator based on PDO to check logins.

##Installation

At first install or download composer.phar to your computer. Follow the instructions provided by getcomposer.org.

Step 1: Download the project

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

php ~/php/composer.phar --prefer-dist require outermedia/pdo-authenticator

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

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

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

Step 3: Rename the database settings template

Rename the file dbconf.php.template:

mv $DEST/dbconf.php.template $DEST/dbconf.php

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

should return something like:

{"charset":"latin1","result":true,"salt":"$1$rasmusl1"}

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

The expected answer is e.g.

{"charset":"latin1","result":true}

The flag "result" indicates the success.

统计信息

  • 总下载量: 3.93k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-04-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固