Introduction
This package enhanced Laravel with easy access to popular Northwestern APIs & webSSO/Duo multi-factor authentication.
| Service | Prerequisites |
|---|---|
| Agentless WebSSO | Apigee API key |
| Azure AD SSO | Registered Azure AD application |
| Directory Search | Data steward approval, Apigee API key |
| EventHub | Topics or queues, Apigee API key |
Installation
Section titled “Installation”You can install the package via composer:
composer require northwestern-sysdev/laravel-soaphp artisan vendor:publish --provider="Northwestern\SysDev\SOA\Providers\NuSoaServiceProvider"And finally, add the options to your .env file (and don’t forget to update .env.example for the rest of your team!) for the services you want to use:
# DirectorySearchDIRECTORY_SEARCH_API_KEY=
# EventHubEVENT_HUB_BASE_URL=https://northwestern-dev.apigee.netEVENT_HUB_API_KEY=EVENT_HUB_EVENT_HUB_HMAC_VERIFICATION_SHARED_SECRET=The API objects should be injected by the Laravel service container. This ensures the configuration is injected into the objects for you:
<?php
namespace App\Http\Controllers;
use Northwestern\SysDev\SOA\DirectorySearch;
class MyController extends Controllers{ protected $ds_api;
public function __construct(DirectorySearch $ds_api) { $this->ds_api = $ds_api; }
}If you are ever in a spot where injection is unavailable, you can always call resolve yourself. This is particularly handy in the tinker console:
$pub = resolve(Northwestern\SysDev\SOA\DirectorySearch::class);For troubleshooting, each API has a getLastError() method. dd()ing the API object should give you everything you’ll need, including the request body and URL.