Skip to content

Commit

Permalink
Merge pull request #19 from ocervell/main
Browse files Browse the repository at this point in the history
add decorators for FastAPI as well
  • Loading branch information
mschwager authored Apr 24, 2024
2 parents 8d8f521 + 45c1089 commit 982d880
Showing 1 changed file with 52 additions and 12 deletions.
64 changes: 52 additions & 12 deletions routes/rules/fastapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,38 @@ rules:
- id: fastapi-route-authenticated
patterns:
- pattern-either:
- pattern: |
@$APP.$METHOD($PATH, ...)
def $FUNC(..., token, ...):
...
- pattern: |
@$APP.$METHOD($PATH, ...)
def $FUNC(..., current_user, ...):
...
- pattern: |
@$APP.$METHOD($PATH, ...)
def $FUNC(..., auth_result, ...):
...
- pattern: |
@$APP.$METHOD($PATH, ...)
def $FUNC(..., token, ...):
...
- pattern: |
@$APP.$METHOD($PATH, ...)
def $FUNC(..., current_user, ...):
...
- pattern: |
@$APP.$METHOD($PATH, ...)
def $FUNC(..., auth_result, ...):
...
- pattern: |
@$APP.$METHOD($PATH, ...)
@auth_required
def $FUNC(...):
...
- pattern: |
@$APP.$METHOD($PATH, ...)
@login_required
def $FUNC(...):
...
- pattern: |
@$APP.$METHOD($PATH, ...)
@requires_authentication
def $FUNC(...):
...
- pattern: |
@$APP.$METHOD($PATH, ...)
@jwt_required
def $FUNC(...):
...
- metavariable-pattern:
metavariable: $METHOD
pattern-either:
Expand Down Expand Up @@ -55,6 +75,26 @@ rules:
@$APP.$METHOD($PATH, ...)
def $FUNC(..., auth_result, ...):
...
- pattern-not: |
@$APP.$METHOD($PATH, ...)
@auth_required
def $FUNC(...):
...
- pattern-not: |
@$APP.$METHOD($PATH, ...)
@login_required
def $FUNC(...):
...
- pattern-not: |
@$APP.$METHOD($PATH, ...)
@requires_authentication
def $FUNC(...):
...
- pattern-not: |
@$APP.$METHOD($PATH, ...)
@jwt_required
def $FUNC(...):
...
- metavariable-pattern:
metavariable: $METHOD
pattern-either:
Expand Down

0 comments on commit 982d880

Please sign in to comment.