Skip to content

Commit

Permalink
Use a case-sensitive compare for org_name (#783)
Browse files Browse the repository at this point in the history
  • Loading branch information
Widcket authored Jul 18, 2023
1 parent 2c89b61 commit ad781b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Auth0/ClaimValidators.swift
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ struct IDTokenOrgNameValidator: JWTValidator {

func validate(_ jwt: JWT) -> Auth0Error? {
guard let actualOrgName = jwt.claim(name: "org_name").string else { return ValidationError.missingOrgName }
guard actualOrgName.caseInsensitiveCompare(expectedOrgName) == .orderedSame else {
guard actualOrgName == expectedOrgName.lowercased() else {
return ValidationError.mismatchedOrgName(actual: actualOrgName, expected: expectedOrgName)
}
return nil
Expand Down
6 changes: 3 additions & 3 deletions Auth0Tests/ClaimValidatorsSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,9 @@ class ClaimValidatorsSpec: IDTokenValidatorBaseSpec {
}
}

it("should perform a case insensitive compare") {
let orgName = "aBc1234"
let expectedOrgName = "AbC1234"
it("should lowercase the expected org_name") {
let orgName = "abc1234"
let expectedOrgName = "ABC1234"
let jwt = generateJWT(orgName: orgName)
orgNameValidator = IDTokenOrgNameValidator(orgName: expectedOrgName)

Expand Down

0 comments on commit ad781b2

Please sign in to comment.