Catalyst-Plugin-OpenIDConnect
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/OpenIDConnect.pm view on Meta::CPAN
package Catalyst::Plugin::OpenIDConnect;
use strict;
use warnings;
use Moose::Role;
use namespace::autoclean;
use Catalyst::Plugin::OpenIDConnect::Context;
use Catalyst::Plugin::OpenIDConnect::Utils::JWT;
use Catalyst::Plugin::OpenIDConnect::Utils::Store;
use Catalyst::Plugin::OpenIDConnect::Role::Store;
use Crypt::OpenSSL::RSA;
use Crypt::PK::RSA;
use JSON::MaybeXS qw(encode_json decode_json);
use Try::Tiny;
use DateTime;
use DateTime::Format::ISO8601;
use Data::UUID;
use URI;
our $VERSION = '0.15';
=head1 NAME
Catalyst::Plugin::OpenIDConnect - OpenID Connect provider plugin for Catalyst
=head1 DESCRIPTION
A Catalyst plugin implementing the OpenID Connect specification,
providing OAuth 2.0 authentication and authorization. Note that this plugin
does not implement the OIDC Client role; it is intended for applications
acting as OIDC providers (authorization servers).
This plugin provides the core OpenIDConnect functionality (JWT handling,
state management, and a reusable controller). To use it in your application,
you must create a controller in your app's namespace that extends the plugin's
controller (see below). This allows you to keep full control over your routing
while cooperating with ACL and other route-processing plugins.
=head1 CONFIGURATION
package MyApp;
use Catalyst qw/
OpenIDConnect
Session
Session::Store::File
Session::State::Cookie
/;
MyApp->config(
'Plugin::OpenIDConnect' => {
issuer => {
url => 'http://localhost:5000',
private_key_file => '/path/to/private.pem',
public_key_file => '/path/to/public.pem',
key_id => 'key-123',
},
clients => {
'my-client' => {
client_secret => 'secret123',
redirect_uris => ['http://localhost:3000/callback'],
response_types => ['code'],
grant_types => ['authorization_code'],
scope => 'openid profile email',
},
},
},
);
=head1 CREATING THE OPENIDCONNECT CONTROLLER
To enable the OpenIDConnect endpoints, create a controller in your app that extends
the plugin's controller. Create the file C<lib/MyApp/Controller/OpenIDConnect.pm>
(where MyApp is your app's namespace) with the following content:
( run in 0.875 second using v1.01-cache-2.11-cpan-5fbc6bb55f2 )