com.microsoft.azure.kusto.data.auth.CallbackTokenProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kusto-data Show documentation
Show all versions of kusto-data Show documentation
Kusto client library for executing queries and retrieving data
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
package com.microsoft.azure.kusto.data.auth;
import com.microsoft.azure.kusto.data.exceptions.DataClientException;
import org.jetbrains.annotations.NotNull;
import reactor.core.publisher.Mono;
import java.net.URISyntaxException;
import java.util.concurrent.Callable;
public class CallbackTokenProvider extends TokenProviderBase {
public static final String CALLBACK_TOKEN_PROVIDER = "CallbackTokenProvider";
private final @NotNull Callable tokenProvider;
CallbackTokenProvider(@NotNull String clusterUrl, @NotNull Callable tokenProvider) throws URISyntaxException {
super(clusterUrl, null);
this.tokenProvider = tokenProvider;
}
@Override
protected Mono acquireAccessTokenImpl() {
return Mono.fromCallable(tokenProvider).onErrorMap(e -> DataClientException.unwrapThrowable(clusterUrl, e));
}
@Override
protected String getAuthMethod() {
return CALLBACK_TOKEN_PROVIDER;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy