ids/login

IDS authentication package

Maintainers

Details

repo.fnbpos.net/ids/ids-login

Installs: 554

Dependents: 0

Suggesters: 0

Security: 0

pkg:composer/ids/login


README

This package is used to generate the scaffolding of IDS Login (IDS API Client / SDK)

Installation

  1. Add the following into composer.json:
composer require ids/login
  1. Publish the vendor files
php artisan vendor:publish --provider="IDS\Login\IDSLoginServiceProvider"

3a. Run migration files

php artisan migrate

3b. Run migration for tenants (If Multitenant is setup)

php artisan tenants:migrate

Setting up

Environment variables

Set up/make sure you have the variables in the .env file as below:

BROADCAST_DRIVER=pusher

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=
PUSHER_APP_HOST=
PUSHER_APP_PORT=

IDS_LOGIN_REDIRECT_TO=
IDS_UDID=

IDS_HOST=
IDS_PASSWORD_CLIENT_ID=
IDS_PASSWORD_SECRET=
IDS_CLIENT_CREDENTIAL_CLIENT_ID=
IDS_CLIENT_CREDENTIAL_SECRET=
IDS_QR_REDIRECT_ID=

IDS_LOGIN_RESTRICTED=
IDS_LOGIN_ALLOW_LOCAL_AUTH=

config/app.php

Define service provider AFTER App\Providers\RouteServiceProvider::class

<?php
'providers' => [
    App\Providers\RouteServiceProvider::class,
    IDS\Login\IDSLoginServiceProvider::class
]
>

config/broadcasting.php

Set up/make sure you have the variables set up correctly in config/broadcasting.php:

<?php
'connections' => [

    'pusher' => [
        'driver' => 'pusher',
        'key' => env('PUSHER_APP_KEY'),
        'secret' => env('PUSHER_APP_SECRET'),
        'app_id' => env('PUSHER_APP_ID'),
        'options' => [
            'cluster' => env('PUSHER_APP_CLUSTER'),
            'host' => env('PUSHER_APP_HOST'),
            'port' => env('PUSHER_APP_PORT'),
            'useTLS' => true,
            'encrypted' => true,
            'scheme' => 'https',
        ],
    ],
]

Configuration

<?php
return [
    // Redirecting to a specific path after successful login
    'login_redirect_to' => env('IDS_LOGIN_REDIRECT_TO', '/'),

    // This is the base url for IDS server
    'host' => env('IDS_HOST', null),

    // IDS's UDID
    'udid' => env('IDS_UDID', 'ids-login'),

    // Password grant
    'password_grant' => [
        'client_id' => env('IDS_PASSWORD_CLIENT_ID', null),
        'secret' => env('IDS_PASSWORD_SECRET', null)
    ],

    // Client credentials
    'client_credentials' => [
        'client_id' => env('IDS_CLIENT_CREDENTIAL_CLIENT_ID', null),
        'secret' => env('IDS_CLIENT_CREDENTIAL_SECRET', null),
    ],

    'qr_login' => [
        'qr_redirect_id' => env('IDS_QR_REDIRECT_ID', null),
        'qr_redirect_url' => env('IDS_QR_REDIRECT_URL', env('APP_URL') . "/qr_login/callback")
    ],

    // if == true, when there is no user data in local database, then show an error
    // if == false, system will automatically create the user data to local database and allowed to login
    // if user doesnt exist in database, it will be created for first time sign in
    'restricted' => env('IDS_LOGIN_RESTRICTED', false),

    // if true, if IDS failed, then will attempt to login using local database
    // if false, if IDS failed, then show an error IDS error (credential not found).
    'allow_local_auth' => env('IDS_LOGIN_ALLOW_LOCAL_AUTH', true),

    'user_model' => "IDS\\Login\\Models\\User",

    'callbacks' => [
        // Route name
        // 'login_failed' => 'local.login',
        'login_failed' => null
    ],

    // Field name of ids_id in your users table
    'attributes' => [
        'ids_id' => 'ids_id'
    ],

    'project_name' => 'IDS Login',
    'project_title' => 'IDS Login',
    'migrate_vplus_ids' => env('MIGRATE_VPLUS_ID', false),

    // These configs are custom field name in your users table
    'username_field' => 'username',
    'email_field' => 'email',
    'phone_field' => 'phone',
    'password_field' => 'password',

    // Logo path, put it under /public/images folder
    'logo_path' => 'images/logo.png',

    // These configs to customize your authentication process
    'ids_auth_page' => [
        // Change this if you want to customize the path of your view files
        'ids_login_page' => 'ids.auth.login',
        'ids_register_page' => 'ids.auth.register',
        'ids_submit_otp' => 'ids.auth.submit_otp',
        'ids_reset_password_page' => 'ids.auth.reset-password.request-password',

        'settings' => [
            'is_protected' => true,
            'middleware' => ['auth', 'store', 'installed'],
        ],
        'auth_logo' => '',
        'auth_show_logo' => true,
        'auth_logo_width' => '100',
        'auth_logo_height' => '100',
        'auth_background_image' => '',
        'auth_title1' => env('APP_NAME', 'IDS Login'),
        'auth_title2' => '',
        'auth_subtitle' => '',
        'auth_background_color' => '#0b0506',
        'auth_color_theme' => '#1592E9',
        'button_color_label' => '#ffffff',
        'auth_primary_text_color' => '#ffffff',
        'auth_secondary_text_color' => '#464647',
        'auth_form_dark_mode' => true,
        'auth_header_alignment' => 'left',
        'auth_qr_horizontal_alignment' => 'center',
        'auth_qr_vertical_alignment' => 'center',
        'auth_qr_box_color' => '#ffffff',
        'auth_qr_background_type' => 'default',
        'auth_qr_background_default' => 'bg-gradient-to-tr from-[#741F4C]/15 from-10% to-[#2D8ACA]/15 to-80% ',
        'auth_qr_background_color' => '#ffffff',
        'auth_qr_background_image' => '',
        'forgot_password_title1' => '',
        'forgot_password_title2' => '',
    ]
];