Sha256: 03c7292e75687167247c33818a632ccb997aed16bba1527ebe10d6245afab744

Contents?: true

Size: 787 Bytes

Versions: 6

Compression:

Stored size: 787 Bytes

Contents

require '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).
class CASServer::Authenticators::Test < CASServer::Authenticators::Base
  def validate(credentials)
    read_standard_credentials(credentials)
    
    raise CASServer::AuthenticatorError, "Username is 'do_error'!" if @username == 'do_error'
    
    @extra_attributes[:test_string] = "testing!"
    @extra_attributes[:test_numeric] = 123.45
    @extra_attributes[:test_serialized] = {:foo => 'bar', :alpha => [1,2,3]}
    
    return @password == "testpassword"
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
gunark-rubycas-server-0.8.0.20090715 lib/casserver/authenticators/test.rb
gunark-rubycas-server-0.8.0.20090812 lib/casserver/authenticators/test.rb
kch-rubycas-server-0.8.0.20090715 lib/casserver/authenticators/test.rb
brontes3d-rubycas-server-0.8.0.20100111 lib/casserver/authenticators/test.rb
brontes3d-rubycas-server-0.8.0.20091208 lib/casserver/authenticators/test.rb
brontes3d-rubycas-server-0.8.0.20090812 lib/casserver/authenticators/test.rb