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

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

Issue 14341043: Issue 351: Reimplement OAuth2 (Step 4): ServiceAccount and MVC (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Left Patch Set: Created 10 years, 9 months ago
Right Patch Set: Gus comments Created 10 years, 8 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:
Right: Side by side diff | Download
LEFTRIGHT
(no file at all)
1 /* 1 /*
2 Copyright 2013 Google Inc 2 Copyright 2013 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
11 distributed under the License is distributed on an "AS IS" BASIS, 11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and 13 See the License for the specific language governing permissions and
14 limitations under the License. 14 limitations under the License.
15 */ 15 */
16 16
17 using System.Collections.Generic; 17 using System.Collections.Generic;
18 using System.IO; 18 using System.IO;
19 using System.Threading; 19 using System.Threading;
20 using System.Threading.Tasks; 20 using System.Threading.Tasks;
21 21
22 using Google.Apis.Auth.OAuth2.Flows;
22 using Google.Apis.Util.Store; 23 using Google.Apis.Util.Store;
23 24
24 namespace Google.Apis.Auth.OAuth2 25 namespace Google.Apis.Auth.OAuth2
25 { 26 {
26 /// <summary>A helper utility to manage the authorization code flow.</summar y> 27 /// <summary>A helper utility to manage the authorization code flow.</summar y>
27 public class GoogleWebAuthenticationBroker 28 public class GoogleWebAuthenticationBroker
28 { 29 {
29 /// <summary>The folder which is used by the <seealso cref="Google.Apis. Util.Store.FileDataStore"/>.</summary> 30 /// <summary>The folder which is used by the <seealso cref="Google.Apis. Util.Store.FileDataStore"/>.</summary>
30 public static string Folder = "Google.Apis.Auth"; 31 public static string Folder = "Google.Apis.Auth";
31 32
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 /// <returns>User credential.</returns> 91 /// <returns>User credential.</returns>
91 private static async Task<UserCredential> AuthenticateAsyncCore(Authoriz ationCodeFlow.Initializer initializer, 92 private static async Task<UserCredential> AuthenticateAsyncCore(Authoriz ationCodeFlow.Initializer initializer,
92 IEnumerable<string> scopes, string user, CancellationToken taskCance llationToken, 93 IEnumerable<string> scopes, string user, CancellationToken taskCance llationToken,
93 IDataStore dataStore = null) 94 IDataStore dataStore = null)
94 { 95 {
95 initializer.Scopes = scopes; 96 initializer.Scopes = scopes;
96 initializer.DataStore = dataStore ?? new FileDataStore(Folder); 97 initializer.DataStore = dataStore ?? new FileDataStore(Folder);
97 var flow = new GoogleAuthorizationCodeFlow(initializer); 98 var flow = new GoogleAuthorizationCodeFlow(initializer);
98 99
99 // Create authorization code installed app instance and authorize th e user. 100 // Create authorization code installed app instance and authorize th e user.
100 return await new AuthorizationCodeInstalledApp(flow, new LocalServer CodeReceiver()).Authorize 101 return await new AuthorizationCodeInstalledApp(flow, new LocalServer CodeReceiver()).AuthorizeAsync
101 (user, taskCancellationToken); 102 (user, taskCancellationToken);
102 } 103 }
103 } 104 }
104 } 105 }
LEFTRIGHT

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