Download the PHP package lorenzoferrarajr/lfj-opauth without Composer

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

LfjOpauth

Created By Lorenzo Ferrara Junior

Introduction

LfjOpauth is a Zend Framework 2 module that enables support for many authentication providers through the Opauth framework.

Installation

To use the module you need to:

To install the LfjOpauth module, you need to add "lorenzoferrarajr/lfj-opauth": "dev-master" to the require list of your project's composer.json file.

To install the Opauth strategy, you need find the required package on Packagist or on GitHub and add it to the require list of your project's composer.json file.

This is an example of a modified composer.json which includes the LfjOpauth module and the Facebook strategy:

The example includes the installation of the Facebook Opauth strategy. More info on Opauth strategies can be found on GitHub:

Installing LfjOpauth using composer, the Opauth dependecy is automatically resolved, but you still must provide at least one strategy.

Next, you need to add LfjOpauth to the modules list in the config/application.config.php file of your Zend Framework 2 project.

This is an example:

Configuration

Once LfjOpauth is installed you must create a file named lfjopauth.global.php in your config/autoload directory. This is the configuration file where you specify the LfjOpauth options.

An example of the lfjopauth.global.php file:

The configuration is pretty much the same as the Opauth configuration, without the path and callback_url options, which are handled by the module.

The check_controller_enabled flag enables or disables access to CheckController.

Alternatively, an option provider can be set using the Service Manager to replace the current configuration loader. To do that, you just have to :

This can be usefull if you want to load your configuration from database or generate configuration for complexe cases.

Login and callback urls

Given the above configuration (and the corresponding Facebook applications), you will be able to login using:

and to logout using:

For the two demo Facebook application described in the example configuration, you should use

as value of the Website with Facebook Login, Site URL option.

Events

The LfjOpauth\Service\OpauthService triggers the LfjOpauth\LfjOpauthEvent::EVENT_LOGIN_CALLBACK event after the callback is processed. Be aware that the LfjOpauth\LfjOpauthEvent::EVENT_LOGIN_CALLBACK event is alwais triggered, even when the login process fails. Use the available event parameters to implement result checking.

The event contains three parameters:

and its target is an instance of LfjOpauth\Service\OpauthService.

As en example on how to attach to the event, please refer to the following code.

Custom callback urls

If you need custom login and/or callback urls (for example containing more parameters), you can code custom routes and controller.

This is the code that defines the custom_lfjopauth_login and custom_lfjopauth_callback routes (custom-auth is the controller alias):

This is the code of the hypothetical controller that manages login and callback actions:

Checking login status

If the check_controller_enabled flag is enabled, you will be able to print current session info at this url:

The default value of check_controller_enabled is false.

Other info

LfjOpauth uses Zend\Authentication\AuthenticationService (alias lfjopauth_auth_service) to manage authentication.

The LfjOpauth\Service\OpauthService (alias: opauth_service) class exposes the redirect and callback methods which can be used in any controller. An example can be found in the LfjOpauth\Controller\LoginController class.

LICENSE

The files in this archive are released under the MIT license. You can find a copy of this license in LICENSE.txt.


All versions of lfj-opauth with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3
opauth/opauth Version 0.4.4
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 lorenzoferrarajr/lfj-opauth contains the following files

Loading the files please wait ....