Results of 1 - 4 of about 4 for hashed (0.009 sec.)
- Simple OAuth2 with Password and Bearer 11298
- 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
...del fake_users_db = { "johndoe" : { "username" : "johndoe" , "full_name" : "John Doe" , "email" : "johndoe@example.com" , "hashed_password" : "fakehashedsecret" , "disabled" : False , }, "alice" : { "username" : "alice" , "full_name" : "Alice Wonderson..." , "email" : "alice@example.com" , "hashed_password" : "fakehashedsecret2" , "disabled" : True , }, } app = FastAPI () def fake_hash_password ( password : str ): ret...urn "fakehashed" + password oauth2_scheme = OAuth2PasswordBearer ( tokenUrl = "token" ) class User ( BaseModel ): username : str email : s... - https://man.mtool.work/fastapi/0.115/tutorial/security/simple-oauth2/
- OAuth2 scopes 10189
- 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
...30 fake_users_db = { "johndoe" : { "username" : "johndoe" , "full_name" : "John Doe" , "email" : "johndoe@example.com" , "hashed_password" : "$2b$12$EixZaYVK1fsbw1ZfbX3OXePaWxn96p36WQoeG6Lruj3vjPGga31lW" , "disabled" : False , }, "alice" : { "username..." : "alice" , "full_name" : "Alice Chains" , "email" : "alicechains@example.com" , "hashed_password" : "$2b$12$gSvqqUPvlXP2tfVFaWK1Be7DlH.PKZbv5H8KnzzVgXXbVxpva.pFm" , "disabled" : True , }, } class Token ( BaseMo...rname : str email : str | None = None full_name : str | None = None disabled : bool | None = None class UserInDB ( User ): hashed_password : str pwd_context = CryptContext ( schemes = [ "bcrypt" ], deprecated = "auto" ) oauth2_scheme = OAuth2PasswordBe... - https://man.mtool.work/fastapi/0.115/advanced/security/oauth2-scopes/
- パスワード(およびハッシュ化)によるOAuth2、JWTトークンによるBearer 9135
- パスワード(およびハッシュ化)によるOAuth2、JWTトークンによるBearer これでセキュリティの流れが全てわかったので、 JWT トークンと安全なパスワードのハッシュ化を使用して、実際にアプリケーションを安全にしてみましょう。 このコードは、アプリケーシ
...30 fake_users_db = { "johndoe" : { "username" : "johndoe" , "full_name" : "John Doe" , "email" : "johndoe@example.com" , "hashed_password" : "$2b$12$EixZaYVK1fsbw1ZfbX3OXePaWxn96p36WQoeG6Lruj3vjPGga31lW" , "disabled" : False , } } class Token ( BaseMo...r , None ] = None full_name : Union [ str , None ] = None disabled : Union [ bool , None ] = None class UserInDB ( User ): hashed_password : str pwd_context = CryptContext ( schemes = [ "bcrypt" ], deprecated = "auto" ) oauth2_scheme = OAuth2PasswordBe...arer ( tokenUrl = "token" ) app = FastAPI () def verify_password ( plain_password , hashed_password ): return pwd_context . verify ( plain_password , hashed_password ) def get_password_hash ( password ): return pw... - https://man.mtool.work/fastapi/0.115/tutorial/security/oauth2-jwt/
- モデル - より詳しく 6324
- モデル - より詳しく 先ほどの例に続き、複数の関連モデルを持つことが一般的です。 これはユーザーモデルの場合は特にそうです。なぜなら: 入力モデル にはパスワードが必要です。 出力モデル はパスワードをもつべきではありません。 データベースモデル は
...el ): username : str email : EmailStr full_name : Union [ str , None ] = None class UserInDB ( BaseModel ): username : str hashed_password : str email : EmailStr full_name : Union [ str , None ] = None def fake_password_hasher ( raw_password : str ): r...eturn "supersecret" + raw_password def fake_save_user ( user_in : UserIn ): hashed_password = fake_password_hasher ( user_in . password ) user_in_db = UserInDB ( ** user_in . dict (), hashed_password = has...( BaseModel ): username : str email : EmailStr full_name : str | None = None class UserInDB ( BaseModel ): username : str hashed_password : str email : EmailStr full_name : str | None = None def fake_password_hasher ( raw_password : str ): return "sup... - https://man.mtool.work/fastapi/0.115/tutorial/extra-models/
PREV
1
NEXT