C# Class BlottoBeats.Library.Authentication.UserToken

Afficher le fichier Open project: Zwolf11/BlottoBeats Class Usage Examples

Méthodes publiques

Méthode Description
GenerateToken ( ) : string

Generates a new authentication token using a crytographically-secure random number generator

GetExpiration ( ) : System.DateTime

Returns a DateTime object that represents the moment the token expires

TrimMilliseconds ( System.DateTime dt ) : System.DateTime

Because dateTimes are stupid

UserToken ( String username, System.DateTime expires, string token ) : System
Verify ( UserToken token ) : bool

Verifies that two tokens are equal to each other and the "expires" date has not passed. Uses SlowEquals to prevent timing attacks.

Method Details

GenerateToken() public static méthode

Generates a new authentication token using a crytographically-secure random number generator
public static GenerateToken ( ) : string
Résultat string

GetExpiration() public static méthode

Returns a DateTime object that represents the moment the token expires
public static GetExpiration ( ) : System.DateTime
Résultat System.DateTime

TrimMilliseconds() public static méthode

Because dateTimes are stupid
public static TrimMilliseconds ( System.DateTime dt ) : System.DateTime
dt System.DateTime
Résultat System.DateTime

UserToken() public méthode

public UserToken ( String username, System.DateTime expires, string token ) : System
username String
expires System.DateTime
token string
Résultat System

Verify() public méthode

Verifies that two tokens are equal to each other and the "expires" date has not passed. Uses SlowEquals to prevent timing attacks.
public Verify ( UserToken token ) : bool
token UserToken Token to compare
Résultat bool