Created
January 14, 2015 00:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jboss.errai.enterprise.client.jaxrs.api.interceptor.RestCallContext; | |
import org.jboss.errai.enterprise.client.jaxrs.api.interceptor.RestClientInterceptor; | |
public class KeycloakBearerTokenInterceptor implements RestClientInterceptor { | |
@Override | |
public void aroundInvoke(RestCallContext context) { | |
String bearerToken = getBearerToken(); | |
context.getRequestBuilder().setHeader("Authorization", bearerToken); | |
context.proceed(); | |
} | |
public static native String getBearerToken() /*-{ | |
//$wnd.keycloak.updateToken(10); | |
return "Bearer " + $wnd.keycloak.token; | |
}-*/; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment