Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(644)

Delta Between Two Patch Sets: Src/GoogleApis.Auth/OAuth2/ServiceCredential.cs

Issue 181560043: ComputeCredential (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Left Patch Set: minor Created 9 years, 3 months ago
Right Patch Set: reverting changes to Program release Created 9 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Src/GoogleApis.Auth/OAuth2/GoogleConsts.cs ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 Copyright 2014 Google Inc 2 Copyright 2014 Google Inc
3 3
4 Licensed under the Apache License, Version 2.0 (the "License"); 4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License. 5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at 6 You may obtain a copy of the License at
7 7
8 http://www.apache.org/licenses/LICENSE-2.0 8 http://www.apache.org/licenses/LICENSE-2.0
9 9
10 Unless required by applicable law or agreed to in writing, software 10 Unless required by applicable law or agreed to in writing, software
(...skipping 10 matching lines...) Expand all
21 using System.Threading.Tasks; 21 using System.Threading.Tasks;
22 22
23 using Google.Apis.Auth.OAuth2.Responses; 23 using Google.Apis.Auth.OAuth2.Responses;
24 using Google.Apis.Http; 24 using Google.Apis.Http;
25 using Google.Apis.Logging; 25 using Google.Apis.Logging;
26 using Google.Apis.Util; 26 using Google.Apis.Util;
27 27
28 namespace Google.Apis.Auth.OAuth2 28 namespace Google.Apis.Auth.OAuth2
29 { 29 {
30 /// <summary> 30 /// <summary>
31 /// Google OAuth 2.0 credential for accessing protected resources using an a ccess token. The Google OAuth 2.0· 31 /// This type of Google OAuth 2.0 credential enables access to protected res ources using an access token when
class 2014/12/11 18:39:11 Maybe rephrase the first paragraph of the summary
peleyal 2014/12/12 23:13:29 Done.
32 /// Authorization Server supports server-to-server interactions such as thos e between a web application and Google 32 /// interacting server to server. For example, a service account credential could be used to access Google Cloud
33 /// Cloud Storage. The requesting application has to prove its own identity to gain access to an API, and an· 33 /// Storage from a web application without a user's involvement.
34 /// end-user doesn't have to be involved.·
35 /// <para> 34 /// <para>
36 /// Take a look at <see cref="Google.Apis.Auth.OAuth2.ServiceAccountCredenti al"/>. 35 /// See also: <see cref="Google.Apis.Auth.OAuth2.ServiceAccountCredential"/> .
class 2014/12/11 18:39:10 Rephrase "Take a look at" ... as: See also: <see
peleyal 2014/12/12 23:13:29 Done.
37 /// <code>ServiceAccountCredential</code> inherits from this class in order to support Service Account. More 36 /// <code>ServiceAccountCredential</code> inherits from this class in order to support Service Account. More
38 /// details available at: https://developers.google.com/accounts/docs/OAuth2 ServiceAccount. 37 /// details available at: https://developers.google.com/accounts/docs/OAuth2 ServiceAccount.
39 /// <see cref="Google.Apis.Auth.OAuth2.ComputeCredential"/> is another examp le for a class that inherits from this 38 /// <see cref="Google.Apis.Auth.OAuth2.ComputeCredential"/> is another examp le for a class that inherits from this
40 /// class in order to support Compute credentials. More further reading abou t Compute authentication, take a look 39 /// class in order to support Compute credentials. For more information abou t Compute authentication, see:
class 2014/12/11 18:39:11 "More further reading about Compute authentication
peleyal 2014/12/12 23:13:29 Done.
41 /// at https://cloud.google.com/compute/docs/authentication. 40 /// https://cloud.google.com/compute/docs/authentication.
42 /// </para> 41 /// </para>
43 /// </summary> 42 /// </summary>
44 public abstract class ServiceCredential : IHttpExecuteInterceptor, IHttpUnsu ccessfulResponseHandler, 43 public abstract class ServiceCredential : IHttpExecuteInterceptor, IHttpUnsu ccessfulResponseHandler,
45 IConfigurableHttpClientInitializer 44 IConfigurableHttpClientInitializer
46 { 45 {
47 protected static readonly ILogger Logger = ApplicationContext.Logger.For Type<ServiceCredential>(); 46 protected static readonly ILogger Logger = ApplicationContext.Logger.For Type<ServiceCredential>();
48 47
49 /// <summary>An initializer class for the service credential. </summary> 48 /// <summary>An initializer class for the service credential. </summary>
50 public class Initializer 49 public class Initializer
51 { 50 {
52 /// <summary>Gets the token server URL.</summary> 51 /// <summary>Gets the token server URL.</summary>
53 public string TokenServerUrl { get; private set; } 52 public string TokenServerUrl { get; private set; }
54 53
55 /// <summary> 54 /// <summary>
56 /// Gets or sets the clock. The clock is used to determine if the to ken has expired, if so we will try to 55 /// Gets or sets the clock used to refresh the token when it expires . The default value is
class 2014/12/11 18:39:10 Gets or sets the clock used to refresh the token w
peleyal 2014/12/12 23:13:29 Done.
57 /// refresh it. The default value is <see cref="Google.Apis.Util.Sys temClock.Default"/>. 56 /// <see cref="Google.Apis.Util.SystemClock.Default"/>.
58 /// </summary> 57 /// </summary>
59 public IClock Clock { get; set; } 58 public IClock Clock { get; set; }
60 59
61 /// <summary> 60 /// <summary>
62 /// Gets or sets the method for presenting the access token to the r esource server. 61 /// Gets or sets the method for presenting the access token to the r esource server.
63 /// The default value is <see cref="BearerToken.AuthorizationHeaderA ccessMethod"/>. 62 /// The default value is <see cref="BearerToken.AuthorizationHeaderA ccessMethod"/>.
64 /// </summary> 63 /// </summary>
65 public IAccessMethod AccessMethod { get; set; } 64 public IAccessMethod AccessMethod { get; set; }
66 65
67 /// <summary> 66 /// <summary>
(...skipping 27 matching lines...) Expand all
95 private readonly string tokenServerUrl; 94 private readonly string tokenServerUrl;
96 private readonly IClock clock; 95 private readonly IClock clock;
97 private readonly IAccessMethod accessMethod; 96 private readonly IAccessMethod accessMethod;
98 private readonly ConfigurableHttpClient httpClient; 97 private readonly ConfigurableHttpClient httpClient;
99 98
100 #endregion 99 #endregion
101 100
102 /// <summary>Gets the token server URL.</summary> 101 /// <summary>Gets the token server URL.</summary>
103 public string TokenServerUrl { get { return tokenServerUrl; } } 102 public string TokenServerUrl { get { return tokenServerUrl; } }
104 103
105 /// <summary> 104 /// <summary>Gets the clock used to refresh the token if it expires.</su mmary>
106 /// Gets the clock. The clock is used to determine if the token has expi red, if so we will try to refresh it.·
class 2014/12/11 18:39:11 Gets the clock used to refresh the token if it exp
peleyal 2014/12/12 23:13:29 Done.
107 /// </summary>
108 public IClock Clock { get { return clock; } } 105 public IClock Clock { get { return clock; } }
109 106
110 /// <summary>Gets the method for presenting the access token to the reso urce server.</summary> 107 /// <summary>Gets the method for presenting the access token to the reso urce server.</summary>
111 public IAccessMethod AccessMethod { get { return accessMethod; } } 108 public IAccessMethod AccessMethod { get { return accessMethod; } }
112 109
113 /// <summary>Gets the HTTP client used to make authentication requests t o the server.</summary> 110 /// <summary>Gets the HTTP client used to make authentication requests t o the server.</summary>
114 public ConfigurableHttpClient HttpClient { get { return httpClient; } } 111 public ConfigurableHttpClient HttpClient { get { return httpClient; } }
115 112
116 private TokenResponse token; 113 private TokenResponse token;
117 private object lockObject = new object(); 114 private object lockObject = new object();
(...skipping 11 matching lines...) Expand all
129 protected set 126 protected set
130 { 127 {
131 lock (lockObject) 128 lock (lockObject)
132 { 129 {
133 token = value; 130 token = value;
134 } 131 }
135 } 132 }
136 } 133 }
137 134
138 /// <summary>Constructs a new service account credential using the given initializer.</summary> 135 /// <summary>Constructs a new service account credential using the given initializer.</summary>
139 /// <param name="initializer"></param>
class 2014/12/11 18:39:10 Missing parameter description
peleyal 2014/12/12 23:13:29 Done.
140 public ServiceCredential(Initializer initializer) 136 public ServiceCredential(Initializer initializer)
141 { 137 {
142 tokenServerUrl = initializer.TokenServerUrl; 138 tokenServerUrl = initializer.TokenServerUrl;
143 accessMethod = initializer.AccessMethod.ThrowIfNull("initializer.Acc essMethod"); 139 accessMethod = initializer.AccessMethod.ThrowIfNull("initializer.Acc essMethod");
144 clock = initializer.Clock.ThrowIfNull("initializer.Clock"); 140 clock = initializer.Clock.ThrowIfNull("initializer.Clock");
145 141
146 // Set the HTTP client. 142 // Set the HTTP client.
147 var httpArgs = new CreateHttpClientArgs(); 143 var httpArgs = new CreateHttpClientArgs();
148 144
149 // Add exponential back-off initializer if necessary. 145 // Add exponential back-off initializer if necessary.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 } 196 }
201 197
202 #endregion 198 #endregion
203 199
204 /// <summary>Requests a new token.</summary> 200 /// <summary>Requests a new token.</summary>
205 /// <param name="taskCancellationToken">Cancellation token to cancel ope ration.</param> 201 /// <param name="taskCancellationToken">Cancellation token to cancel ope ration.</param>
206 /// <returns><c>true</c> if a new token was received successfully.</retu rns> 202 /// <returns><c>true</c> if a new token was received successfully.</retu rns>
207 public abstract Task<bool> RequestAccessTokenAsync(CancellationToken tas kCancellationToken); 203 public abstract Task<bool> RequestAccessTokenAsync(CancellationToken tas kCancellationToken);
208 } 204 }
209 } 205 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b