abstract class Athena::Security::Authentication::Token::AbstractToken
inherits Reference
#
Provides the common implementation of tokens.
The role names of a token are set when it is created, and are not updated when the user is changed, as they describe the authentication rather than the roles the user has.
Included modules
Athena::Security::Authentication::Token::Interface
Direct known subclasses
Athena::Security::Authentication::Token::UsernamePassword
Constructors#
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))#
Replaces the attributes of this token with the provided attributes, whose values are serialized as JSON.
#has_attribute?(name : String) : Bool#
Returns true if this token has an attribute with the provided name, otherwise false.
#set_attribute(name : String, value : _) : Nil#
Sets the attribute with the provided name to the provided value.
#to_s(io : IO) : Nil#
Writes a representation of this token to the provided io, for debugging purposes.
#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.