auth_helper: basic method to gen a permenant token
Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
parent
a329ad3b10
commit
4617e5a7a2
@ -1,5 +1,5 @@
|
||||
- [ ] Redesign database
|
||||
- [ ] Define mergancy triggers (manual and automatic)
|
||||
- [ ] Define emrgancy triggers (manual and automatic)
|
||||
- [ ] Expose temporary control in case of emergancy
|
||||
- Triggers
|
||||
- Acccess
|
||||
|
@ -41,3 +41,8 @@ def valid_api_key(key = Security(api_key_header)):
|
||||
if not __API_KEY == key:
|
||||
raise HTTPException(401, detail="invalid key")
|
||||
return
|
||||
|
||||
def create_iot_dev_token(data: dict):
|
||||
to_encode = data.copy()
|
||||
encoded_jwt = jwt.encode(to_encode, JWT_SECRET, algorithm=JWT_ALGO)
|
||||
return encoded_jwt
|
||||
|
@ -1,5 +1,5 @@
|
||||
from fastapi import Depends, FastAPI, HTTPException, status
|
||||
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
|
||||
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm, OAuth2AuthorizationCodeBearer
|
||||
from fastapi.security.api_key import APIKey
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user