{"id":24522767,"url":"https://github.com/gbzarelli/tryauth","last_synced_at":"2026-05-02T20:36:54.143Z","repository":{"id":184496372,"uuid":"669337046","full_name":"gbzarelli/tryauth","owner":"gbzarelli","description":"Authentication and Authorization sample with Spring Boot + Kotlin + Spring Security with Oauth2 Resource Server + KeyCloak ","archived":false,"fork":false,"pushed_at":"2023-07-28T16:36:20.000Z","size":79,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-08T12:37:49.590Z","etag":null,"topics":["kotlin","spring","spring-boot","spring-security-jwt","spring-security-oauth2","spring-security-resource-server"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/gbzarelli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-22T01:04:03.000Z","updated_at":"2024-02-05T11:49:17.000Z","dependencies_parsed_at":"2023-07-28T18:07:23.089Z","dependency_job_id":null,"html_url":"https://github.com/gbzarelli/tryauth","commit_stats":null,"previous_names":["gbzarelli/tryauth"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gbzarelli/tryauth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbzarelli%2Ftryauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbzarelli%2Ftryauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbzarelli%2Ftryauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbzarelli%2Ftryauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gbzarelli","download_url":"https://codeload.github.com/gbzarelli/tryauth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbzarelli%2Ftryauth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32549384,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T19:18:06.202Z","status":"ssl_error","status_checked_at":"2026-05-02T19:16:21.335Z","response_time":132,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["kotlin","spring","spring-boot","spring-security-jwt","spring-security-oauth2","spring-security-resource-server"],"created_at":"2025-01-22T03:35:34.053Z","updated_at":"2026-05-02T20:36:49.124Z","avatar_url":"https://github.com/gbzarelli.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TryAuth\n\nAuthorization and authentication sample with resource server (keycloak).\n\n## Technologies\n\n- Kotlin 1.8.22\n- JDK 17\n- Spring Boot 3.1.1\n  - Web \n  - Actuator\n  - SpringDoc OpenApi\n  - Spring Security\n    - Oauth2 Resource Server\n\n## How to run\n\n### Run local stack\n\nIn your shell run:\n\n```shell\ndocker-compose up\n```\n\n### Run the project\n\n```shell\n./mvnw spring-boot:run\n```\n\n## Keycloak - Resource Server\n\nThis stack run a KeyCloak already configured with the follow credentials:\n\n- REAM: `tryauth`\n- Clients\n  - ID: `foo-user`\n    - Grant Type: `client_credentials`\n    - Scopes: `tryauth:read`\n  - ID: `bar-user`\n      - Grant Type: `client_credentials`\n      - Scopes: `tryauth:read tryauth:write`\n\n### How to generate a token:\n\nBy default, the secret is not imported with a value, \nbut you can use: `**********` . If you want to reset, just access the panel and regenerate it.\n- For `foo-user`: http://localhost:9002/admin/master/console/#/tryauth/clients/9a520b23-531a-4d4b-8684-579cb74a05d7/credentials\n- For `bar-user`: http://localhost:9002/admin/master/console/#/tryauth/clients/490a5ec9-8413-490c-8a37-9645378f555a/credentials\n\n#### Generate a token for foo-user (only read):\n\n```shell\ncurl --location 'http://localhost:9002/realms/tryauth/protocol/openid-connect/token' \\\n--data-urlencode 'grant_type=client_credentials' \\\n--data-urlencode 'client_id=foo-user' \\\n--data-urlencode 'client_secret=**********' \\\n--header 'Content-Type: application/x-www-form-urlencoded'\n```\n\n#### Generate a token for bar-user (read and write)\n\n```shell\ncurl --location 'http://localhost:9002/realms/tryauth/protocol/openid-connect/token' \\\n--data-urlencode 'grant_type=client_credentials' \\\n--data-urlencode 'client_id=bar-user' \\\n--data-urlencode 'client_secret=**********' \\\n--header 'Content-Type: application/x-www-form-urlencoded'\n```\n\n## TryAuth REST API\n\nAccess the contract (openapi) in swagger-ui:\n\n- [http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgbzarelli%2Ftryauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgbzarelli%2Ftryauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgbzarelli%2Ftryauth/lists"}