Class: Nexpose::SharedCredentialSummary

Inherits:
Credential show all
Defined in:
lib/nexpose/shared_credential.rb

Direct Known Subclasses

SharedCredential

Constant Summary

Constants inherited from Credential

Credential::DEFAULT_PORTS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CredentialHelper

#set_as400_service, #set_cifs_service, #set_cifshash_service, #set_cvs_service, #set_db2_service, #set_ftp_service, #set_http_service, #set_mysql_service, #set_notes_service, #set_oracle_service, #set_pop_service, #set_postgresql_service, #set_remote_execution_service, #set_snmp_service, #set_snmpv3_service, #set_ssh_key_service, #set_ssh_service, #set_sybase_service, #set_tds_service, #set_telnet_service

Methods inherited from APIObject

#object_from_hash

Instance Attribute Details

#all_sitesObject

Boolean to indicate whether this credential applies to all sites.



45
46
47
# File 'lib/nexpose/shared_credential.rb', line 45

def all_sites
  @all_sites
end

#domainObject

Domain or realm.



35
36
37
# File 'lib/nexpose/shared_credential.rb', line 35

def domain
  @domain
end

#idObject

Unique ID assigned to this credential by Nexpose.



27
28
29
# File 'lib/nexpose/shared_credential.rb', line 27

def id
  @id
end

#last_modifiedObject

When this credential was last modified.



47
48
49
# File 'lib/nexpose/shared_credential.rb', line 47

def last_modified
  @last_modified
end

#nameObject

Name to identify this credential.



29
30
31
# File 'lib/nexpose/shared_credential.rb', line 29

def name
  @name
end

#privilege_usernameObject Also known as: permission_elevation_user

User name to use when elevating permissions (e.g., sudo).



41
42
43
# File 'lib/nexpose/shared_credential.rb', line 41

def privilege_username
  @privilege_username
end

#serviceObject Also known as: type

The credential service/type. See Nexpose::Credential::Service.



31
32
33
# File 'lib/nexpose/shared_credential.rb', line 31

def service
  @service
end

#usernameObject Also known as: user_name

User name.



37
38
39
# File 'lib/nexpose/shared_credential.rb', line 37

def username
  @username
end

Class Method Details

.from_json(json) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/nexpose/shared_credential.rb', line 49

def self.from_json(json)
  cred = new
  cred.id                 = json['credentialID']['ID']
  cred.name               = json['name']
  cred.type               = json['service']
  cred.domain             = json['domain']
  cred.username           = json['username']
  cred.privilege_username = json['privilegeElevationUsername']
  cred.all_sites          = json['scope'] == 'ALL_SITES_ENABLED_DEFAULT'
  cred.last_modified      = Time.at(json['lastModified']['time'] / 1000)
  cred
end

Instance Method Details

#delete(nsc) ⇒ Object

Delete this credential from the security console.

Parameters:

  • nsc (Connection)

    An active connection to the security console.



66
67
68
# File 'lib/nexpose/shared_credential.rb', line 66

def delete(nsc)
  nsc.delete_shared_credential(@id)
end