npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

laravel-oidc-client

v1.0.1

Published

A Laravel package for delegating authentication to an OpenID Provider.

Downloads

5

Readme

OIDC Client

A Laravel package for delegating authentication to an OpenID Provider.

This package is an heavenly modified fork of cabinetoffice / oidc-client — Bitbucket

Requirements

  • PHP 8.0+
  • Laravel 8+
  • Composer 2

Installation

Begin by adding this package to your depedencies with the command:

composer require autisid/laravel-oidc-client

If you have opted out from auto discovery, you'll need to add the following line to the list of registered service providers in config/app.php:

Autisid\OIDCClient\OIDCServiceProvider::class

Edit your config/auth.php file to use OpenID as the authentication method for your users:

'guards' => [
    'web' => [
        'driver' => 'oidc',
        ...
    ],
    ...
],

Configuration

You can set the following environment variables to adjust the package settings:

  • OIDC_CLIENT_ID: Client ID of your app. This is commonly provided by your OIDC provider.
  • OIDC_CLIENT_SECRET: Client secret of your app. This is commonly provided by your OIDC provider.
  • OIDC_PROVIDER_URL: URL of your OIDC provider. This is used if your provider supports OIDC Auto Discovery.
  • OIDC_PROVIDER_NAME: This is a short name for your OpenID provider, which will only appears in your OpenID routes. Do not use spaces. Defaults to oidc
  • OIDC_CALLBACK_ROUTE_PATH: A path (with or without leading slash) to append to the provider name, to make the callback route path. Defaults to callback Example with the default values: oidc/callback (OIDC_PROVIDER_NAME + / + OIDC_CALLBACK_ROUTE_PATH)
  • OIDC_VERIFY: Verify SSL when sending requests to the server. Defaults to true. (Optional: You can set OIDC_CERT_PATH to an SSL certificate path if you set this option to false)
  • OIDC_HTTP_PROXY: If you have a proxy, set it here.
  • OIDC_SCOPES: A list of scopes, separated by a comma (,). Defaults to ['openid']. Example of valid value: openid,email
  • OIDC_AUTHORIZATION_ENDPOINT_QUERY_PARAMS: A list of query parameters to add to the authorization endpoint encoded as a JSON object. Example of valid value: {"response_type":"code"}
  • OIDC_DISABLE_STATE_MIDDLEWARE_FOR_POST_CALLBACK: A boolean to disable the registration of the OIDCStateMiddleware middleware.
    This middleware rebuilds the session token held in the state parameter of a POST request to the callback route.
  • OIDC_SUB_COLUMN: A column name to store uuid from openid to your user table.

You can find other options to set and their env variables in config/oidc.php. Note that some options are not required (like endpoints) if you use OIDC auto discovery!

You can also publish the config file (config/oidc.php) if you want:

php artisan vendor:publish --provider="Autisid\OIDCClient\OIDCServiceProvider"

How to use

Once everything is set up, you can replace your login system with a call to the route route('oidc.login'). For logouts, use the route route('oidc.logout').

You can set the following environment variables to specify the routes/URLs you want your users to be redirected to upon successful authentication/logout: OIDC_REDIRECT_PATH_AFTER_LOGIN and OIDC_REDIRECT_PATH_AFTER_LOGOUT.

You may want to create your own User model. If yes, then you must extend Autisid\OIDCClient\User in order to get auth working.

Check your auth.providers.users.model config value: it must be set to your custom User model or to Autisid\OIDCClient\User instead.


Originally developed by Cabinet Office Digital Development in October 2019.

Currently maintained by maicol07 from October 2021

Modified by autisid in Februari 2023