Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 Copyright 2013 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.Collections.Generic; | |
19 using System.IO; | |
20 | |
21 using Google.Apis.Json; | |
22 | |
23 namespace Google.Apis.Auth.OAuth2 | |
24 { | |
25 /// <summary> | |
26 /// OAuth 2.0 client secrets model as specified in "https://code.google.com/ apis/console/". | |
class
2013/09/24 17:25:58
Just a heads up, this is moving to https://cloud.g
peleyal
2013/09/24 20:55:35
Done.
| |
27 /// </summary> | |
28 public sealed class GoogleClientSecrets | |
29 { | |
30 /// <summary>Gets or sets the details for installed applications.</summa ry> | |
31 [Newtonsoft.Json.JsonProperty("installed")] | |
32 private ClientSecrets Installed { get; set; } | |
33 | |
34 /// <summary>Gets or sets the details for web applications.</summary> | |
35 [Newtonsoft.Json.JsonProperty("web")] | |
36 private ClientSecrets Web { get; set; } | |
37 | |
38 /// <summary>Gets the client secrets which contains the client identifie r and client secret. </summary> | |
39 public ClientSecrets Secrets | |
40 { | |
41 get | |
42 { | |
43 if (Installed == null && Web == null) | |
44 { | |
45 throw new InvalidOperationException( | |
46 "At least one client secrets (Installed or Web) should b e set"); | |
47 } | |
48 return Installed ?? Web; | |
49 } | |
50 } | |
51 | |
52 /// <summary>Loads the Google client secret from the input stream.</summ ary> | |
53 public static GoogleClientSecrets Load(Stream stream) | |
54 { | |
55 return NewtonsoftJsonSerializer.Instance.Deserialize<GoogleClientSec rets>(stream); | |
56 } | |
57 } | |
58 } | |
OLD | NEW |