Eric Michael Martinez commited on
Commit
8dfcc52
1 Parent(s): 1c8901a
Files changed (3) hide show
  1. app/users.py +4 -1
  2. requirements.txt +1 -1
  3. student_api.ipynb +6 -1
app/users.py CHANGED
@@ -52,9 +52,12 @@ async def get_user_manager(user_db: SQLAlchemyUserDatabase = Depends(get_user_db
52
 
53
  bearer_transport = BearerTransport(tokenUrl="auth/jwt/login")
54
 
 
 
 
55
 
56
  def get_jwt_strategy() -> JWTStrategy:
57
- return JWTStrategy(secret=SECRET, lifetime_seconds=3600)
58
 
59
 
60
  auth_backend = AuthenticationBackend(
 
52
 
53
  bearer_transport = BearerTransport(tokenUrl="auth/jwt/login")
54
 
55
+ seconds_in_day = 60 * 60 * 24
56
+ seconds_in_month = seconds_in_day * 31
57
+ seconds_in_six_months = seconds_in_month * 6
58
 
59
  def get_jwt_strategy() -> JWTStrategy:
60
+ return JWTStrategy(secret=SECRET, lifetime_seconds=seconds_in_six_months)
61
 
62
 
63
  auth_backend = AuthenticationBackend(
requirements.txt CHANGED
@@ -8,4 +8,4 @@ Requests==2.28.1
8
  SQLAlchemy==1.4.47
9
  uvicorn==0.21.1
10
  asyncpg==0.27.0
11
- greenlet==2.0.1
 
8
  SQLAlchemy==1.4.47
9
  uvicorn==0.21.1
10
  asyncpg==0.27.0
11
+ greenlet==2.0.1
student_api.ipynb CHANGED
@@ -180,6 +180,9 @@
180
  "\n",
181
  "bearer_transport = BearerTransport(tokenUrl=\"auth/jwt/login\")\n",
182
  "\n",
 
 
 
183
  "\n",
184
  "def get_jwt_strategy() -> JWTStrategy:\n",
185
  " return JWTStrategy(secret=SECRET, lifetime_seconds=3600)\n",
@@ -548,7 +551,9 @@
548
  "\u001b[32mINFO\u001b[0m: 127.0.0.1:58810 - \"\u001b[1mPOST /auth/jwt/login HTTP/1.1\u001b[0m\" \u001b[32m200 OK\u001b[0m\n",
549
  "\u001b[32mINFO\u001b[0m: 127.0.0.1:58809 - \"\u001b[1mPOST /login HTTP/1.1\u001b[0m\" \u001b[32m200 OK\u001b[0m\n",
550
  "\u001b[32mINFO\u001b[0m: 127.0.0.1:58809 - \"\u001b[1mGET / HTTP/1.1\u001b[0m\" \u001b[32m200 OK\u001b[0m\n",
551
- "\u001b[32mINFO\u001b[0m: 127.0.0.1:58809 - \"\u001b[1mGET /theme.css HTTP/1.1\u001b[0m\" \u001b[32m200 OK\u001b[0m\n"
 
 
552
  ]
553
  }
554
  ],
 
180
  "\n",
181
  "bearer_transport = BearerTransport(tokenUrl=\"auth/jwt/login\")\n",
182
  "\n",
183
+ "seconds_in_day = 60 * 60 * 24\n",
184
+ "seconds_in_month = seconds_in_day * 31\n",
185
+ "seconds_in_six_months = seconds_in_month * 6\n",
186
  "\n",
187
  "def get_jwt_strategy() -> JWTStrategy:\n",
188
  " return JWTStrategy(secret=SECRET, lifetime_seconds=3600)\n",
 
551
  "\u001b[32mINFO\u001b[0m: 127.0.0.1:58810 - \"\u001b[1mPOST /auth/jwt/login HTTP/1.1\u001b[0m\" \u001b[32m200 OK\u001b[0m\n",
552
  "\u001b[32mINFO\u001b[0m: 127.0.0.1:58809 - \"\u001b[1mPOST /login HTTP/1.1\u001b[0m\" \u001b[32m200 OK\u001b[0m\n",
553
  "\u001b[32mINFO\u001b[0m: 127.0.0.1:58809 - \"\u001b[1mGET / HTTP/1.1\u001b[0m\" \u001b[32m200 OK\u001b[0m\n",
554
+ "\u001b[32mINFO\u001b[0m: 127.0.0.1:58809 - \"\u001b[1mGET /theme.css HTTP/1.1\u001b[0m\" \u001b[32m200 OK\u001b[0m\n",
555
+ "\u001b[32mINFO\u001b[0m: 127.0.0.1:58855 - \"\u001b[1mGET /docs HTTP/1.1\u001b[0m\" \u001b[32m200 OK\u001b[0m\n",
556
+ "\u001b[32mINFO\u001b[0m: 127.0.0.1:58855 - \"\u001b[1mGET /openapi.json HTTP/1.1\u001b[0m\" \u001b[32m200 OK\u001b[0m\n"
557
  ]
558
  }
559
  ],