Download the PHP package sebk/small-swoft-auth without Composer

On this page you can find all versions of the php package sebk/small-swoft-auth. 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 small-swoft-auth

sebk/small-swoft-auth

Jwt auth for Swoft based on small-orm

Include a controller superclass to simple implement token support in your controllers and link with voters to manage user rigths

Install

Create your Swoft project : http://swoft.io/docs/2.x/en/quick-start/install.html

Install dependencies

Require Swoft Voter package (https://github.com/sebk69/small-swoft-auth) :

Documentation

Parameter

In base.php, register AuthManagerService :

In app.php, register app.user according to your app to tell AuthManager to request you're app user:

Implement UserModelInterface

You're application user model must implement UserModelInterface. (In this example, password stored via md5 hash for simplicity. Don't use md5 hash, prefere SHA-256 hash or more for security reasons) :

Implement your voters

See https://github.com/sebk69/small-voter for config and implementation

Implement login

Implement your controllers

To protect your controller :

Additionnaly, you can protect a route via specific rules of your app by using voter on your controller object using denyAccessUnlessGranted method :

Here is a controller example :

Usage : login request

Here is a AuthController implementing a login action :

To test it, use your favorit rest app on :

It will respond you something like :

Or a 401 response if wrong login or password

Now, to access protected route, use Authorization header with the token of login response.

For our customer list route, use :

If success, the server will return a 200 status code and if token is wrong or expired, it wil return a 401 status code.


All versions of small-swoft-auth with dependencies

PHP Build Version
Package Version
Requires swoft/framework Version ~2.0.0
swoft/auth Version ~2.0.0
sebk/small-orm-swoft Version 1.*
sebk/small-orm-forms Version 1.*
sebk/swoft-voter Version 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 sebk/small-swoft-auth contains the following files

Loading the files please wait ....