Skip to content

Commit d2ac1a1

Browse files
authored
Adding back list_credentials and get_credentials
1 parent 9eb0538 commit d2ac1a1

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

defectdojo_api/defectdojo.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,34 @@ def reupload_scan(self, test_id, scan_type, file, active, scan_date, tags=None,
698698
files=data
699699
)
700700

701+
##### Credential API #####
702+
703+
def list_credentials(self, name=None, username=None, limit=20):
704+
"""Retrieves all the globally configured credentials.
705+
:param name_contains: Search by credential name.
706+
:param username: Search by username
707+
:param limit: Number of records to return.
708+
"""
709+
710+
params = {}
711+
if limit:
712+
params['limit'] = limit
713+
714+
if name:
715+
params['name__contains'] = name
716+
717+
if username:
718+
params['username__contains'] = username
719+
720+
return self._request('GET', 'credentials/', params)
721+
722+
def get_credential(self, cred_id, limit=20):
723+
"""
724+
Retrieves a credential using the given credential id.
725+
:param credential_id: Credential identification.
726+
"""
727+
return self._request('GET', 'credentials/' + str(cred_id) + '/')
728+
701729
##### Credential Mapping API #####
702730

703731
def list_credential_mappings(self, name=None, product_id_in=None, engagement_id_in=None, test_id_in=None, finding_id_in=None, limit=20):

0 commit comments

Comments
 (0)