2017 © Pedro Peláez
 

library pushauth

A package for push authorization

image

pushauth/pushauth

A package for push authorization

  • Friday, July 21, 2017
  • by pushauth
  • Repository
  • 1 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

PushAuth php code

PHP push authorization, (*1)

=======, (*2)

Latest Stable Version Total Downloads License, (*3)

Requirements

PHP 5.6 and later., (*4)

Composer

You can install the bindings via Composer. Run the following command:, (*5)

composer require pushauth/pushauth-php

To use the bindings, use Composer's autoload:, (*6)

require_once('vendor/autoload.php');

Manual Installation

If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the init.php file., (*7)

require_once('/path/to/pushauth-php/pushahuth.php');

Dependencies

The bindings require the following extension in order to work properly:, (*8)

  • curl, although you can use your own non-cURL client if you prefer
  • json
  • mbstring (Multibyte String)

If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available., (*9)

Getting Started

Simple usage looks like:, (*10)

use PushAuth\PushAuth;

//Setting your Public & Private keys
$authRequest = new PushAuth('publicKey', 'privateKey');

Sending Push Request

And waiting responce from client until 30 sec:, (*11)

$request = $authRequest->to('client@yourfirm.com')
                       ->mode('push')
                       ->response(false)
                       ->send();

if ($authRequest->isAccept()) {
                                //Make logIn action...
                            } else {
                                //Make Access Denied action...
                            }

Or custom wait 10 seconds response with self check:, (*12)

$request = $authRequest->to('client@yourfirm.com')
                       ->mode('push')
                       ->response(true)
                       ->send();

$sec = 1;
while ($sec <= 10) {
 if ($authRequest->isAccept()) { //Make LogIn action }
$sec++;
sleep(1);
}

if ($authRequest->isAccept() == false) { //Make Access Denied action }
if ($authRequest->isAccept() == Null) { //No answer from client }  

Sending Push Code

Special security code to client device:, (*13)

$request = $authRequest->to('client@yourfirm.com')
                       ->mode('code')
                       ->code('123-456')
                       ->send();

Sending Routing Push Request

To all clients together and wait response:, (*14)

$request = $authRequest->to([
                                ['1'=>'client.one@yourfirm.com'],
                                ['1'=>'client.two@yourfirm.com'],
                                ['1'=>'client.three@yourfirm.com']
                                ])
                                ->response(false)
                                ->send();

All clients recieve push and request will be true only if all clients answering true., (*15)

To all clients by order:, (*16)

$request = $authRequest->to([
                                ['1'=>'client.one@yourfirm.com'],
                                ['2'=>'client.two@yourfirm.com'],
                                ['3'=>'client.three@yourfirm.com']
                                ])
                       ->send();

if ($authRequest->isAccept()) { //Make LogIn action }
if ($authRequest->isAccept() == false) { //Make Access Denied action }
if ($authRequest->isAccept() == Null) { //No answer from client }

The first client receive push and the next client will receive push only if previous answer true. All request will be true, only if all clients answered true., (*17)

Retrieve request status

At any time you can view request status:, (*18)

$request = $authRequest->to('client@yourfirm.com')
                       ->mode('push')
                       ->send();

//show request hash
print_r($request);
// will return Request Hash ex. 1232dwfef31x4xfcf34c2x4

//Show push request information
print_r($authRequest->requestStatus($request));
/*
will return array:
['answer'=>true,
'response_dt'=>'Time....',
'response_code'=>200,
'response_message'=>'Success answer received']
*/

Show QR-code

Generate QR-code for client reading and auth:, (*19)

$qr_url = $authRequest->qrconfig([
            'margin'=>'5',
            'size'=>'256',
            'color'=>'121,0,121'
        ])->qr();

if ($authRequest->isAccept()) { //Make LogIn action }
if ($authRequest->isAccept() == false) { //Make Access Denied action }
if ($authRequest->isAccept() == Null) { //No answer from client }

Documentation

Please see: https://dashboard.pushauth.io/api/index.html, (*20)

Support

Please see: http://dashboard.pushauth.io/support/request/create, (*21)

The Versions

21/07 2017

dev-master

9999999-dev

A package for push authorization

  Sources   Download

MIT

The Requires

  • php >=5.5.9
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

by Avatar pushauth

authorization push

21/07 2017

1.2-stable

1.2.0.0

A package for push authorization

  Sources   Download

MIT

The Requires

  • php >=5.5.9
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

by Avatar pushauth

authorization push

21/07 2017

1.0

1.0.0.0

A package for push authorization

  Sources   Download

MIT

The Requires

  • php >=5.5.9
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

by Avatar pushauth

authorization push