module SoarAuthenticationCas

Constants

VERSION

Public Class Methods

cas_servers(environment) click to toggle source
# File lib/soar_authentication_cas.rb, line 4
def self.cas_servers(environment)
  { 'production' => environment['CAS_SERVER'],
    'development' => environment['CAS_SERVER'], }
end
configure(environment) click to toggle source
# File lib/soar_authentication_cas.rb, line 9
def self.configure(environment)
  return nil if environment.nil? or environment['RACK_ENV'].nil?
  self.validate(environment)
  signon_prefix = cas_servers(environment)[environment['RACK_ENV']]
  are_we_in_development = ( environment['RACK_ENV'] == 'development' )
  { :prefix => signon_prefix,
    :browsers_only => are_we_in_development,
    :ignore_certificate => are_we_in_development }
end

Private Class Methods

abort_on_validation_failures(errors) click to toggle source
# File lib/soar_authentication_cas.rb, line 27
def self.abort_on_validation_failures(errors)
  errors << 'Failure initializing authentication provider' if not errors.empty?
  raise URI::InvalidURIError.new(errors) if not errors.empty?
end
validate(environment) click to toggle source
# File lib/soar_authentication_cas.rb, line 21
def self.validate(environment)
  errors = []
  errors << 'invalid authentication provider uri' if not environment['CAS_SERVER'] =~ URI::regexp
  self.abort_on_validation_failures(errors) if not errors.empty?
end