{"id":25720012,"url":"https://github.com/gregwhitaker/springboot-apikey-example","last_synced_at":"2025-08-02T10:34:29.630Z","repository":{"id":41143493,"uuid":"166618051","full_name":"gregwhitaker/springboot-apikey-example","owner":"gregwhitaker","description":"Example of authenticating with a Spring Boot application using an API key.","archived":false,"fork":false,"pushed_at":"2020-12-04T17:08:40.000Z","size":103,"stargazers_count":71,"open_issues_count":1,"forks_count":22,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-06T19:53:24.994Z","etag":null,"topics":["api-key","caffeine-cache","spring-boot","spring-security"],"latest_commit_sha":null,"homepage":"","language":"Java","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/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}},"created_at":"2019-01-20T03:12:25.000Z","updated_at":"2025-03-14T13:27:02.000Z","dependencies_parsed_at":"2022-08-25T17:21:26.678Z","dependency_job_id":null,"html_url":"https://github.com/gregwhitaker/springboot-apikey-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gregwhitaker/springboot-apikey-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Fspringboot-apikey-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Fspringboot-apikey-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Fspringboot-apikey-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Fspringboot-apikey-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregwhitaker","download_url":"https://codeload.github.com/gregwhitaker/springboot-apikey-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregwhitaker%2Fspringboot-apikey-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268371820,"owners_count":24239794,"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-08-02T02:00:12.353Z","response_time":74,"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":["api-key","caffeine-cache","spring-boot","spring-security"],"created_at":"2025-02-25T17:36:18.915Z","updated_at":"2025-08-02T10:34:29.567Z","avatar_url":"https://github.com/gregwhitaker.png","language":"Java","readme":"# springboot-apikey-example\n![Build](https://github.com/gregwhitaker/springboot-apikey-example/workflows/Build/badge.svg)\n\nAn example of authenticating with a Spring Boot application using an API key.\n\nIf you are looking for an example using WebFlux, please check out [springboot-webflux-apikey-example](https://github.com/gregwhitaker/springboot-webflux-apikey-example).\n\n## Prerequisites\nThis example requires that you have a running [PostgreSQL](https://www.postgresql.org/) database. You can start one as a Docker container using the following commands:\n\n    $ docker pull postgres\n    $ docker run -p 5432:5432 postgres\n\n## Running the Example\nFollow the steps below to run the example:\n\n1. Ensure you have a running PostgreSQL instance at `localhost:5432`.\n\n2. Run the following command to start the example application:\n\n        ./gradlew bootRun\n        \n3. Run the following command to send a request to the non-secure endpoint:\n\n        curl -v http://localhost:8080/api/v1/nonsecure\n        \n    If successful, you will receive an `HTTP 200 OK` response.\n    \n4. Run the following command to send a request to the secure endpoint:\n\n        curl -v http://localhost:8080/api/v1/secure\n        \n    You will receive an `HTTP 403 Forbidden` response because you have not supplied a valid API key.\n    \n5. Run the following command to send a request to the secure endpoint with an API key:\n\n        curl -v --header \"API_KEY: aec093c2c98144f99a4a365ad1d2f05e\" http://localhost:8080/api/v1/secure\n        \n    If successful, you will now receive an `HTTP 200 OK` response because you have supplied a valid API key.\n\n## Bugs and Feedback\nFor bugs, questions, and discussions please use the [Github Issues](https://github.com/gregwhitaker/springboot-apikey-example/issues).\n\n## License\nCopyright 2019 Greg Whitaker\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregwhitaker%2Fspringboot-apikey-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregwhitaker%2Fspringboot-apikey-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregwhitaker%2Fspringboot-apikey-example/lists"}