Class: HTTPI::Auth::Config
- Inherits:
- 
      Object
      
        - Object
- HTTPI::Auth::Config
 
- Defined in:
- lib/cs-httpi/auth/config.rb
Overview
HTTPI::Auth::Config
Manages HTTP and SSL auth configuration. Currently supports HTTP basic/digest and SSL client authentication.
Constant Summary collapse
- TYPES =
          Supported authentication types. 
- [:basic, :digest, :ssl] 
Instance Attribute Summary collapse
- 
  
    
      #type  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Accessor for the authentication type in use. 
Instance Method Summary collapse
- 
  
    
      #basic(*args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Accessor for the HTTP basic auth credentials. 
- 
  
    
      #basic?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Returns whether to use HTTP basic auth. 
- 
  
    
      #credentials  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Shortcut method for returning the credentials for the authentication specified. 
- 
  
    
      #digest(*args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Accessor for the HTTP digest auth credentials. 
- 
  
    
      #digest?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Returns whether to use HTTP digest auth. 
- 
  
    
      #http?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Returns whether to use HTTP basic or dihest auth. 
- 
  
    
      #ntlm(*args)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Only available with the httpi-ntlm gem. 
- 
  
    
      #ntlm?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Only available with the httpi-ntlm gem. 
- 
  
    
      #ssl  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Returns the HTTPI::Auth::SSLobject.
- 
  
    
      #ssl?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Returns whether to use SSL client auth. 
Instance Attribute Details
#type ⇒ Object
Accessor for the authentication type in use.
| 74 75 76 | # File 'lib/cs-httpi/auth/config.rb', line 74 def type @type end | 
Instance Method Details
#basic(*args) ⇒ Object
Accessor for the HTTP basic auth credentials.
| 16 17 18 19 20 21 | # File 'lib/cs-httpi/auth/config.rb', line 16 def basic(*args) return @basic if args.empty? self.type = :basic @basic = args.flatten.compact end | 
#basic? ⇒ Boolean
Returns whether to use HTTP basic auth.
| 24 25 26 | # File 'lib/cs-httpi/auth/config.rb', line 24 def basic? type == :basic end | 
#credentials ⇒ Object
Shortcut method for returning the credentials for the authentication specified. Returns nil unless any authentication credentials were specified.
| 68 69 70 71 | # File 'lib/cs-httpi/auth/config.rb', line 68 def credentials return unless type send type end | 
#digest(*args) ⇒ Object
Accessor for the HTTP digest auth credentials.
| 29 30 31 32 33 34 | # File 'lib/cs-httpi/auth/config.rb', line 29 def digest(*args) return @digest if args.empty? self.type = :digest @digest = args.flatten.compact end | 
#digest? ⇒ Boolean
Returns whether to use HTTP digest auth.
| 37 38 39 | # File 'lib/cs-httpi/auth/config.rb', line 37 def digest? type == :digest end | 
#http? ⇒ Boolean
Returns whether to use HTTP basic or dihest auth.
| 42 43 44 | # File 'lib/cs-httpi/auth/config.rb', line 42 def http? type == :basic || type == :digest end | 
#ntlm(*args) ⇒ Object
Only available with the httpi-ntlm gem.
| 47 48 49 | # File 'lib/cs-httpi/auth/config.rb', line 47 def ntlm(*args) raise "Install the httpi-ntlm gem for experimental NTLM support" end | 
#ntlm? ⇒ Boolean
Only available with the httpi-ntlm gem.
| 52 53 54 | # File 'lib/cs-httpi/auth/config.rb', line 52 def ntlm? raise "Install the httpi-ntlm gem for experimental NTLM support" end | 
#ssl ⇒ Object
Returns the HTTPI::Auth::SSL object.
| 57 58 59 | # File 'lib/cs-httpi/auth/config.rb', line 57 def ssl @ssl ||= SSL.new end | 
#ssl? ⇒ Boolean
Returns whether to use SSL client auth.
| 62 63 64 | # File 'lib/cs-httpi/auth/config.rb', line 62 def ssl? ssl.present? end |