コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 5 of about 5 for decode (0.009 sec.)
現在のユーザーの取得 12078
現在のユーザーの取得 一つ前の章では、(依存性注入システムに基づいた)セキュリティシステムは、 path operation関数 に str として token を与えていました: Python 3.8+ - non-Annotated from fastapi import Depends , FastAPI from fastapi.security i ... ail : Union [ str , None ] = None full_name : Union [ str , None ] = None disabled : Union [ bool , None ] = None def fake_decode_token ( token ): return User ( username = token + "fakedecoded" , email = "john@example.com" , full_name = "John Doe" ) as ... ync def get_current_user ( token : str = Depends ( oauth2_scheme )): user = fake_decode_token ( token ) return user @app . get ( "/users/me" ) async def read_users_me ( current_user : User = Depends ( get_curre ... BaseModel ): username : str email : str | None = None full_name : str | None = None disabled : bool | None = None def fake_decode_token ( token ): return User ( username = token + "fakedecoded" , email = "john@example.com" , full_name = "John Doe" ) as ...
https://man.mtool.work/fastapi/0.115/tutorial/security/get-current-user/
Simple OAuth2 with Password and Bearer 10552
Simple OAuth2 with Password and Bearer Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . Now let's build from the previous chapter and add the missing parts to have ... et_user ( db , username : str ): if username in db : user_dict = db [ username ] return UserInDB ( ** user_dict ) def fake_decode_token ( token ): # This doesn't provide any security at all # Check the next version user = get_user ( fake_users_db , tok ... en ) 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 , detail = "Invalid authe ... et_user ( db , username : str ): if username in db : user_dict = db [ username ] return UserInDB ( ** user_dict ) def fake_decode_token ( token ): # This doesn't provide any security at all # Check the next version user = get_user ( fake_users_db , tok ...
https://man.mtool.work/fastapi/0.115/tutorial/security/simple-oauth2/
OAuth2 scopes 8199
OAuth2 scopes Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You can use OAuth2 scopes directly with FastAPI , they are integrated to work seamlessly. This would ... detail = "Could not validate credentials" , headers = { "WWW-Authenticate" : authenticate_value }, ) try : payload = jwt . decode ( token , SECRET_KEY , algorithms = [ ALGORITHM ]) username = payload . get ( "sub" ) if username is None : raise credenti ... detail = "Could not validate credentials" , headers = { "WWW-Authenticate" : authenticate_value }, ) try : payload = jwt . decode ( token , SECRET_KEY , algorithms = [ ALGORITHM ]) username = payload . get ( "sub" ) if username is None : raise credenti ... detail = "Could not validate credentials" , headers = { "WWW-Authenticate" : authenticate_value }, ) try : payload = jwt . decode ( token , SECRET_KEY , algorithms = [ ALGORITHM ]) username = payload . get ( "sub" ) if username is None : raise credenti ...
https://man.mtool.work/fastapi/0.115/advanced/security/oauth2-scopes/
パスワード(およびハッシュ化)によるOAuth2、JWTトークンによるBearer 7997
パスワード(およびハッシュ化)によるOAuth2、JWTトークンによるBearer これでセキュリティの流れが全てわかったので、 JWT トークンと安全なパスワードのハッシュ化を使用して、実際にアプリケーションを安全にしてみましょう。 このコードは、アプリケーシ ... HORIZED , detail = "Could not validate credentials" , headers = { "WWW-Authenticate" : "Bearer" }, ) try : payload = jwt . decode ( token , SECRET_KEY , algorithms = [ ALGORITHM ]) username = payload . get ( "sub" ) if username is None : raise credenti ... HORIZED , detail = "Could not validate credentials" , headers = { "WWW-Authenticate" : "Bearer" }, ) try : payload = jwt . decode ( token , SECRET_KEY , algorithms = [ ALGORITHM ]) username = payload . get ( "sub" ) if username is None : raise credenti ... HORIZED , detail = "Could not validate credentials" , headers = { "WWW-Authenticate" : "Bearer" }, ) try : payload = jwt . decode ( token , SECRET_KEY , algorithms = [ ALGORITHM ]) username = payload . get ( "sub" ) if username is None : raise credenti ...
https://man.mtool.work/fastapi/0.115/tutorial/security/oauth2-jwt/
Custom Request and APIRoute class 7114
Custom Request and APIRoute class Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . In some cases, you may want to override the logic used by the Request and APIRout ... cept RequestValidationError as exc : body = await request . body () detail = { "errors" : exc . errors (), "body" : body . decode ()} raise HTTPException ( status_code = 422 , detail = detail ) return custom_route_handler app = FastAPI () app . router ... cept RequestValidationError as exc : body = await request . body () detail = { "errors" : exc . errors (), "body" : body . decode ()} raise HTTPException ( status_code = 422 , detail = detail ) return custom_route_handler app = FastAPI () app . router ...
https://man.mtool.work/fastapi/0.115/how-to/custom-request-and-route/
PREV 1 NEXT