com.opengamma.sdk.common.auth.Credentials Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sdk-common Show documentation
Show all versions of sdk-common Show documentation
OpenGamma SDK - Common code for accessing remote services
/*
* Copyright (C) 2016 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.sdk.common.auth;
import java.io.UncheckedIOException;
/**
* Credentials used to authenticate with the service.
*/
public interface Credentials {
// the design of this interface and the methods that use it are intended to support
// different ways to authenticate without exposing the implementing classes
/**
* Obtains credentials using an API key and secret.
*
* This is the recommended way to connect.
*
* @param apiKey the API key
* @param secret the secret
* @return the credentials
*/
public static Credentials ofApiKey(String apiKey, String secret) {
return ApiKeyCredentials.of(apiKey, secret);
}
//-------------------------------------------------------------------------
/**
* Authenticates using these credentials, returning an access token.
*
* @param client the client to authenticate with
* @return the access token result
* @throws AuthenticationException if unable to authenticate
* @throws UncheckedIOException if an IO error occurs
*/
public abstract AccessTokenResult authenticate(AuthClient client);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy