Secret-less authentication with workload identity federation #619
chandlerkent
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
(Cross-posted from https://github.com/orgs/DuendeSoftware/discussions/617#discussioncomment-18290039 per request from @maartenba!)
We have extended Identity Server to support what we call a federated credential (seems the industry may now be standardizing on calling it "workload identity federation") which allows a secret-less authentication flow with Identity Server. We think the pattern is broadly applicable that we would love to see some version of this built-in to Identity Server so we can remove this customization.
The basic concept is you establish trust with another OIDC provider and then you can accept tokens from this provider and map them to an Identity Server
Client. To implement this in Identity Server, there are 3 components involved:FederatedOpenIDConnectCredentialthat is a sub-class ofSecretwhich accepts anissuer,audience, and a way to extract claims from the credential to map to an Identity Server client. You add this secret to the Identity ServerClient'sClientSecrets.FederatedOpenIDConnectClientAssertionSecretParserthat implementsISecretParserwhich extracts the token from the incoming HTTP request (it is really an implementation ofJwtBearerClientAssertionSecretParserand perhaps we could use the built-in instead of creating our own).FederatedOpenIDConnectCredentialValidatorthat implementsISecretValidatorwhich maps the incoming token to aFederatedOpenIDConnectCredentialand then validates it using standard JWT validation (validateissuer,audience, expiration, etc.).With this foundation in place, Identity Server can accept a token from another OIDC provider and exchange it for a token representing a
Clientin Identity Server. There's no shared secret or even public keys (in the case of private key JWT or mutual TLS) to configure. You can then allow your users to integrate with popular OIDC providers such as GitHub actions or your cloud Identity Provider without needing to set up or store any secrets.For our use case, we use Azure and Azure Kubernetes Service, which allows us to get tokens from Identity Server without creating or managing any secrets.
Here's the real world workflow we use. First the setup:
With this setup, we get a full end-to-end flow where our workloads can get a token from Identity Server without secrets:
#3above), via the (WorkloadIdentityCredential)[https://learn.microsoft.com/en-us/dotnet/api/azure.identity.workloadidentitycredential?view=azure-dotnet&preserve-view=true]rolesclaim (which Entra ID adds), uses mapping logic to map therolesto an Identity ServerClient, and then return a token.I believe what I described works in any of the major clouds and should be applicable more broadly than Azure.
All reactions