Catalyst-Plugin-OpenIDConnect
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/OpenIDConnect/Context.pm view on Meta::CPAN
package Catalyst::Plugin::OpenIDConnect::Context;
use Moose;
use namespace::autoclean;
use Catalyst::Plugin::OpenIDConnect::Utils::Store;
# Per-application-class storage for extension-point callbacks.
# Keyed by the consuming application class name so that multiple Catalyst apps
# loaded in the same interpreter each hold their own handlers.
my %_scope_handler_by_class;
my %_claims_provider_by_class;
=head1 NAME
Catalyst::Plugin::OpenIDConnect::Context - OIDC provider context object
=head1 DESCRIPTION
Context object passed to controllers for accessing OIDC functionality.
=head1 ATTRIBUTES
=head2 catalyst
The Catalyst application instance.
=cut
has catalyst => (
is => 'ro',
required => 1,
);
=head1 METHODS
=head2 jwt()
Returns the JWT handler instance.
=cut
sub jwt {
my ($self) = @_;
$self->catalyst->log->debug('Retrieving JWT handler') if $self->config->{debug};
my $jwt = $self->catalyst->_oidc_jwt();
unless ($jwt) {
$self->catalyst->log->error('OpenID Connect JWT handler not initialized');
die 'OpenID Connect JWT handler not initialized. Check your Plugin::OpenIDConnect configuration (issuer.private_key_file and issuer.public_key_file required).';
}
return $jwt;
}
=head2 store()
Returns the state store instance.
=cut
sub store {
my ($self) = @_;
$self->catalyst->log->debug('Retrieving state store') if $self->config->{debug};
my $store = $self->catalyst->_oidc_store();
return $store if $store;
$self->catalyst->log->debug('Creating new state store instance') if $self->config->{debug};
my $store_class = $self->config->{store_class}
( run in 2.529 seconds using v1.01-cache-2.11-cpan-995e09ba956 )