auth
pixel_client.auth ¶
KeyCloakAuth ¶
Bases: httpx.Auth
Auth class for KeyCloak authentication
Source code in src/pixel_client/auth.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
token_url
instance-attribute
¶
token_url = f"{keycloak_server_url}/realms/{realm}/protocol/openid-connect/token"
__init__ ¶
Source code in src/pixel_client/auth.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
auth_flow ¶
auth_flow(request)
Flow for the authentication.
Note
See httpx documentation on custom authentication schemes
Source code in src/pixel_client/auth.py
28 29 30 31 32 33 34 35 36 37 38 39 40 | |
ApiKeyAuth ¶
Bases: httpx.Auth
Auth class for Pixel API key authentication.
An api key is a long lived, opaque bearer token minted by
create_api_key. Unlike a
Keycloak token it never expires mid-session and cannot be refreshed, so a
401 means the key was revoked, expired, or lacks the required role.
Source code in src/pixel_client/auth.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
__init__ ¶
__init__(api_key: str)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str
|
The api key token, as returned once by the create endpoint. |
required |
Source code in src/pixel_client/auth.py
77 78 79 80 81 82 83 84 85 | |
auth_flow ¶
auth_flow(request)
Flow for the authentication.
Note
See httpx documentation on custom authentication schemes
Source code in src/pixel_client/auth.py
87 88 89 90 91 92 93 94 | |
Some calls need a signed-in user
A client using ApiKeyAuth can use the rest of the API within the key's access, but not these calls, which need KeyCloakAuth (a username and password): creating, listing, renaming, revoking and replacing api keys; create_user and update_user; creating, changing and deleting geo service users; and list_grants, get_user_access and get_group_access. See Installation and Setup.