Skip to content

Commit

Permalink
make scope check concise
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobmichels committed Apr 29, 2024
1 parent 056fd88 commit a1ef038
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,9 @@ impl PolicyWithJWKS {
pub fn check_scope_allowed(&self, scope_name: &str, scope_value: &str) -> bool {
match self.allowed_scopes.get(scope_name) {
Some(allowed_value) => {
if allowed_value == "read" && scope_value == "read" {
true
} else if allowed_value == "write" && scope_value == "write" {
true
} else if allowed_value == "write" && scope_value == "read" {
true
} else {
false
}
(allowed_value == "read" && scope_value == "read")
|| (allowed_value == "write" && scope_value == "write")
|| (allowed_value == "write" && scope_value == "read")
}
None => false,
}
Expand Down

0 comments on commit a1ef038

Please sign in to comment.