Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rapideinternet/hellohi.middleware.oauth
OAuth Middleware
https://github.com/rapideinternet/hellohi.middleware.oauth
Last synced: about 6 hours ago
JSON representation
OAuth Middleware
- Host: GitHub
- URL: https://github.com/rapideinternet/hellohi.middleware.oauth
- Owner: rapideinternet
- Created: 2019-08-01T09:57:43.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T20:13:38.000Z (about 1 year ago)
- Last Synced: 2024-04-16T03:11:11.699Z (10 months ago)
- Language: PHP
- Size: 38.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# OAuth2 MijnKantoor middleware for Laravel 5
## Installation
Require the `mijnkantoor/middleware.oauth` package in your `composer.json` and update your dependencies:
```sh
$ composer require mijnkantoor/middleware.oauth
```For laravel >=5.5 that's all. This package supports Laravel new [Package Discovery](https://laravel.com/docs/5.5/packages#package-discovery).
If you are using Laravel < 5.5 or have package discovery disabled, you also need to add OauthMiddleware\ServiceProvider to your `config/app.php` providers array:
```php
MijnKantoor\OauthMiddleware\ServiceProvider::class,
```## Global usage
To allow OAuth for all your routes, add the `ValidateOAuth` middleware in the `$middleware` property of `app/Http/Kernel.php` class:
```php
protected $middleware = [
// ...
\MijnKantoor\OauthMiddleware\ValidateOAuth::class,
];
```## Group middleware
If you want to allow OAuth on a specific middleware group or route, add the `ValidateOAuth` middleware to your group:
```php
protected $middlewareGroups = [
'web' => [
// ...
],'api' => [
// ...
\MijnKantoor\OauthMiddleware\ValidateOAuth::class,
],
];
```## Configuration
The defaults are set in `config/oauth-middleware.php`. Copy this file to your own config directory to modify the values. You can publish the config using this command:
```sh
$ php artisan vendor:publish --provider="MijnKantoor\OAuthMiddleware\ServiceProvider"
```