C# Class BlottoBeats.Library.Authentication.UserToken

Show file Open project: Zwolf11/BlottoBeats Class Usage Examples

Public Methods

Method 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 method

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

GetExpiration() public static method

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

TrimMilliseconds() public static method

Because dateTimes are stupid
public static TrimMilliseconds ( System.DateTime dt ) : System.DateTime
dt System.DateTime
return System.DateTime

UserToken() public method

public UserToken ( String username, System.DateTime expires, string token ) : System
username String
expires System.DateTime
token string
return System

Verify() public method

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
return bool