Ryo Ito > OIDC-Lite-0.06 > OIDC::Lite::Server::Endpoint::Token

Download:
OIDC-Lite-0.06.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Source   Latest Release: OIDC-Lite-0.07

NAME ^

OIDC::Lite::Server::Endpoint::Token - token endpoint PSGI application

SYNOPSIS ^

token_endpoint.psgi

    use strict;
    use warnings;
    use Plack::Builder;
    use OIDC::Lite::Server::Endpoint::Token;
    use MyDataHandlerClass;

    builder {
        my $app = OIDC::Lite::Server::Endpoint::Token->new(
            data_handler => 'MyDataHandlerClass',
        );
        $app->support_grant_types(qw(authorization_code refresh_token));
        $app;
    };

DESCRIPTION ^

The object of this class behaves as PSGI application (subroutine reference). This is for OpenID Connect token-endpoint.

At first you have to make your custom class inheriting OIDC::Lite::Server::DataHandler, and setup PSGI file with it.

METHODS ^

new( %params )

data_handler

name of your custom class that inherits OIDC::Lite::Server::DataHandler and implements interface.

error_uri

Optional. URI that represents error description page. This would be included in error responses.

support_grant_type( $type )

You can set 'authorization_code', 'password', 'client_credentials' or 'refresh_token'

support_grant_types( @types )

You can set 'authorization_code', 'password', 'client_credentials' or 'refresh_token'

TEST ^

You can test with OAuth::Lite2::Agent::PSGIMock and some of client classes.

    my $app = OIDC::Lite::Server::Endpoint::Token->new(
        data_handler => 'MyDataHandlerClass',
    );
    $app->support_grant_types(qw(authorization_code refresh_token));
    my $mock_agent = OAuth::Lite2::Agent::PSGIMock->new(app => $app);
    my $client = OAuth::Lite2::Client::UsernameAndPassword->new(
        id     => q{my_client_id},
        secret => q{my_client_secret},
        agent  => $mock_agent,
    );
    my $token = $client->get_access_token(
        username => q{foo},
        password => q{bar},
    );
    ok($token);
    is($token->access_token, q{access_token_value});

AUTHOR ^

Ryo Ito, <ritou.06@gmail.com>

COPYRIGHT AND LICENSE ^

Copyright (C) 2012 by Ryo Ito

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: