Giter VIP home page Giter VIP logo

phalcon-oauth2-api's Introduction

Phalcon API Boilerplate Project With OAuth2 Server

⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️

Disclaimer

This project is under construction

  • Do not attempt to use in prod environment
  • PM me for requests/suggestions

⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️

Software License

This repo contains a boilerplate project for a Phalcon API including an OAuth2 Server (https://github.com/thephpleague/oauth2-server) to manage authentication and authorization checks.

Currently support

  • Client credentials grant
  • Password grant
  • Refresh grant
  • Plain token and JWT bearer responses
  • API requests validation
  • Client scripts/sandbox for the supported grant

Requirements

Before you install this project make sure your environment includes the following requirements:

  • PHP 7.*
  • Phalcon 3.*
  • Module php_openssl activated

Installation

All environments

  1. Clone or download the repo
  2. Run composer update in the project folder
  3. Create the oauth2 database and import the content of the config/dump-[prefered-charset].sql file
  4. Coming soon: test token creation and API call using the client snippet

Additional steps for production environment

  1. Secure or remove the public/docs folder to prevent access to the sandbox

Development

Swagger documentation/sandbox

This repository include a Swagger documentation and a sandbox. You can launch it by double-clicking on the index.html file in the docs/swagger folder.

Annotations

The Swagger documentation use doctrine annotations.

The annotations should look like this:

/**
 * @SWG\Get(
 *     path="/api/resource.json",
 *     @SWG\Response(response="200", description="An example resource")
 * )
 */

You can find some annotation examples in the existing files :

app/common/controllers/DefaultController.php (Global annotations)
app/oauth2/controllers/OAuth2AccessTokenController.php (Call, request parameters and response annotations)
app/oauth2/entities/models/AccessTokenModel.php (Entity annotations)

Generate/update documentation

To generate the Swagger documentation for the application (app folder) run the following command

php app/cli/cli.php swagger generate

Tests

Examples

Custom sandbox

This sandbox contains working examples of a client implementations.

See the following files for more details:

phalcon-oauth2-api's People

Contributors

pjmazenot avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.