All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yandex.ydb.core.grpc.YdbCallCredentials Maven / Gradle / Ivy

There is a newer version: 1.45.6
Show newest version
package com.yandex.ydb.core.grpc;

import java.util.concurrent.Executor;

import com.yandex.ydb.core.auth.AuthProvider;
import io.grpc.CallCredentials;
import io.grpc.Metadata;


/**
 * @author Sergey Polovko
 */
public class YdbCallCredentials extends CallCredentials {

    private final AuthProvider authProvider;

    public YdbCallCredentials(AuthProvider authProvider) {
        this.authProvider = authProvider;
    }

    @Override
    public void applyRequestMetadata(
        RequestInfo requestInfo,
        Executor appExecutor,
        MetadataApplier applier)
    {
        Metadata headers = new Metadata();
        headers.put(YdbHeaders.AUTH_TICKET, authProvider.getToken());
        applier.apply(headers);
    }

    @Override
    public void thisUsesUnstableApi() {
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy