Class CASServer::Authenticators::ActiveResource
In: lib/casserver/authenticators/active_resource.rb
Parent: Base

Methods

setup   validate  

Public Class methods

This is called at server startup. Any class-wide initializiation for the authenticator should be done here. (e.g. establish database connection). You can leave this empty if you don‘t need to set up anything.

[Source]

    # File lib/casserver/authenticators/active_resource.rb, line 62
62:       def self.setup(options)
63:         raise AuthenticatorError, 'You must define at least site option' unless options[:site]
64:         # apply options to active resource object
65:         options.each do |method, arg|
66:           Helpers::Identity.send "#{method}=", arg if Helpers::Identity.respond_to? "#{method}="
67:         end
68:         $LOG.info "ActiveResource configuration loaded"
69:       end

Public Instance methods

Override this to implement your authentication credential validation. This is called each time the user tries to log in. The credentials hash holds the credentials as entered by the user (generally under :username and :password keys; :service and :request are also included by default)

Note that the standard credentials can be read in to instance variables by calling read_standard_credentials.

[Source]

    # File lib/casserver/authenticators/active_resource.rb, line 78
78:       def validate(credentials)
79:         begin
80:           $LOG.debug("Starting Active Resource authentication")
81:           result = Helpers::Identity.authenticate(credentials.except(:request))
82:           extract_extra_attributes(result) if result
83:           !!result
84:         rescue ::ActiveResource::ConnectionError => e
85:           $LOG.warn("Error during authentication: #{e}")
86:           false
87:         end
88:       end

[Validate]