C# Class WebApiSeed.Infrastructure.Helpers.SecurityHelper

Security functions
Inheritance: ISecurityHelper
ファイルを表示 Open project: MakingSense/webapi-seed

Public Methods

Method Description
GenerateApiToken ( User user ) : ApiTokenDto

Generate API autentication token

GenerateVerificationCode ( ) : string

Generate a mobile phone number verification code

GetUserIdForToken ( string token ) : int

Retrieve the user ID from a token

SecurityHelper ( IMapper mappingEngine, IDbContext userRepository ) : System

Security helper

ValidateToken ( string token ) : bool

Verify a given token exists in the database for the user in that token

Private Methods

Method Description
GetUtcDateTime ( DateTimeOffset dateTime ) : System.DateTime

Method Details

GenerateApiToken() public method

Generate API autentication token
public GenerateApiToken ( User user ) : ApiTokenDto
user User
return ApiTokenDto

GenerateVerificationCode() public method

Generate a mobile phone number verification code
public GenerateVerificationCode ( ) : string
return string

GetUserIdForToken() public method

Retrieve the user ID from a token
public GetUserIdForToken ( string token ) : int
token string Token
return int

SecurityHelper() public method

Security helper
public SecurityHelper ( IMapper mappingEngine, IDbContext userRepository ) : System
mappingEngine IMapper Automapper engine
userRepository IDbContext User repository
return System

ValidateToken() public method

Verify a given token exists in the database for the user in that token
public ValidateToken ( string token ) : bool
token string Token
return bool