Download the PHP package javaabu/efaas-socialite without Composer

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

eFaas Laravel Socialite

Latest Version on Packagist Total Downloads

Laravel Socialite Provider for eFaas.

Note: Current version of this package is based on eFaas Documentation version 2.2

Requirements

This package requires the following:

Installation

For Laravel 6.0+, you can install the package via composer:

For Laravel 5.6, use version 1.x

Add configuration to your .env file

Add the following config to your .env file

Publishing the config file

Optionally you can also publish the config file to config/efaas.php:

This is the default content of the config file:

Publishing migrations

This package ships with the migrations for an efaas_sessions table which can be used to implement back channel logout. You can publish these migrations using the following Artisan command:

After publishing the migrations, you can run them:

Usage

Note: A demo implementation of this package is available here.

You should now be able to use the provider like you would regularly use Socialite (assuming you have the facade installed): Refer to the Official Social Docs for more info.

Warning: If you get 403 Forbidden error when your Laravel app makes requests to the eFaas authorization endpoints, request NCIT to whitelist your server IP.

and in your callback handler, you can access the user data like so. Remember to save the user's id_token and sid (session id).

Enabling PKCE

By default, this package has PKCE disabled. To enable PKCE, use the enablePKCE() method in both your redirect call and the callback handler.

Logging out the eFaas User

In your Laravel logout redirect, redirect with the provider logOut() method using the id token saved during login

Note: Since the id_token can be very long, you might run into nginx errors when redirecting. To fix this you can add the following to your nginx config. More info here.

Using eFaas One-tap Login

This package will automatically add an /efaas-one-tap-login endpoint to your web routes which will redirect to eFaas with the eFaas login code.

Sometimes you may wish to customize the routes defined by the Efaas Provider. To achieve this, you first need to ignore the routes registered by Efaas Provider by adding EfaasProvider::ignoreRoutes to the register method of your application's AppServiceProvider:

Then, you may copy the routes defined by Efaas Provider in its routes file to your application's routes/web.php file and modify them to your liking:

Implementing Front Channel Single Sign Out

First, during login, in your efaas callback handler method, save the users sid (session ID) to your session.

Then, in your single sign out controller handler method, first retrieve the logout token's sid using the eFaas provider's getLogoutSid() method. The method will return null if the provided logout token is invalid. You can then compare the saved sid in your current session with the retrieved sid and logout the user if they match.

Implementing Back Channel Single Sign Out

For Back Channel Logout, you will need to use Laravel's database session driver and the provided efaas_sessions migration.

During login, save the user's sid (session ID) using the eFaas provider's sessionHandler():

Then, in your single sign out controller handler method, first retrieve the logout token's sid using the eFaas provider's getLogoutSid() method. The method will return null if the provided logout token is invalid. You can then use the eFaas provider's sessionHandler() to logout all laravel sessions that match the sid.

Authenticating from mobile apps

To authenticate users from mobile apps, redirect to the eFaas login screen through a Web View on the mobile app. Then intercept the code (authorization code) from eFaas after they redirect you back to your website after logging in to eFaas.

Once your mobile app receives the auth code, send the code to your API endpoint. You can then get the eFaas user details from your server side using the auth code as follows. Remember to use the stateless() option as the redirect had originated outside of your server:

After you receive the eFaas user, you can then issue your own access token or API key according to whatever authentication scheme you use for your API.

Changing the eFaas login prompt behaviour

The eFaas login prompt behaviour can be customized by modifying the prompt option on your redirect request

The available prompt options are:

Option Description
login Forces the user to enter their credentials on that request, regardless of whether the user is already logged into eFaas.
none Opposite of the login option. Ensures that the user isn't presented with any interactive prompt. If the request can't be completed silently by using single-sign on, the Microsoft identity platform returns an interaction_required error.
consent Triggers the OAuth consent dialog after the user signs in, asking the user to grant permissions to the app.
select_account Interrupts the single sign-on, providing account selection experience listing all the accounts either in session or any remembered account or an option to choose to use a different account altogether

