PHP code example of polaris / sso

1. Go to this page and download the library: Download polaris/sso library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

polaris / sso example snippets


use Polaris\Admin\AdminPlugin;
use Polaris\Audit\AuditPlugin;
use Polaris\Sso\SsoPlugin;

$polaris = Polaris::create(new Config(..., plugins: [
    new AuditPlugin(),
    new AdminPlugin(),
    new SsoPlugin(baseUrl: 'https://app.example.com/auth', httpClient: $client, requestFactory: $requests, streamFactory: $streams),
]));

new SsoPlugin(
    baseUrl: 'https://app.example.com/auth',
    httpClient: $client, requestFactory: $requests, streamFactory: $streams,   // PSR-18 and PSR-17, for OIDC and the HTTPS domain check
    spCertificate: $pem, spPrivateKey: $key,   // optional: signed AuthnRequests and logout messages, encrypted assertions, the certificate in the metadata
    oidc: new MyOidc(), saml: new MySaml(),    // optional: your own protocol implementations (the tests use fakes)
    domains: new MyDomainVerifier(),
);