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()@Nullable CalendarThis method is marked obsolete.@Nullable HttpTransportFactory@Nullable Stringint@Nullable GoogleCredentials@Nullable StringsetCalendar(@Nullable Calendar calendar) This method is marked obsolete.setDelegates(@Nullable List<String> delegates) setHttpTransportFactory(@Nullable HttpTransportFactory transportFactory) setIamEndpointOverride(@Nullable String iamEndpointOverride) setLifetime(int lifetime) setQuotaProjectId(@Nullable String quotaProjectId) 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
@CanIgnoreReturnValue public ImpersonatedCredentials.Builder setDelegates(@Nullable List<String> delegates) -
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(@Nullable HttpTransportFactory transportFactory) -
getHttpTransportFactory
-
setQuotaProjectId
@CanIgnoreReturnValue public ImpersonatedCredentials.Builder setQuotaProjectId(@Nullable String quotaProjectId) - Overrides:
setQuotaProjectIdin classGoogleCredentials.Builder
-
setIamEndpointOverride
@CanIgnoreReturnValue public ImpersonatedCredentials.Builder setIamEndpointOverride(@Nullable String iamEndpointOverride) -
getIamEndpointOverride
-
setCalendar
@CanIgnoreReturnValue @ObsoleteApi("This method is obsolete and will be removed in a future release.") public ImpersonatedCredentials.Builder setCalendar(@Nullable 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
-
getCalendar
@ObsoleteApi("This method is obsolete and will be removed in a future release.") public @Nullable 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.