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

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

Issue 94340043: Issue 463: Provide a signout\logout method (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Left Patch Set: Update code for WP and WinRT Created 9 years, 10 months ago
Right Patch Set: Gus' comments Created 9 years, 10 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
LEFTRIGHT
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 { 69 {
70 var initializer = new GoogleAuthorizationCodeFlow.Initializer 70 var initializer = new GoogleAuthorizationCodeFlow.Initializer
71 { 71 {
72 ClientSecretsStream = clientSecretsStream, 72 ClientSecretsStream = clientSecretsStream,
73 }; 73 };
74 74
75 return await AuthorizeAsyncCore(initializer, scopes, user, taskCance llationToken).ConfigureAwait(false); 75 return await AuthorizeAsyncCore(initializer, scopes, user, taskCance llationToken).ConfigureAwait(false);
76 } 76 }
77 77
78 /// <summary> 78 /// <summary>
79 /// Reauthorize asynchronously the user. This method should be called if the user should be reauthorize after 79 /// Asynchronously reauthorizes the user. This method should be called i f the users want to authorize after
80 /// revoking the token. 80 /// they revoked the token.
81 /// </summary> 81 /// </summary>
82 /// <param name="userCredential">The current user credential. Its <see c ref="UserCredential.Token"/></param> 82 /// <param name="userCredential">The current user credential. Its <see c ref="UserCredential.Token"/> will be
83 /// will be updated. 83 /// updated. </param>
84 /// <param name="taskCancellationToken">Cancellation token to cancel an operation.</param> 84 /// <param name="taskCancellationToken">Cancellation token to cancel an operation.</param>
85 public static async Task ReauthorizeAsync(UserCredential userCredential, 85 public static async Task ReauthorizeAsync(UserCredential userCredential,
86 CancellationToken taskCancellationToken) 86 CancellationToken taskCancellationToken)
87 { 87 {
88 var installedApp = new AuthorizationCodeWPInstalledApp(userCredentia l.Flow); 88 var installedApp = new AuthorizationCodeWPInstalledApp(userCredentia l.Flow);
89 // Create authorization code installed app instance and authorize th e user. 89 // Create an authorization code installed app instance and authorize the user.
90 UserCredential newUserCredential = await installedApp.AuthorizeAsync ( 90 UserCredential newUserCredential = await installedApp.AuthorizeAsync (userCredential.UderId,
91 userCredential.UderId, taskCancellationToken).ConfigureAwait(fal se); 91 taskCancellationToken).ConfigureAwait(false);
92 userCredential.Token = newUserCredential.Token; 92 userCredential.Token = newUserCredential.Token;
93 } 93 }
94 94
95 /// <summary>The core logic for asynchronously authorizing the specified user.</summary> 95 /// <summary>The core logic for asynchronously authorizing the specified user.</summary>
96 /// <param name="initializer">The authorization code initializer.</param > 96 /// <param name="initializer">The authorization code initializer.</param >
97 /// <param name="scopes"> 97 /// <param name="scopes">
98 /// The scopes which indicate the Google API access your application is requesting. 98 /// The scopes which indicate the Google API access your application is requesting.
99 /// </param> 99 /// </param>
100 /// <param name="user">The user to authenticate.</param> 100 /// <param name="user">The user to authenticate.</param>
101 /// <param name="taskCancellationToken">Cancellation token to cancel an operation.</param> 101 /// <param name="taskCancellationToken">Cancellation token to cancel an operation.</param>
102 /// <returns>User credential.</returns> 102 /// <returns>User credential.</returns>
103 private static async Task<UserCredential> AuthorizeAsyncCore( 103 private static async Task<UserCredential> AuthorizeAsyncCore(
104 GoogleAuthorizationCodeFlow.Initializer initializer, IEnumerable<str ing> scopes, string user, 104 GoogleAuthorizationCodeFlow.Initializer initializer, IEnumerable<str ing> scopes, string user,
105 CancellationToken taskCancellationToken) 105 CancellationToken taskCancellationToken)
106 { 106 {
107 initializer.Scopes = scopes; 107 initializer.Scopes = scopes;
108 initializer.DataStore = new StorageDataStore(); 108 initializer.DataStore = new StorageDataStore();
109 109
110 var installedApp = new AuthorizationCodeWPInstalledApp(initializer); 110 var installedApp = new AuthorizationCodeWPInstalledApp(new GoogleAut horizationCodeFlow(initializer));
111 return await installedApp.AuthorizeAsync(user, taskCancellationToken ).ConfigureAwait(false); 111 return await installedApp.AuthorizeAsync(user, taskCancellationToken ).ConfigureAwait(false);
112 } 112 }
113 } 113 }
114 } 114 }
LEFTRIGHT

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