Class: Nexpose::Headers

Inherits:
Object
  • Object
show all
Includes:
XMLUtils
Defined in:
lib/nexpose/creds.rb

Overview

Object that represents Headers, associated with Web Session Authentication.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from XMLUtils

#make_xml, #parse_xml

Constructor Details

#initialize(webapproot, soft403) ⇒ Headers

Returns a new instance of Headers.



218
219
220
221
222
# File 'lib/nexpose/creds.rb', line 218

def initialize(webapproot, soft403)
  @headers = []
  @webapproot = webapproot
  @soft403 = soft403
end

Instance Attribute Details

#headersObject (readonly)

When using httpheaders, this represents the set of headers to pass with the authentication request.



216
217
218
# File 'lib/nexpose/creds.rb', line 216

def headers
  @headers
end

#soft403Object (readonly)

A regular expression used to match against the response to identify authentication failures.



212
213
214
# File 'lib/nexpose/creds.rb', line 212

def soft403
  @soft403
end

#webapprootObject (readonly)

Base URL of the application for which the form authentication applies.



214
215
216
# File 'lib/nexpose/creds.rb', line 214

def webapproot
  @webapproot
end

Instance Method Details

#add_header(header) ⇒ Object



224
225
226
# File 'lib/nexpose/creds.rb', line 224

def add_header(header)
  @headers.push(header)
end

#as_xmlObject Also known as: to_xml_elem



228
229
230
231
232
233
234
235
236
237
238
# File 'lib/nexpose/creds.rb', line 228

def as_xml
  attributes = {}
  attributes['webapproot'] = @webapproot
  attributes['soft403'] = @soft403

  xml = make_xml('Headers', attributes)
  @headers.each do |header|
    xml.add_element(header.to_xml_elem)
  end
  xml
end