Download the PHP package rougin/authsum without Composer

On this page you can find all versions of the php package rougin/authsum. 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 authsum

Authsum

Latest Version on Packagist Software License Build Status Coverage Status Total Downloads

Authsum is a simple authentication package written in PHP which allows to create simple and extensible authentication logic.

Installation

Install the Authsum package via Composer:

Basic usage

Prior in using Authsum, a data source must be defined first (e.g., BasicSource):

Once the source is defined, use the Authsum class to perform the validation logic:

Customization

Authsum also provides simple extensibility utilities to be able to fit in from various use-cases.

Pass or fail from Authsum

The Authsum class can also be extended to provide methods if the validation logic passed or failed:

Alternatively, the Authsum class can also get the error or the result after validation using getError() and getResult() respectively:

[!NOTE] An UnexpectedValueException will be thrown if trying to access an empty output (e.g., trying to access getResult() after the failed validation).

Changing fields to check

By default, the Authsum class can check the email as its username and password for the password from the payload (e.g., $_POST). If this is not the case, kindly update the specified fields using setUsernameField or setPasswordField:

[!NOTE] The specified fields will be used by the Authsum class if they are required by the specified source (e.g., BasicSource, PdoSource).

Using sources

Sources in Authsum are PHP classes that provide user data. They can be used for checking the specified username and password fields against its data source:

PdoSource

Besides from BasicSource, another available source that can be used is PdoSource which uses PDO to interact with a database:

The setTableName method can also be used to specify its database table name:

[!NOTE] If the setTableName is not specified, it always refer to the users table.

When using PdoSource, the value in the password field will be assumed as a hash (e.g., $2y$10...). If this is not the case, kindly add the withoutHash method:

Doing this will make a strict comparison of the provided password against the result from the database.

JwtSource

The JwtSource class is a special class that checks a user's authentication using JSON Web Token:

From the example above, initializing JwtSource requires a JwtParserInterface for parsing the JSON web tokens from payload:

If JwtSource is used as a source, the token field must be updated also from the Authsum class based on the query parameter or parsed body where the token exists:

[!NOTE] If setTokenField is not specified, its default value is token.

Then use the setUsernameField to specify the field to be compared against the parsed data from the JSON web token:

Creating custom sources

To create a custom source, kindly use the SourceInterface for its implementation:

If the custom source requires an username field, kindly add the WithUsername interface:

The WithPassword interface can be also added if the custom source requires a password to be defined:

Some custom sources may require to use the provided payload instead of username and password fields (e.g., JwtSource). With this, kindly use the WithPayload interface:

Changelog

Please see CHANGELOG for more recent changes.

Contributing

See CONTRIBUTING on how to contribute.

License

The MIT License (MIT). Please see LICENSE for more information.


All versions of authsum with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
rougin/ezekiel Version ~0.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 rougin/authsum contains the following files

Loading the files please wait ...