class Athena::Security::User::Provider::InMemory
inherits Reference
#
Provides users that are kept in memory, e.g. defined in the configuration of the application.
Useful for testing, prototyping, or applications with a few fixed users, such as a single admin. User identifiers are case insensitive.
provider = ASEC::User::Provider::InMemory.new [
ASEC::User::InMemory.new("admin", "$2y$13$...", ["ROLE_ADMIN"]),
]
provider.load_user_by_identifier("ADMIN").roles # => ["ROLE_ADMIN"]
Included modules
Athena::Security::User::Provider::Interface
Constructors#
Methods#
#create_user(user : ASEC::User::InMemory) : Nil#
Adds the provided user to this provider.
Raises an ASEC::Exception::Logic if a user with the same identifier already exists.
#load_user_by_identifier(identifier : String) : ASEC::User::Interface#
Returns the user with the provided identifier, e.g. its username or email address.
Raises an ASEC::Exception::UserNotFound if no user has that identifier.
#refresh_user(user : ASEC::User::Interface) : ASEC::User::Interface#
Returns an up to date instance of the provided user, e.g. reloaded from the database.
Raises an ASEC::Exception::UnsupportedUser if the user is not supported, or an ASEC::Exception::UserNotFound if it no longer exists.
#supports_class?(klass : ASEC::User::Interface.class) : Bool#
Returns true if this provider supports users of the provided klass, otherwise false.