- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
“We need ServiceNow to connect to Google Cloud, but we do not want the Google private key stored in the ServiceNow instance.”
That was the customer requirement.
And it immediately changed the conversation.
Because the obvious question was no longer:
Where should we store the key?
It became:
Why should we store the Google key at all?
For years, service-account keys have been a normal way to authenticate workloads to Google Cloud. They work. But they also introduce something every security team would rather avoid: a long-lived private key that must be downloaded, transported, stored, protected, rotated, and eventually replaced.
So instead of trying to find a safer place inside ServiceNow for the Google private key, we looked at a different authentication model:
Workload Identity Federation
Workload Identity Federation, or WIF, allows an external workload to prove its identity to Google Cloud and exchange that identity for short-lived Google credentials.
Google specifically positions WIF as an alternative to service-account keys for workloads outside Google Cloud.
That was exactly the problem we were trying to solve.
The architecture we wanted to avoid
A traditional private-key-based design looks roughly like this:
Google Service Account
↓
Google Private Key
↓
Keystore / Credential in ServiceNow
↓
JWT Signing
↓
Google OAuth
↓
Google Access Token
There is nothing inherently wrong with that architecture.
But the Google service-account private key becomes another credential that has to exist inside ServiceNow.
For this customer, that was the problem.
The architecture we implemented instead
With WIF, the model changes:
ServiceNow KMF
↓
ServiceNow-managed RSA signing key
↓
Signed workload JWT
↓
Google Workload Identity Federation
↓
Google Security Token Service
↓
Short-lived Google access token
↓
Google Cloud API
The important security difference is:
The Google service-account private key is never imported into ServiceNow.
ServiceNow still uses cryptography, of course. But the signing key is generated and managed by ServiceNow Key Management Framework (KMF).
Google only needs the corresponding public identity information to verify the JWT.
Before you begin
For the implementation described here, you need:
-
A ServiceNow instance with Key Management Framework available.
-
An instance version that exposes KMF Crypto Module as a JWT Key Source.
-
A Google Cloud project.
-
Permission to create a Google Workload Identity Pool and Provider.
-
Permission to configure Google IAM access.
-
Appropriate ServiceNow KMF and OAuth administrative roles.
Important patch-level observation
During testing, the KMF-backed JWT Key Source was not available on the earlier Australia patch levels we tested.
After upgrading the instance to Australia Patch 7, the JWT Key form exposed:
Key Source
KMF Crypto Module
So for the environment in which this solution was validated, Australia Patch 7 or later was required.
This is an implementation finding from testing rather than a general statement for every future ServiceNow release.
Part 1 — Create the ServiceNow KMF signing key
The first task is to create the asymmetric signing key that represents the ServiceNow workload.
ServiceNow documents cryptographic modules under Key Management Framework and allows cryptographic specifications and keys to be created underneath those modules.
Procedure
Navigate to:
All > Key Management > Cryptographic Modules > Create New
Create a module with values similar to:
Module name
google_wif_signing
Crypto spec template
Default template
Create the module.
ServiceNow prefixes the module name with the application scope. If created in Global, the module becomes something similar to:
global.google_wif_signing
Part 2 — Create the signing specification
Open the cryptographic module you just created.
Under Crypto Specifications, select:
New
Configure:
Crypto purpose
Signature Generation
Algorithm
RSA 2048 SHA 256
For the key origin, select:
ServiceNow
Provide a key alias, for example:
google_wif_jwt_signing_key
Continue through the wizard and select:
Generate Key
After generation, confirm that KMF contains both:
Private Signature Generation Key
Public Signature Verification Key
The private key is now managed by KMF.
It is not a Google service-account key.
It is ServiceNow's own workload-signing key.
Part 3 — Create the JWT signing configuration
Now tell ServiceNow's JWT framework to use KMF rather than an uploaded keystore.
Navigate to:
All > System OAuth > JWT Keys
or open:
jwt_keystore_aliases.list
Select:
New
Configure the record.
Name
Google WIF JWT Signing Key
Key Source
KMF Crypto Module
KMF Crypto Module
global.google_wif_signing
Signing Algorithm
RSA 256
Select:
Active
Save the record.
This is one of the most important differences from the traditional model.
Instead of:
JWT Key
↓
Uploaded keystore
↓
Google private key
we now have:
JWT Key
↓
KMF Crypto Module
↓
ServiceNow-managed signing key
Part 4 — Create the JWT Provider
Navigate to:
All > System OAuth > JWT Providers
Select:
New
Configure:
Name
Google WIF JWT Provider
Signing Configuration
Google WIF JWT Signing Key
For testing, configure a short expiry interval such as:
300 seconds
Then configure the standard JWT claims.
The key claims required for the WIF trust are:
iss
sub
aud
For example:
Issuer
https://<instance>.service-now.com
Subject
servicenow-google-wif-demo
Audience
https://iam.googleapis.com/projects/<PROJECT_NUMBER>/
locations/global/workloadIdentityPools/<POOL_ID>/
providers/<PROVIDER_ID>
The subject becomes particularly important later because Google can map:
assertion.sub
to:
google.subject
Google recommends using a unique and stable claim such as sub for this mapping.
Part 5 — Verify the ServiceNow OIDC metadata
Google must be able to verify that the JWT genuinely came from ServiceNow.
Open:
https://<instance>.service-now.com/
.well-known/openid-configuration
Confirm that the response contains:
issuer
jwks_uri
For example:
issuer:
https://<instance>.service-now.com
jwks_uri:
https://<instance>.service-now.com/oauth_jwks.do
Google uses the public JWKS information to validate ServiceNow's JWT signature.
The private KMF key never needs to be shared with Google.
Part 6 — Create the Google Workload Identity Pool
Now move to Google Cloud.
Navigate to:
Google Cloud Console > IAM & Admin > Workload Identity Federation
Select:
Create Pool
Provide a name, for example:
ServiceNow WIF Demo
Use a pool ID similar to:
servicenow-wif-demo
Continue.
Google documents this as the standard way to federate external OIDC workloads into Google Cloud.
Part 7 — Add ServiceNow as the OIDC Provider
Inside the workload identity pool, create a provider.
Select:
OpenID Connect (OIDC)
Enter a provider name such as:
ServiceNow Demo
For Issuer URL, use the exact issuer value from the ServiceNow OIDC metadata.
For example:
https://<instance>.service-now.com
Do not enter the entire:
/.well-known/openid-configuration
URL.
Google uses the issuer to discover the OIDC metadata automatically.
If the ServiceNow JWKS endpoint is publicly available, the JWK file field can remain empty. Google can retrieve the keys from the issuer metadata.
Keep:
Default audience
Continue.
Part 8 — Configure the Google identity mapping
Under provider attributes, configure:
google.subject = assertion.sub
For the initial proof of concept, an attribute condition can remain empty.
Google requires an OIDC provider to map an assertion claim to google.subject and specifically recommends assertion.sub when it contains a stable, unique identifier.
Save the provider.
At this point, Google trusts the ServiceNow OIDC issuer.
But ServiceNow still needs a mechanism to exchange its JWT for a Google token.
That is the next step.
Part 9 — Create the outbound OAuth provider in ServiceNow
Navigate to:
All > System OAuth > Application Registry
Select:
New
Then choose:
Connect to a third-party OAuth Provider
Create the provider.
For example:
Name
Google WIF
Set:
Default Grant type
Token Exchange
Set the token endpoint to:
https://sts.googleapis.com/v1/token
The important part here is the grant type.
Google Workload Identity Federation uses OAuth 2.0 Token Exchange, rather than a conventional client-secret authentication flow. Google documents WIF as following the OAuth 2.0 token-exchange model.
Save the OAuth provider.
Part 10 — Configure the OAuth Entity Profile
Open the OAuth Entity Profile created for the Google WIF OAuth provider.
Configure:
Grant type
Token Exchange
Token Source
JWT Provider
JWT Provider
Google WIF JWT Provider
Requested Token Type
Access Token
Configure the Google WIF provider resource as the STS audience:
//iam.googleapis.com/projects/<PROJECT_NUMBER>/
locations/global/workloadIdentityPools/<POOL_ID>/
providers/<PROVIDER_ID>
Add the scope:
https://www.googleapis.com/auth/cloud-platform
At runtime, ServiceNow now has all the pieces required to perform:
JWT
↓
OAuth Token Exchange
↓
Google Security Token Service
↓
Google Access Token
Part 11 — The first test… and the first error
At this point, everything looked ready.
We created a small REST Message using:
Authentication type = OAuth 2.0
OAuth Profile = Google WIF profile
Then we selected:
Get OAuth Token
And instead of receiving a Google token, ServiceNow returned:
Crypto module is not accessible
Initially, this looked like something had gone wrong with Google.
It had not.
The request had not even reached Google yet.
KMF was doing exactly what it was supposed to do.
Part 12 — Configure the KMF Module Access Policy
KMF uses Module Access Policies to decide which callers may use a cryptographic module.
ServiceNow's default MAP behavior is Reject unless an appropriate policy permits access.
Navigate to:
All > Key Management > Module Access Policies > All
After the initial JWT signing attempt, an auto-generated policy was present for the cryptographic module.
It looked similar to:
AutoGen-scope-global-global.google_wif_signing
The result was:
Reject
Open the policy.
After confirming that it represented the expected OAuth/JWT caller, change:
Result = Track
and save the policy.
Track permits the operation while allowing KMF usage to be monitored. ServiceNow documents Track as permitting access and monitoring use of the module.
Part 13 — Try again
Return to the REST Message.
Select:
Get OAuth Token
This time:
Success.
ServiceNow:
-
generated the workload JWT;
-
used KMF to sign it;
-
sent it to Google Security Token Service;
-
Google validated the ServiceNow identity;
-
Google returned a short-lived access token.
And that was the moment the entire architecture was proven.
What about refresh tokens?
This is one of the nice characteristics of this design.
The architecture does not depend on a permanent Google refresh token.
The Google access token is temporary.
When another token is required, the OAuth flow can generate a fresh workload JWT and perform the token exchange again.
Conceptually:
Access token expires
↓
Generate new JWT
↓
Sign using KMF
↓
Exchange with Google STS
↓
New short-lived access token
The important principle is that authentication continues to be based on the workload identity rather than possession of a permanent Google private key.
Part 14 — Use WIF through normal ServiceNow integrations
Once the WIF OAuth profile is working, it becomes an authentication building block.
For integrations using ServiceNow Connection & Credential Management, the pattern can become:
Flow / Spoke
↓
Connection & Credential Alias
↓
OAuth Credential
↓
Google WIF OAuth Profile
↓
Google Cloud
This means the flow or IntegrationHub action does not need to understand KMF, JWT signing, OIDC or token exchange.
It simply needs an OAuth credential.
The complexity stays in the authentication layer, where it belongs.
For a particular IntegrationHub spoke or Service Graph Connector, verify that the connector supports the standard Connection & Credential model before assuming that its existing authentication can simply be replaced by WIF.
Did this solve the customer problem?
The original concern was:
“We do not want our Google service-account private key stored in ServiceNow.”
The final design became:
Google private key in ServiceNow ❌
Google client secret used for authentication ❌
ServiceNow KMF signing key ✅
Google validates ServiceNow identity ✅
Short-lived Google credentials ✅
Explicit control over who can use the KMF key ✅
So instead of finding a better hiding place for the customer's Google key, we removed the Google key from the ServiceNow authentication model entirely.
That was the real solution.
The lesson I took away
The most interesting part of this implementation was not JWT.
It was not OAuth.
It was not even Google Cloud.
It was the question that started the whole thing:
“Why should we store the key?”
That question completely changed the architecture.
The traditional model says:
I possess a secret, therefore trust me.
Workload Identity Federation says:
Verify who I am, and give me temporary access.
That is a much more interesting security model.
So the next time an integration design starts with:
“First, download the service-account private key…”
it may be worth stopping there.
Because sometimes the best place to store a cloud private key…
is nowhere in the integration at all.
Quick configuration reference
ServiceNow
KMF module
Navigate to:
Key Management > Cryptographic Modules > Create New
Configure:
Purpose = Signature Generation
Algorithm = RSA 2048 SHA 256
Key Origin = ServiceNow
JWT Key
Navigate to:
System OAuth > JWT Keys > New
Configure:
Key Source = KMF Crypto Module
KMF Crypto Module = <your module>
Signing Algorithm = RSA 256
JWT Provider
Navigate to:
System OAuth > JWT Providers > New
Configure:
Signing Configuration = <KMF JWT Key>
iss = ServiceNow issuer
sub = workload identity
aud = Google provider audience
Application Registry
Navigate to:
System OAuth > Application Registry > New
Select:
Connect to a third-party OAuth Provider
Configure:
Grant Type = Token Exchange
Token URL = https://sts.googleapis.com/v1/token
OAuth Entity Profile
Configure:
Token Source = JWT Provider
Requested Token Type = Access Token
Audience = //iam.googleapis.com/projects/.../providers/...
Scope = https://www.googleapis.com/auth/cloud-platform
KMF Module Access Policy
Navigate to:
Key Management > Module Access Policies > All
For the expected OAuth/JWT caller:
Result = Track
Google Cloud
Navigate to:
IAM & Admin > Workload Identity Federation
Create:
Workload Identity Pool
↓
OIDC Provider
Configure:
Issuer URL =
https://<instance>.service-now.com
Attribute mapping =
google.subject = assertion.sub
Google then verifies ServiceNow JWTs using the issuer's JWKS information and exchanges successful assertions for short-lived Google credentials.
Result
You now have:
ServiceNow
↓
KMF-protected identity
↓
Signed JWT
↓
Google WIF
↓
Short-lived Google token
↓
Google Cloud API
without importing the Google service-account private key into ServiceNow.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.