Skip to content

Instantly share code, notes, and snippets.

View alexcrownus's full-sized avatar

Alex Adeyemo alexcrownus

  • London, United Kingdom
View GitHub Profile
@alexcrownus
alexcrownus / GCPAuthenticationInterceptor.java
Created August 23, 2023 21:49 — forked from tylertreat/GCPAuthenticationInterceptor.java
Spring RestTemplate interceptor which can make HTTP requests to Google OIDC-authenticated resources using a service account
package com.realkinetic.gcp.spring.oidc;
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.google.api.client.http.*;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonObjectParser;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.GenericData;