Skip to content

Instantly share code, notes, and snippets.

View RogerParkinson's full-sized avatar

Roger Parkinson RogerParkinson

View GitHub Profile
@tylertreat
tylertreat / GCPAuthenticationInterceptor.java
Created January 25, 2019 16:45
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;