-
Notifications
You must be signed in to change notification settings - Fork 166
feat: Add client credentials guide for NGINXaaS Google #2052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nparikh03
wants to merge
11
commits into
main
Choose a base branch
from
naas/client-creds-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f781e89
feat: Add client credentials guide for NGINXaaS Google
nparikh03 ac27394
Apply suggestions from code review
nparikh03 0556ad3
add reference section at the end
nparikh03 c50ac20
cleanup content in security best practices
nparikh03 12ff400
Merge branch 'main' into naas/client-creds-docs
nparikh03 39dc821
Merge branch 'main' into naas/client-creds-docs
JTorreG 3c1b497
Merge branch 'main' into naas/client-creds-docs
JTorreG 1a4a24a
Merge branch 'main' into naas/client-creds-docs
JTorreG 8059de2
Adding more details to sections
nparikh03 ff4eac5
Merge branch 'main' into naas/client-creds-docs
JTorreG 3fce686
update auth token endpoint
nparikh03 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
193 changes: 193 additions & 0 deletions
193
content/nginxaas-google/quickstart/security-controls/client-credentials.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,193 @@ | ||
| --- | ||
| title: "Programmatic Authentication With Client Credentials" | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
| description: "Learn how to set up OAuth2 client credentials for programmatic access to the NGINXaaS API." | ||
| weight: 100 | ||
| toc: true | ||
| url: /nginxaas/google/quickstart/security-controls/client-credentials/ | ||
|
nparikh03 marked this conversation as resolved.
|
||
| f5-product: NGOOGL | ||
| f5-content-type: how-to | ||
| f5-keywords: "client credentials, OAuth2, programmatic authentication, API" | ||
| --- | ||
|
nparikh03 marked this conversation as resolved.
|
||
|
|
||
| ## Overview | ||
|
|
||
| This guide explains how to create and use client credentials to manage some NGINXaaS for Google Cloud APIs programmatically. This allows machine users such as Terraform, CI/CD pipelines, or other automation tools to authenticate and interact with the NGINXaaS API securely. | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
|
|
||
| Client credentials are scoped to an organization and enable programmatic access to manage Deployments, Configurations, and Certificates APIs. | ||
|
|
||
| ## Key features | ||
|
|
||
| - **Secure programmatic access**: Enables programmatic access for machine clients with tokens minted using client credentials | ||
| - **Configurable Expiration controls**: Configurable expiration with recommended best practices | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
| - **Limited scope**: Client credentials can only manage Deployments, Configs, and Certificates | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Prerequisites | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
|
|
||
| - You must be logged into NGINXaaS Console [https://console.nginxaas.net/](https://console.nginxaas.net/) | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Creating client credentials | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
|
|
||
| Follow these steps to create a new client credential through the NGINXaaS console: | ||
|
|
||
| 1. Log in to [NGINXaaS Console](https://console.nginxaas.net/) using your Google credentials. | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
| 2. Select **Settings** > **Client Credentials** from the left navigation menu. | ||
| 3. Select **+ Add Client** to create a new credential. | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
| 4. Enter a unique name for your client in the text field that appears. | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
| 5. Choose an expiration date (maximum 1 year from today; 6 months is recommended). This setting is immutable after creation. | ||
| 6. Select **Create**. A popup window displays your client secret. | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
|
|
||
| {{< call-out class="warning" title="Important: Store Your Client Secret Securely" >}} | ||
| The client secret appears only once. Save it immediately in a secure location, such as a password manager or secrets vault. If you lose the secret, you must delete this credential and create a new one. | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
| {{< /call-out >}} | ||
|
|
||
| Your client credentials can access the following APIs programmatically: | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
|
|
||
| - Certificates API | ||
| - Configs API | ||
| - Deployments API | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
|
|
||
| ### Client limits | ||
|
|
||
| Organizations are limited to a maximum of 10 client credentials. To request an increase to this limit, contact the NGINX Support team. | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Retrieving client information | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
|
|
||
| Follow these steps to view your client credentials: | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
|
|
||
| 1. Log in to [NGINXaaS Console](https://console.nginxaas.net/). | ||
| 2. Select **Settings** > **Client Credentials** from the left navigation menu. | ||
| 3. The **Client Credentials** page displays all available client credentials for your organization. The table shows the following metadata for each credential: | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
| - Client Name | ||
| - Client ID | ||
| - Token Endpoint | ||
| - Date Created | ||
| - Expires On | ||
|
|
||
| 4. Check the expiration status indicator next to **Expires On**: | ||
| - **Green dot**: Credential is active and valid | ||
| - **Red dot**: Credential has expired | ||
|
|
||
| {{< call-out class="note" >}} | ||
| Client secrets are not displayed after creation. If you need to use credentials again, you must have saved the secret when you initially created the client. | ||
| {{< /call-out >}} | ||
|
|
||
| ## Deleting client credentials | ||
|
|
||
| Follow these steps to delete a client credential: | ||
|
|
||
| 1. Log in to [NGINXaaS Console](https://console.nginxaas.net/). | ||
| 2. Select **Settings** > **Client Credentials** from the left navigation menu. | ||
| 3. Locate the credential to delete in the table. | ||
| 4. Select the three vertical dots icon (⋮) at the end of the row. | ||
| 5. Select **Delete** from the menu. | ||
|
|
||
| After deletion: | ||
|
nparikh03 marked this conversation as resolved.
|
||
|
|
||
| - The client can no longer request new access tokens using this credential | ||
| - Existing access tokens continue to work until they expire (1 hour from issuance) | ||
| - The client ID and secret become permanently invalid | ||
|
|
||
| {{< call-out class="note" >}} | ||
| Expired credentials are not automatically removed. You must manually delete credentials that are past their expiration date. | ||
|
nparikh03 marked this conversation as resolved.
|
||
| {{< /call-out >}} | ||
|
|
||
| ## Using client credentials for authentication | ||
|
|
||
| ### Exchange credentials for an access token | ||
|
nparikh03 marked this conversation as resolved.
|
||
|
|
||
| Use the client credentials to obtain an access token from the token endpoint. | ||
|
|
||
| **Endpoint**: `POST https://us.api.nginxaas.net/api/v1/marketplace/auth/token` | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
|
|
||
| **Example using cURL**: | ||
|
|
||
| ```bash | ||
| curl -X POST "https://us.api.nginxaas.net/api/v1/marketplace/auth/token" \ | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "client_id": "client_abc123", | ||
| "client_secret": "superSecret", | ||
| "grant_type": "client_credentials" | ||
|
nparikh03 marked this conversation as resolved.
Outdated
JTorreG marked this conversation as resolved.
Outdated
|
||
| }' | ||
| ``` | ||
|
|
||
| **Response**: | ||
|
|
||
| ```json | ||
| { | ||
| "access_token": "<access_token>", | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
| "token_type": "Bearer", | ||
| "expires_in": 3600 | ||
| } | ||
| ``` | ||
|
|
||
| ### Use the access token | ||
|
|
||
| Include the access token in the Authorization header when making API requests. | ||
|
|
||
| **Example**: | ||
|
|
||
| ```bash | ||
| curl -X GET "https://us.api.nginxaas.net/api/v1/deployments" \ | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
| -H "Authorization: Bearer <access_token>" | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
| ``` | ||
|
|
||
| ### Access token validity | ||
|
|
||
| - **Duration**: Access tokens are valid for 1 hour from issuance | ||
| - **Reauthentication**: When a token expires, request a new one using the same client credentials, if the client credentials are still active | ||
| - **Scope**: Tokens are also scoped to the organization associated with the client credentials | ||
|
|
||
| ## Security best practices | ||
|
|
||
| - **Use separate credentials for different environments**: Create distinct clients for various scopes to keep things logically separate | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
| - **Store secrets securely**: Never commit client secrets to version control | ||
| - **Delete unused credentials**: Remove clients that are no longer needed | ||
| - **Follow the recommended expiration**: Unless you have a specific reason, use the recommended 6-month expiration | ||
|
|
||
| ## Error handling | ||
|
nparikh03 marked this conversation as resolved.
Outdated
|
||
|
|
||
| ### Invalid or expired credentials | ||
|
nparikh03 marked this conversation as resolved.
|
||
|
|
||
| If you attempt to authenticate with invalid or expired credentials, you will receive a `401 Unauthorized` response. In this case: | ||
|
|
||
| - Verify your client ID and secret are correct | ||
| - Check if the client has expired | ||
| - Create new credentials if necessary | ||
|
|
||
| **Example error response**: | ||
|
|
||
| ```json | ||
| { | ||
| "error": "unauthorized", | ||
| "error_description": "token is expired/invalid" | ||
| } | ||
| ``` | ||
|
|
||
| ### Forbidden APIs | ||
|
|
||
| Client credentials can only access the Certificates, Configs, and Deployments APIs. Attempting to access any other API with client credentials returns a `403 Forbidden` response. In this case: | ||
|
|
||
| - Verify you are using the correct API endpoint | ||
| - Ensure the API is one of the supported resources (Deployments, Configs, or Certificates) | ||
|
|
||
| **Example error response**: | ||
|
|
||
| ```json | ||
| { | ||
| "error": "forbidden", | ||
| "error_description": "Client credentials do not have permission to access this resource" | ||
| } | ||
| ``` | ||
|
|
||
| ## Quick reference | ||
|
|
||
| | Property | Value | | ||
| |----------|-------| | ||
| | Client secret visibility | Only shown once during creation | | ||
| | Default expiration | 6 months (recommended) | | ||
| | Maximum expiration | 1 year | | ||
| | Client limit per organization | 10 clients (contact NGINX Support to increase) | | ||
| | Access token validity | 1 hour | | ||
| | Supported resources | Deployments, Configs, Certificates | | ||
| | Token endpoint | `https://{region}.api.nginxaas.net/api/v1/marketplace/auth/token` | | ||
|
nparikh03 marked this conversation as resolved.
Outdated
nparikh03 marked this conversation as resolved.
Outdated
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.