class Athena::Security::Authentication::Token::Null
inherits Reference
#
Represents the absence of an authenticated user, e.g. when deciding the access of a guest.
Included modules
Athena::Security::Authentication::Token::Interface
Methods#
#attribute(name : String, type : T.class) : T forall T#
Returns the value of the attribute with the provided name, deserialized as the provided type.
Raises an ASEC::Exception::InvalidArgument if this token has no attribute with that name.
#attribute?(name : String, type : T.class) : T | Nil forall T#
Returns the value of the attribute with the provided name, deserialized as the provided type, or nil if this token has no attribute with that name.
#attributes : Hash(String, String)#
Returns the attributes of this token, with their values serialized as JSON.
#attributes=(attributes : Hash(String, String)) : NoReturn#
Replaces the attributes of this token with the provided attributes, whose values are serialized as JSON.
Raises an ASEC::Exception::Logic, as a null token has no attributes.
#has_attribute?(name : String) : Bool#
Returns true if this token has an attribute with the provided name, otherwise false.
#set_attribute(name : String, value : _) : NoReturn#
Sets the attribute with the provided name to the provided value.
Raises an ASEC::Exception::Logic, as a null token has no attributes.
#to_s(io : IO) : Nil#
Writes a representation of this token to the provided io, for debugging purposes.
#user=(user : ASEC::User::Interface) : NoReturn#
Sets the authenticated user.
Raises an ASEC::Exception::Logic, as a null token has no user.
#user_identifier : String#
Returns the identifier of the user, e.g. its username or email address, or an empty string if there is no user.