module Auth

Extended Modules

Defined in:

auth.cr

Constant Summary

ACCESS_TOKEN_VALIDITY = 5 * 60
Logger = Log.for("Auth")
REFRESH_TOKEN_VALIDITY = 60 * 60

Instance Method Summary

Instance Method Detail

def generate_access_token(user : User) #

[View source]
def generate_refresh_token(user : User) #

[View source]
def generate_token(user : User, validity : Int32) #

Generate a token for user for validity seconds.

Returns generated token as a String


[View source]
def login(username, password) : Credentials | Nil #

[View source]
def secret #

[View source]
def validate_token(token : String) #

Validate a user token.

Return user_id associated with that token or nil if the token is invalid


[View source]