2017 © Pedro Peláez
 

library openid-connect-with-client-credentials-php

image

krisrandall/openid-connect-with-client-credentials-php

  • Tuesday, July 31, 2018
  • by krisr
  • Repository
  • 2 Watchers
  • 1 Stars
  • 39 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 147 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

Forked Version

This version was originally forked so as to add the Client Credentials connect flow endpoint. It is maintained because it includes a special condition preventing an error., (*1)

To bring the latest changes over from the original jumbojett repo use :, (*2)

$ git pull upstream master

PHP OpenID Connect Basic Client

A simple library that allows an application to authenticate a user through the basic OpenID Connect flow. This library hopes to encourage OpenID Connect use by making it simple enough for a developer with little knowledge of the OpenID Connect protocol to setup authentication., (*3)

A special thanks goes to Justin Richer and Amanda Anganes for their help and support of the protocol., (*4)

Requirements

  1. PHP 5.4 or greater
  2. CURL extension
  3. JSON extension

Install

  1. Install library using composer
composer require jumbojett/openid-connect-php:0.1.*
  1. Include composer autoloader
require '/vendor/autoload.php';

Example 1: Basic Client

$oidc = new OpenIDConnectClient('https://id.provider.com',
                                'ClientIDHere',
                                'ClientSecretHere');
$oidc->setCertPath('/path/to/my.cert');
$oidc->authenticate();
$name = $oidc->requestUserInfo('given_name');

[See openid spec for available user attributes][1], (*5)

Example 2: Dynamic Registration

$oidc = new OpenIDConnectClient("https://id.provider.com");

$oidc->register();
$client_id = $oidc->getClientID();
$client_secret = $oidc->getClientSecret();

// Be sure to add logic to store the client id and client secret

Example 3: Network and Security

// Configure a proxy
$oidc->setHttpProxy("http://my.proxy.com:80/");

// Configure a cert
$oidc->setCertPath("/path/to/my.cert");

Example 4: Request Client Credentials Token

$oidc = new OpenIDConnectClient('https://id.provider.com/',
                                'ClientIDHere',
                                'ClientSecretHere');
$oidc->providerConfigParam(array('token_endpoint'=>'https://id.provider.com/connect/token'));
$oidc->addScope('my_scope');

// this assumes success (to validate check if the access_token property is there and a valid JWT) :
$clientCredentialsToken = $oidc->requestClientCredentialsToken()->access_token;

Example 4: Request Client Credentials Token

$oidc = new OpenIDConnectClient('https://id.provider.com',
                                'ClientIDHere',
                                'ClientSecretHere');
$oidc->providerConfigParam(array('token_endpoint'=>'https://id.provider.com/connect/token'));
$oidc->addScope('my_scope');

// this assumes success (to validate check if the access_token property is there and a valid JWT) :
$clientCredentialsToken = $oidc->requestClientCredentialsToken()->access_token;

Development Environments

In some cases you may need to disable SSL security on on your development systems. Note: This is not recommended on production systems., (*6)

$oidc->setVerifyHost(false);
$oidc->setVerifyPeer(false);

Todo

  • Dynamic registration does not support registration auth tokens and endpoints

The Versions

31/07 2018

dev-jumbojett-patch-1

dev-jumbojett-patch-1

  Sources   Download

25/05 2017

dev-master

9999999-dev

Bare-bones OpenID Connect client

  Sources   Download

The Requires

 

25/05 2017

0.3.2

0.3.2.0

Bare-bones OpenID Connect client

  Sources   Download

The Requires

 

10/03 2017

0.3.1

0.3.1.0

Bare-bones OpenID Connect client

  Sources   Download

The Requires

 

10/01 2017

dev-merge-back-to-jumbojett

dev-merge-back-to-jumbojett

Bare-bones OpenID Connect client

  Sources   Download

The Requires

 

10/01 2017

0.3.0

0.3.0.0

Bare-bones OpenID Connect client

  Sources   Download

The Requires

 

13/12 2016

dev-client_credentials

dev-client_credentials

Bare-bones OpenID Connect client

  Sources   Download

The Requires

 

13/08 2016

0.2.0

0.2.0.0

Bare-bones OpenID Connect client

  Sources   Download

The Requires

 

04/03 2016

0.1.0

0.1.0.0

Bare-bones OpenID Connect client

  Sources   Download

The Requires

 

04/09 2015

dev-add-license

dev-add-license

Bare-bones OpenID Connect client

  Sources   Download

The Requires