.auth
cattle_grid.auth
create_app
Allows running just the auth endpoint
Source code in cattle_grid/auth/__init__.py
http_util
AcceptEntry
dataclass
AcceptEntry(content_type: str, profile: str | None = None, quality: float = 1.0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
content_type
|
str
|
|
required |
profile
|
str | None
|
|
None
|
quality
|
float
|
|
1.0
|
Source code in cattle_grid/auth/http_util.py
ContentType
parse_accept_header
>>> header = 'application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams", text/html;q=0.1'
>>> parse_accept_header(header)
[AcceptEntry(content_type='application/activity+json', profile=None, quality=1.0),
AcceptEntry(content_type='application/ld+json', profile='https://www.w3.org/ns/activitystreams', quality=1.0),
AcceptEntry(content_type='text/html', profile=None, quality=0.1)]
Source code in cattle_grid/auth/http_util.py
model
RemoteIdentity
Bases: Model
Represents the information about a remote identity
Source code in cattle_grid/auth/model.py
public_key_cache
PublicKeyCache
dataclass
Caches public keys in the database and fetches them using bovine_actor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bovine_actor
|
BovineActor
|
|
required |
Source code in cattle_grid/auth/public_key_cache.py
cryptographic_identifier
async
cryptographic_identifier(
key_id: str,
) -> CryptographicIdentifier | Literal["gone"] | None
Returns “gone” if Tombstone
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key_id
|
str
|
URI of the public key to fetch |
required |
Returns:
Type | Description |
---|---|
CryptographicIdentifier | Literal['gone'] | None
|
|
Source code in cattle_grid/auth/public_key_cache.py
router
ReverseProxyHeaders
Bases: BaseModel
Headers set by the reverse proxy
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x_original_method
|
str
|
|
'get'
|
x_original_uri
|
str | None
|
|
None
|
x_original_host
|
str | None
|
|
None
|
x_forwarded_proto
|
str
|
|
'http'
|
Source code in cattle_grid/auth/router.py
x_forwarded_proto
class-attribute
instance-attribute
x_forwarded_proto: str = 'http'
The protocol being used
x_original_host
class-attribute
instance-attribute
x_original_host: str | None = None
The original used host
x_original_method
class-attribute
instance-attribute
x_original_method: str = 'get'
The original used method
x_original_uri
class-attribute
instance-attribute
x_original_uri: str | None = None
The original request uri
create_auth_router
create_auth_router(
config: AuthConfig, tags: List[str | Enum] = ["auth"]
) -> APIRouter
Adds the authorization endpoint to the app
Source code in cattle_grid/auth/router.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
|
util
check_block
Checks if a controller’s domain is in block list
>>> check_block({"blocked.example"}, "http://actor.example/path")
False
>>> check_block({"blocked.example"}, "http://blocked.example/path")
True