All Projects → heloufir → security-starter

heloufir / security-starter

Licence: other
Security starter is a full implementation of laravel/passport and heloufir/simple-passport, containing all the implementations of the authentication and forgot password systems, which allows you to start your project from a good foundation, and only worry about the business logic of your application.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to security-starter

lumen-lighthouse-graphql
Lumen example use of a GraphQL PHP server using Lighthouse package
Stars: ✭ 31 (+0%)
Mutual labels:  laravel-passport
laravel-passport-socialite
The missing social authentication plugin (i.e. SocialGrant) for laravel passport.
Stars: ✭ 50 (+61.29%)
Mutual labels:  laravel-passport
simple-passport
Simple passport, is a complete implementation of laravel/passport package, containing authentication, forgot passwort, recovery password, ... and all what you need to start your application that needs a complete authentication system
Stars: ✭ 22 (-29.03%)
Mutual labels:  laravel-passport
passport
The Laravel passport compatible oauth extension for your Flarum forum.
Stars: ✭ 24 (-22.58%)
Mutual labels:  laravel-passport
laravel-passport-demo
Shows you how to turn your website to an Oauth2 server using Laravel Passport
Stars: ✭ 27 (-12.9%)
Mutual labels:  laravel-passport
docker-laravel-vuejs
🌟 🎯 📰 Dockerized Blog + Forum + REST API + App using Laravel, Vue.js
Stars: ✭ 27 (-12.9%)
Mutual labels:  laravel-passport
rest-api
Laravel restfull api boilerplate
Stars: ✭ 57 (+83.87%)
Mutual labels:  laravel-passport
vuetified
Laravel 5.5 Vuetify Real Time Starter App
Stars: ✭ 15 (-51.61%)
Mutual labels:  laravel-passport
ngx-security-starter
A full implementation of the heloufir/security-starter with an Angular 7+ front-end implementation, with a laravel 5.8.* server
Stars: ✭ 37 (+19.35%)
Mutual labels:  laravel-passport
laravel-api-auth
A Laravel Package for easy API authentication setup with passport
Stars: ✭ 29 (-6.45%)
Mutual labels:  laravel-passport
Clean-Laravel-Api
⭐️ Build APIs You Won't Hate In Laravel.
Stars: ✭ 85 (+174.19%)
Mutual labels:  laravel-passport
api.yike.io
一刻社区后端 API 源码
Stars: ✭ 1,019 (+3187.1%)
Mutual labels:  laravel-passport

Due to a time constraint, unfortunately this repository is no longer maintained.


Security-Starter is a ready to use package that provide to you a complete CRUD REST system for a User/Profile/Role architecture, and also provide a middleware to specify roles that the user must have to access your routes, and it's based on the **heloufir/simple-passport** package that offers to you a **forgot password** system, you can refer to this [link](https://github.com/heloufir/simple-passport) to know more about this package.

Security starter architecture

A full implementation

You can find a complete implementation of this repository in Ngx Security Starter

Installation

composer require heloufir/security-starter

Configuration

Method 1. You can configure this package automatically, by using the command php artisan starter:config (if you want to configure it manually, go to Method 2) When executing this command you will be asked to answer some questions, and at the very end you will need to complete 3 steps manually :

  • Add Laravel\Passport\HasApiTokens trait to the User model
<?php

namespace App;
    
use Laravel\Passport\HasApiTokens;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
    
class User extends Authenticatable
{
    use HasApiTokens, Notifiable;
}
  • Add Heloufir\SecurityStarter\Core\UserProfiles trait to the User model
<?php

namespace App;
    
use Laravel\Passport\HasApiTokens;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Heloufir\SecurityStarter\Core\UserProfiles;
    
class User extends Authenticatable
{
    use HasApiTokens, Notifiable, UserProfiles;
}
  • Add 'roles' => \Heloufir\SecurityStarter\Http\Middleware\RoleMiddleware::class to the $routeMiddleware in Kernel

File: app/Http/Kernel.php

protected $routeMiddleware = [
    // ...
    'roles' => \Heloufir\SecurityStarter\Http\Middleware\RoleMiddleware::class
];

Method 2. (Manual configuration)

First, you need to publish the heloufir/simple-passport:

php artisan vendor:publish --provider=Heloufir\SimplePassport\SimplePassportServiceProvider

After, you need to publish the heloufir/security-starter:

php artisan vendor:publish --provider=Heloufir\SecurityStarter\SecurityStarterServiceProvider

Then, if you want to customize the profiles, roles, profile_roles and user_profiles tables you need first to update the file config/security-starter.php, then go to next step.

Launch migrations to add laravel/passport tables and heloufir/security-starter tables:

php artisan migrate

Then, install laravel/passport oauth clients, by executing:

php artisan passport:install

Add Laravel\Passport\HasApiTokens trait to the User model

<?php

namespace App;
    
use Laravel\Passport\HasApiTokens;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
    
class User extends Authenticatable
{
    use HasApiTokens, Notifiable;
}

Add Heloufir\SecurityStarter\Core\UserProfiles trait to the User model

<?php

namespace App;
    
use Laravel\Passport\HasApiTokens;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Heloufir\SecurityStarter\Core\UserProfiles;
    
class User extends Authenticatable
{
    use HasApiTokens, Notifiable, UserProfiles;
}

Add 'roles' => \Heloufir\SecurityStarter\Http\Middleware\RoleMiddleware::class to the $routeMiddleware in Kernel

File: app/Http/Kernel.php

protected $routeMiddleware = [
    // ...
    'roles' => \Heloufir\SecurityStarter\Http\Middleware\RoleMiddleware::class
];

Don't forget to update the guards in your auth.php configuration file for the api to passport

'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],

        'api' => [
            'driver' => 'passport', // <- Here
            'provider' => 'users',
        ],
    ],

That's all, the installation and configuration of security-starter is done.

You can check the wiki for more information about this package.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].