{"id":26821225,"url":"https://github.com/realkinetic/gcp-spring-oidc","last_synced_at":"2026-05-20T14:03:26.925Z","repository":{"id":152904683,"uuid":"165800621","full_name":"RealKinetic/gcp-spring-oidc","owner":"RealKinetic","description":"Spring RestTemplate interceptor which can make authenticated requests to GCP Identity-Aware Proxy using a service account","archived":false,"fork":false,"pushed_at":"2019-04-24T02:22:16.000Z","size":13,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-08T15:57:04.107Z","etag":null,"topics":["authentication","gcp","gcp-iap","oauth2","oidc","openid-connect","resttemplate","spring"],"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/RealKinetic.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,"zenodo":null}},"created_at":"2019-01-15T06:53:07.000Z","updated_at":"2023-02-24T15:02:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"f9dd0487-fd27-4633-9bd6-94eca4f247bb","html_url":"https://github.com/RealKinetic/gcp-spring-oidc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RealKinetic/gcp-spring-oidc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealKinetic%2Fgcp-spring-oidc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealKinetic%2Fgcp-spring-oidc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealKinetic%2Fgcp-spring-oidc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealKinetic%2Fgcp-spring-oidc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RealKinetic","download_url":"https://codeload.github.com/RealKinetic/gcp-spring-oidc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealKinetic%2Fgcp-spring-oidc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269447936,"owners_count":24418756,"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-08T02:00:09.200Z","response_time":72,"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":["authentication","gcp","gcp-iap","oauth2","oidc","openid-connect","resttemplate","spring"],"created_at":"2025-03-30T07:19:09.796Z","updated_at":"2026-05-20T14:03:21.682Z","avatar_url":"https://github.com/RealKinetic.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gcp-spring-oidc\n\nThis contains a Spring `RestTemplate` interceptor which can make HTTP requests to Google\nOIDC-authenticated resources using a service account. For example, this can be used to\nmake requests to resources behind an [Identity-Aware Proxy (IAP)](https://cloud.google.com/iap).\n\nThis works by generating a JWT with an additional `target_audience` claim set to the\nOAuth2 client id which is signed using the GCP service account credentials. This JWT is\nthen exchanged for a Google-signed OIDC token for the client id specified in the JWT\nclaims. Authenticated requests are made by setting the token in the `Authorization: Bearer`\nheader. This token has roughly a 1-hour expiration and is renewed transparently by the\ninterceptor.\n\nMore information on the implementation flow can be found in the\n[GCP documentation](https://cloud.google.com/iap/docs/authentication-howto) for IAP.\n\n## Usage\n\nIt is recommended to use a singleton instance of `GCPAuthenticationInterceptor` since it\nwill cache the OIDC token used for authentication and only renew once the token has\nexpired.\n\n```java\nprivate static final String CLIENT_ID = \"\u003cGCP OAuth2 Client ID\u003e.apps.googleusercontent.com\";\nprivate RestTemplate restTemplate;\n\nprivate synchronized RestTemplate restTemplate() throws IOException {\n    if (restTemplate != null) {\n        return restTemplate;\n    }\n    restTemplate = new RestTemplate();\n    List\u003cClientHttpRequestInterceptor\u003e interceptors = restTemplate.getInterceptors();\n    if (CollectionUtils.isEmpty(interceptors)) {\n        interceptors = new ArrayList\u003c\u003e();\n    }\n    interceptors.add(new GCPAuthenticationInterceptor(CLIENT_ID));\n    restTemplate.setInterceptors(interceptors);\n    return restTemplate;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealkinetic%2Fgcp-spring-oidc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frealkinetic%2Fgcp-spring-oidc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealkinetic%2Fgcp-spring-oidc/lists"}