Release 4.0 API
November 26, 2024
What's New?
Support for OAuth 2.0 and OpenID Connect Authentication Standards
With this release, we have upgraded our API security by incorporating OAuth 2.0 and OpenID Connect for Qualys API authentication and authorization. When OpenID Connect API authentication is implemented along with OAuth 2.0, IdP is used for user authentication and JWT token generation for the Qualys API access.
Key Updates
- Seamless integration of OAuth 2.0 and OpenID Connect to enhance API authentication and authorization measures.
- Compatibility with current identity providers and authentication to facilitate a seamless integration experience.
- This authentication is supported by all Qualys APIs.
- It eliminates the need for users to provide a username and password. This streamlines Qualys API access by allowing users to use JWT tokens, bypassing the hassle associated with usernames and passwords.
Enable OpenID Connect API Authentication
This feature is not available by default. Contact Qualys support to enable it for your subscription. You must follow the onboarding process. This feature requires IdP.
Benefits
- Enhanced API security
OpenID Connect (OIDC) uses tokens to establish a user's identity and grant access.
- Standardized access control
OpenID Connect (OIDC) provides a standardized way to manage user identities and access control
- Centralized Authentication
By enabling IDP-initiated SSO, users can authenticate once through your organization’s Identity Provider (IDP) and gain access to all the necessary APIs without needing to log in again. This simplifies the user experience and reduces password fatigue, making access faster and more secure.
- Compliance and Security
Helps to meet compliance requirements by ensuring that user authentication processes adhere to established security protocols like SAML and OIDC.
Prerequisites
Public signing certificates for verifying the authenticity of SAML responses. Upto 3 certificates can be provided. The certificate must be in X.509 format (usuallyin .pem or .cer files).
- IdP Name
The name of the Identity Provider (IdP) being configured. This can be a customname or provided by the customer.
Example: "TestNameforIDP Qualys Internal" - Entity ID
The unique identifier for the customer’s IdP. Typically, this is a URN or URL that serves as the IdP’s primary identifier during OIDC communications.
Example: "https://example.com/idp" - Single Sign-On (SSO) URL
The URL where authentication requests will be sent. This is the endpoint where users are redirected to authenticate with the customer’s IdP.
Example: "https://example.com/login" - Single Logout (SLO) URL (if applicable)
The URL for handling logout requests. If you support Single Logout, this endpoint will manage the termination of sessions both at the IdP and within Qualys.
Example: "https://example.com/logout" - SSO Exit URL (optional)
The URL where users will be redirected after successful authentication.
- Certificates
Public signing certificates for verifying the authenticity of SAML responses. Upto 3 certificates can be provided. The certificate must be in X.509 format (usuallyin .pem or .cer files).
Onboarding Process
To start using OpenID Connect API authentication, the following onboarding process must be completed.
- Contact Qualys Support (www.qualys.com/support) to request OpenID Connect API authentication activation for your subscription. A CRM ticket is automatically created and is used as a reference and tracking for all discussions concerning the activation.
- Qualys Support replies to the ticket to share and request the required technical information used to enable OIDC. see the Prerequisites for the details.
- Upon receipt of the response, Qualys enables OpenID Connect API authentication support. This process takes approximately one week to complete.
Use OpenID Connect API Authentication
Once the onboarding process is complete and the OpenID Connect API authentication is enabled, you can begin using it. To start using it, you must first generate the JWT token and then use that token to execute the Qualys APIs. The following subsections provide API request and response samples for generating a JWT token and executing APIs using this token.
Sample API Request to Generate JWT Token for API Authentication and its sample responseSample API Request to Generate JWT Token for API Authentication and its sample response
The token generation URL may vary based on the IdP application you are using. The sample below illustrates the request and response for Okta.
API Request
curl --location ' https://qualys.oktapreview.com/oauth2/aus27sviwo8jbrP4T0h8/v1/token' --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'grant_type=password' --data-urlencode 'username=jdoe@qualysit.com' --data-urlencode 'password= ' --data-urlencode 'client_id=0oa27l586h672nMy90h8' --data-urlencode 'scope=openid profile'
Response
{ "token_type": "Bearer", "expires_in": 3600, "access_token": " ", "scope": "openid profile", "id_token": " " }
Sample API Request to Execute API Using the above JWT Token and it's sample responseSample API Request to Execute API Using the above JWT Token and it's sample response
API Request
curl -X POST "<qualys_base_url>/certview/v1/certificates" -H "Accept: application/json" -H "Content-Type: application/json" -d "{ \"filter\" : \"subject.name:www.qualys.com\", \"pageNumber\": 0, \"pageSize\" : 1}" -H "Authorization: Bearer <access_token from above response>"
Response
[ { "keySize": 2048, "subject": { "organization": "Qualys, Inc.", "locality": "Foster City", "name": "www.qualys.com", "state": "California", "country": "US", "organizationUnit": [] }, "validFrom": 1676246400000, "signatureAlgorithm": "SHA256withRSA", "issuer": { "organization": "DigiCert Inc", "organizationUnit": [ "www.digicert.com" ], "name": "DigiCert SHA2 Extended Validation Server CA", "country": "US", "state": "", "certhash": "403e062a2653059113285baf80a0d4ae422c848c9f78fad01fc94bc5b87fef1a", "locality": "" }, "rootissuer": { "organization": "DigiCert Inc", "organizationUnit": [ "www.digicert.com" ], "name": "DigiCert High Assurance EV Root CA", "country": "US", "state": "", "certhash": "7431e5f4c3c1ce4690774f0b61e05440883ba9a01ed00ba6abd7806ed3b118cf", "locality": "" }, "instanceCount": 2, "dn": "CN=www.qualys.com, O=\"Qualys, Inc.\", L=Foster City, ST=California, C=US, serialNumber=3152140, businessCategory=Private Organization, StateOrProvince=Delaware, CountryName=US","certhash": "192a86240c5ec5d87dd108f17e2543e78439101f193c99c53193f60d115b885d", "assets": [ { "netbiosName": "", "assetId": "99f29795-4c11-49e1-8898-82e9982b0710", "name": "qualys.com", "operatingSystem": "NetScaler", "tags": [ { "name": "Internet Facing Assets", "uuid": "d2ba3be1-66a3-4d1f-89fadd534a2bccc1" } ], "primaryIp": "64.39.xx.xxx", "hostInstances": [ { "protocol": "tcp", "sslProtocols": [ "TLSv1.2" ], "port": 443, "grade": "A", "service": "http", "vulnerabilities": [], "vulnCount": 0 } ], "created": 1680247510486, "updated": 1680247131000, "assetInterfaces": [ { "hostname": "qualys.com", "address": "64.39.xx.xxx" } ], "certificateCount": 0 }, { "netbiosName": "", "assetId": "646c7aa5-cfdc-4294-bea7-d43664ac03f4", "name": "www.qualys.com", "operatingSystem": "NetScaler", "tags": [ { "name": "Internet Facing Assets", "uuid": "d2ba3be1-66a3-4d1f-89fadd534a2bccc1" } ], "primaryIp": "64.39.xx.xxx", "hostInstances": [ { "protocol": "tcp", "sslProtocols": [ "TLSv1.2" ], "port": 443, "grade": "A", "service": "http", "vulnerabilities": [], "vulnCount": 0 } ], "created": 1675158036000, "updated": 1680254412000, "assetInterfaces": [ { "hostname": "www.qualys.com", "address": "64.39.xx.xxx" } ], "certificateCount": 0 } ], "selfSigned": false, "validTo": 1707868799000, "issuerCategory": "DigiCert SHA2 Extended Validation Server CA","subjectAlternativeNames": { "DNS Name": [ "www.qualys.com", "qualys.com", "docs.qualys.com", "qualys.dk", "qualys.us", "qualys.de", "qualys.biz", "nemeannetworks.com", "qualys.fr", "www.qualys.eu", "qualys.io", "qualysguard.tw", "www.securityvibes.co.uk", "qualys.es", "qualysblog.net", "qualys.nl", "qualys.report", "qualysinsight.com", "qualysworks.net", "qualysguard.eu", "qualysguard.com", "qualys.eu", "www.qualysguard.eu" ], "IP Address": null }, "lastFound": 1680256864611, "extendedValidation": true, "sources": [ "VM", "QAGENT" ] } ]