forked from SaviorXTanren/StreamingClientLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
82 changed files
with
3,400 additions
and
3,724 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,79 @@ | ||
using System; | ||
using System; | ||
using System.Runtime.Serialization; | ||
|
||
using Newtonsoft.Json; | ||
|
||
namespace StreamingClient.Base.Model.OAuth | ||
{ | ||
/// <summary> | ||
/// A token received from an OAuth authentication service. | ||
/// </summary> | ||
[DataContract] | ||
public class OAuthTokenModel | ||
{ | ||
/// <summary> | ||
/// The ID of the client service. | ||
/// </summary> | ||
[DataMember] | ||
public string clientID { get; set; } | ||
/// <summary> | ||
/// A token received from an OAuth authentication service. | ||
/// </summary> | ||
[DataContract] | ||
public class OAuthTokenModel | ||
{ | ||
/// <summary> | ||
/// The ID of the client service. | ||
/// </summary> | ||
[DataMember] | ||
public string clientID { get; set; } | ||
|
||
/// <summary> | ||
/// The secret of the client service. | ||
/// </summary> | ||
[DataMember] | ||
public string clientSecret { get; set; } | ||
/// <summary> | ||
/// The secret of the client service. | ||
/// </summary> | ||
[DataMember] | ||
public string clientSecret { get; set; } | ||
|
||
/// <summary> | ||
/// The authorization code sent when authenticating against the OAuth service. | ||
/// </summary> | ||
[DataMember] | ||
public string authorizationCode { get; set; } | ||
/// <summary> | ||
/// The authorization code sent when authenticating against the OAuth service. | ||
/// </summary> | ||
[DataMember] | ||
public string authorizationCode { get; set; } | ||
|
||
/// <summary> | ||
/// The token used for refreshing the authentication. | ||
/// </summary> | ||
[JsonProperty("refresh_token"), DataMember] | ||
public string refreshToken { get; set; } | ||
/// <summary> | ||
/// The token used for refreshing the authentication. | ||
/// </summary> | ||
[JsonProperty("refresh_token"), DataMember] | ||
public string refreshToken { get; set; } | ||
|
||
/// <summary> | ||
/// The token used for accessing the OAuth service. | ||
/// </summary> | ||
[JsonProperty("access_token"), DataMember] | ||
public string accessToken { get; set; } | ||
/// <summary> | ||
/// The token used for accessing the OAuth service. | ||
/// </summary> | ||
[JsonProperty("access_token"), DataMember] | ||
public string accessToken { get; set; } | ||
|
||
/// <summary> | ||
/// The expiration time of the token in seconds from when it was obtained. | ||
/// </summary> | ||
[JsonProperty("expires_in"), DataMember] | ||
public long expiresIn { get; set; } | ||
/// <summary> | ||
/// The expiration time of the token in seconds from when it was obtained. | ||
/// </summary> | ||
[JsonProperty("expires_in"), DataMember] | ||
public long expiresIn { get; set; } | ||
|
||
/// <summary> | ||
/// The timestamp of the expiration, if supported by the service, in seconds from Unix Epoch | ||
/// </summary> | ||
[JsonIgnore] | ||
public long expiresTimeStamp { get; set; } | ||
/// <summary> | ||
/// The timestamp of the expiration, if supported by the service, in seconds from Unix Epoch | ||
/// </summary> | ||
[JsonIgnore] | ||
public long expiresTimeStamp { get; set; } | ||
|
||
/// <summary> | ||
/// The redirect URL used as part of the token. | ||
/// </summary> | ||
[DataMember] | ||
public string redirectUrl { get; set; } | ||
/// <summary> | ||
/// The redirect URL used as part of the token. | ||
/// </summary> | ||
[DataMember] | ||
public string redirectUrl { get; set; } | ||
|
||
/// <summary> | ||
/// The time when the token was obtained. | ||
/// </summary> | ||
[DataMember] | ||
public DateTimeOffset AcquiredDateTime { get; set; } | ||
/// <summary> | ||
/// The time when the token was obtained. | ||
/// </summary> | ||
[DataMember] | ||
public DateTimeOffset AcquiredDateTime { get; set; } | ||
|
||
/// <summary> | ||
/// The expiration time of the token. | ||
/// </summary> | ||
[JsonIgnore] | ||
public DateTimeOffset ExpirationDateTime { get { return (this.expiresTimeStamp > 0) ? DateTimeOffset.FromUnixTimeSeconds(this.expiresTimeStamp) : this.AcquiredDateTime.AddSeconds(this.expiresIn); } } | ||
/// <summary> | ||
/// The expiration time of the token. | ||
/// </summary> | ||
[JsonIgnore] | ||
public DateTimeOffset ExpirationDateTime => (expiresTimeStamp > 0) ? DateTimeOffset.FromUnixTimeSeconds(expiresTimeStamp) : AcquiredDateTime.AddSeconds(expiresIn); | ||
|
||
/// <summary> | ||
/// Creates a new instance of an OAuth token. | ||
/// </summary> | ||
public OAuthTokenModel() | ||
{ | ||
this.AcquiredDateTime = DateTimeOffset.Now; | ||
} | ||
} | ||
/// <summary> | ||
/// Creates a new instance of an OAuth token. | ||
/// </summary> | ||
public OAuthTokenModel() => AcquiredDateTime = DateTimeOffset.Now; | ||
} | ||
} |
Oops, something went wrong.