/** * @param sourceCredentials The source credential used as to acquire the impersonated credentials * @param targetPrincipal The service account to impersonate. * @param delegates The chained list of delegates required to grant the final access_token. If * set, the sequence of identities must have "Service Account Token Creator" capability granted to * the preceding identity. For example, if set to [serviceAccountB, serviceAccountC], the * sourceCredential must have the Token Creator role on serviceAccountB. serviceAccountB must have * the Token Creator on serviceAccountC. Finally, C must have Token Creator on target_principal. * If left unset, sourceCredential must have that role on targetPrincipal. * @param scopes Scopes to request during the authorization grant. * @param lifetime Number of seconds the delegated credential should be valid for (up to 3600). */ public static ImpersonatedCredentials create(GoogleCredentials sourceCredentials, String targetPrincipal, List<String> delegates, List<String> scopes, int lifetime) { return ImpersonatedCredentials.newBuilder() .setSourceCredentials(sourceCredentials) .setTargetPrincipal(targetPrincipal) .setDelegates(delegates) .setScopes(scopes) .setLifetime(lifetime) .build(); }
/** * @param sourceCredentials The source credential used as to acquire the impersonated credentials * @param targetPrincipal The service account to impersonate. * @param delegates The chained list of delegates required to grant the final access_token. If * set, the sequence of identities must have "Service Account Token Creator" capability granted to * the preceding identity. For example, if set to [serviceAccountB, serviceAccountC], the * sourceCredential must have the Token Creator role on serviceAccountB. serviceAccountB must have * the Token Creator on serviceAccountC. Finally, C must have Token Creator on target_principal. * If left unset, sourceCredential must have that role on targetPrincipal. * @param scopes Scopes to request during the authorization grant. * @param lifetime Number of seconds the delegated credential should be valid for (up to 3600). */ public static ImpersonatedCredentials create(GoogleCredentials sourceCredentials, String targetPrincipal, List<String> delegates, List<String> scopes, int lifetime) { return ImpersonatedCredentials.newBuilder() .setSourceCredentials(sourceCredentials) .setTargetPrincipal(targetPrincipal) .setDelegates(delegates) .setScopes(scopes) .setLifetime(lifetime) .build(); }
/** * @param sourceCredentials The source credential used as to acquire the impersonated credentials * @param targetPrincipal The service account to impersonate. * @param delegates The chained list of delegates required to grant the final access_token. If * set, the sequence of identities must have "Service Account Token Creator" capability granted to * the preceding identity. For example, if set to [serviceAccountB, serviceAccountC], the * sourceCredential must have the Token Creator role on serviceAccountB. serviceAccountB must have * the Token Creator on serviceAccountC. Finally, C must have Token Creator on target_principal. * If left unset, sourceCredential must have that role on targetPrincipal. * @param scopes Scopes to request during the authorization grant. * @param lifetime Number of seconds the delegated credential should be valid for (up to 3600). * @param transportFactory HTTP transport factory, creates the transport used to get access * tokens. */ public static ImpersonatedCredentials create(GoogleCredentials sourceCredentials, String targetPrincipal, List<String> delegates, List<String> scopes, int lifetime, HttpTransportFactory transportFactory) { return ImpersonatedCredentials.newBuilder() .setSourceCredentials(sourceCredentials) .setTargetPrincipal(targetPrincipal) .setDelegates(delegates) .setScopes(scopes) .setLifetime(lifetime) .setHttpTransportFactory(transportFactory) .build(); }
/** * @param sourceCredentials The source credential used as to acquire the impersonated credentials * @param targetPrincipal The service account to impersonate. * @param delegates The chained list of delegates required to grant the final access_token. If * set, the sequence of identities must have "Service Account Token Creator" capability granted to * the preceding identity. For example, if set to [serviceAccountB, serviceAccountC], the * sourceCredential must have the Token Creator role on serviceAccountB. serviceAccountB must have * the Token Creator on serviceAccountC. Finally, C must have Token Creator on target_principal. * If left unset, sourceCredential must have that role on targetPrincipal. * @param scopes Scopes to request during the authorization grant. * @param lifetime Number of seconds the delegated credential should be valid for (up to 3600). * @param transportFactory HTTP transport factory, creates the transport used to get access * tokens. */ public static ImpersonatedCredentials create(GoogleCredentials sourceCredentials, String targetPrincipal, List<String> delegates, List<String> scopes, int lifetime, HttpTransportFactory transportFactory) { return ImpersonatedCredentials.newBuilder() .setSourceCredentials(sourceCredentials) .setTargetPrincipal(targetPrincipal) .setDelegates(delegates) .setScopes(scopes) .setLifetime(lifetime) .setHttpTransportFactory(transportFactory) .build(); }