Giter Site home page Giter Site logo

rahmatcmos / base-lumen-oauth2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from feelinc/base-lumen-oauth2

0.0 1.0 0.0 372 KB

Implementation of OAuth 2 Server in Lumen PHP Framework using league/oauth2-server

License: MIT License

PHP 99.32% ApacheConf 0.68%

base-lumen-oauth2's Introduction

Implementation of OAuth 2 Server in Lumen PHP Framework using league/oauth2-server

Build Status Total Downloads Latest Stable Version Latest Unstable Version License

Laravel Lumen is a stunningly fast PHP micro-framework for building web applications with expressive, elegant syntax. Documentation for the framework can be found on the Lumen website.

Lumen PHP Framework version 5.1.*

About

This is simple example of how to use league/oauth2-serve inside Lumen PHP Framework.

Grants Implemented:

  1. Client Credentials
  2. Authorization Code
  3. Refresh Token

Authorization Code grant is automatically executed after logging in a user in this implementation, so you will not have any authorization approval user interface.

You can modify the Authorization Code grant implementation or remove it by modifying the UserController file. You can find OAuth2 trait usage there. But remember, you need to figure out by your self on how to identify authenticated User by removing the implementation.

Installation

Run composer install from the command line

composer install

Tables Schema

Import SQL table schema into your database.

Testing

Import Postman JSON file into your Postman application.

Steps

  1. Change all URL endpoints based on your installation.
  2. Run the "Authorization".
  3. Copy access_token value into the "User Login" Authorization header, then run it.
  4. Copy refresh_token value into the "Refresh Token" body, then run it.
  5. Copy access_token value into the "Get a User" Authorization header, then run it.

Middlewares

1. OAuthMiddleware

This middleware will identify Client based on access_token passed to the request, then it will save the identified OAuth info (client, user, and scopes) into request object.

2. AuthMiddleware

This middleware will identify authenticated User based on identified OAuth info, so you need to put OAuthMiddleware in the first place of you route middleware definition before this middleware.

Issue

Submit your issue in here.

License

Whole additional source codes included is open-sourced software licensed under the MIT license

base-lumen-oauth2's People

Contributors

feelinc avatar

Watchers

Rahmat 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.