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

Side by Side Diff: Src/GoogleApis.Auth.DotNet4/OAuth2/GoogleWebAuthorizationBroker.cs

Issue 176220043: Issue 471: Support WP8.1 (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Patch Set: minor Created 9 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:
View unified diff | Download patch
OLDNEW
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
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 /// </summary> 93 /// </summary>
94 /// <param name="userCredential">The current user credential. Its <see c ref="UserCredential.Token"/> will be 94 /// <param name="userCredential">The current user credential. Its <see c ref="UserCredential.Token"/> will be
95 /// updated. </param> 95 /// updated. </param>
96 /// <param name="taskCancellationToken">Cancellation token to cancel an operation.</param> 96 /// <param name="taskCancellationToken">Cancellation token to cancel an operation.</param>
97 public static async Task ReauthorizeAsync(UserCredential userCredential, 97 public static async Task ReauthorizeAsync(UserCredential userCredential,
98 CancellationToken taskCancellationToken) 98 CancellationToken taskCancellationToken)
99 { 99 {
100 // Create an authorization code installed app instance and authorize the user. 100 // Create an authorization code installed app instance and authorize the user.
101 UserCredential newUserCredential = await new AuthorizationCodeInstal ledApp(userCredential.Flow, 101 UserCredential newUserCredential = await new AuthorizationCodeInstal ledApp(userCredential.Flow,
102 new LocalServerCodeReceiver()).AuthorizeAsync 102 new LocalServerCodeReceiver()).AuthorizeAsync
103 (userCredential.UderId, taskCancellationToken).ConfigureAwait(fa lse); 103 (userCredential.UserId, taskCancellationToken).ConfigureAwait(fa lse);
104 userCredential.Token = newUserCredential.Token; 104 userCredential.Token = newUserCredential.Token;
105 } 105 }
106 106
107 /// <summary>The core logic for asynchronously authorizing the specified user.</summary> 107 /// <summary>The core logic for asynchronously authorizing the specified user.</summary>
108 /// <param name="initializer">The authorization code initializer.</param > 108 /// <param name="initializer">The authorization code initializer.</param >
109 /// <param name="scopes"> 109 /// <param name="scopes">
110 /// The scopes which indicate the Google API access your application is requesting. 110 /// The scopes which indicate the Google API access your application is requesting.
111 /// </param> 111 /// </param>
112 /// <param name="user">The user to authorize.</param> 112 /// <param name="user">The user to authorize.</param>
113 /// <param name="taskCancellationToken">Cancellation token to cancel an operation.</param> 113 /// <param name="taskCancellationToken">Cancellation token to cancel an operation.</param>
114 /// <param name="dataStore">The data store, if not specified a file data store will be used.</param> 114 /// <param name="dataStore">The data store, if not specified a file data store will be used.</param>
115 /// <returns>User credential.</returns> 115 /// <returns>User credential.</returns>
116 private static async Task<UserCredential> AuthorizeAsyncCore( 116 private static async Task<UserCredential> AuthorizeAsyncCore(
117 GoogleAuthorizationCodeFlow.Initializer initializer, IEnumerable<str ing> scopes, string user, 117 GoogleAuthorizationCodeFlow.Initializer initializer, IEnumerable<str ing> scopes, string user,
118 CancellationToken taskCancellationToken, IDataStore dataStore = null ) 118 CancellationToken taskCancellationToken, IDataStore dataStore = null )
119 { 119 {
120 initializer.Scopes = scopes; 120 initializer.Scopes = scopes;
121 initializer.DataStore = dataStore ?? new FileDataStore(Folder); 121 initializer.DataStore = dataStore ?? new FileDataStore(Folder);
122 var flow = new GoogleAuthorizationCodeFlow(initializer); 122 var flow = new GoogleAuthorizationCodeFlow(initializer);
123 123
124 // Create an authorization code installed app instance and authorize the user. 124 // Create an authorization code installed app instance and authorize the user.
125 return await new AuthorizationCodeInstalledApp(flow, new LocalServer CodeReceiver()).AuthorizeAsync 125 return await new AuthorizationCodeInstalledApp(flow, new LocalServer CodeReceiver()).AuthorizeAsync
126 (user, taskCancellationToken).ConfigureAwait(false); 126 (user, taskCancellationToken).ConfigureAwait(false);
127 } 127 }
128 } 128 }
129 } 129 }
OLDNEW
« no previous file with comments | « Src/GoogleApis.Auth.DotNet4/GoogleApis.Auth.DotNet4.csproj ('k') | Src/GoogleApis.Auth.DotNet4/app.config » ('j') | no next file with comments »

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