Skip to content

Commit

Permalink
Merge pull request #59 from Omnipro-Solutions/fix/refactor-app-oms-mo…
Browse files Browse the repository at this point in the history
…dels

chore: Add token validation to TokenValidScope permission class
  • Loading branch information
edgarpena14 authored May 24, 2024
2 parents c9d32de + 2dd417a commit 741e774
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions omni_pro_oms/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,11 @@ def has_permission(self, request, view):
response = requests.get(url, headers=headers)
return response.status_code == 200

token = request.headers.get("token", None)
if token:
url = settings.AUTH_BASE_URL + "/auth/user/validate/"
headers = {"Authorization": f"Token {token}"}
response = requests.get(url, headers=headers)
return response.status_code == 200

return False

0 comments on commit 741e774

Please sign in to comment.