-
Notifications
You must be signed in to change notification settings - Fork 592
CNTRLPLANE-2550: Add support for CEL expression claim mappings for username and groups #2719
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
base: master
Are you sure you want to change the base?
Changes from all commits
e8556dd
abc8d56
6cc13c4
d040102
1f17fea
3994322
1726d42
b1eb335
0e5bdf3
91412a1
a23a022
ea37c6a
39c762b
f87a2b3
b9a7264
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -492,6 +492,49 @@ tests: | |
| claimMappings: | ||
| username: | ||
| claim: "" | ||
| - name: Should allow updating groups claim mapping from invalid empty value to valid value | ||
| initialCRDPatches: | ||
| - op: remove | ||
| path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/oidcProviders/items/properties/claimMappings/properties/groups/properties/claim/minLength | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://meh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| groups: | ||
| claim: "" | ||
| updated: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://meh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| groups: | ||
| claim: "groups" | ||
| expected: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://meh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| groups: | ||
| claim: "groups" | ||
|
Comment on lines
+495
to
+537
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this test, an empty group claim ( |
||
| - name: Should allow updating other fields if existing username claim mapping is longer than 256 characters | ||
| initialCRDPatches: | ||
| - op: remove | ||
|
|
@@ -535,6 +578,80 @@ tests: | |
| claimMappings: | ||
| username: | ||
| claim: "thisisanincrediblylongclaimnamethatwhileacceptableinjwtsisgenerallyadvisedagainstbecauseitisextremelylongandnoteasilyusablebutmaybethereisausecaseouttherethathasdecidedthattheyneedtousethisextremelylongclaimnameforsomereasoneventhoughtheyreallyshouldreconsiderthis" | ||
| - name: Should allow updating groups claim mapping from a previously invalid long value to a valid value | ||
| initialCRDPatches: | ||
| - op: remove | ||
| path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/oidcProviders/items/properties/claimMappings/properties/groups/properties/claim/maxLength | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://meh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| groups: | ||
| claim: "thisisanextremelylonggroupclaimnamethatexceedsthetypicalmaximummappinglengthandshouldfailvalidationbecauseitiswaytoobigforsaneuse" | ||
|
Comment on lines
+595
to
+597
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Additionally, you added a maxLength of 256 and |
||
| updated: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://meh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| groups: | ||
| claim: "groups" | ||
| expected: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://meh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| groups: | ||
| claim: "groups" | ||
| - name: Should not allow updating groups claim mapping from a previously invalid long value to a still invalid long value | ||
| initialCRDPatches: | ||
| - op: remove | ||
| path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/oidcProviders/items/properties/claimMappings/properties/groups/properties/claim/maxLength | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://meh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| groups: | ||
| claim: "thisisanextremelylonggroupclaimnamethatexceedsthetypicalmaximummappinglengthandshouldfailvalidationbecauseitiswaytoobigforsaneuse" | ||
|
Comment on lines
+638
to
+640
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| updated: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://meh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| groups: | ||
| claim: "thisisanextremelylonggroupclaimnamethatexceedsthetypicalmaximummappinglengthandshouldfailvalidationbecauseitiswaytoobigforsaneuseandstilltoolong" | ||
| expectedError: "Too long: may not be more than 256 bytes" | ||
| - name: Should allow updating other fields if issuerURL contains fragment | ||
| initialCRDPatches: | ||
| - op: remove | ||
|
|
||
ShazaAldawamneh marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -588,6 +588,209 @@ tests: | |
| valueExpression: "claims.foo" | ||
| expectedError: "the domain of the key must consist of only lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character" | ||
| onUpdate: | ||
| - name: Should allow updating other fields if existing username claim mapping is empty string | ||
| initialCRDPatches: | ||
| - op: remove | ||
| path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/oidcProviders/items/properties/claimMappings/properties/username/properties/claim/minLength | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://meh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| username: | ||
| claim: "" | ||
| updated: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://huh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| username: | ||
| claim: "" | ||
| expected: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://huh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| username: | ||
| claim: "" | ||
| - name: Should allow updating groups claim mapping from previously invalid empty value to a valid value | ||
| initialCRDPatches: | ||
| - op: remove | ||
| path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/oidcProviders/items/properties/claimMappings/properties/groups/properties/claim/minLength | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://meh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| groups: | ||
| claim: "" | ||
| updated: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://meh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| groups: | ||
| claim: "groups" | ||
| expected: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://meh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| groups: | ||
| claim: "groups" | ||
| - name: Should allow updating other fields if existing username claim mapping is longer than 256 characters | ||
| initialCRDPatches: | ||
| - op: remove | ||
| path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/oidcProviders/items/properties/claimMappings/properties/username/properties/claim/maxLength | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://meh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| username: | ||
| claim: "thisisanincrediblylongclaimnamethatwhileacceptableinjwtsisgenerallyadvisedagainstbecauseitisextremelylongandnoteasilyusablebutmaybethereisausecaseouttherethathasdecidedthattheyneedtousethisextremelylongclaimnameforsomereasoneventhoughtheyreallyshouldreconsiderthis" | ||
| updated: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://huh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| username: | ||
| claim: "thisisanincrediblylongclaimnamethatwhileacceptableinjwtsisgenerallyadvisedagainstbecauseitisextremelylongandnoteasilyusablebutmaybethereisausecaseouttherethathasdecidedthattheyneedtousethisextremelylongclaimnameforsomereasoneventhoughtheyreallyshouldreconsiderthis" | ||
| expected: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://huh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| username: | ||
| claim: "thisisanincrediblylongclaimnamethatwhileacceptableinjwtsisgenerallyadvisedagainstbecauseitisextremelylongandnoteasilyusablebutmaybethereisausecaseouttherethathasdecidedthattheyneedtousethisextremelylongclaimnameforsomereasoneventhoughtheyreallyshouldreconsiderthis" | ||
| - name: Should allow updating groups claim mapping from a previously invalid long value to a valid value | ||
| initialCRDPatches: | ||
| - op: remove | ||
| path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/oidcProviders/items/properties/claimMappings/properties/groups/properties/claim/maxLength | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://meh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| groups: | ||
| claim: "thisisanextremelylonggroupclaimnamethatexceedsthetypicalmaximummappinglengthandshouldfailvalidationbecauseitiswaytoobigforsaneuse" | ||
| updated: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://meh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| groups: | ||
| claim: "groups" | ||
| expected: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://meh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| groups: | ||
| claim: "groups" | ||
| - name: Should not allow updating groups claim mapping from a previously invalid long value to a still invalid long value | ||
| initialCRDPatches: | ||
| - op: remove | ||
| path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/oidcProviders/items/properties/claimMappings/properties/groups/properties/claim/maxLength | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://meh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| groups: | ||
| claim: "thisisanextremelylonggroupclaimnamethatexceedsthetypicalmaximummappinglengthandshouldfailvalidationbecauseitiswaytoobigforsaneuse" | ||
| updated: | | ||
| apiVersion: config.openshift.io/v1 | ||
| kind: Authentication | ||
| spec: | ||
| type: OIDC | ||
| oidcProviders: | ||
| - name: myoidc | ||
| issuer: | ||
| issuerURL: https://meh.tld | ||
| audiences: ['openshift-aud'] | ||
| claimMappings: | ||
| groups: | ||
| claim: "thisisanextremelylonggroupclaimnamethatexceedsthetypicalmaximummappinglengthandshouldfailvalidationbecauseitiswaytoobigforsaneuseandstilltoolong" | ||
| expectedError: "Too long: may not be more than 256 bytes" | ||
|
Comment on lines
+591
to
+793
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To keep things easier to track here, lets just trust that the ratcheting test in the I know I said it should be added to all files, and while it doesn't hurt, it makes this PR bigger than it needs to be and I hadn't thought of that. Apologies for the churn here, I should have had better foresight here - not sure why I didn't. |
||
| - name: Updating OIDC provider with a client that's not in the status | ||
| initial: | | ||
| apiVersion: config.openshift.io/v1 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.