Download the PHP package okneloper/jwt-validators without Composer

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

JWT validation library for lcobucci/jwt v3

Easily validate your lcobucci/jwt JWTs, add custom validators when you need. This package is intended for use with lcobucci/jwt v3. V4 will include validation improvements, so it might not require any additional packages to set up token validation.

Installation

composer require okneloper/jwt-validators

Validating tokens

Included Validators

ClaimPresenceValidator

Validates if a particular claim is present.

ExpirationValidator

Validates if exp claim is present and the token is not expired.

LifetimeValidator

Validates if token lifetime is less or equal to the number of seconds. Handy for validating tokens issued by other issuers.

SignaturePresenceValidator

Validates if the token is signed. This will prevent an exception when trying to verify signature on a token without one.

UniqueJtiValidator

Validates if the token does not exist in a custom storage. To use it, you need to pass it an instance of a call implementing TokenExistenceChecker interface. This is a simple interface that lets you define how to check if the token exists on your records. Example usage:

Writing custom validators

There are 2 ways to write a custom validator depenfing on the complexity of you validator you require.

ITokenValidator interface

A token validator a class that implements ITokenValidator interface. This interface has 2 methods:

Simply implement this interface and you can add this validator to your list of validators.

TokenValidator class

To simplify the process of writing validators the library includes an abstract class that implements this interface and the Decorator pattern that lets you chain multiple validators. For instance you want check that a claim exists before you will validate the value. Splitting this logic into 2 separate validators allows for clean and exact error messages. This helps developers consuming your api a lot.

All you need to do is define your error message and the validation method:


All versions of jwt-validators with dependencies

PHP Build Version
Package Version
Requires lcobucci/jwt Version ^3.2
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 okneloper/jwt-validators contains the following files

Loading the files please wait ....