Package com.google.auth.oauth2
Class ImpersonatedCredentials.Builder
java.lang.Object
com.google.auth.oauth2.OAuth2Credentials.Builder
com.google.auth.oauth2.GoogleCredentials.Builder
com.google.auth.oauth2.ImpersonatedCredentials.Builder
- Enclosing class:
- ImpersonatedCredentials
-
Field Summary
Fields inherited from class com.google.auth.oauth2.GoogleCredentials.Builder
quotaProjectId, universeDomain -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBuilder()protectedBuilder(GoogleCredentials sourceCredentials, String targetPrincipal) Deprecated.protectedBuilder(ImpersonatedCredentials credentials) -
Method Summary
Modifier and TypeMethodDescriptionbuild()This method is marked obsolete.intsetCalendar(Calendar calendar) This method is marked obsolete.setConnectTimeout(int connectTimeout) Warning: Not for public use and can be removed at any time.setDelegates(List<String> delegates) setHttpTransportFactory(HttpTransportFactory transportFactory) setIamEndpointOverride(String iamEndpointOverride) setLifetime(int lifetime) setQuotaProjectId(String quotaProjectId) setReadTimeout(int readTimeout) Warning: Not for public use and can be removed at any time.Set the scopes to be applied on the impersonated token and not on the source credential.setSourceCredentials(GoogleCredentials sourceCredentials) setTargetPrincipal(String targetPrincipal) Methods inherited from class com.google.auth.oauth2.GoogleCredentials.Builder
getQuotaProjectId, getUniverseDomain, setAccessToken, setUniverseDomainMethods inherited from class com.google.auth.oauth2.OAuth2Credentials.Builder
getAccessToken, getExpirationMargin, getRefreshMargin, setExpirationMargin, setRefreshMargin
-
Constructor Details
-
Builder
protected Builder() -
Builder
Deprecated.UseBuilder(ImpersonatedCredentials)instead. This constructor will be removed in a future release.- Parameters:
sourceCredentials- The source credentials to use for impersonation.targetPrincipal- The service account to impersonate.
-
Builder
-
-
Method Details
-
setSourceCredentials
@CanIgnoreReturnValue public ImpersonatedCredentials.Builder setSourceCredentials(GoogleCredentials sourceCredentials) -
getSourceCredentials
-
setTargetPrincipal
@CanIgnoreReturnValue public ImpersonatedCredentials.Builder setTargetPrincipal(String targetPrincipal) -
getTargetPrincipal
-
setDelegates
-
getDelegates
-
setScopes
Set the scopes to be applied on the impersonated token and not on the source credential. This user configuration has precedence over the scopes listed in the source credential json file.- Parameters:
scopes- List of scopes to apply to the impersonated token
-
getScopes
- Returns:
- List of scopes to be applied to the impersonated token.
-
setLifetime
-
getLifetime
public int getLifetime() -
setHttpTransportFactory
@CanIgnoreReturnValue public ImpersonatedCredentials.Builder setHttpTransportFactory(HttpTransportFactory transportFactory) -
getHttpTransportFactory
-
setQuotaProjectId
@CanIgnoreReturnValue public ImpersonatedCredentials.Builder setQuotaProjectId(String quotaProjectId) - Overrides:
setQuotaProjectIdin classGoogleCredentials.Builder
-
setIamEndpointOverride
@CanIgnoreReturnValue public ImpersonatedCredentials.Builder setIamEndpointOverride(String iamEndpointOverride) -
setCalendar
@CanIgnoreReturnValue @ObsoleteApi("This method is obsolete and will be removed in a future release.") public ImpersonatedCredentials.Builder setCalendar(Calendar calendar) This method is marked obsolete. There is no alternative to setting a custom calendar for the Credential.Sets the calendar to be used for parsing the expiration time.
- Parameters:
calendar- the calendar to use- Returns:
- the builder
-
setConnectTimeout
Warning: Not for public use and can be removed at any time. -
setReadTimeout
Warning: Not for public use and can be removed at any time. -
getCalendar
@ObsoleteApi("This method is obsolete and will be removed in a future release.") public Calendar getCalendar()This method is marked obsolete. There is no alternative to getting a custom calendar for the Credential.Returns the calendar to be used for parsing the expiration time.
- Returns:
- the calendar
-
build
- Overrides:
buildin classGoogleCredentials.Builder
-
Builder(ImpersonatedCredentials)instead.