{"id":25720057,"url":"https://github.com/gregwhitaker/ratpack-jwt-example","last_synced_at":"2026-07-15T14:33:26.713Z","repository":{"id":82732605,"uuid":"106985634","full_name":"gregwhitaker/ratpack-jwt-example","owner":"gregwhitaker","description":"Example of using JSON Web Tokens to authenticate with Ratpack","archived":false,"fork":false,"pushed_at":"2017-10-15T15:14:18.000Z","size":82,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-25T12:30:42.323Z","etag":null,"topics":["jwt","jwt-authentication","jwt-token","ratpack","rest-api"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gregwhitaker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-15T05:13:25.000Z","updated_at":"2021-06-02T17:19:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"e808a82a-f65f-45aa-bcb0-5ae02f35f6a6","html_url":"https://github.com/gregwhitaker/ratpack-jwt-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gregwhitaker/ratpack-jwt-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Fratpack-jwt-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Fratpack-jwt-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Fratpack-jwt-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Fratpack-jwt-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregwhitaker","download_url":"https://codeload.github.com/gregwhitaker/ratpack-jwt-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Fratpack-jwt-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35509495,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-15T02:00:06.706Z","response_time":131,"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":["jwt","jwt-authentication","jwt-token","ratpack","rest-api"],"created_at":"2025-02-25T17:36:27.510Z","updated_at":"2026-07-15T14:33:26.708Z","avatar_url":"https://github.com/gregwhitaker.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ratpack-jwt-example\n[![Build Status](https://travis-ci.org/gregwhitaker/ratpack-jwt-example.svg?branch=master)](https://travis-ci.org/gregwhitaker/ratpack-jwt-example)\n\nAn example of using [JSON Web tokens](https://jwt.io/introduction/) to authenticate with [Ratpack](http://www.ratpack.io).\n\nThis example starts a Ratpack application that hosts three endpoints: one secured with JWT as a url parameter, one secured with JWT as an Authorization header, and one that is not secured.\n\n## Prerequisites\nThis example requires that you have installed the [Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files](http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html).\n\n## Running the Example\n1. Generate a `READ_WRITE` role JWT token by running the following Gradle command:\n\n        $ ./gradlew generateReadWrite\n    \n2. Copy the generated token to the clipboard (It will look similar to the one below):\n\n        eyJjdHkiOiJKV1QiLCJlbmMiOiJBMjU2R0NNIiwiYWxnIjoiZGlyIn0..rYmzSzVwurf_tJRk.VL_IzEqi9bihjSd44W8HCTIm2tfVqMTCAHklSxbsteO67mZ0nqxXfeo7h7D0tWy0Wk4Hg7jJngBu5Thd2m5S27xUlS9YsakkROmIOkdnsCs5j4mv5Qd9PgPRxSWAH2qC_K7fywpGlUoPojGO03MA0odbR9PPS4WpuBlealgKF2gAbcfADokyNy897AehcmEJ6ZRwzP--vKcCP59Z1CSqHEEgwLGgXOOQl7PAMgvhOHJwJJl5OvhHcQRg9vG89CegONXFypZNWDGv0LtcCjJ-H8_ZH-wWtkqjXyC2m9QipORc_Of-uLov-kJeuIRkT-M3DqwIyqofaO7MDv7xAuCtk_jpl0uN.UNev8gOwcbEhr9fJOCA5BQ\n\n3. Start the example service by running the following Gradle command:\n\n        $ ./gradlew run\n\n4. Curl the JWT protected endpoint using the following command:\n\n        $ curl -v http://localhost:5050/secure\n        \n5. Notice that you receive a `401 - Unauthorized` error.\n\n6. Curl the JWT protected endpoint and supply the JWT token:\n\n    If you wish to supply the JWT token as a URL parameter use the following command:\n    \n        $ curl -v http://localhost:5050/secure?token={your token}\n        \n    If you wish to supply the JWT token in the Authorization header use the following command:\n    \n        $ curl -v -H \"Authorization: Bearer {your token}\" http://localhost:5050/secureheader\n\n7. Notice that you now have access to the secure resource and your user information.\n\n        {\n          \"message\": \"This endpoint is protected by JWT\",\n          \"user\": {\n            \"displayName\": \"jdoe\",\n            \"roles\": [\n              \"READ_WRITE\"\n            ],\n            \"email\": \"john.doe@netifi.com\"\n          }\n        }\n\n## Bugs and Feedback\nFor bugs, questions and discussions please use the [Github Issues](https://github.com/gregwhitaker/ratpack-jwt-example/issues).\n\n## License\nMIT License\n\nCopyright (c) 2017 Greg Whitaker\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregwhitaker%2Fratpack-jwt-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregwhitaker%2Fratpack-jwt-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregwhitaker%2Fratpack-jwt-example/lists"}