|
13 | 13 | import com.microsoft.graph.http.CoreHttpProvider; |
14 | 14 | import com.microsoft.graph.http.IHttpRequest; |
15 | 15 | import com.microsoft.graph.httpcore.HttpClients; |
16 | | -import com.microsoft.graph.authentication.IAuthenticationProvider; |
| 16 | +import com.microsoft.graph.authentication.BaseAuthenticationProvider; |
17 | 17 | import com.microsoft.graph.requests.GraphServiceClient; |
18 | 18 |
|
19 | 19 | import okhttp3.OkHttpClient; |
@@ -58,20 +58,24 @@ private void GetClient(boolean authenticate) |
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
61 | | - public IAuthenticationProvider getUnauthenticationProvider() { |
62 | | - return new IAuthenticationProvider() { |
| 61 | + public BaseAuthenticationProvider getUnauthenticationProvider() { |
| 62 | + return new BaseAuthenticationProvider() { |
63 | 63 | @Override |
64 | 64 | public CompletableFuture<String> getAuthorizationTokenAsync(final URL requestUrl) { |
65 | 65 | return CompletableFuture.completedFuture((String)null); |
66 | 66 | } |
67 | 67 | }; |
68 | 68 | } |
69 | | - public IAuthenticationProvider getAuthenticationProvider() { |
| 69 | + public BaseAuthenticationProvider getAuthenticationProvider() { |
70 | 70 | final String accessToken = GetAccessToken().replace("\"", ""); |
71 | | - return new IAuthenticationProvider() { |
| 71 | + return new BaseAuthenticationProvider() { |
72 | 72 | @Override |
73 | 73 | public CompletableFuture<String> getAuthorizationTokenAsync(final URL requestUrl) { |
74 | | - return CompletableFuture.completedFuture(accessToken); |
| 74 | + if(this.shouldAuthenticateRequestWithUrl(requestUrl)) { |
| 75 | + return CompletableFuture.completedFuture(accessToken); |
| 76 | + } else { |
| 77 | + return CompletableFuture.completedFuture(null); |
| 78 | + } |
75 | 79 | } |
76 | 80 | }; |
77 | 81 | } |
|
0 commit comments