{"id":32215042,"url":"https://github.com/domm/web-request-role-jwt","last_synced_at":"2025-10-22T07:28:19.468Z","repository":{"id":53152594,"uuid":"94081731","full_name":"domm/Web-Request-Role-JWT","owner":"domm","description":"Accessors for JSON Web Token (JWT) stored in psgix","archived":false,"fork":false,"pushed_at":"2021-04-04T11:27:14.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-08-20T22:58:56.971Z","etag":null,"topics":["hacktoberfest","jwt","psgi"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/domm.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-12T10:00:02.000Z","updated_at":"2021-04-04T11:27:13.000Z","dependencies_parsed_at":"2022-09-22T21:30:39.593Z","dependency_job_id":null,"html_url":"https://github.com/domm/Web-Request-Role-JWT","commit_stats":null,"previous_names":[],"tags_count":4,"template":null,"template_full_name":null,"purl":"pkg:github/domm/Web-Request-Role-JWT","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domm%2FWeb-Request-Role-JWT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domm%2FWeb-Request-Role-JWT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domm%2FWeb-Request-Role-JWT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domm%2FWeb-Request-Role-JWT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/domm","download_url":"https://codeload.github.com/domm/Web-Request-Role-JWT/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domm%2FWeb-Request-Role-JWT/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280400419,"owners_count":26324504,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","jwt","psgi"],"created_at":"2025-10-22T07:28:18.208Z","updated_at":"2025-10-22T07:28:19.463Z","avatar_url":"https://github.com/domm.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nWeb::Request::Role::JWT - Accessors for JSON Web Token (JWT) stored in psgix\n\n# VERSION\n\nversion 1.003\n\n# SYNOPSIS\n\n    # Create a request handler\n    package My::App::Request;\n    use Moose;\n    extends 'Web::Request';\n    with 'Web::Request::Role::JWT';\n\n    # Finally, in some controller action\n    sub action_that_needs_a_user_stored_in_jwt {\n        my ($self, $req) = @_;\n\n        my $sub   = $req-\u003erequires_jwt_claim_sub;\n\n        my $data  = $self-\u003emodel-\u003edo_something( $sub );\n        return $self-\u003ejson_response( $data );\n    }\n\n# DESCRIPTION\n\n`Web::Request::Role::JWT` provides a few accessor and helper methods\nthat make accessing JSON Web Tokens (JWT) stored in your PSGI `$env`\neasier.\n\nIt works especially well when used with\n[Plack::Middleware::Auth::JWT](https://metacpan.org/pod/Plack%3A%3AMiddleware%3A%3AAuth%3A%3AJWT), which will validate the token and\nextract the payload into the PSGI `$env`.\n\n# METHODS\n\n## requires\\_\\* and logging\n\nIf a `requires_*` method fails, it will log an error via [Log::Any](https://metacpan.org/pod/Log%3A%3AAny).\n\n## get\\_jwt\n\n    my $raw_token = $req-\u003eget_jwt;\n\nReturns the raw token, so you can inspect it, or maybe pass it along to some other endpoint.\n\nIf you want to store your token somewhere else than the default `$env-\u003e{'psgix.token'}`, you have to provide another implementation\nfor this method.\n\n## get\\_jwt\\_claims\n\n    my $claims = $req-\u003eget_jwt_claims;\n\nReturns all the claims as a hashref.\n\nIf you want to store your claims somewhere else than the default `$env-\u003e{'psgix.claims'}`, you have to provide another implementation\nfor this method.\n\n## get\\_jwt\\_claim\\_sub\n\n    my $sub = $req-\u003eget_jwt_claim_sub;\n\nGet the `sub` claim: [https://tools.ietf.org/html/rfc7519#section-4.1.2](https://tools.ietf.org/html/rfc7519#section-4.1.2)\n\n## get\\_jwt\\_claim\\_aud\n\n    my $aud = $req-\u003eget_jwt_claim_aud;\n\nGet the `aud` claim: [https://tools.ietf.org/html/rfc7519#section-4.1.3](https://tools.ietf.org/html/rfc7519#section-4.1.3)\n\n## requires\\_jwt\n\n    my $raw_token = $req-\u003erequires_jwt;\n\nReturns the raw token. If no token is available, throws a [HTTP::Throwable::Role::Status::Unauthorized](https://metacpan.org/pod/HTTP%3A%3AThrowable%3A%3ARole%3A%3AStatus%3A%3AUnauthorized) exception (aka HTTP Status 401)\n\n## requires\\_jwt\\_claims\n\n    my $claims = $req-\u003erequires_jwt_claims;\n\nReturns all the claims as a hashref. If no claims are available, throws a [HTTP::Throwable::Role::Status::Unauthorized](https://metacpan.org/pod/HTTP%3A%3AThrowable%3A%3ARole%3A%3AStatus%3A%3AUnauthorized) exception (aka HTTP Status 401)\n\n## requires\\_jwt\\_claim\\_sub\n\n    my $sub = $req-\u003erequires_jwt_claim_sub;\n\nReturns the `sub` claim. If the `sub` claim is missing, throws a [HTTP::Throwable::Role::Status::Unauthorized](https://metacpan.org/pod/HTTP%3A%3AThrowable%3A%3ARole%3A%3AStatus%3A%3AUnauthorized) exception (aka HTTP Status 401)\n\n## requires\\_jwt\\_claim\\_aud\n\n    my $aud = $req-\u003erequires_jwt_claim_aud;\n\nReturns the `aud` claim. If the `aud` claim is missing, throws a [HTTP::Throwable::Role::Status::Unauthorized](https://metacpan.org/pod/HTTP%3A%3AThrowable%3A%3ARole%3A%3AStatus%3A%3AUnauthorized) exception (aka HTTP Status 401)\n\n# THANKS\n\nThanks to\n\n- [validad.com](https://www.validad.com/) for supporting Open Source.\n\n# AUTHOR\n\nThomas Klausner \u003cdomm@plix.at\u003e\n\n# COPYRIGHT AND LICENSE\n\nThis software is copyright (c) 2017 - 2021 by Thomas Klausner.\n\nThis is free software; you can redistribute it and/or modify it under\nthe same terms as the Perl 5 programming language system itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdomm%2Fweb-request-role-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdomm%2Fweb-request-role-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdomm%2Fweb-request-role-jwt/lists"}