public static async Task<TokenStatus> CheckTokenStatus(Token token) { var status = TokenStatus.NOTACKED; switch (token.Status) { case "NOTACKED": status = TokenStatus.NOTACKED; break; case "EXPIRED": status = TokenStatus.EXPIRED; throw new NotImplementedException(); case "REVOKED": status = TokenStatus.REVOKED; throw new NotImplementedException(); case "VALID": status = TokenStatus.VALID; //Retrieve the user for later User = await GetCurrentUserFromAPI(); break; } // Create or update the token. if (settings.Contains("Token")) { settings["Token"] = token.NTToken; settings["TokenStatus"] = status; settings.Save(); } else { // Add token.. settings.Add("Token", token.NTToken); settings.Add("TokenStatus", status); settings.Save(); } return status; }
public UserController(string UserName, Token token) { this.NTUser = new User(UserName, token); }