fix: scim 2.0 patch ignore op casing (#9282)

# Which Problems Are Solved
- Some SCIM clients send "op" of a patch operation in PascalCase

# How the Problems Are Solved
- Well known "op" values of patch operations are matched
case-insensitive.

# Additional Context
Related to #8140
This commit is contained in:
Lars 2025-01-31 10:15:39 +01:00 committed by GitHub
parent 563f74640e
commit 20cff9c70a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View File

@ -3,7 +3,7 @@
"Operations": [ "Operations": [
// add without path // add without path
{ {
"op": "add", "op": "Add", // with PascalCase operation type
"value": { "value": {
"emails":[ "emails":[
{ {
@ -17,7 +17,7 @@
}, },
// add complex attribute with path // add complex attribute with path
{ {
"op": "add", "op": "add", // with camelCase operation type
"path": "name", "path": "name",
"value": { "value": {
"formatted": "added-formatted", "formatted": "added-formatted",
@ -30,7 +30,7 @@
}, },
// add complex attribute value // add complex attribute value
{ {
"op": "add", "op": "ADD", // with UPPERCASE operation type
"path": "name.middlename", "path": "name.middlename",
"value": "added-middle-name-2" "value": "added-middle-name-2"
}, },

View File

@ -60,6 +60,9 @@ func (req *OperationRequest) Validate() error {
} }
func (op *Operation) validate() error { func (op *Operation) validate() error {
// ignore the casing, as some scim clients send these capitalized
op.Operation = OperationType(strings.ToLower(string(op.Operation)))
if !op.Operation.isValid() { if !op.Operation.isValid() {
return serrors.ThrowInvalidValue(zerrors.ThrowInvalidArgumentf(nil, "SCIM-opty1", "Patch op %s not supported", op.Operation)) return serrors.ThrowInvalidValue(zerrors.ThrowInvalidArgumentf(nil, "SCIM-opty1", "Patch op %s not supported", op.Operation))
} }