class HTTPI::Auth::Config
HTTPI::Auth::Config¶ ↑
Manages HTTP and SSL auth configuration. Currently supports HTTP basic/digest 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 68 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
http?()
click to toggle source
Returns whether to use HTTP basic or dihest auth.
# File lib/httpi/auth/config.rb, line 42 def http? type == :basic || type == :digest end
ntlm(*args)
click to toggle source
Only available with the httpi-ntlm gem.
# File lib/httpi/auth/config.rb, line 47 def ntlm(*args) raise "Install the httpi-ntlm gem for experimental NTLM support" end
ntlm?()
click to toggle source
Only available with the httpi-ntlm gem.
# File lib/httpi/auth/config.rb, line 52 def ntlm? raise "Install the httpi-ntlm gem for experimental NTLM support" end
ssl()
click to toggle source
Returns the HTTPI::Auth::SSL
object.
# File lib/httpi/auth/config.rb, line 57 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 62 def ssl? ssl.present? end