PHPackages                             novay/sso-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. novay/sso-client

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

novay/sso-client
================

SSO integration for Laravel

1.0.5(5y ago)51041MITPHPPHP &gt;=7.1.3

Since Feb 6Pushed 5y ago1 watchersCompare

[ Source](https://github.com/novay/sso-samarinda)[ Packagist](https://packagist.org/packages/novay/sso-client)[ RSS](/packages/novay-sso-client/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (1)Versions (7)Used By (0)

Integrasi SSO-Samarinda menggunakan Laravel
===========================================

[](#integrasi-sso-samarinda-menggunakan-laravel)

[![Latest Stable Version](https://camo.githubusercontent.com/2e4262eacc80383bd6fd0ae9bcf008196ce3f18a4eb997a8d104f969b257b9a8/68747470733a2f2f706f7365722e707567782e6f72672f6e6f7661792f73736f2d636c69656e742f762f737461626c65)](https://packagist.org/packages/novay/sso-client)[![Total Downloads](https://camo.githubusercontent.com/0b33fdcb8a0389b001ed4bf26009284b834680e62074de2c3d66e7b5ee2e2dce/68747470733a2f2f706f7365722e707567782e6f72672f6e6f7661792f73736f2d636c69656e742f646f776e6c6f616473)](https://packagist.org/packages/novay/sso-client)[![Latest Unstable Version](https://camo.githubusercontent.com/46bf6b5535114e03873d9f8c1d59d8c0d06e187e63580f17e61541e190c00889/68747470733a2f2f706f7365722e707567782e6f72672f6e6f7661792f73736f2d636c69656e742f762f756e737461626c65)](https://packagist.org/packages/novay/sso-client)[![License](https://camo.githubusercontent.com/4d23249940e72966480c3e1b3162636f537b606fa6fe26a00b8be14998328619/68747470733a2f2f706f7365722e707567782e6f72672f6e6f7661792f73736f2d636c69656e742f6c6963656e7365)](https://packagist.org/packages/novay/sso-client)

Package ini berbasis pada [Simple PHP SSO skeleton](https://github.com/zefy/php-simple-sso) dan dibuat khusus agar dapat berjalan dan digunakan di framework Laravel.

Teknologi Single-sign-on (sering disingkat menjadi SSO) adalah teknologi yang mengizinkan pengguna jaringan agar dapat mengakses aplikasi dalam jaringan hanya dengan menggunakan satu akun pengguna saja. Teknologi ini sangat diminati, khususnya dalam jaringan yang sangat besar dan bersifat heterogen (di saat sistem operasi serta aplikasi yang digunakan oleh komputer adalah berasal dari banyak vendor, dan pengguna dimintai untuk mengisi informasi dirinya ke dalam setiap platform yang berbeda tersebut yang hendak diakses oleh pengguna). Dengan menggunakan SSO, seorang pengguna hanya cukup melakukan proses autentikasi sekali saja untuk mendapatkan izin akses terhadap semua layanan yang terdapat di dalam jaringan.

### Requirements

[](#requirements)

- Laravel 5.5+
- PHP 7.1+

### How it works?

[](#how-it-works)

Client visits Broker and unique token is generated. When new token is generated we need to attach Client session to his session in Broker so he will be redirected to Server and back to Broker at this moment new session in Server will be created and associated with Client session in Broker's page. When Client visits other Broker same steps will be done except that when Client will be redirected to Server he already use his old session and same session id which associated with Broker#1.

[![flow](https://camo.githubusercontent.com/cae3b6db73d3a702ad2e8fed045f43aed9be53333ee4a03c8de17c6a51a2baf3/68747470733a2f2f73736f2e73616d6172696e64616b6f74612e676f2e69642f696d672f666c6f772e6a7067)](https://camo.githubusercontent.com/cae3b6db73d3a702ad2e8fed045f43aed9be53333ee4a03c8de17c6a51a2baf3/68747470733a2f2f73736f2e73616d6172696e64616b6f74612e676f2e69642f696d672f666c6f772e6a7067)

Installation
============

[](#installation)

#### 1. Install Package

[](#1-install-package)

Install package ini menggunakan composer.

```
$ composer require novay/sso-client
```

Package ini otomatis akan mendaftarkan service provider kedalam aplikasi Anda.

#### 2. Publish Vendor

[](#2-publish-vendor)

Salin file config `sso.php` ke dalam folder `config/` pada projek Anda dengan menjalankan:

```
$ php artisan vendor:publish --provider="Novay\SSO\Providers\SSOServiceProvider"
```

Berikut adalah isi konten default dari file konfigurasi yang disalin:

```
//config/sso.php

return [
    'name' => 'Single Sign On - Broker (Client)',
    'version' => '1.0.5',

    /*
    |--------------------------------------------------------------------------
    | Redirect to ???
    |--------------------------------------------------------------------------
    | Arahkan kemana Anda akan tuju setelah login berhasil
    |
    */
    'redirect_to' => '/home',

    /*
    |--------------------------------------------------------------------------
    | Konfigurasi auth.php
    |--------------------------------------------------------------------------
    | Pilih guard auth default yang dipakai
    |
    */
    'guard' => 'web',

    /*
    |--------------------------------------------------------------------------
    | Pengaturan Umum untuk Broker
    |--------------------------------------------------------------------------
    | Beberapa parameter yang dibutuhkan untuk broker. Bisa ditemukan di
    | https://sso.samarindakota.go.id
    |
    */
    'server_url' => env('SSO_SERVER_URL', null),
    'broker_name' => env('SSO_BROKER_NAME', null),
    'broker_secret' => env('SSO_BROKER_SECRET', null),

    /*
    |--------------------------------------------------------------------------
    | Custom for UserList
    |--------------------------------------------------------------------------
    | Tentukan Model User yang dipakai
    |
    */
    'model' => '\App\Models\User'
];
```

#### 3. Edit Environment

[](#3-edit-environment)

Buat 3 opsi baru dalam file `.env` Anda:

```
SSO_SERVER_URL=https://sso.samarindakota.go.id
SSO_BROKER_NAME=
SSO_BROKER_SECRET=
```

`SSO_SERVER_URL` berisi URI dari SSO Samarinda. `SSO_BROKER_NAME` dan `SSO_BROKER_SECRET` harus diisi sesuai dengan data aplikasi yang didaftarkan di .

#### 4. Register Middleware

[](#4-register-middleware)

Edit file `app/Http/Kernel.php` dan tambahkan `\Novay\SSO\Http\Middleware\SSOAutoLogin::class` ke grup `web` middleware. Contohnya seperti ini:

```
protected $middlewareGroups = [
	'web' => [
		...
	    \Novay\SSO\Http\Middleware\SSOAutoLogin::class,
	],

	'api' => [
		...
	],
];
```

Apabila dalam implementasinya Anda ingin melakukan penyimpanan sesi atau melakukan manipulasi pada models **User**, Anda juga bisa melakukan custom pada middleware yang telah disediakan. Contohnya:

a) Buat Middleware Baru

```
$ php artisan make:middleware SSOAutoLogin
```

b) Extend **Default Middleware** ke **Custom Middleware**

```
