How to Find Expired SAML App Certificates Using Okta Workflows

In this guide:

Okta Workflows guides offer questions and answers from the Okta Workflows community office hours. They also come from the #okta-workflows channel on the Mac Admins Slack, as well as other places. Read all the other guides.

How do you find expired SAML app certificates using Okta Workflows?

This guide will teach you how to find expired SAML app certificates using Okta Workflows.

Find expired SAML app certificates

The automation retrieves all SAML apps in your Okta org and checks each app’s certificate expiration date. If the certificate has expired, the flow logs a message with the app name. If the certificate is still valid, the flow stops for that app.

The automation has 2 flows:

  1. List applications: gets all SAML apps and passes each one to a helper flow.
  2. Process application: checks the certificate expiration date for one app and logs a message if it has expired.

List applications flow

The List applications flow gets all SAML apps in the org and calls a helper flow for each app.

The List applications flow in Okta Workflows, which gets all SAML apps and calls a helper flow for each one.
List SAML applications

How the flow works

  1. The Okta-Custom API Action card sends a GET request to /api/v1/apps with the filter signOnMode eq "SAML_2_0". The filter returns only SAML apps.
  2. The List-For Each card goes through the list of apps and calls the Process application helper flow for each one, passing the app ID and label.

Process application flow

The Process application flow checks the certificate expiration date for one app and logs a message if the certificate has expired.

The Process application flow in Okta Workflows, which checks an app's certificate expiration date and logs a message if it has expired.
Check app certificate expiration date

How the flow works

  1. The Helper Flow card receives the app passed from the List applications flow.
  2. The Text-Compose card builds the API path /api/v1/apps/{id}/credentials/keys using the app ID. This endpoint returns the app’s certificates.
  3. The Okta-Custom API Action card sends a GET request to that path.
  4. The Object-Get card reads 0.expiresAt from the response, which is the expiration date of the first certificate. If an app has more than one certificate, the flow doesn’t check the others.
  5. The Date-Now card returns the current date and time.
  6. The Branching-Continue If card checks that the expiration date is less than the current date. If the certificate hasn’t expired, the flow stops here with the message App certificate hasn’t expired.
  7. The Text-Compose card builds the message The app certificate for [app label] expired.
  8. The Note card records the message.

Okta Workflows resources

Leave a Reply