[OIDC 7] DB migration for federated credentials, associate policy with API key #10285
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.
Important
This PR contains a DB migration. During deployment, we must execute Entity Framework DB migrations prior to deploying the new code.
Progress on #10212.
Depends on #10269.
This PR introduces database changes to support the OIDC feature. We are adding two new tables and adding a new column to the existing
Credentials
table.FederatedCredentialPolicies
- this stores criteria to evaluate a federated credentials like OIDC JWTs. SeeFederatedCredentialEvaluator
to see how the columns are used.Users
via theCreatedByUserKey
andPackageOwnerUserKey
columns.FederatedCredentials
- this stored federated credentials that have been used, in order to detect token replay.FederatedCredentialPolicies
table without a foreign key. If a policy is deleted, the federated credential record should not be removed, otherwise replay could occur. It is totally possible for a federated credential record to refer to a policy key that no longer exists. I added the column so we have a persistent record of the policy that was used to accept the federated credential. This can be used to correlate with existing records or make sense of audit logs.Identity
string column so we can detect replay (duplicateuti
orjti
JWT claims).FederatedCredentialPolicyKey
on theCredentials
table - this allows us to associate a policy with a short-lived API key that was created. In audit logs this will allow us to correlate a federated credential (JWT claims) with an API key that is used for a privileged action. Also, it allows us to delete short-lived API keys if the policy is deleted (manual revocation).Credentials
table design).SQL: