OLD | NEW |
(Empty) | |
| 1 /* |
| 2 Copyright 2014 Google Inc |
| 3 |
| 4 Licensed under the Apache License, Version 2.0 (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 |
| 7 |
| 8 http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
| 10 Unless required by applicable law or agreed to in writing, software |
| 11 distributed under the License is distributed on an "AS IS" BASIS, |
| 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 See the License for the specific language governing permissions and |
| 14 limitations under the License. |
| 15 */ |
| 16 |
| 17 using System; |
| 18 using System.Threading; |
| 19 using System.Threading.Tasks; |
| 20 |
| 21 using Google.Apis.Auth.OAuth2.Flows; |
| 22 |
| 23 namespace Google.Apis.Auth.OAuth2 |
| 24 { |
| 25 /// <summary> |
| 26 /// OAuth 2.0 authorization code flow for a Windows Phone 8.1 installed appl
ication that persists end-user |
| 27 /// credentials. |
| 28 /// <remarks> |
| 29 /// This installed app class uses an internal <see cref="AuthorizationCodeIn
stalledApp"/> with a |
| 30 /// <see cref="Google.Apis.Auth.OAuth2.AuthorizationCodeBroker"/> for retrie
ving the authorization code.· |
| 31 /// </remarks> |
| 32 /// </summary> |
| 33 public sealed class AuthorizationCodeWPInstalledApp : IAuthorizationCodeInst
alledApp |
| 34 { |
| 35 private readonly IAuthorizationCodeInstalledApp innerInstallApp; |
| 36 |
| 37 /// <summary> |
| 38 /// Constructs a new authorization code for Windows Store application ta
rgeting an installed application flow. |
| 39 /// </summary> |
| 40 /// <param name="authorizationCodeFlowInitializer">An authorization code
flow initializer.</param> |
| 41 public AuthorizationCodeWPInstalledApp(AuthorizationCodeFlow.Initializer
authorizationCodeFlowInitializer) |
| 42 { |
| 43 innerInstallApp = new AuthorizationCodeInstalledApp( |
| 44 new AuthorizationCodeFlow(authorizationCodeFlowInitializer), new
AuthorizationCodeBroker()); |
| 45 } |
| 46 |
| 47 /// <summary> |
| 48 /// Constructs a new authorization code for Windows Store application ta
rgeting an installed application flow. |
| 49 /// </summary> |
| 50 /// <param name="flow">An authorization code flow.</param> |
| 51 public AuthorizationCodeWPInstalledApp(IAuthorizationCodeFlow flow) |
| 52 { |
| 53 innerInstallApp = new AuthorizationCodeInstalledApp(flow, new Author
izationCodeBroker()); |
| 54 } |
| 55 |
| 56 #region IAuthorizationCodeInstalledApp Members |
| 57 |
| 58 public IAuthorizationCodeFlow Flow |
| 59 { |
| 60 get { return innerInstallApp.Flow; } |
| 61 } |
| 62 |
| 63 public ICodeReceiver CodeReceiver |
| 64 { |
| 65 get { return innerInstallApp.CodeReceiver; } |
| 66 } |
| 67 |
| 68 public async Task<UserCredential> AuthorizeAsync(string userId, Cancella
tionToken taskCancellationToken) |
| 69 { |
| 70 return await innerInstallApp.AuthorizeAsync(userId, taskCancellation
Token).ConfigureAwait(false); |
| 71 } |
| 72 |
| 73 #endregion |
| 74 } |
| 75 } |
OLD | NEW |