C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
BearerAuthenticationToken.cs
Go to the documentation of this file.
1using System;
2
4{
10 {
14 public string AuthorizationMethod => "Bearer";
15
19 public AccessTokenStatus status { get; set; } = AccessTokenStatus.Unknown;
20
24 public string access_token { get; set; } // Updated
25
29 public DateTime ExpirationTime { get; private set; }
30
35
41 public BearerAuthenticationToken(string token, DateTime expirationTime)
42 {
43 access_token = token;
44 ExpirationTime = expirationTime;
45 }
46
51 public bool IsExpired()
52 {
53 return DateTime.UtcNow >= ExpirationTime;
54 }
55
60 public override string ToString() => $"{AuthorizationMethod} {access_token}";
61 }
62}
An AccessToken storing Bearer authentication information for requests made to the server,...
string AuthorizationMethod
The Authorization Method included in the Authorization header.
override string ToString()
Returns the representation of this access token that could be placed in an "Authorization" header.
BearerAuthenticationToken(string token, DateTime expirationTime)
Construct a new BearerAuthenticationToken with a token and expiration.
BearerAuthenticationToken()
Construct a new unauthorized BearerAuthenticationToken.
AccessTokenStatus status
The AccessToken's current AccessTokenStatus (unauthorized / valid).
An AccessToken storing authentication information for requests made to the server.
AccessTokenStatus
An AccessToken's status (unauthorized / valid).