|
17 | 17 |
|
18 | 18 | import com.google.auth.Credentials; |
19 | 19 | import com.google.auth.oauth2.ServiceAccountCredentials; |
20 | | - |
21 | 20 | import java.io.IOException; |
22 | 21 | import java.net.URI; |
23 | 22 | import java.util.List; |
|
31 | 30 | * underlying service account credentials for a running Spanner Client. |
32 | 31 | * |
33 | 32 | * <p>All operations inherited from {@link Credentials} are forwarded to the current delegate, |
34 | | - * including request metadata retrieval and token refresh. Calling |
35 | | - * {@link #updateCredentials(ServiceAccountCredentials)} replaces the delegate with a newly scoped |
| 33 | + * including request metadata retrieval and token refresh. Calling {@link |
| 34 | + * #updateCredentials(ServiceAccountCredentials)} replaces the delegate with a newly scoped |
36 | 35 | * credentials instance created from the same scopes that were provided when this object was |
37 | 36 | * constructed. |
38 | 37 | */ |
39 | 38 | public class MutableCredentials extends Credentials { |
40 | | - ServiceAccountCredentials delegate; |
41 | | - List<String> scopes; |
| 39 | + ServiceAccountCredentials delegate; |
| 40 | + List<String> scopes; |
42 | 41 |
|
43 | | - public MutableCredentials(ServiceAccountCredentials credentials, List<String> scopes) { |
44 | | - this. scopes = scopes; |
45 | | - delegate = (ServiceAccountCredentials) credentials.createScoped(scopes); |
46 | | - } |
| 42 | + public MutableCredentials(ServiceAccountCredentials credentials, List<String> scopes) { |
| 43 | + this.scopes = scopes; |
| 44 | + delegate = (ServiceAccountCredentials) credentials.createScoped(scopes); |
| 45 | + } |
47 | 46 |
|
48 | | - /** |
49 | | - * Replaces the current delegate with a newly scoped credentials instance. |
50 | | - * |
51 | | - * <p>The provided {@link ServiceAccountCredentials} is scoped using the same scopes that were |
52 | | - * supplied when this {@link MutableCredentials} instance was created. |
53 | | - * |
54 | | - * @param credentials the new base service account credentials to scope and use for client |
55 | | - * authorization. |
56 | | - */ |
57 | | - public void updateCredentials(ServiceAccountCredentials credentials) { |
58 | | - delegate =(ServiceAccountCredentials) credentials.createScoped(scopes); |
59 | | - } |
| 47 | + /** |
| 48 | + * Replaces the current delegate with a newly scoped credentials instance. |
| 49 | + * |
| 50 | + * <p>The provided {@link ServiceAccountCredentials} is scoped using the same scopes that were |
| 51 | + * supplied when this {@link MutableCredentials} instance was created. |
| 52 | + * |
| 53 | + * @param credentials the new base service account credentials to scope and use for client |
| 54 | + * authorization. |
| 55 | + */ |
| 56 | + public void updateCredentials(ServiceAccountCredentials credentials) { |
| 57 | + delegate = (ServiceAccountCredentials) credentials.createScoped(scopes); |
| 58 | + } |
60 | 59 |
|
61 | | - @Override |
62 | | - public String getAuthenticationType() { |
63 | | - return delegate.getAuthenticationType(); |
64 | | - } |
| 60 | + @Override |
| 61 | + public String getAuthenticationType() { |
| 62 | + return delegate.getAuthenticationType(); |
| 63 | + } |
65 | 64 |
|
66 | | - @Override |
67 | | - public Map<String, List<String>> getRequestMetadata(URI uri) throws IOException { |
68 | | - return delegate.getRequestMetadata(uri); |
69 | | - } |
| 65 | + @Override |
| 66 | + public Map<String, List<String>> getRequestMetadata(URI uri) throws IOException { |
| 67 | + return delegate.getRequestMetadata(uri); |
| 68 | + } |
70 | 69 |
|
71 | | - @Override |
72 | | - public boolean hasRequestMetadata() { |
73 | | - return delegate.hasRequestMetadata(); |
74 | | - } |
| 70 | + @Override |
| 71 | + public boolean hasRequestMetadata() { |
| 72 | + return delegate.hasRequestMetadata(); |
| 73 | + } |
75 | 74 |
|
76 | | - @Override |
77 | | - public boolean hasRequestMetadataOnly() { |
78 | | - return delegate.hasRequestMetadataOnly(); |
79 | | - } |
| 75 | + @Override |
| 76 | + public boolean hasRequestMetadataOnly() { |
| 77 | + return delegate.hasRequestMetadataOnly(); |
| 78 | + } |
80 | 79 |
|
81 | | - @Override |
82 | | - public void refresh() throws IOException { |
83 | | - delegate.refresh(); |
84 | | - } |
| 80 | + @Override |
| 81 | + public void refresh() throws IOException { |
| 82 | + delegate.refresh(); |
| 83 | + } |
85 | 84 | } |
86 | | - |
0 commit comments