Class: Nexpose::WebCredentials::HTMLForms

Inherits:
APIObject
  • Object
show all
Defined in:
lib/nexpose/web_credentials.rb

Overview

When using HTML form, this represents the login form information.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from APIObject

#object_from_hash

Constructor Details

#initialize(name, baseURL, loginURL, soft403Pattern, id = -1,, enabled = true) ⇒ HTMLForms

Returns a new instance of HTMLForms.



202
203
204
205
206
207
208
209
210
# File 'lib/nexpose/web_credentials.rb', line 202

def initialize(name, baseURL, loginURL, soft403Pattern, id = -1, enabled = true)
  @name           = name
  @baseURL        = baseURL
  @loginURL       = loginURL
  @soft403Pattern = soft403Pattern
  @service        = WebAppAuthType::HTML_FORM
  @enabled        = enabled
  @id             = id
end

Instance Attribute Details

#baseURLObject (readonly)

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



188
189
190
# File 'lib/nexpose/web_credentials.rb', line 188

def baseURL
  @baseURL
end

#enabledObject

is this enable for the site configuration



194
195
196
# File 'lib/nexpose/web_credentials.rb', line 194

def enabled
  @enabled
end

#formObject (readonly)

The forms to authenticate with



200
201
202
# File 'lib/nexpose/web_credentials.rb', line 200

def form
  @form
end

#idObject (readonly)

id of the header



198
199
200
# File 'lib/nexpose/web_credentials.rb', line 198

def id
  @id
end

#loginURLObject (readonly)

The URL of the login page containing the login form.



190
191
192
# File 'lib/nexpose/web_credentials.rb', line 190

def loginURL
  @loginURL
end

#nameObject (readonly)

name of the html header



192
193
194
# File 'lib/nexpose/web_credentials.rb', line 192

def name
  @name
end

#serviceObject (readonly)

service type of header



196
197
198
# File 'lib/nexpose/web_credentials.rb', line 196

def service
  @service
end

#soft403PatternObject (readonly)

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



186
187
188
# File 'lib/nexpose/web_credentials.rb', line 186

def soft403Pattern
  @soft403Pattern
end

Instance Method Details

#==(other) ⇒ Object



231
232
233
# File 'lib/nexpose/web_credentials.rb', line 231

def ==(other)
  eql?(other)
end

#add_html_form(html_form) ⇒ Object



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

def add_html_form(html_form)
  @form = html_form
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


235
236
237
238
239
240
241
242
243
244
# File 'lib/nexpose/web_credentials.rb', line 235

def eql?(other)
  id.eql?(other.id) &&
  service.eql?(other.service) &&
  enabled.eql?(other.enabled) &&
  name.eql?(other.name) &&
  form.eql?(other.form) &&
  baseURL.eql?(other.baseURL) &&
  loginURL.eql?(other.loginURL) &&
  soft403Pattern.eql?(other.soft403Pattern)
end

#to_hObject



220
221
222
223
224
225
226
227
228
229
# File 'lib/nexpose/web_credentials.rb', line 220

def to_h
  { id: id,
    service: service,
    enabled: enabled,
    name: name,
    form: form.to_h,
    baseURL: baseURL,
    loginURL: loginURL,
    soft403Pattern: soft403Pattern }
end

#to_jsonObject



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

def to_json
  JSON.generate(to_h)
end