Available Methods for eFaas Provider

Available Methods and Public Properties for eFaas User

Changing the eFaas request scopes

By default, this package adds all available scopes to the eFaas redirect. You can modify the default scopes by publishing the package config file and changing the scopes. To customize the scopes on a per request basis, you can override the scopes during the redirect.

Getting eFaas data from eFaas User object

Available eFaas data fields

Different data is associated with different scopes. By default, all scopes are included, so you should be able to get all the data fields.

Scope: efaas.openid
Field Type Description Example
sub string Unique user key assigned to the user 178dedf2-581b-4b48-9d73-770f302751dc
Scope: efaas.profile
Field Type Description Example
first_name string First name of the user Mariyam
middle_name string Middle name of the user Ahmed
last_name string Last name of the user Rasheed
first_name_dhivehi string First name of the user in Dhivehi (Maldivians only) މަރިޔަމް
middle_name_dhivehi string Middle name of the user in Dhivehi (Maldivians only) އަހުމަދު
last_name_dhivehi string Last name of the user in dhivehi (Maldivians only) ރަޝީދު
gender string Gender of the user M / F
idnumber string Identification number of the user
- National ID number for Maldivians
- Work permit number for work permit holders
- Passport number for other foreigners
A000111 / WP941123 / LA110011
verified bool Indicates if the user is verified True / False
verification_type string Type of verification taken by the user biometric / in-person / NA
last_verified_date Carbon The last date when the user was verified either using biometrics or by visiting an eFaas verification counter. 6/26/2019 9:18:11 AM
user_type_description string Indicates the type of user Maldivian / Work Permit Holder / Foreigner
updated_at Carbon The last date when the user information was updated 6/15/2023 2:12:38 PM
Scope: efaas.email
Field Type Description Example
email string Email of the user [email protected]
Scope: efaas.mobile
Field Type Description Example
mobile string Mobile number of the user 9074512
country_dialing_code string Dialing code of the registered number +960
Scope: efaas.birthdate
Field Type Description Example
birthdate string Date of birth of the user 12/20/1990
Scope: efaas.photo
Field Type Description Example
photo string Photo of the user https://efaas-api egov.mv/user/photo
Scope: efaas.work_permit_status
Field Type Description Example
is_workpermit_active bool Boolean indicating if the work permit is active (only applicable to work permit holders) true / false
Scope: efaas.passport_number
Field Type Description Example
passport_number string Passport number of the user LA110011
Scope: efaas.country
Field Type Description Example
country_name string Name of the country of the user Maldives
country_code int ISO 3-digit code 462
country_code_alpha3 string ISO alpha3 code MDV
country_dialing_code string Dialing code of the country +960
Scope: efaas.permanent_address
Field Type Description Example
permanent_address EfaasAddress Permanent address of the user Given below

Here are the fields of the EfaasAddress object:

Field Type Example
AddressLine1 string Blue Light
AddressLine2 string ``
Road string Road Name
AtollAbbreviation string K
AtollAbbreviationDhivehi string ކ
IslandName string Male
IslandNameDhivehi string މާލެ
HomeNameDhivehi string ބުލޭ ލައިޓް
Ward string Maafannu
WardAbbreviationEnglish string M
WardAbbreviationDhivehi string މ
Country string Maldives
CountryISOThreeDigitCode string 462
CountryISOThreeLetterCode string MDV

The EfaasAddress class also has the following methods:

Testing

You can run the tests with

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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


All versions of efaas-socialite with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0 || ^8.1
ext-openssl Version *
laravel/socialite Version ^5.15
illuminate/support Version ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0
lcobucci/jwt Version ^4.3 || ^5.0
lcobucci/clock Version ^2.0 || ^3.0
strobotti/php-jwk Version ^1.4
phpseclib/phpseclib Version ^3.0.39
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 javaabu/efaas-socialite contains the following files

Loading the files please wait ....