Sha256: a8528d3057513e9f803121b91d367ae91a1d3b41cea97813f5b25fa2e0a2c7b3

Contents?: true

Size: 814 Bytes

Versions: 25

Compression:

Stored size: 814 Bytes

Contents

module Roqua
  module CoreApi
    module Sessions
      class BasicAuthSession < AuthSession
        attr_reader :username
        attr_reader :password

        def initialize(username: ENV.fetch('CORE_BASICAUTH_ID'),
                       password: ENV.fetch('CORE_BASICAUTH_SECRET'),
                       **additional_arguments)
          @username = username
          @password = password
          super additional_arguments
        end

        private

        # handle 401 response.
        def access_denied(response)
          if response.headers['WWW-Authenticate']
            fail 'basic auth for core invalid'
          else
            fail Unauthorized
          end
        end

        def basic_auth
          {username: username, password: password}
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
roqua-core-api-0.6.0 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.5.0 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.4.0 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.3.1 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.3.0 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.2.4 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.2.3 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.2.2 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.2.1 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.2.0 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.1.1 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.1.0 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.0.39 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.0.38 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.0.37 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.0.36 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.0.35 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.0.32 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.0.31 lib/roqua/core_api/sessions/basic_auth_session.rb
roqua-core-api-0.0.30 lib/roqua/core_api/sessions/basic_auth_session.rb