Conversation
- Synthesize Key IDs for our JWT keys. For backwards compatibility, also include the same keys with an empty `kid` in JWKS. - Sign AWS OIDC tokens with a `kid=""` header claim, rather than omitting the `kid` claim altogether. See comment for details.
fec6c58 to
8e8232a
Compare
|
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
| ResourceHeader `json:""` | ||
| Spec struct { | ||
| AWSOIDC AWSOIDCIntegrationSpecV1 `json:"aws_oidc"` | ||
| AWSOIDC AWSOIDCIntegrationSpecV1 `json:"aws_oidc"` |
There was a problem hiding this comment.
You should probably add omitempty since now only one will be set
| expectedErrorIs: func(err error) bool { | ||
| return trace.IsBadParameter(err) | ||
| }, | ||
| expectedErrorIs: trace.IsBadParameter, |
|
|
||
| token, err := privateKey.SignEntraOIDC(jwt.SignParams{ | ||
| Audience: azureDefaultJWTAudience, | ||
| Subject: "teleport-azure", // TODO(justinas): consider moving this to a constant or a field in the integration settings |
There was a problem hiding this comment.
Should this be addressed before merging?
There was a problem hiding this comment.
Shouldn't be a problem later: as long as we have no user-facing way to onboard this, there's nothing to break 🙂 Left it TODO as I'm not sure how to handle this, but considering 1 ID provider = 1 subject for purposes of Entra app auth, constant should be okay I guess.
| } | ||
|
|
||
| func TestKeyID(t *testing.T) { | ||
| t.Run("deterministic", func(t *testing.T) { |
There was a problem hiding this comment.
Those can be two separate tests
| require.Equal(t, "sig", jwk.Use) | ||
| } | ||
|
|
||
| func TestKeyID(t *testing.T) { |
There was a problem hiding this comment.
| func TestKeyID(t *testing.T) { | |
| func TestKeyID(t *testing.T) { | |
| t.Parallel() |
| require.Equal(t, "sig", jwk.Use) | ||
| } | ||
|
|
||
| func TestKeyIDHasConsistentOutputForAnInput(t *testing.T) { |
There was a problem hiding this comment.
It'd be nice to see a test which takes a known public key and asserts that it produces a fixed KeyID - that'd let us ensure that we don't accidentally introduce a regression that causes the key ID in an already issued JWT to mismatch the key ID in the jwks.
| return trace.Wrap(err) | ||
| } | ||
| case *IntegrationSpecV1_AzureOIDC: | ||
| err := integrationSubKind.CheckAndSetDefaults() |
There was a problem hiding this comment.
| err := integrationSubKind.CheckAndSetDefaults() | |
| err := integrationSubKind.Validate() |
| // CheckAndSetDefaults validates the configuration for Azure OIDC integration subkind. | ||
| func (s *IntegrationSpecV1_AzureOIDC) CheckAndSetDefaults() error { |
There was a problem hiding this comment.
| // CheckAndSetDefaults validates the configuration for Azure OIDC integration subkind. | |
| func (s *IntegrationSpecV1_AzureOIDC) CheckAndSetDefaults() error { | |
| // Validate validates the configuration for Azure OIDC integration subkind. | |
| func (s *IntegrationSpecV1_AzureOIDC) Validate() error { |
| return nil | ||
| } | ||
|
|
||
| func (c *PluginEntraIDSettings) CheckAndSetDefaults() error { |
There was a problem hiding this comment.
| func (c *PluginEntraIDSettings) CheckAndSetDefaults() error { | |
| func (c *PluginEntraIDSettings) Validate() error { |
* Add e imports for MS Graph SDK * Add ability to sign Entra ID OIDC JWTs, rework KID handling - Synthesize Key IDs for our JWT keys. For backwards compatibility, also include the same keys with an empty `kid` in JWKS. - Sign AWS OIDC tokens with a `kid=""` header claim, rather than omitting the `kid` claim altogether. See comment for details. * Add validation for Entra ID plugin * Fix typo in assertion function name * Update the OIDC JWKS test to expect the same key twice * Add Entra ID plugin type constant * go mod tidy * Fix expected JWKS size in integration test * Add basic tests for KeyID * Move Azure auth settings from Plugin to Integration * Address review comments * Add a unit test to ensure KeyID compatibility * Add license header to token_generator.go * Rename validation function per new conventions
* Entra ID reconciler: directory reconciler prerequisites (#40778) * Add Entra ID resource origin * Ignore ID and Revision from `header` in cmp * Add e_imports for MS Graph SDK * Entra ID integration: add proto definitions (#40997) * Entra ID integration boilerplate (#40998) * Add e imports for MS Graph SDK * Add ability to sign Entra ID OIDC JWTs, rework KID handling - Synthesize Key IDs for our JWT keys. For backwards compatibility, also include the same keys with an empty `kid` in JWKS. - Sign AWS OIDC tokens with a `kid=""` header claim, rather than omitting the `kid` claim altogether. See comment for details. * Add validation for Entra ID plugin * Fix typo in assertion function name * Update the OIDC JWKS test to expect the same key twice * Add Entra ID plugin type constant * go mod tidy * Fix expected JWKS size in integration test * Add basic tests for KeyID * Move Azure auth settings from Plugin to Integration * Address review comments * Add a unit test to ensure KeyID compatibility * Add license header to token_generator.go * Rename validation function per new conventions * Access Graph: sync AWS identity providers (#41368) * Add AWSSAMLProviderV1 to access graph proto * Access Graph: sync AWS SAML Providers * Parse SAML entity descriptor before sending to TAG * Add protos for AWS OIDC providers * Fetch AWS OIDC providers * Fetch signing certificates for AWS SAML providers * Deflake identity provider fetch test The concrete implementation of IAM mock uses a map, resulting in non-deterministic iteration order. Sort the results before comparing to alleviate. * Update lib/srv/discovery/fetchers/aws-sync/iam_test.go Co-authored-by: Jakub Nyckowski <jakub.nyckowski@goteleport.com> --------- Co-authored-by: Jakub Nyckowski <jakub.nyckowski@goteleport.com> * Access Graph: Entra ID application sync prerequisites (#41650) * Add access graph settings to Entra ID plugin * Move Entra ID labels to OSS * Add Entra resources and RPC to Access Graph proto * Add azure-oidc integration to web. Current code assumes that Integration is always either AwsOidc, or an external audit storage integration * Change app sso cache to a repeated field * Entra ID integration: add onboarding script (#41811) * Add Entra ID integration onboarding script * Adapt after proto update * Validate names in azure script handler, add test * Add license headers * Update Entra plugin test with SSO connector field * Fix lint * Remove leftover panics * Adjust success message * Downgrade log message level * Expect exactly 1 SP for MS Graph, improve errors * Properly extract hostname for enterprise app name * Comment on assuming the first subscription * Address review nits * Factor out sso info fetch into a function * fixup refactor * Add retry logic to app role assignment * Make godoc conventional * Entra ID integration: integration script updates and web onboarding prerequisites (#42172) * Remove integration name validation from web script Not used by the script. It is validated by the "plugins/validate" endpoint. * Add required frontend constants for Entra ID * Support Azure/Entra integrations in the list * Add IsPolicyEnabled to web config * Allow custom URL for ButtonLockedFeature * Add CTA_ENTRA_ID event type * Expose TAGInfoCache for use in e * Add LackingIgs option * Add Entra ID icon * Add Entra ID plugin to storybook * Bump e for dev build * Return underlying error in getPrivateAPIToken * Find default Azure subscription instead of the first one * Require user to re-login when provisioning Azure OIDC * Update prehog protos with Entra ID values From https://github.com/gravitational/cloud/pull/9111 * Suppress verbose warnings / information from az * Add an additional message after successful auth Lets user know that `az login` has completed and `teleport` is continuing its work. * Move EntraId constant to the bottom * Revert unintended changes to usageevents CTA is 1-to-1 with prehog, but IntegrationEnrollKind is not. * Remove integrationName validation asserts from test This parameter is no longer accepted by the endpoint * Revert "Bump e for dev build" This reverts commit fc747a0. * `go mod tidy` secondary modules --------- Co-authored-by: Jakub Nyckowski <jakub.nyckowski@goteleport.com>
* Set the key id in JWT Some JWT libraries panic with multiple keys present in the JWKS. A second JWKS key entry was added in #40998 Fixes #44245 * Update lib/jwt/jwt.go Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com> * fix compile error --------- Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
* Set the key id in JWT Some JWT libraries panic with multiple keys present in the JWKS. A second JWKS key entry was added in #40998 Fixes #44245 * Update lib/jwt/jwt.go Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com> * fix compile error --------- Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
* Set the key id in JWT Some JWT libraries panic with multiple keys present in the JWKS. A second JWKS key entry was added in #40998 Fixes #44245 * Update lib/jwt/jwt.go Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com> * fix compile error --------- Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
* Set the key id in JWT Some JWT libraries panic with multiple keys present in the JWKS. A second JWKS key entry was added in #40998 Fixes #44245 * Update lib/jwt/jwt.go * fix compile error --------- Co-authored-by: Jeff Anderson <jeff@goteleport.com> Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
* Set the key id in JWT Some JWT libraries panic with multiple keys present in the JWKS. A second JWKS key entry was added in #40998 Fixes #44245 * Update lib/jwt/jwt.go * fix compile error --------- Co-authored-by: Jeff Anderson <jeff@goteleport.com> Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
Split off from #40556 . Depends on #40997
Introduces validation for types introduced in #40997 , as well as modifications to OIDC/JWT logic required to sign tokens for Entra APIs. See #40556 for more details.