Sha256: fc39d655c7e9552b09b120143a78b61af08a5f96df7e102bbfa2a27a724c5858

Contents?: true

Size: 697 Bytes

Versions: 1

Compression:

Stored size: 697 Bytes

Contents

module OmniAuth
  module Strategies
    class CAS
      class Configuration

        def initialize( options )
          @options = options

          extract_url if @options['url']

          validate_cas_setup
        end

        def extract_url
          url = Addressable::URI.parse( @options.delete('url') )

          @options.merge!(
            'host' => url.host,
            'port' => url.port,
            'ssl'  => url.scheme == 'https'
          )
        end

        def validate_cas_setup
          if @options.host.nil? || @options.login_url.nil?
            raise ArgumentError.new(":host and :login_url MUST be provided")
          end
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-cas-1.0.1 lib/omniauth/strategies/cas/configuration.rb