示例#1
0
        public async Task <EsiTokenInfo> GetFullToken(string tokenCodeStr, TokenAuthenticationType authType)
        {
            var Token        = RequestAccessToken(tokenCodeStr, authType);
            var Verification = RequestTokenVerification(Token.AccessToken);

            // Create token composite with reference to self (EsiAuthClient) to allow tokens self-refresh functionality.
            return(new EsiTokenInfo(Token, Verification, this));
        }
示例#2
0
        public async Task <EsiTokenInfo> GetFullToken(string authorizationCode, bool firstTime /*= false*/)
        {
            TokenAuthenticationType type =
                firstTime ? TokenAuthenticationType.VerifyAuthCode : TokenAuthenticationType.RefreshToken;

            var Token        = RequestAccessToken(authorizationCode, type);
            var Verification = RequestTokenVerification(Token.AccessToken);

            // Create token composite with reference to self (EsiAuthClient) to allow tokens self-refresh functionality.
            return(new EsiTokenInfo(Token, Verification, this));
        }
示例#3
0
 /// <summary>
 /// Creates a token.
 /// </summary>
 /// <param name="accessToken">The access token.</param>
 /// <param name="refreshToken">The refresh token.</param>
 /// <param name="tokenType">The token type.</param>
 /// <param name="expiresIn">The expires in value.</param>
 /// <param name="tokenGenerated">The datetime the token was generated.</param>
 /// <param name="scope">The scope of the token.</param>
 /// <param name="canAccessPersonalData">If the token can access personal data.</param>
 /// <param name="authenticationType">The authentication type of the token.</param>
 /// <returns>The newly made <see cref="Token"/>.</returns>
 public static Token Make(
     string accessToken,
     string refreshToken,
     string tokenType           = "Bearer",
     int expiresIn              = 3600,
     DateTime?tokenGenerated    = null,
     string scope               = null,
     bool canAccessPersonalData = true,
     TokenAuthenticationType authenticationType = TokenAuthenticationType.AuthorizationCode)
 {
     return(new Token
     {
         AccessToken = accessToken,
         RefreshToken = refreshToken,
         Type = tokenType,
         ExpiresIn = expiresIn,
         TokenGenerated = tokenGenerated ?? DateTime.UtcNow,
         Scope = scope ?? string.Empty,
         CanAccessPersonalData = canAccessPersonalData,
         AuthenticationType = authenticationType
     });
 }