com.rt.storage.auth.oauth2.IdTokenProvider Maven / Gradle / Ivy
package com.rt.storage.auth.oauth2;
import com.google.common.annotations.Beta;
import java.io.IOException;
import java.util.List;
@Beta
public interface IdTokenProvider {
/**
* Enum of various credential-specific options to apply to the token.
*
* ComputeEngineCredentials
*
*
* - FORMAT_FULL
*
- LICENSES_TRUE
*
*
*
* ImpersonatedCredential
*
*
* - INCLUDE_EMAIL
*
*/
public enum Option {
FORMAT_FULL("formatFull"),
LICENSES_TRUE("licensesTrue"),
INCLUDE_EMAIL("includeEmail");
private String option;
private Option(String option) {
this.option = option;
}
public String getOption() {
return option;
}
}
/**
* Returns a Google OpenID Token with the provided audience field.
*
* @param targetAudience List of audiences the issued ID Token should be valid for. targetAudience
* accepts a single string value (multiple audiences are not supported)
* @param options List of Credential specific options for for the token. For example, an IDToken
* for a ComputeEngineCredential can return platform specific claims if
* "ComputeEngineCredentials.ID_TOKEN_FORMAT_FULL" is provided as a list option.
* @throws IOException if token creation fails
* @return IdToken object which includes the raw id_token, expiration and audience.
*/
IdToken idTokenWithAudience(String targetAudience, List