logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Plack::Middleware::Auth::OAuth2::ProtectedResource - middleware for OAuth 2.0 Protected Resource endpoint

Author

       Lyo Kato, <lyo.kato@gmail.com>

Description

       middleware for OAuth 2.0 Protected Resource endpoint

Env Values

       After successful verifying authorization within middleware layer, Following 3 type of values are set in
       env.

       REMOTE_USER
           Identifier  of  user  who  grant the client to access the user's protected resource that is stored on
           service provider.

       X_OAUTH_CLIENT
           Identifier of the client that accesses to user's protected resource on beharf of the user.

       X_OAUTH_SCOPE
           Scope parameter that represents what kind of resources that the user grant client to access.

Methods

call($env)
       This method parses access token.  If access token is valid, authorization information are set to
       environment variables.

Name

       Plack::Middleware::Auth::OAuth2::ProtectedResource - middleware for OAuth 2.0 Protected Resource endpoint

Synopsis

           my $app = sub {...};
           builder {
               enable "Plack::Middleware::Auth::OAuth2::ProtectedResource",
                   data_handler => "YourApp::DataHandler",
                   error_uri    => q{http://example.org/error/description};
               enable "Plack::Middleware::JSONP";
               enable "Plack::Middleware::ContentLength";
               $app;
           };

           # and on your controller
           $plack_request->env->{REMOTE_USER};
           $plack_request->env->{X_OAUTH_CLIENT_ID};
           $plack_request->env->{X_OAUTH_SCOPE};

See Also