Setting up a Service Account with OKTA as IdP (vCert Bonus)

Setting up a Service Account with OKTA as IdP (vCert Bonus)

104
Created On 11/10/26 10:56 AM - Last Modified 11/10/26 16:07 PM


Objective


Certificate Manager offers the ability to automate certificate request process via Services Accounts

Overview - Service Accounts

Users may don't have the expertise needed on how a IdP works and technical skills needed to setup a Service Account in Certificate Manager, SaaS



Environment


VaaS/TLSPC TLSPC

Procedure


Creating an application

  1. Go to Applications -> Applications
  2. Click on "Create App Integration"
    1. Here either select OIDC - OpenID Connect or Web Application
    2. If we select Web App leave everything as default and at the end click on "Skip group assignment for now"
    3. If we select just uncheck "Require Demonstrating Proof of Posession (DPoP) header in token requests"

 

Creating a server authorization

 

  1. Next, we are going to create Server Authorization
  2. Go to Security -> API
  3. Click on "Add Authorization Server"
    1. Named as you wish
    2. In audience is a common practice to type the external API which we are going to communicate in this case is api.venafi.cloud
    3. Next, click on "Scopes" tab
    4. Click "Add Scope"
    5. Name: certificates:request
    6. “Display phrase" a text which describe shortly purpose
    7. User consent "Implicit"
  4. Switch to "Claims" tab
    1. Click on "Add Claim"
    2. Name: certificate_request
    3. Value: certificates:requests
    4. Include in: Any scope
  5. Next, switch to "Token Preview"
    1. In OAuth/OIDC client type and select API Application previously created
    2. In Grant type and select Client credentials
    3. In Scopes type and select certificates:request
    4. Click on "Preview Token"
    5. And you will see values that we will input in TLSPC
      1. Issuer URL = iss
      2. Subject Identifier = cid or sub
      3. Audience = aud

 

Note: JWKS URI must be retrieved from the Metadata URI from the Server Homepage

 

Now, we are ready to request token

Requesting a JWT

 

  1. Open any API client of your choice (preferably postman)
    1. Create a new POST request
      1. URL= https://[your OKTA domain]/oauth2/[long alphanumeric value]/v1/token. Note: long alpahnumeric value can be obtained from the Metadata URI from the Server Homepage (token_endpoint)
      2. Then, go to Authorization tab. Username and Password are Client ID are CLIENT SECRETS respectively from API Application created
      3. Next, switch to Headers and add the following key:value Accept:application/json
      4. Go to Body and checkbox x-www-form-urlencoded and add the following keys-values
      5. scope certificates:request
      6. grant_type:client_credentials

 

If everything goes well you will a similar response

{

    "token_type": "Bearer",

    "expires_in": 3600,

    "access_token": "LONG ALPHANUMERIC VALUE",

    "scope": "certificates:request"

}

 

If you decide to perform it manually via cURL should look like this

 

curl --location 'https://trial-5320507.okta.com/oauth2/XXX/v1/token' \

--header 'Accept: application/json' \

--header 'Content-Type: application/x-www-form-urlencoded' \

--header 'Authorization: Basic MG9hcTJ1MnU5eGlYVWtjd082OTc6dzY4eDF0aGcxY2w3c0M0WXNpcGNFZ2QyNi1PSmFnRmMtT092bnUtYVNIcWJvSGp6X1JRdkgzZ1N0Zk1VZXNPcA==' \

--header 'Cookie: JSESSIONID=6FCA7703685A455A72D95BCA5EB92515' \

--data-urlencode 'scope=certificates:request' \

--data-urlencode 'grant_type=client_credentials'

 

Note: cookie header is optional

 

Requesting a bearer token

 

Now that you get the access_token value take it and build a similar cURL request

 

curl --location --globoff -X POST "TLPC TOKEN ENDPOINT" \

--header 'Content-Type: application/x-www-form-urlencoded' \

--data-urlencode 'grant_type=client_credentials' \

--data-urlencode 'client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer' \

--data-urlencode 'client_assertion=LONG ALPHANUMERIC VALUE'

 

And response must be

 

{"access_token":"XXX","expires_in":900,"token_type":"bearer_token"}

 

Either way, OKTA has his own documentations on how to do this

 

https://developer.okta.com/docs/guides/implement-oauth-for-okta-serviceapp/main/#grant-allowed-scopes

Bonus: vCert

Idira offers a tool which easy automation process by avoiding development of an API client from zero named vCert

 

GitHub - Venafi/vcert: Go client SDK and command line utility

 

Once you get a bearer token vCert request should look like this

 

vcert enroll -p vcp -t <access token> --cn <common name> -z <application name\issuing template alias>

 

Output will print certificate information along with the same in a base64 format.



Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA1hj0000001QYLCA2&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail