Home

Awesome

Padlock, Phalcon Authentication Server

Latest Version on Packagist Software License Total Downloads

Padlock is a docker-based phalcon authentication server built on top of the PHP OAuth 2.0 Server

Setting Up

Try it out

Requesting a Token

  1. Password Grant Flow: Send a POST request to http://padlock.local:8899/api/v1/oauth/token with the following parameters:

    • client_id: test
    • client_secret: secret
    • grant_type: password
    • username: abc
    • password: abc

    NOTE: This grant returns an access token and a refresh token

  2. Client Credentials Grant Flow: Send a POST request to http://padlock.local:8899/api/v1/oauth/token with the following parameters:

    • client_id: test
    • client_secret: secret
    • grant_type: client_credentials

    NOTE: This grant returns only an access token

  3. Refresh Token Grant: Send a POST request to http://padlock.local:8899/api/v1/oauth/token with the following parameters:

    • client_id: test
    • client_secret: secret
    • grant_type: refresh_token
    • refresh_token: value gotten from any flow that returns a refresh token (e.g password grant flow)

    NOTE: This grant returns another access token and refresh token and invalidates/revokes the previous ones

  4. Implicit Grant: Send a GET request to http://padlock.local:8899/api/v1/oauth/authorize with the following parameters:

    • client_id: test
    • response_type: token
    • state: a random string (optional)
    • redirect_uri: http://www.test.com (optional)

    NOTE: This grant returns an access token immediately. It does not return a refresh token.

  5. Authorization Code Grant: Send a GET request to http://padlock.local:8899/api/v1/oauth/authorize with the following parameters:

    • client_id: test
    • response_type: code
    • state: a random string (optional)
    • redirect_uri: http://www.test.com (optional)

    NOTE: This grant returns an authorization code that is then used to request for a token by sending a POST request to the endpoint http://padlock.local:8899/api/v1/oauth/token with the following parameters:

    • client_id: test
    • client_secret: secret
    • grant_type: authorization_code
    • code: value gotten from the get request
    • redirect_uri: http://www.test.com (optional)

Validating a Token

Send a POST request to http://padlock.local:8899/api/v1/oauth/token/validate with an Authorization header whose value is Bearer {access_token}

Running Tests

Install

Via Composer

$ composer require tegaphilip/padlock

Change log

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Credits