Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DateTimeOffset property for simpler usage #280

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions FirebaseAdmin/FirebaseAdmin/Auth/FirebaseToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using System.Collections.Generic;
using Newtonsoft.Json;

Expand Down Expand Up @@ -56,12 +57,24 @@ internal FirebaseToken(Args args)
/// </summary>
public long ExpirationTimeSeconds { get; }

/// <summary>
/// Gets the expiration time claim that identifies the expiration time
/// on or after which the token MUST NOT be accepted for processing.
/// </summary>
public DateTimeOffset ExpiredAt => DateTimeOffset.FromUnixTimeSeconds(ExpirationTimeSeconds);

/// <summary>
/// Gets the issued at claim that identifies the time (in seconds) at which the JWT was
/// issued.
/// </summary>
public long IssuedAtTimeSeconds { get; }

/// <summary>
/// Gets the issued at claim that identifies the time at which the JWT was
/// issued.
/// </summary>
public DateTimeOffset IssuedAt => DateTimeOffset.FromUnixTimeSeconds(IssuedAtTimeSeconds);

/// <summary>
/// Gets the User ID of the user to which this ID token belongs. This is same as
/// <see cref="Subject"/>.
Expand Down