Download the PHP package m7/iam without Composer

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

Laravel 6+ wrapper for IAM by m7 s.r.o.

This package provides simple wrapper for comunicating with IAM created by m7 s.r.o. inside Laravel 6+ applications.

Installation

  1. Install via composer: composer require m7/iam
  2. Run migrations: php artisan migrate - this creates (or updates) some fields to users table that are used to pair your users with IAM:
    1. iam_uid
    2. name
    3. surname
    4. email
  3. Fields generated by migration from this package should be added to fillable property on your User model, like so:

  4. Next up, you should use Iam trait in your user model

Configuration

.env values

Note public key file should also be included in your .gitignore file for security reasons

Middleware

Middleware setup is not required, but very useful. You can also create your own middleware using methods from this package

IAM scopes

You can register middleware shipped with this package to protect certain routes or route groups based on scopes assigned to users in IAM.

To do so, register IamScopes middleware in your app/Http/Kernel.php:

IAM auth

IAM auth middleware is used to protect routes that you wish to restrict access to. This restriction is based on having valid access token from IAM.

To register IAM auth middleware, register IamAuth middleware class in your app/Http/Kernel.php:

Usage

Basic

You can always get instance of iam manager class via helper function iam_manager() if you need to do so.

There are two routes created for login and logout. Feel free to use your own routes and functionality, but these are recommended for logging your users in and out.

Request body for iam.manager.login route should contain username and password keys with corresponding values.

Alternatively, if you do not want to use this particular routes for some reason, you can log in and out your users via manager helper instance methods iam_manager()->login($username, $password) and iam_manager()->logout()

iam_manager()->login method returns instance of User model if successfully logged in, false otherwise.

Trait methods

If you successfully added Iam trait to user model, you can now access several methods:

Middleware

If you registered middleware during configuration, you can protect routes or route groups based on scopes provided by IAM or based on having valid access token set

Single scope

Example usage of iam.scopes middleware for single scope could look like this

Multiple scopes

You can also use multiple scopes. Just separate them with pipe (|), and you can use as many scopes as you want:

IAM Auth

Protecting routes with IamAuth middleware could look like this

Manager methods


All versions of iam with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
laravel/framework Version ^6.0
guzzlehttp/guzzle Version ^6.3
ext-json Version *
doctrine/dbal Version ^2.9
firebase/php-jwt Version ^5.0
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 m7/iam contains the following files

Loading the files please wait ....