Skip to content

class Athena::Security::Authentication::Token::Storage
inherits Reference #

Holds the token of the current user, optionally loading it lazily via an #initializer=.

Included modules

Athena::Contracts::Service::Resettable Athena::Security::Authentication::Token::Storage::Interface

Methods#

#initializer=(initializer : Proc(Nil) | Nil)#

Sets the initializer called the next time the token is accessed, which typically sets the token, e.g. after loading it from the session.

View source

#reset : Nil#

Removes the token.

View source

#token : ASEC::Authentication::Token::Interface | ::Nil#

Returns the token of the current user, if any.

Calls the initializer first, if one was set.

View source

#token=(token : ASEC::Authentication::Token::Interface | Nil)#

Sets the token of the current user, or removes it if token is nil.

Calls the initializer first if a token is set, so that it cannot override the token later.

View source