Class: Nexpose::ExportCredential
- Inherits:
-
Object
- Object
- Nexpose::ExportCredential
- Defined in:
- lib/nexpose/report.rb
Overview
DBExport credentials configuration object.
The user_id, password and realm attributes should ONLY be used if a security blob cannot be generated and the data is being transmitted/stored using external encryption (e.g., HTTPS).
Instance Attribute Summary collapse
-
#credential ⇒ Object
Security blob for exporting to a database.
-
#password ⇒ Object
Returns the value of attribute password.
-
#realm ⇒ Object
DB specific, usually the database name.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(credential) ⇒ ExportCredential
constructor
A new instance of ExportCredential.
- #to_xml ⇒ Object
Constructor Details
#initialize(credential) ⇒ ExportCredential
Returns a new instance of ExportCredential.
554 555 556 |
# File 'lib/nexpose/report.rb', line 554 def initialize(credential) @credential = credential end |
Instance Attribute Details
#credential ⇒ Object
Security blob for exporting to a database.
548 549 550 |
# File 'lib/nexpose/report.rb', line 548 def credential @credential end |
#password ⇒ Object
Returns the value of attribute password.
550 551 552 |
# File 'lib/nexpose/report.rb', line 550 def password @password end |
#realm ⇒ Object
DB specific, usually the database name.
552 553 554 |
# File 'lib/nexpose/report.rb', line 552 def realm @realm end |
#user_id ⇒ Object
Returns the value of attribute user_id.
549 550 551 |
# File 'lib/nexpose/report.rb', line 549 def user_id @user_id end |
Class Method Details
.parse(xml) ⇒ Object
568 569 570 571 572 573 574 575 576 577 578 |
# File 'lib/nexpose/report.rb', line 568 def self.parse(xml) xml.elements.each('//credentials') do |creds| credential = ExportCredential.new(creds.text) # The following attributes may not exist. credential.user_id = creds.attributes['userid'] credential.password = creds.attributes['password'] credential.realm = creds.attributes['realm'] return credential end nil end |
Instance Method Details
#to_xml ⇒ Object
558 559 560 561 562 563 564 565 566 |
# File 'lib/nexpose/report.rb', line 558 def to_xml xml = '<credentials' xml << %Q{ userid='#{@user_id}'} if @user_id xml << %Q{ password='#{@password}'} if @password xml << %Q{ realm='#{@realm}'} if @realm xml << '>' xml << @credential if @credential xml << '</credentials>' end |