class Athena::Security::Authenticator::Passport::Credentials::Custom
inherits Reference
#
Credentials checked by a block, e.g. comparing an API token presented by the user with the one of the user.
ASEC::Authenticator::Passport::Credentials::Custom.new(api_token) do |token, user|
user.as(User).api_token == token
end
Included modules
Athena::Security::Authenticator::Passport::Credentials::Interface
Constructors#
.new(credentials : T, &checker : T, ASEC::User::Interface -> Bool) : self forall T#
Creates credentials made of the provided credentials, which the block checks against the user being authenticated.
The authentication fails unless the block returns true.
The block may also raise an ASEC::Exception::Authentication to fail with a more specific reason.
Methods#
#execute_custom_checker(user : ASEC::User::Interface) : Nil#
Checks the credentials against the provided user, marking them as resolved if they are valid.
Raises an ASEC::Exception::BadCredentials if the block did not return true.
#resolved? : Bool#
Returns true if this badge was checked by the security system, otherwise false.
Every badge of a passport must be resolved once it was checked, otherwise the authentication fails.