Class CASServer::Authenticators::Test
In: lib/casserver/authenticators/test.rb
Parent: CASServer::Authenticators::Base

Dummy authenticator used for testing. Accepts any username as valid as long as the password is "testpassword"; otherwise authentication fails. Raises an AuthenticationError when username is "do_error" (this is useful to test the Exception handling functionality).

Methods

validate  

Public Instance methods

[Source]

    # File lib/casserver/authenticators/test.rb, line 9
 9:   def validate(credentials)
10:     read_standard_credentials(credentials)
11: 
12:     raise CASServer::AuthenticatorError, "Username is 'do_error'!" if @username == 'do_error'
13: 
14:     @extra_attributes[:test_utf_string] = "Ютф"
15:     @extra_attributes[:test_numeric] = 123.45
16:     @extra_attributes[:test_serialized] = {:foo => 'bar', :alpha => [1,2,3]}
17: 
18:     valid_password = options[:password] || "testpassword"
19: 
20:     return @password == valid_password
21:   end

[Validate]