class UserToken

Overview

Generates and decodes JSON Web Tokens for Authenticating users.

Included Modules

Defined in:

models/user_token.cr

Constant Summary

ALGORITHM = JWT::Algorithm::HS256
HABITAT_SETTINGS = [{decl: stubbed_token : String | ::Nil, example: nil, validation: nil}] of Nil

Class Method Summary

Instance Method Summary

Class Method Detail

def self.configure(&) #

[View source]
def self.create_token(payload) #

[View source]
def self.decode_user_id(token : String) : Int64 | Nil #

[View source]
def self.generate(user : User) : String #

[View source]
def self.settings #

[View source]
def self.stub_token(&token : String) #

Used in tests to return a fake token to test against.


[View source]

Instance Method Detail

def settings #

[View source]