- Sort Score
- Result 10 results
- Languages All
Results 61 - 70 of 1,772 for user5 (0.03 sec)
-
docs/iam/opa.md
- ### 2. Create a sample OPA Policy
- In another terminal, create a policy that allows root user all access and for all other users denies `PutObject`:
- ```sh
- cat > example.rego <<EOF
- package httpapi.authz
- import input
- default allow = false
- # Allow the root user to perform any action.
- allow {
- input.owner == true
- }
- # All other users may do anything other than call PutObject
- allow {
- input.action != "s3:PutObject"
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Sun Jul 17 15:43:14 UTC 2022 - 2.3K bytes - Viewed (0) -
tests/test_tutorial/test_security/test_tutorial005_an_py310.py
- response = client.get(
- "/users/me", headers={"Authorization": f"Bearer {access_token}"}
- )
- assert response.status_code == 400, response.text
- assert response.json() == {"detail": "Inactive user"}
- @needs_py310
- def test_read_items(client: TestClient):
- access_token = get_access_token(scope="me items", client=client)
- response = client.get(
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Mar 13 19:07:10 UTC 2024 - 16.3K bytes - Viewed (0) -
tests/test_security_api_key_cookie.py
- from pydantic import BaseModel
- app = FastAPI()
- api_key = APIKeyCookie(name="key")
- class User(BaseModel):
- username: str
- def get_current_user(oauth_header: str = Security(api_key)):
- user = User(username=oauth_header)
- return user
- @app.get("/users/me")
- def read_current_user(current_user: User = Depends(get_current_user)):
- return current_user
- def test_security_api_key():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 1.9K bytes - Viewed (0) -
tests/test_security_api_key_cookie_description.py
- app = FastAPI()
- api_key = APIKeyCookie(name="key", description="An API Cookie Key")
- class User(BaseModel):
- username: str
- def get_current_user(oauth_header: str = Security(api_key)):
- user = User(username=oauth_header)
- return user
- @app.get("/users/me")
- def read_current_user(current_user: User = Depends(get_current_user)):
- return current_user
- def test_security_api_key():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 2.1K bytes - Viewed (0) -
docs_src/security/tutorial004_an.py
- access_token = create_access_token(
- data={"sub": user.username}, expires_delta=access_token_expires
- )
- return Token(access_token=access_token, token_type="bearer")
- @app.get("/users/me/", response_model=User)
- async def read_users_me(
- current_user: Annotated[User, Depends(get_current_active_user)],
- ):
- return current_user
- @app.get("/users/me/items/")
- async def read_own_items(
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/scopes_test.go
- }
- DB.Scopes(NameIn([]string{users[0].Name, users[2].Name})).Find(&users3)
- if len(users3) != 2 {
- t.Errorf("Should found two users's name in 1, 3, but got %v", len(users3))
- }
- db := DB.Scopes(func(tx *gorm.DB) *gorm.DB {
- return tx.Table("custom_table")
- }).Session(&gorm.Session{})
- db.AutoMigrate(&User{})
- if db.Find(&User{}).Statement.Table != "custom_table" {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Jan 12 08:42:21 UTC 2024 - 3.3K bytes - Viewed (0) -
tests/test_security_openid_connect_optional.py
- oid = OpenIdConnect(openIdConnectUrl="/openid", auto_error=False)
- class User(BaseModel):
- username: str
- def get_current_user(oauth_header: Optional[str] = Security(oid)):
- if oauth_header is None:
- return None
- user = User(username=oauth_header)
- return user
- @app.get("/users/me")
- def read_current_user(current_user: Optional[User] = Depends(get_current_user)):
- if current_user is None:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 2.4K bytes - Viewed (0) -
tests/test_security_api_key_query_description.py
- app = FastAPI()
- api_key = APIKeyQuery(name="key", description="API Key Query")
- class User(BaseModel):
- username: str
- def get_current_user(oauth_header: str = Security(api_key)):
- user = User(username=oauth_header)
- return user
- @app.get("/users/me")
- def read_current_user(current_user: User = Depends(get_current_user)):
- return current_user
- client = TestClient(app)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 2K bytes - Viewed (0) -
docs/en/docs/tutorial/security/simple-oauth2.md
- ```JSON
- {
- "detail": "Not authenticated"
- }
- ```
- ### Inactive user
- Now try with an inactive user, authenticate with:
- User: `alice`
- Password: `secret2`
- And try to use the operation `GET` with the path `/users/me`.
- You will get an "Inactive user" error, like:
- ```JSON
- {
- "detail": "Inactive user"
- }
- ```
- ## Recap
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 12.3K bytes - Viewed (0) -
tests/test_security_api_key_query.py
- from pydantic import BaseModel
- app = FastAPI()
- api_key = APIKeyQuery(name="key")
- class User(BaseModel):
- username: str
- def get_current_user(oauth_header: str = Security(api_key)):
- user = User(username=oauth_header)
- return user
- @app.get("/users/me")
- def read_current_user(current_user: User = Depends(get_current_user)):
- return current_user
- client = TestClient(app)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 1.8K bytes - Viewed (0)