.auth
cattle_grid.auth
create_app(filenames)
Allows running just the auth endpoint
Source code in cattle_grid/auth/__init__.py
__main__
new_config(actor_id, config_file, username)
Creates a new authorization configuration, including generating a public and private key.
Argument is the actor_id for the fetch actor, e.g. http://cattle_grid/fetch_actor
Source code in cattle_grid/auth/__main__.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)
>>> 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
bovine_actor
instance-attribute
used to fetch the public key
cryptographic_identifier(key_id)
async
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 = 'http'
class-attribute
instance-attribute
The protocol being used
x_original_host = None
class-attribute
instance-attribute
The original used host
x_original_method = 'get'
class-attribute
instance-attribute
The original used method
x_original_uri = None
class-attribute
instance-attribute
The original request uri
create_auth_router(config, tags=['auth'])
Adds the authorization endpoint to the app
Source code in cattle_grid/auth/router.py
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 |
|
util
check_block(domain_blocks, controller)
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