| 1 | package Net::OAuth2::AuthorizationServer; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Net::OAuth2::AuthorizationServer - Easier implementation of an OAuth2 | ||
| 6 | Authorization Server | ||
| 7 | |||
| 8 | =for html | ||
| 9 | <a href='https://travis-ci.org/Humanstate/net-oauth2-authorizationserver?branch=master'><img src='https://travis-ci.org/Humanstate/net-oauth2-authorizationserver.svg?branch=master' alt='Build Status' /></a> | ||
| 10 | <a href='https://coveralls.io/github/Humanstate/net-oauth2-authorizationserver?branch=master'><img src='https://coveralls.io/repos/github/Humanstate/net-oauth2-authorizationserver/badge.svg?branch=master' alt='Coverage Status' /></a> | ||
| 11 | |||
| 12 | =head1 VERSION | ||
| 13 | |||
| 14 | 0.28 | ||
| 15 | |||
| 16 | =head1 SYNOPSIS | ||
| 17 | |||
| 18 | my $Server = Net::OAuth2::AuthorizationServer->new; | ||
| 19 | |||
| 20 | my $Grant = $Server->$grant_type( | ||
| 21 | ... | ||
| 22 | ); | ||
| 23 | |||
| 24 | =head1 DESCRIPTION | ||
| 25 | |||
| 26 | This module is the gateway to the various OAuth2 grant flows, as documented | ||
| 27 | at L<https://tools.ietf.org/html/rfc6749>. Each module implements a specific | ||
| 28 | grant flow and is designed to "just work" with minimal detail and effort. | ||
| 29 | |||
| 30 | Please see L<Net::OAuth2::AuthorizationServer::Manual> for more information | ||
| 31 | on how to use this module and the various grant types. You should use the manual | ||
| 32 | in conjunction with the grant type module you are using to understand how to | ||
| 33 | override the defaults if the "just work" mode isn't good enough for you. | ||
| 34 | |||
| 35 | =cut | ||
| 36 | |||
| 37 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 38 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 39 | |||
| 40 | 1 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 41 | 1 | ▶ | use Types::Standard qw/ :all /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 42 | |||
| 43 | 1 | ▶ | use Net::OAuth2::AuthorizationServer::AuthorizationCodeGrant; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 44 | 1 | ▶ | use Net::OAuth2::AuthorizationServer::ImplicitGrant; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 45 | 1 | ▶ | use Net::OAuth2::AuthorizationServer::PasswordGrant; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 46 | 1 | ▶ | use Net::OAuth2::AuthorizationServer::ClientCredentialsGrant; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 47 | |||
| 48 | 1 | our $VERSION = '0.28'; | |
| 49 | |||
| 50 | =head1 GRANT TYPES | ||
| 51 | |||
| 52 | =head2 auth_code_grant | ||
| 53 | |||
| 54 | OAuth Authorisation Code Grant as document at L<http://tools.ietf.org/html/rfc6749#section-4.1>. | ||
| 55 | |||
| 56 | See L<Net::OAuth2::AuthorizationServer::AuthorizationCodeGrant>. | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | 1 | ▶ | sub auth_code_grant { |
|
Subroutine
auth_code_grant: called CC=1 SCAR=0.0
Pod
documented
| |||
| 61 | 1 | my ( $self, @args ) = @_; | |
| 62 | 1 | return Net::OAuth2::AuthorizationServer::AuthorizationCodeGrant->new( @args ); | |
| 63 | } | ||
| 64 | |||
| 65 | =head2 implicit_grant | ||
| 66 | |||
| 67 | OAuth Implicit Grant as document at L<https://tools.ietf.org/html/rfc6749#section-4.2>. | ||
| 68 | |||
| 69 | See L<Net::OAuth2::AuthorizationServer::ImplicitGrant>. | ||
| 70 | |||
| 71 | =cut | ||
| 72 | |||
| 73 | 1 | ▶ | sub implicit_grant { |
|
Subroutine
implicit_grant: called CC=1 SCAR=0.0
Pod
documented
| |||
| 74 | 1 | my ( $self, @args ) = @_; | |
| 75 | 1 | return Net::OAuth2::AuthorizationServer::ImplicitGrant->new( @args ); | |
| 76 | } | ||
| 77 | |||
| 78 | =head2 password_grant | ||
| 79 | |||
| 80 | OAuth Resource Owner Password Grant as document at L<http://tools.ietf.org/html/rfc6749#section-4.3>. | ||
| 81 | |||
| 82 | See L<Net::OAuth2::AuthorizationServer::PasswordGrant>. | ||
| 83 | |||
| 84 | =cut | ||
| 85 | |||
| 86 | 1 | ▶ | sub password_grant { |
|
Subroutine
password_grant: called CC=1 SCAR=0.0
Pod
documented
| |||
| 87 | 1 | my ( $self, @args ) = @_; | |
| 88 | 1 | return Net::OAuth2::AuthorizationServer::PasswordGrant->new( @args ); | |
| 89 | } | ||
| 90 | |||
| 91 | =head2 client_credentials_grant | ||
| 92 | |||
| 93 | OAuth Client Credentials Grant as document at L<http://tools.ietf.org/html/rfc6749#section-4.4>. | ||
| 94 | |||
| 95 | See L<Net::OAuth2::AuthorizationServer::ClientCredentialsGrant>. | ||
| 96 | |||
| 97 | =cut | ||
| 98 | |||
| 99 | 1 | ▶ | sub client_credentials_grant { |
|
Subroutine
client_credentials_grant: called CC=1 SCAR=0.0
Pod
documented
| |||
| 100 | 1 | my ( $self, @args ) = @_; | |
| 101 | 1 | return Net::OAuth2::AuthorizationServer::ClientCredentialsGrant->new( @args ); | |
| 102 | } | ||
| 103 | |||
| 104 | =head1 SEE ALSO | ||
| 105 | |||
| 106 | L<Mojolicious::Plugin::OAuth2::Server> - A Mojolicious plugin using this module | ||
| 107 | |||
| 108 | L<Crypt::JWT> - encode/decode JWTs | ||
| 109 | |||
| 110 | =head1 AUTHOR & CONTRIBUTORS | ||
| 111 | |||
| 112 | Lee Johnson - C<leejo@cpan.org> | ||
| 113 | |||
| 114 | With contributions from: | ||
| 115 | |||
| 116 | Martin Renvoize - C<martin.renvoize@ptfs-europe.com> | ||
| 117 | |||
| 118 | Pierre VIGIER - C<pierre.vigier@gmail.com> | ||
| 119 | |||
| 120 | Ian Sillitoe - L<https://github.com/sillitoe> | ||
| 121 | |||
| 122 | Mirko Tietgen - L<mirko@abunchofthings.net> | ||
| 123 | |||
| 124 | Dylan William Hardison - L<dylan@hardison.net> | ||
| 125 | |||
| 126 | =head1 LICENSE | ||
| 127 | |||
| 128 | This library is free software; you can redistribute it and/or modify it under | ||
| 129 | the same terms as Perl itself. If you would like to contribute documentation | ||
| 130 | or file a bug report then please raise an issue / pull request: | ||
| 131 | |||
| 132 | https://github.com/Humanstate/net-oauth2-authorizationserver | ||
| 133 | |||
| 134 | =cut | ||
| 135 | |||
| 136 | 1 | __PACKAGE__->meta->make_immutable; | |