Class: CASServer::Authenticators::Test

Inherits:
Base
  • Object
show all
Defined in:
lib/casserver/authenticators/test.rb

Overview

Dummy authenticator used for testing. Accepts “testuser” for username and “testpassword” for password; otherwise authentication fails. Raises an AuthenticationError when username is “do_error” (this is useful to test the Exception handling functionality).

Instance Attribute Summary

Attributes inherited from Base

#options, #username

Instance Method Summary collapse

Methods inherited from Base

#configure, #extra_attributes

Instance Method Details

#validate(credentials) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/casserver/authenticators/test.rb', line 8

def validate(credentials)
  read_standard_credentials(credentials)
  
  raise CASServer::AuthenticatorError, "Username is 'do_error'!" if @username == 'do_error'
  
  return @username == "testuser" && @password == "testpassword"
end