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

ru.tinkoff.testops.droidherd.auth.BasicAuthProvider Maven / Gradle / Ivy

Go to download

A library that parallelizes Android Test execution to all connected devices and emulators

There is a newer version: 1.0.0
Show newest version
package ru.tinkoff.testops.droidherd.auth;

import java.util.Base64;
import java.util.Optional;

public class BasicAuthProvider implements AuthProvider {
    private final DroidherdAuthData data;
    private final String clientId;
    private final String token;

    public BasicAuthProvider() {
        this.data = new DroidherdAuthData() {
            @Override
            public String getClientId() {
                return clientId;
            }

            @Override
            public String getToken() {
                return token;
            }
        };
        this.clientId = Optional.ofNullable(System.getenv("DROIDHERD_CLIENT_ID"))
                .orElse("droidherd-default");
        this.token = Optional.ofNullable(System.getenv("DROIDHERD_AUTH_TOKEN"))
                .orElse("Basic " + Base64.getEncoder().encodeToString(String.format("%s:", clientId).getBytes()));
    }

    @Override
    public DroidherdAuthData get() {
        return data;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy