- Sort Score
- Result 10 results
- Languages All
Results 41 - 50 of 59 for get_current_user (0.14 sec)
-
docs_src/security/tutorial005.py
to_encode.update({"exp": expire}) encoded_jwt = jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM) return encoded_jwt async def get_current_user( security_scopes: SecurityScopes, token: str = Depends(oauth2_scheme) ): if security_scopes.scopes: authenticate_value = f'Bearer scope="{security_scopes.scope_str}"' else:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Mon May 20 17:37:28 UTC 2024 - 5.2K bytes - Viewed (0) -
docs_src/security/tutorial005_an.py
to_encode.update({"exp": expire}) encoded_jwt = jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM) return encoded_jwt async def get_current_user( security_scopes: SecurityScopes, token: Annotated[str, Depends(oauth2_scheme)] ): if security_scopes.scopes: authenticate_value = f'Bearer scope="{security_scopes.scope_str}"' else:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Mon May 20 17:37:28 UTC 2024 - 5.3K bytes - Viewed (0) -
docs_src/security/tutorial003_an_py310.py
def fake_decode_token(token): # This doesn't provide any security at all # Check the next version user = get_user(fake_users_db, token) return user async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]): user = fake_decode_token(token) if not user: raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED,
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Mar 26 16:56:53 UTC 2024 - 2.5K bytes - Viewed (0) -
tests/test_security_oauth2_optional.py
"scopes": {"read:users": "Read the users", "write:users": "Create users"}, } }, auto_error=False, ) class User(BaseModel): username: str def get_current_user(oauth_header: Optional[str] = Security(reusable_oauth2)): if oauth_header is None: return None user = User(username=oauth_header) return user @app.post("/login")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 10.8K bytes - Viewed (0) -
docs_src/security/tutorial004_an.py
expire = datetime.now(timezone.utc) + timedelta(minutes=15) to_encode.update({"exp": expire}) encoded_jwt = jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM) return encoded_jwt async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]): credentials_exception = HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, detail="Could not validate credentials",
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Mon May 20 17:37:28 UTC 2024 - 4.2K bytes - Viewed (0) -
tests/test_security_oauth2.py
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 10.7K bytes - Viewed (0) -
tests/test_security_oauth2_optional_description.py
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 10.9K bytes - Viewed (0) -
docs/em/docs/tutorial/security/simple-oauth2.md
🎂, **FastAPI** 🍵 ⚫️ 👆. /// ## ℹ 🔗 🔜 👥 🔜 ℹ 👆 🔗. 👥 💚 🤚 `current_user` *🕴* 🚥 👉 👩💻 🦁. , 👥 ✍ 🌖 🔗 `get_current_active_user` 👈 🔄 ⚙️ `get_current_user` 🔗. 👯♂️ 👉 🔗 🔜 📨 🇺🇸🔍 ❌ 🚥 👩💻 🚫 🔀, ⚖️ 🚥 🔕. , 👆 🔗, 👥 🔜 🕴 🤚 👩💻 🚥 👩💻 🔀, ☑ 🔓, & 🦁: //// tab | 🐍 3️⃣.6️⃣ & 🔛 ```Python hl_lines="58-66 69-72 90"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 8.8K bytes - Viewed (0) -
docs/em/docs/tutorial/security/oauth2-jwt.md
``` //// //// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛 ```Python hl_lines="5 11-13 27-29 77-85" {!> ../../docs_src/security/tutorial004_py310.py!} ``` //// ## ℹ 🔗 ℹ `get_current_user` 📨 🎏 🤝 ⏭, ✋️ 👉 🕰, ⚙️ 🥙 🤝. 🔣 📨 🤝, ✔ ⚫️, & 📨 ⏮️ 👩💻. 🚥 🤝 ❌, 📨 🇺🇸🔍 ❌ ▶️️ ↖️. //// tab | 🐍 3️⃣.6️⃣ & 🔛 ```Python hl_lines="89-106"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 9.5K bytes - Viewed (0) -
docs/en/docs/tutorial/security/simple-oauth2.md
Now we are going to update our dependencies. We want to get the `current_user` *only* if this user is active. So, we create an additional dependency `get_current_active_user` that in turn uses `get_current_user` as a dependency. Both of these dependencies will just return an HTTP error if the user doesn't exist, or if is inactive.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 12.3K bytes - Viewed (0)