//package com.iailab.module.sdk.auth.interceptor;
|
//
|
//import org.springframework.http.HttpRequest;
|
//import org.springframework.http.client.ClientHttpRequestExecution;
|
//import org.springframework.http.client.ClientHttpRequestInterceptor;
|
//import org.springframework.http.client.ClientHttpResponse;
|
//
|
//import java.io.IOException;
|
//
|
//public class AuthInterceptor implements ClientHttpRequestInterceptor {
|
//
|
// private final AuthTokenHolder tokenHolder;
|
//
|
// public AuthInterceptor(AuthTokenHolder tokenHolder) {
|
// this.tokenHolder = tokenHolder;
|
// }
|
//
|
// @Override
|
// public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) {
|
// if (tokenHolder.getToken() != null) {
|
// request.getHeaders().setBearerAuth(tokenHolder.getToken());
|
// }
|
// return execution.execute(request, body);
|
// }
|
//
|
//}
|