Sha256: d0c12392b8584dbc9f5da9b26d4c20f6b08583e6304843db5971d752a645592e

Contents?: true

Size: 1.62 KB

Versions: 22

Compression:

Stored size: 1.62 KB

Contents

module CASServer
  module Authenticators
    class Base
      attr_accessor :options
      attr_reader :username # make this accessible so that we can pick up any 
                            # transformations done within the authenticator
    
      def validate(credentials)
        raise NotImplementedError, "This method must be implemented by a class extending #{self.class}"
      end
      
      def configure(options)
        raise ArgumentError, "options must be a HashWithIndifferentAccess" unless options.kind_of? HashWithIndifferentAccess
        @options = options.dup
        @extra_attributes = {}
      end
      
      def extra_attributes
        @extra_attributes
      end
      
      protected
      def read_standard_credentials(credentials)
        @username = credentials[:username]
        @password = credentials[:password]
        @service = credentials[:service]
        @request = credentials[:request]
      end
      
      def extra_attributes_to_extract
        if @options[:extra_attributes].kind_of? Array
          attrs = @options[:extra_attributes]
        elsif @options[:extra_attributes].kind_of? String
          attrs = @options[:extra_attributes].split(',').collect{|col| col.strip}
        else
          $LOG.error("Can't figure out attribute list from #{@options[:extra_attributes].inspect}. This must be an Aarray of column names or a comma-separated list.")
          attrs = []
        end
        
        $LOG.debug("#{self.class.name} will try to extract the following extra_attributes: #{attrs.inspect}")
        return attrs
      end
    end
  end
  
  class AuthenticatorError < Exception
  end
end

Version data entries

22 entries across 22 versions & 6 rubygems

Version Path
arpitjain11-rubycas-server-0.8.0.20090612 lib/casserver/authenticators/base.rb
arpitjain11-rubycas-server-0.8.0.20090613 lib/casserver/authenticators/base.rb
gunark-rubycas-server-0.6.99.336 lib/casserver/authenticators/base.rb
gunark-rubycas-server-0.7.999.20090212 lib/casserver/authenticators/base.rb
gunark-rubycas-server-0.7.9999.20090212 lib/casserver/authenticators/base.rb
gunark-rubycas-server-0.8.0.20090213 lib/casserver/authenticators/base.rb
gunark-rubycas-server-0.8.0.20090225 lib/casserver/authenticators/base.rb
gunark-rubycas-server-0.8.0.20090227 lib/casserver/authenticators/base.rb
gunark-rubycas-server-0.8.0.20090427 lib/casserver/authenticators/base.rb
gunark-rubycas-server-0.8.0.20090430 lib/casserver/authenticators/base.rb
gunark-rubycas-server-0.8.0.20090506 lib/casserver/authenticators/base.rb
gunark-rubycas-server-0.8.0.20090715 lib/casserver/authenticators/base.rb
gunark-rubycas-server-0.8.0.20090812 lib/casserver/authenticators/base.rb
kch-rubycas-server-0.8.0.20090715 lib/casserver/authenticators/base.rb
wmernagh-rubycas-server-0.6.99.336 lib/casserver/authenticators/base.rb
wmernagh-rubycas-server-0.7.1.1 lib/casserver/authenticators/base.rb
brontes3d-rubycas-server-0.8.0.20100111 lib/casserver/authenticators/base.rb
brontes3d-rubycas-server-0.8.0.20091208 lib/casserver/authenticators/base.rb
brontes3d-rubycas-server-0.8.0.20090812 lib/casserver/authenticators/base.rb
rubycas-server-0.7.1 lib/casserver/authenticators/base.rb