The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Catalyst::Authentication::Credential::OAuth2 - Authenticate against OAuth2 servers

VERSION

version 0.001008

SYNOPSIS

    __PACKAGE__->config(
      'Plugin::Authentication' => {
        default => {
          credential => {
            class     => 'OAuth2',
            grant_uri => 'http://authserver/request',
            token_uri => 'http://authserver/token',
            client_id => 'dead69beef'
          },
          store => { class => 'Null' }
        }
      }
    );

DESCRIPTION

This module implements authentication via OAuth2 credentials, giving you a user object which stores tokens for accessing protected resources.

ATTRIBUTES

grant_uri

token_uri

client_id

Required attributes that you get from your Oauth2 provider

client_secret

optional secret code from your Oauth2 provider (you need to review the docs from your provider).

scope

Value of 'scope' field submitted to the grant_uri. Optional.

audience

Value of 'audience' field submitted to the grant_uri. Optional.

token_uri_method

Default is GET; some providers require POST

token_uri_post_content_type

Default is 'application/x-www-form-urlencoded', some providers support 'application/json'.

has_extra_find_user_token_fields

By default we call ->find_user on the store with a hashref that contains key 'token' and the value of the access_token (which we get from calling the 'token_uri'). The results of calling the token_uri is usually a JSON named array structure which can contain other fields such as id_token (typically a JWT). You can set this to an arrayref of extra fields you want to pass.

AUTHOR

Eden Cardim <edencardim@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Suretec Systems Ltd.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.