Download the PHP package fuzz/laravel-oauth without Composer

On this page you can find all versions of the php package fuzz/laravel-oauth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-oauth

Laravel OAuth Build Status

An OAuth wrapper to bridge lucadegasperi/oauth2-server-laravel and Laravel's authentication system while providing optional support for fuzz/magic-box repositories

Setup

  1. Require the composer package
  2. Set up your project AuthServiceProvider to extend Fuzz\Auth\Providers\AuthServiceProvider
  3. Follow instructions in lucadegasperi/oauth2-server-laravel to set it up.
  4. Configure the grant_types array in config/oauth2.php to use the Fuzz grants (or extend/create your own)

  5. Set up config/auth.php

    Set the default guard to api

    Set the api guard to use \Fuzz\Auth\Guards\OAuthGuard::class as its driver

    Set Laravel to use the oauth user provider and set your project's User class

  6. Create app/Http/Middleware/OAuthMiddleware.php and extend Fuzz\Auth\Middleware\OAuthenticateMiddleware. Add it to the $routeMiddleware array in `app/Http/Kernel.php
  7. Your User class should implement the Fuzz\Auth\Models\AgentInterface and Illuminate\Contracts\Auth\Authenticatable and their required methods

Usage

Protecting routes

Routes that require authentication can now be protected with the auth middleware:

Within any authenticated route, you can use all the default Laravel Auth methods such as Auth::user() to resolve the currently authenticated user. lucadegasperi/oauth2-server-laravel provides a way to protect routes based on scope, but you can also use Fuzz\Auth\Policies\RepositoryModelPolicy@requireScopes to throw League\OAuth2\Server\Exception\AccessDeniedException exceptions when a user does not have the required scopes.

Protecting resources

Laravel OAuth comes with a base Fuzz\Auth\Policies\RepositoryModelPolicy but you may create your own (implementing the Fuzz\Auth\Policies\RepositoryModelPolicyInterface might be helpful). Extending Fuzz\Auth\Policies\RepositoryModelPolicy will provide some base methods to ease writing policies for repositories.

Once a policy is set up and mapped to its model class, you may use it to check user permissions according to your policy:

Resolving the current user

All of Laravel's Auth methods will work, so resolving the current user is as simple as $user = Auth::user(). https://laravel.com/docs/5.2/authentication.

Auth will use your default guard unless specified. A typical guard set up for an OAuth specced API would be having one for users accessing via a client and another for client-only requests. Currently there is only Fuzz\Auth\Guards\OAuthGuard which is responsible for resolving the user for a request.

TODOs

  1. Separate fuzz/laravel-oauth from fuzz/magic-box
  2. Support client requests in their own guard and be compatible with the current user OAuthGuard

All versions of laravel-oauth with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version 5.2.*
lucadegasperi/oauth2-server-laravel Version 5.1.*
symfony/security-core Version 3.0.*
fuzz/magic-box Version 1.1.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package fuzz/laravel-oauth contains the following files

Loading the files please wait ....