class HTTPI::Auth::Config

HTTPI::Auth::Config

Manages HTTP and SSL auth configuration. Currently supports HTTP basic/digest, Negotiate/SPNEGO, and SSL client authentication.

Constants

TYPES

Supported authentication types.

Attributes

type[RW]

Accessor for the authentication type in use.

Public Instance Methods

basic(*args) click to toggle source

Accessor for the HTTP basic auth credentials.

# File lib/httpi/auth/config.rb, line 16
def basic(*args)
  return @basic if args.empty?

  self.type = :basic
  @basic = args.flatten.compact
end
basic?() click to toggle source

Returns whether to use HTTP basic auth.

# File lib/httpi/auth/config.rb, line 24
def basic?
  type == :basic
end
credentials() click to toggle source

Shortcut method for returning the credentials for the authentication specified. Returns nil unless any authentication credentials were specified.

# File lib/httpi/auth/config.rb, line 79
def credentials
  return unless type
  send type
end
digest(*args) click to toggle source

Accessor for the HTTP digest auth credentials.

# File lib/httpi/auth/config.rb, line 29
def digest(*args)
  return @digest if args.empty?

  self.type = :digest
  @digest = args.flatten.compact
end
digest?() click to toggle source

Returns whether to use HTTP digest auth.

# File lib/httpi/auth/config.rb, line 37
def digest?
  type == :digest
end
gssnegotiate() click to toggle source

Enable HTTP Negotiate/SPNEGO authentication.

# File lib/httpi/auth/config.rb, line 42
def gssnegotiate
  self.type = :gssnegotiate
end
gssnegotiate?() click to toggle source

Returns whether to use HTTP Negotiate/SPNEGO auth.

# File lib/httpi/auth/config.rb, line 47
def gssnegotiate?
  type == :gssnegotiate
end
http?() click to toggle source

Returns whether to use HTTP basic or dihest auth.

# File lib/httpi/auth/config.rb, line 52
def http?
  type == :basic || type == :digest
end
ntlm(*args) click to toggle source
# File lib/httpi/auth/config.rb, line 56
def ntlm(*args)
  return @ntlm if args.empty?

  self.type = :ntlm
  @ntlm = args.flatten.compact
end
ntlm?() click to toggle source
# File lib/httpi/auth/config.rb, line 63
def ntlm?
  type == :ntlm
end
ssl() click to toggle source

Returns the HTTPI::Auth::SSL object.

# File lib/httpi/auth/config.rb, line 68
def ssl
  @ssl ||= SSL.new
end
ssl?() click to toggle source

Returns whether to use SSL client auth.

# File lib/httpi/auth/config.rb, line 73
def ssl?
  ssl.present?
end