Download the PHP package uptd-pelita/sso-broker-sdk without Composer
On this page you can find all versions of the php package uptd-pelita/sso-broker-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download uptd-pelita/sso-broker-sdk
More information about uptd-pelita/sso-broker-sdk
Files in uptd-pelita/sso-broker-sdk
Package sso-broker-sdk
Short Description SSO Broker SDK for Bali Province Applications
License MIT
Informations about the package sso-broker-sdk
SSO Broker SDK for Bali Province Applications
A Laravel package for integrating Single Sign-On (SSO) authentication with Bali Province SSO Server.
Requirements
- PHP 7.4+ or PHP 8.0+
- Laravel 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, or 12.0
- GuzzleHTTP 6.0+ or 7.0+
Installation
Via Composer (Private GitLab Repository)
Since this is a private repository, you need to configure Composer to access it.
Step 1: Run composer update:
Using Tagged Versions (Recommended for Production)
Once tags are created in the repository, use specific versions:
To create a version tag:
Configuration
1. Publish Configuration
2. Environment Variables
Add the following to your .env file:
3. Optional: Publish Routes
If you want to customize routes:
Then set SSO_LOAD_DEFAULT_ROUTES=false in your .env file.
Basic Usage
Protecting Routes with Middleware
Using the Facade
Manual Authentication in Controller
Extending the SDK
Custom Controller
Create a custom controller that extends the base:
Custom SSO Manager
Create a custom manager with additional functionality:
Register your custom manager in a service provider:
Using with Local User Model
Add the HasSSOAuthentication trait to your User model:
Usage:
Custom Routes
Disable default routes and define your own:
Custom Middleware
Extend the middleware for custom behavior:
Register in app/Http/Kernel.php:
Default Routes
| Method | URI | Name | Description |
|---|---|---|---|
| GET/POST | /sso/authenticate | sso.authenticate | Initiate SSO login |
| GET | /auth-data/{authData?} | sso.callback | SSO callback (token in URL path or query string) |
| POST | /sso/logout | sso.logout | Logout callback from SSO |
| GET | /logout | sso.user-logout | User-initiated logout |
| GET | /sso/check | sso.check | Check auth status (API) |
| GET | /sso/user | sso.user | Get user data (API) |
Configuration Options
| Key | Description | Default |
|---|---|---|
sso_domain |
SSO server URL | https://sso.baliprov.go.id |
broker_code |
Broker identifier | '' |
jwt_secret |
JWT secret key | SSO-JWT-SECRET-KEY |
callback_route |
Callback URL path | /auth-data |
redirect_after_login |
Post-login redirect | / |
redirect_after_logout |
Post-logout redirect | / |
not_authorized_route |
Unauthorized route name | not-authorized |
load_default_routes |
Load default routes | true |
route_prefix |
Route prefix | '' |
route_middleware |
Route middleware | ['web'] |
http_timeout |
HTTP request timeout | 30 |
verify_ssl |
Verify SSL certificates | true |
Helper Methods
JWT Class
Migration Example
Create a migration for the sso_user_id column:
Troubleshooting
"Invalid browser session" Error
This occurs when the session ID doesn't match. Ensure:
- Sessions are properly configured
- The same domain is used for login and callback
- Session middleware is applied to SSO routes
SSL Certificate Issues
In development, you can disable SSL verification:
Never disable in production!
Custom Session Driver
If using a custom session driver, ensure it's properly configured before SSO routes are accessed.
License
MIT License. See LICENSE for details.
Contributing
Contributions are welcome! Please submit pull requests with tests.
Support
For issues and questions, please open an issue on the repository.
All versions of sso-broker-sdk with dependencies
guzzlehttp/guzzle Version ^6.0|^7.0
illuminate/support Version ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/routing Version ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0