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

Delta Between Two Patch Sets: Src/GoogleApis.Auth/OAuth2/Responses/TokenResponse.cs

Issue 13972043: Issue 351: Reimplement OAuth2 (Step 3 - Tests, Flows and Credential) (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Left Patch Set: Created 10 years, 10 months ago
Right Patch Set: minor Created 10 years, 9 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 /// It should be set by the CLIENT after the token was received from the server. 58 /// It should be set by the CLIENT after the token was received from the server.
59 /// </remarks>· 59 /// </remarks>·
60 /// </summary> 60 /// </summary>
61 public DateTime Issued { get; set; } 61 public DateTime Issued { get; set; }
62 62
63 /// <summary> 63 /// <summary>
64 /// Returns <c>true</c> if the token is expired or it's going to be expi red in the next minute. 64 /// Returns <c>true</c> if the token is expired or it's going to be expi red in the next minute.
65 /// </summary> 65 /// </summary>
66 public bool IsExpired(IClock clock) 66 public bool IsExpired(IClock clock)
67 { 67 {
68 //TODO(peleyal): consider move it to an extension method 68 if (AccessToken == null || !ExpiresInSeconds.HasValue)
69 if (!ExpiresInSeconds.HasValue)
70 { 69 {
71 return true; 70 return true;
72 } 71 }
73 72
74 return Issued.AddSeconds(ExpiresInSeconds.Value 60) <= clock.Now; 73 return Issued.AddSeconds(ExpiresInSeconds.Value 60) <= clock.Now;
75 } 74 }
76
77 /// <summary>
78 /// Copies all properties from the other token, except the other's refre sh token property in case it's null.
79 /// </summary>
80 internal void CopyFrom(TokenResponse other)
81 {
82 AccessToken = other.AccessToken;
83 TokenType = other.TokenType;
84 ExpiresInSeconds = other.ExpiresInSeconds;
85 if (other.RefreshToken != null)
86 {
87 RefreshToken = other.RefreshToken;
88 }
89 Scope = other.Scope;
90 Issued = other.Issued;
91 }
92 } 75 }
93 } 76 }
LEFTRIGHT

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