chillrend / pnj-socialite-provider
A Socialite Provider for PNJ SSO
v1.1
2021-12-03 02:08 UTC
Requires
- php: ^7.2|^8.0
- ext-json: *
- socialiteproviders/manager: ^4.0
This package is auto-updated.
Last update: 2024-04-06 05:58:04 UTC
README
composer require chillrend/pnj-socialite-provider
Installation & Basic Usage
Please see the Base Installation Guide, then follow the provider specific instructions below.
Add configuration to config/services.php
'pnj' => [ 'client_id' => env('CLIENT_ID'), 'client_secret' => env('CLIENT_SECRET'), 'redirect' => env('REDIRECT_URI') ],
Add provider event listener
Configure the package's listener to listen for SocialiteWasCalled
events.
Add the event to your listen[]
array in app/Providers/EventServiceProvider
. See the Base Installation Guide for detailed instructions.
protected $listen = [ \SocialiteProviders\Manager\SocialiteWasCalled::class => [ // ... other providers 'SocialiteProviders\\PNJ\\PNJExtendSocialite@handle', ], ];
Usage
You should now be able to use the provider like you would regularly use Socialite (assuming you have the facade installed):
return Socialite::driver('pnj')->redirect();
Returned User fields
sub
the system internal ID of a userident
the user's internal identification number (can be a NIP (Nomor Induk Pegawai) or NIM (Nomor Induk Mahasiswa) depends on the access level of the user)name
the user's full nameemail
the user's email addressaddress
the user's home addressdate_of_birth
the user's date of birthdepartment_and_level
the user's access level and the user's department (in array)access_level
the user's access level in a departmentaccess_level_name
the 'human readable' representation of the access leveldepartment
the user's departmentdepartment_short_name
the department short abbreviation or name
JSON Representative of the user fields
{ "address": "187 Justen Point Suite 090\nWest Shania, TX 99746-9546", "date_of_birth": "1979-03-14", "department_and_level": [ { "access_level": 99, "access_level_name": "Admin", "department": "Teknik Informatika dan Komputer", "department_short_name": "TIK" } ], "email": "wilkinson.marquise@example.com", "iat": 1622287930, "ident": 80779, "name": "Prof. Ivory Ferry", "sub": "4" }