| 1 |
|
| 2 |
|
| 3 |
import typing |
| 4 |
|
| 5 |
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper |
| 6 |
from ...core.request_options import RequestOptions |
| 7 |
from ...types.user_multifactor_provider_enum import UserMultifactorProviderEnum |
| 8 |
from .raw_client import AsyncRawMultifactorClient, RawMultifactorClient |
| 9 |
|
| 10 |
|
| 11 |
class MultifactorClient: |
| 12 |
def __init__(self, *, client_wrapper: SyncClientWrapper): |
| 13 |
self._raw_client = RawMultifactorClient(client_wrapper=client_wrapper) |
| 14 |
|
| 15 |
@property |
| 16 |
def with_raw_response(self) -> RawMultifactorClient: |
| 17 |
""" |
| 18 |
Retrieves a raw implementation of this client that returns raw responses. |
| 19 |
|
| 20 |
Returns |
| 21 |
------- |
| 22 |
RawMultifactorClient |
| 23 |
""" |
| 24 |
return self._raw_client |
| 25 |
|
| 26 |
def invalidate_remember_browser(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: |
| 27 |
""" |
| 28 |
Invalidate all remembered browsers across all [authentication factors](https://auth0.com/docs/multifactor-authentication) for a user. |
| 29 |
|
| 30 |
Parameters |
| 31 |
---------- |
| 32 |
id : str |
| 33 |
ID of the user to invalidate all remembered browsers and authentication factors for. |
| 34 |
|
| 35 |
request_options : typing.Optional[RequestOptions] |
| 36 |
Request-specific configuration. |
| 37 |
|
| 38 |
Returns |
| 39 |
------- |
| 40 |
None |
| 41 |
|
| 42 |
Examples |
| 43 |
-------- |
| 44 |
from auth0 import Auth0 |
| 45 |
|
| 46 |
client = Auth0( |
| 47 |
token="YOUR_TOKEN", |
| 48 |
) |
| 49 |
client.users.multifactor.invalidate_remember_browser( |
| 50 |
id="id", |
| 51 |
) |
| 52 |
""" |
| 53 |
_response = self._raw_client.invalidate_remember_browser(id, request_options=request_options) |
| 54 |
return _response.data |
| 55 |
|
| 56 |
def delete_provider( |
| 57 |
self, id: str, provider: UserMultifactorProviderEnum, *, request_options: typing.Optional[RequestOptions] = None |
| 58 |
) -> None: |
| 59 |
""" |
| 60 |
Remove a [multifactor](https://auth0.com/docs/multifactor-authentication) authentication configuration from a user's account. This forces the user to manually reconfigure the multi-factor provider. |
| 61 |
|
| 62 |
Parameters |
| 63 |
---------- |
| 64 |
id : str |
| 65 |
ID of the user to remove a multifactor configuration from. |
| 66 |
|
| 67 |
provider : UserMultifactorProviderEnum |
| 68 |
The multi-factor provider. Supported values 'duo' or 'google-authenticator' |
| 69 |
|
| 70 |
request_options : typing.Optional[RequestOptions] |
| 71 |
Request-specific configuration. |
| 72 |
|
| 73 |
Returns |
| 74 |
------- |
| 75 |
None |
| 76 |
|
| 77 |
Examples |
| 78 |
-------- |
| 79 |
from auth0 import Auth0 |
| 80 |
|
| 81 |
client = Auth0( |
| 82 |
token="YOUR_TOKEN", |
| 83 |
) |
| 84 |
client.users.multifactor.delete_provider( |
| 85 |
id="id", |
| 86 |
provider="duo", |
| 87 |
) |
| 88 |
""" |
| 89 |
_response = self._raw_client.delete_provider(id, provider, request_options=request_options) |
| 90 |
return _response.data |
| 91 |
|
| 92 |
|
| 93 |
class AsyncMultifactorClient: |
| 94 |
def __init__(self, *, client_wrapper: AsyncClientWrapper): |
| 95 |
self._raw_client = AsyncRawMultifactorClient(client_wrapper=client_wrapper) |
| 96 |
|
| 97 |
@property |
| 98 |
def with_raw_response(self) -> AsyncRawMultifactorClient: |
| 99 |
""" |
| 100 |
Retrieves a raw implementation of this client that returns raw responses. |
| 101 |
|
| 102 |
Returns |
| 103 |
------- |
| 104 |
AsyncRawMultifactorClient |
| 105 |
""" |
| 106 |
return self._raw_client |
| 107 |
|
| 108 |
async def invalidate_remember_browser( |
| 109 |
self, id: str, *, request_options: typing.Optional[RequestOptions] = None |
| 110 |
) -> None: |
| 111 |
""" |
| 112 |
Invalidate all remembered browsers across all [authentication factors](https://auth0.com/docs/multifactor-authentication) for a user. |
| 113 |
|
| 114 |
Parameters |
| 115 |
---------- |
| 116 |
id : str |
| 117 |
ID of the user to invalidate all remembered browsers and authentication factors for. |
| 118 |
|
| 119 |
request_options : typing.Optional[RequestOptions] |
| 120 |
Request-specific configuration. |
| 121 |
|
| 122 |
Returns |
| 123 |
------- |
| 124 |
None |
| 125 |
|
| 126 |
Examples |
| 127 |
-------- |
| 128 |
import asyncio |
| 129 |
|
| 130 |
from auth0 import AsyncAuth0 |
| 131 |
|
| 132 |
client = AsyncAuth0( |
| 133 |
token="YOUR_TOKEN", |
| 134 |
) |
| 135 |
|
| 136 |
|
| 137 |
async def main() -> None: |
| 138 |
await client.users.multifactor.invalidate_remember_browser( |
| 139 |
id="id", |
| 140 |
) |
| 141 |
|
| 142 |
|
| 143 |
asyncio.run(main()) |
| 144 |
""" |
| 145 |
_response = await self._raw_client.invalidate_remember_browser(id, request_options=request_options) |
| 146 |
return _response.data |
| 147 |
|
| 148 |
async def delete_provider( |
| 149 |
self, id: str, provider: UserMultifactorProviderEnum, *, request_options: typing.Optional[RequestOptions] = None |
| 150 |
) -> None: |
| 151 |
""" |
| 152 |
Remove a [multifactor](https://auth0.com/docs/multifactor-authentication) authentication configuration from a user's account. This forces the user to manually reconfigure the multi-factor provider. |
| 153 |
|
| 154 |
Parameters |
| 155 |
---------- |
| 156 |
id : str |
| 157 |
ID of the user to remove a multifactor configuration from. |
| 158 |
|
| 159 |
provider : UserMultifactorProviderEnum |
| 160 |
The multi-factor provider. Supported values 'duo' or 'google-authenticator' |
| 161 |
|
| 162 |
request_options : typing.Optional[RequestOptions] |
| 163 |
Request-specific configuration. |
| 164 |
|
| 165 |
Returns |
| 166 |
------- |
| 167 |
None |
| 168 |
|
| 169 |
Examples |
| 170 |
-------- |
| 171 |
import asyncio |
| 172 |
|
| 173 |
from auth0 import AsyncAuth0 |
| 174 |
|
| 175 |
client = AsyncAuth0( |
| 176 |
token="YOUR_TOKEN", |
| 177 |
) |
| 178 |
|
| 179 |
|
| 180 |
async def main() -> None: |
| 181 |
await client.users.multifactor.delete_provider( |
| 182 |
id="id", |
| 183 |
provider="duo", |
| 184 |
) |
| 185 |
|
| 186 |
|
| 187 |
asyncio.run(main()) |
| 188 |
""" |
| 189 |
_response = await self._raw_client.delete_provider(id, provider, request_options=request_options) |
| 190 |
return _response.data |