| 1 |
|
| 2 |
|
| 3 |
import typing |
| 4 |
|
| 5 |
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 6 |
from ...core.request_options import RequestOptions |
| 7 |
from ...types.get_signing_keys_response_content import GetSigningKeysResponseContent |
| 8 |
from ...types.revoked_signing_keys_response_content import RevokedSigningKeysResponseContent |
| 9 |
from ...types.rotate_signing_keys_response_content import RotateSigningKeysResponseContent |
| 10 |
from ...types.signing_keys import SigningKeys |
| 11 |
from .raw_client import AsyncRawSigningClient, RawSigningClient |
| 12 |
|
| 13 |
|
| 14 |
class SigningClient: |
| 15 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 16 |
self._raw_client = RawSigningClient(client_wrapper=client_wrapper) |
| 17 |
|
| 18 |
@property |
| 19 |
def with_raw_response(self) -> RawSigningClient: |
| 20 |
""" |
| 21 |
Retrieves a raw implementation of this client that returns raw responses. |
| 22 |
|
| 23 |
Returns |
| 24 |
------- |
| 25 |
RawSigningClient |
| 26 |
""" |
| 27 |
return self._raw_client |
| 28 |
|
| 29 |
def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[SigningKeys]: |
| 30 |
""" |
| 31 |
Retrieve details of all the application signing keys associated with your tenant. |
| 32 |
|
| 33 |
Parameters |
| 34 |
---------- |
| 35 |
request_options : typing.Optional[RequestOptions] |
| 36 |
Request-specific configuration. |
| 37 |
|
| 38 |
Returns |
| 39 |
------- |
| 40 |
typing.List[SigningKeys] |
| 41 |
The signing keys were retrieved. |
| 42 |
|
| 43 |
Examples |
| 44 |
-------- |
| 45 |
from auth0 import Auth0 |
| 46 |
|
| 47 |
client = Auth0( |
| 48 |
token="YOUR_TOKEN", |
| 49 |
) |
| 50 |
client.keys.signing.list() |
| 51 |
""" |
| 52 |
_response = self._raw_client.list(request_options=request_options) |
| 53 |
return _response.data |
| 54 |
|
| 55 |
def rotate(self, *, request_options: typing.Optional[RequestOptions] = None) -> RotateSigningKeysResponseContent: |
| 56 |
""" |
| 57 |
Rotate the application signing key of your tenant. |
| 58 |
|
| 59 |
Parameters |
| 60 |
---------- |
| 61 |
request_options : typing.Optional[RequestOptions] |
| 62 |
Request-specific configuration. |
| 63 |
|
| 64 |
Returns |
| 65 |
------- |
| 66 |
RotateSigningKeysResponseContent |
| 67 |
Signing key rotated successfully. |
| 68 |
|
| 69 |
Examples |
| 70 |
-------- |
| 71 |
from auth0 import Auth0 |
| 72 |
|
| 73 |
client = Auth0( |
| 74 |
token="YOUR_TOKEN", |
| 75 |
) |
| 76 |
client.keys.signing.rotate() |
| 77 |
""" |
| 78 |
_response = self._raw_client.rotate(request_options=request_options) |
| 79 |
return _response.data |
| 80 |
|
| 81 |
def get( |
| 82 |
self, kid: str, *, request_options: typing.Optional[RequestOptions] = None |
| 83 |
) -> GetSigningKeysResponseContent: |
| 84 |
""" |
| 85 |
Retrieve details of the application signing key with the given ID. |
| 86 |
|
| 87 |
Parameters |
| 88 |
---------- |
| 89 |
kid : str |
| 90 |
Key id of the key to retrieve |
| 91 |
|
| 92 |
request_options : typing.Optional[RequestOptions] |
| 93 |
Request-specific configuration. |
| 94 |
|
| 95 |
Returns |
| 96 |
------- |
| 97 |
GetSigningKeysResponseContent |
| 98 |
The signing keys were retrieved. |
| 99 |
|
| 100 |
Examples |
| 101 |
-------- |
| 102 |
from auth0 import Auth0 |
| 103 |
|
| 104 |
client = Auth0( |
| 105 |
token="YOUR_TOKEN", |
| 106 |
) |
| 107 |
client.keys.signing.get( |
| 108 |
kid="kid", |
| 109 |
) |
| 110 |
""" |
| 111 |
_response = self._raw_client.get(kid, request_options=request_options) |
| 112 |
return _response.data |
| 113 |
|
| 114 |
def revoke( |
| 115 |
self, kid: str, *, request_options: typing.Optional[RequestOptions] = None |
| 116 |
) -> RevokedSigningKeysResponseContent: |
| 117 |
""" |
| 118 |
Revoke the application signing key with the given ID. |
| 119 |
|
| 120 |
Parameters |
| 121 |
---------- |
| 122 |
kid : str |
| 123 |
Key id of the key to revoke |
| 124 |
|
| 125 |
request_options : typing.Optional[RequestOptions] |
| 126 |
Request-specific configuration. |
| 127 |
|
| 128 |
Returns |
| 129 |
------- |
| 130 |
RevokedSigningKeysResponseContent |
| 131 |
Signing key revoked successfully. |
| 132 |
|
| 133 |
Examples |
| 134 |
-------- |
| 135 |
from auth0 import Auth0 |
| 136 |
|
| 137 |
client = Auth0( |
| 138 |
token="YOUR_TOKEN", |
| 139 |
) |
| 140 |
client.keys.signing.revoke( |
| 141 |
kid="kid", |
| 142 |
) |
| 143 |
""" |
| 144 |
_response = self._raw_client.revoke(kid, request_options=request_options) |
| 145 |
return _response.data |
| 146 |
|
| 147 |
|
| 148 |
class AsyncSigningClient: |
| 149 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 150 |
self._raw_client = AsyncRawSigningClient(client_wrapper=client_wrapper) |
| 151 |
|
| 152 |
@property |
| 153 |
def with_raw_response(self) -> AsyncRawSigningClient: |
| 154 |
""" |
| 155 |
Retrieves a raw implementation of this client that returns raw responses. |
| 156 |
|
| 157 |
Returns |
| 158 |
------- |
| 159 |
AsyncRawSigningClient |
| 160 |
""" |
| 161 |
return self._raw_client |
| 162 |
|
| 163 |
async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[SigningKeys]: |
| 164 |
""" |
| 165 |
Retrieve details of all the application signing keys associated with your tenant. |
| 166 |
|
| 167 |
Parameters |
| 168 |
---------- |
| 169 |
request_options : typing.Optional[RequestOptions] |
| 170 |
Request-specific configuration. |
| 171 |
|
| 172 |
Returns |
| 173 |
------- |
| 174 |
typing.List[SigningKeys] |
| 175 |
The signing keys were retrieved. |
| 176 |
|
| 177 |
Examples |
| 178 |
-------- |
| 179 |
import asyncio |
| 180 |
|
| 181 |
from auth0 import AsyncAuth0 |
| 182 |
|
| 183 |
client = AsyncAuth0( |
| 184 |
token="YOUR_TOKEN", |
| 185 |
) |
| 186 |
|
| 187 |
|
| 188 |
async def main() -> None: |
| 189 |
await client.keys.signing.list() |
| 190 |
|
| 191 |
|
| 192 |
asyncio.run(main()) |
| 193 |
""" |
| 194 |
_response = await self._raw_client.list(request_options=request_options) |
| 195 |
return _response.data |
| 196 |
|
| 197 |
async def rotate( |
| 198 |
self, *, request_options: typing.Optional[RequestOptions] = None |
| 199 |
) -> RotateSigningKeysResponseContent: |
| 200 |
""" |
| 201 |
Rotate the application signing key of your tenant. |
| 202 |
|
| 203 |
Parameters |
| 204 |
---------- |
| 205 |
request_options : typing.Optional[RequestOptions] |
| 206 |
Request-specific configuration. |
| 207 |
|
| 208 |
Returns |
| 209 |
------- |
| 210 |
RotateSigningKeysResponseContent |
| 211 |
Signing key rotated successfully. |
| 212 |
|
| 213 |
Examples |
| 214 |
-------- |
| 215 |
import asyncio |
| 216 |
|
| 217 |
from auth0 import AsyncAuth0 |
| 218 |
|
| 219 |
client = AsyncAuth0( |
| 220 |
token="YOUR_TOKEN", |
| 221 |
) |
| 222 |
|
| 223 |
|
| 224 |
async def main() -> None: |
| 225 |
await client.keys.signing.rotate() |
| 226 |
|
| 227 |
|
| 228 |
asyncio.run(main()) |
| 229 |
""" |
| 230 |
_response = await self._raw_client.rotate(request_options=request_options) |
| 231 |
return _response.data |
| 232 |
|
| 233 |
async def get( |
| 234 |
self, kid: str, *, request_options: typing.Optional[RequestOptions] = None |
| 235 |
) -> GetSigningKeysResponseContent: |
| 236 |
""" |
| 237 |
Retrieve details of the application signing key with the given ID. |
| 238 |
|
| 239 |
Parameters |
| 240 |
---------- |
| 241 |
kid : str |
| 242 |
Key id of the key to retrieve |
| 243 |
|
| 244 |
request_options : typing.Optional[RequestOptions] |
| 245 |
Request-specific configuration. |
| 246 |
|
| 247 |
Returns |
| 248 |
------- |
| 249 |
GetSigningKeysResponseContent |
| 250 |
The signing keys were retrieved. |
| 251 |
|
| 252 |
Examples |
| 253 |
-------- |
| 254 |
import asyncio |
| 255 |
|
| 256 |
from auth0 import AsyncAuth0 |
| 257 |
|
| 258 |
client = AsyncAuth0( |
| 259 |
token="YOUR_TOKEN", |
| 260 |
) |
| 261 |
|
| 262 |
|
| 263 |
async def main() -> None: |
| 264 |
await client.keys.signing.get( |
| 265 |
kid="kid", |
| 266 |
) |
| 267 |
|
| 268 |
|
| 269 |
asyncio.run(main()) |
| 270 |
""" |
| 271 |
_response = await self._raw_client.get(kid, request_options=request_options) |
| 272 |
return _response.data |
| 273 |
|
| 274 |
async def revoke( |
| 275 |
self, kid: str, *, request_options: typing.Optional[RequestOptions] = None |
| 276 |
) -> RevokedSigningKeysResponseContent: |
| 277 |
""" |
| 278 |
Revoke the application signing key with the given ID. |
| 279 |
|
| 280 |
Parameters |
| 281 |
---------- |
| 282 |
kid : str |
| 283 |
Key id of the key to revoke |
| 284 |
|
| 285 |
request_options : typing.Optional[RequestOptions] |
| 286 |
Request-specific configuration. |
| 287 |
|
| 288 |
Returns |
| 289 |
------- |
| 290 |
RevokedSigningKeysResponseContent |
| 291 |
Signing key revoked successfully. |
| 292 |
|
| 293 |
Examples |
| 294 |
-------- |
| 295 |
import asyncio |
| 296 |
|
| 297 |
from auth0 import AsyncAuth0 |
| 298 |
|
| 299 |
client = AsyncAuth0( |
| 300 |
token="YOUR_TOKEN", |
| 301 |
) |
| 302 |
|
| 303 |
|
| 304 |
async def main() -> None: |
| 305 |
await client.keys.signing.revoke( |
| 306 |
kid="kid", |
| 307 |
) |
| 308 |
|
| 309 |
|
| 310 |
asyncio.run(main()) |
| 311 |
""" |
| 312 |
_response = await self._raw_client.revoke(kid, request_options=request_options) |
| 313 |
return _response.data |