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

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: Created 10 years, 2 months ago
Right Patch Set: Gus' comments Created 10 years, 2 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
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 IEnumerable<string> scopes, string user, CancellationToken taskCance llationToken) 68 IEnumerable<string> scopes, string user, CancellationToken taskCance llationToken)
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>
79 /// Asynchronously reauthorizes the user. This method should be called i f the users want to authorize after·
80 /// they revoked the token.
81 /// </summary>
82 /// <param name="userCredential">The current user credential. Its <see c ref="UserCredential.Token"/> will be
83 /// updated. </param>
84 /// <param name="taskCancellationToken">Cancellation token to cancel an operation.</param>
85 public static async Task ReauthorizeAsync(UserCredential userCredential,
86 CancellationToken taskCancellationToken)
87 {
88 var installedApp = new AuthorizationCodeWPInstalledApp(userCredentia l.Flow);
89 // Create an authorization code installed app instance and authorize the user.
90 UserCredential newUserCredential = await installedApp.AuthorizeAsync (userCredential.UderId,
91 taskCancellationToken).ConfigureAwait(false);
92 userCredential.Token = newUserCredential.Token;
93 }
94
78 /// <summary>The core logic for asynchronously authorizing the specified user.</summary> 95 /// <summary>The core logic for asynchronously authorizing the specified user.</summary>
79 /// <param name="initializer">The authorization code initializer.</param > 96 /// <param name="initializer">The authorization code initializer.</param >
80 /// <param name="scopes"> 97 /// <param name="scopes">
81 /// 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.
82 /// </param> 99 /// </param>
83 /// <param name="user">The user to authenticate.</param> 100 /// <param name="user">The user to authenticate.</param>
84 /// <param name="taskCancellationToken">Cancellation token to cancel an operation.</param> 101 /// <param name="taskCancellationToken">Cancellation token to cancel an operation.</param>
85 /// <returns>User credential.</returns> 102 /// <returns>User credential.</returns>
86 private static async Task<UserCredential> AuthorizeAsyncCore(Authorizati onCodeFlow.Initializer initializer, 103 private static async Task<UserCredential> AuthorizeAsyncCore(
87 IEnumerable<string> scopes, string user, CancellationToken taskCance llationToken) 104 GoogleAuthorizationCodeFlow.Initializer initializer, IEnumerable<str ing> scopes, string user,
105 CancellationToken taskCancellationToken)
88 { 106 {
89 initializer.Scopes = scopes; 107 initializer.Scopes = scopes;
90 initializer.DataStore = new StorageDataStore(); 108 initializer.DataStore = new StorageDataStore();
91 109
92 var installedApp = new AuthorizationCodeWPInstalledApp(initializer); 110 var installedApp = new AuthorizationCodeWPInstalledApp(new GoogleAut horizationCodeFlow(initializer));
93 return await installedApp.AuthorizeAsync(user, taskCancellationToken ).ConfigureAwait(false); 111 return await installedApp.AuthorizeAsync(user, taskCancellationToken ).ConfigureAwait(false);
94 } 112 }
95 } 113 }
96 } 114 }
LEFTRIGHT

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