{"id":22268206,"url":"https://github.com/curityio/kotlin-api-jwt-validation","last_synced_at":"2025-08-27T14:30:01.825Z","repository":{"id":39923245,"uuid":"356930174","full_name":"curityio/kotlin-api-jwt-validation","owner":"curityio","description":"An OAuth 2.0 secured API in Kotlin, to validate a JWT then use scopes and claims for authorization","archived":false,"fork":false,"pushed_at":"2023-06-16T07:12:58.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-01-30T13:31:41.813Z","etag":null,"topics":["api","claims","code-example","jwt-validation","oauth2","scopes","spring-boot","zero-trust"],"latest_commit_sha":null,"homepage":"https://curity.io/resources/learn/kotlin-api/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/curityio.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":"2021-04-11T17:12:39.000Z","updated_at":"2023-04-26T10:24:43.000Z","dependencies_parsed_at":"2024-12-03T11:12:02.972Z","dependency_job_id":"daaa8fe7-c7d8-42db-93d9-1c97e50616de","html_url":"https://github.com/curityio/kotlin-api-jwt-validation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curityio%2Fkotlin-api-jwt-validation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curityio%2Fkotlin-api-jwt-validation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curityio%2Fkotlin-api-jwt-validation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/curityio%2Fkotlin-api-jwt-validation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/curityio","download_url":"https://codeload.github.com/curityio/kotlin-api-jwt-validation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245486241,"owners_count":20623239,"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","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":["api","claims","code-example","jwt-validation","oauth2","scopes","spring-boot","zero-trust"],"created_at":"2024-12-03T11:11:54.137Z","updated_at":"2025-03-25T14:45:48.973Z","avatar_url":"https://github.com/curityio.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kotlin API OAuth Integration\n\n[![Quality](https://img.shields.io/badge/quality-experiment-red)](https://curity.io/resources/code-examples/status/)\n[![Availability](https://img.shields.io/badge/availability-source-blue)](https://curity.io/resources/code-examples/status/)\n\nA basic sample to show how to use the [jose4j security library](https://bitbucket.org/b_c/jose4j/wiki/Home) for managing validation of OAuth (JWT) access tokens. API routes can then use scopes and claims from the JWT to authorize requests.\n\n## Configuration\n\nThe API is configured with these details in its `api.properties` file.\\\nPoint these to the equivalent values for your own instance of the Curity Identity Server.\n\n```text\njwks_endpoint=https://idsvr.example.com/oauth/v2/oauth-anonymous/jwks\nissuer=https://idsvr.example.com/oauth/v2/oauth-anonymous\naudience=api.example.com\n```\n\n## Run the API\n\nEnsure that maven and a Java SDK of 17 or higher is installed.\nThen build and run the API with these commands:\n\n```bash\nmvn package\njava -jar target/secureapi-1.0-SNAPSHOT-jar-with-dependencies.jar\n```\n\n## Call the API\n\nCall the running API with an HTTP request such as the following:\n\n```bash\ncurl -i http://localhost:3000 -H \"Authorization: Bearer eyJraWQiOiIyV01TWGcwekE...\"\n```\n\nIf the authorization server is configured with the appropriate scopes and claims, a 200 response will be returned:   \n\n```json\n{\n  \"message\": \"API Request has role: admin and scope read\"\n}\n```\n\nIf there is a token validation problem, a 401 response will be returned, with a www-authenticate response header:\n\n```text\nWWW-Authenticate: Bearer, error=invalid_token, error_description=Access token is missing, invalid or expired\n```\n\n## Further Information\n\n- See the [Kotlin API Tutorial](https://curity.io/resources/learn/kotlin-api/) for a technical walkthrough\n- Please visit [curity.io](https://curity.io/) for more information about the Curity Identity Server\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurityio%2Fkotlin-api-jwt-validation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcurityio%2Fkotlin-api-jwt-validation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcurityio%2Fkotlin-api-jwt-validation/lists"}