change python client generator for hydra
This commit is contained in:
parent
c15be406ea
commit
4e9fd55093
128 changed files with 16275 additions and 11 deletions
1
libs/ory-hydra-client/ory_hydra_client/api/__init__.py
Normal file
1
libs/ory-hydra-client/ory_hydra_client/api/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
""" Contains methods for accessing the API """
|
|
@ -0,0 +1,273 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.accept_consent_request import AcceptConsentRequest
|
||||
from ...models.completed_request import CompletedRequest
|
||||
from ...models.generic_error import GenericError
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: AcceptConsentRequest,
|
||||
consent_challenge: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/auth/requests/consent/accept".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["consent_challenge"] = consent_challenge
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
json_json_body = json_body.to_dict()
|
||||
|
||||
return {
|
||||
"method": "put",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"json": json_json_body,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[CompletedRequest, GenericError]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = CompletedRequest.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 404:
|
||||
response_404 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_404
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[CompletedRequest, GenericError]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: AcceptConsentRequest,
|
||||
consent_challenge: str,
|
||||
) -> Response[Union[CompletedRequest, GenericError]]:
|
||||
"""Accept a Consent Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
to authenticate the subject and then tell ORY Hydra now about it. If the subject authenticated,
|
||||
he/she must now be asked if
|
||||
the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the
|
||||
subject's behalf.
|
||||
|
||||
The consent provider which handles this request and is a web app implemented and hosted by you. It
|
||||
shows a subject interface which asks the subject to
|
||||
grant or deny the client access to the requested scope (\"Application my-dropbox-app wants write
|
||||
access to all your private files\").
|
||||
|
||||
The consent challenge is appended to the consent provider's URL to which the subject's user-agent
|
||||
(browser) is redirected to. The consent
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then tells ORY Hydra if
|
||||
the subject accepted
|
||||
or rejected the request.
|
||||
|
||||
This endpoint tells ORY Hydra that the subject has authorized the OAuth 2.0 client to access
|
||||
resources on his/her behalf.
|
||||
The consent provider includes additional information, such as session data for access and ID tokens,
|
||||
and if the
|
||||
consent request should be used as basis for future requests.
|
||||
|
||||
The response contains a redirect URL which the consent provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
consent_challenge (str):
|
||||
json_body (AcceptConsentRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
consent_challenge=consent_challenge,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: AcceptConsentRequest,
|
||||
consent_challenge: str,
|
||||
) -> Optional[Union[CompletedRequest, GenericError]]:
|
||||
"""Accept a Consent Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
to authenticate the subject and then tell ORY Hydra now about it. If the subject authenticated,
|
||||
he/she must now be asked if
|
||||
the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the
|
||||
subject's behalf.
|
||||
|
||||
The consent provider which handles this request and is a web app implemented and hosted by you. It
|
||||
shows a subject interface which asks the subject to
|
||||
grant or deny the client access to the requested scope (\"Application my-dropbox-app wants write
|
||||
access to all your private files\").
|
||||
|
||||
The consent challenge is appended to the consent provider's URL to which the subject's user-agent
|
||||
(browser) is redirected to. The consent
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then tells ORY Hydra if
|
||||
the subject accepted
|
||||
or rejected the request.
|
||||
|
||||
This endpoint tells ORY Hydra that the subject has authorized the OAuth 2.0 client to access
|
||||
resources on his/her behalf.
|
||||
The consent provider includes additional information, such as session data for access and ID tokens,
|
||||
and if the
|
||||
consent request should be used as basis for future requests.
|
||||
|
||||
The response contains a redirect URL which the consent provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
consent_challenge (str):
|
||||
json_body (AcceptConsentRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
consent_challenge=consent_challenge,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: AcceptConsentRequest,
|
||||
consent_challenge: str,
|
||||
) -> Response[Union[CompletedRequest, GenericError]]:
|
||||
"""Accept a Consent Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
to authenticate the subject and then tell ORY Hydra now about it. If the subject authenticated,
|
||||
he/she must now be asked if
|
||||
the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the
|
||||
subject's behalf.
|
||||
|
||||
The consent provider which handles this request and is a web app implemented and hosted by you. It
|
||||
shows a subject interface which asks the subject to
|
||||
grant or deny the client access to the requested scope (\"Application my-dropbox-app wants write
|
||||
access to all your private files\").
|
||||
|
||||
The consent challenge is appended to the consent provider's URL to which the subject's user-agent
|
||||
(browser) is redirected to. The consent
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then tells ORY Hydra if
|
||||
the subject accepted
|
||||
or rejected the request.
|
||||
|
||||
This endpoint tells ORY Hydra that the subject has authorized the OAuth 2.0 client to access
|
||||
resources on his/her behalf.
|
||||
The consent provider includes additional information, such as session data for access and ID tokens,
|
||||
and if the
|
||||
consent request should be used as basis for future requests.
|
||||
|
||||
The response contains a redirect URL which the consent provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
consent_challenge (str):
|
||||
json_body (AcceptConsentRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
consent_challenge=consent_challenge,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: AcceptConsentRequest,
|
||||
consent_challenge: str,
|
||||
) -> Optional[Union[CompletedRequest, GenericError]]:
|
||||
"""Accept a Consent Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
to authenticate the subject and then tell ORY Hydra now about it. If the subject authenticated,
|
||||
he/she must now be asked if
|
||||
the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the
|
||||
subject's behalf.
|
||||
|
||||
The consent provider which handles this request and is a web app implemented and hosted by you. It
|
||||
shows a subject interface which asks the subject to
|
||||
grant or deny the client access to the requested scope (\"Application my-dropbox-app wants write
|
||||
access to all your private files\").
|
||||
|
||||
The consent challenge is appended to the consent provider's URL to which the subject's user-agent
|
||||
(browser) is redirected to. The consent
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then tells ORY Hydra if
|
||||
the subject accepted
|
||||
or rejected the request.
|
||||
|
||||
This endpoint tells ORY Hydra that the subject has authorized the OAuth 2.0 client to access
|
||||
resources on his/her behalf.
|
||||
The consent provider includes additional information, such as session data for access and ID tokens,
|
||||
and if the
|
||||
consent request should be used as basis for future requests.
|
||||
|
||||
The response contains a redirect URL which the consent provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
consent_challenge (str):
|
||||
json_body (AcceptConsentRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
consent_challenge=consent_challenge,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,261 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.accept_login_request import AcceptLoginRequest
|
||||
from ...models.completed_request import CompletedRequest
|
||||
from ...models.generic_error import GenericError
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: AcceptLoginRequest,
|
||||
login_challenge: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/auth/requests/login/accept".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["login_challenge"] = login_challenge
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
json_json_body = json_body.to_dict()
|
||||
|
||||
return {
|
||||
"method": "put",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"json": json_json_body,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[CompletedRequest, GenericError]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = CompletedRequest.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_400 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_400
|
||||
if response.status_code == 401:
|
||||
response_401 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_401
|
||||
if response.status_code == 404:
|
||||
response_404 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_404
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[CompletedRequest, GenericError]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: AcceptLoginRequest,
|
||||
login_challenge: str,
|
||||
) -> Response[Union[CompletedRequest, GenericError]]:
|
||||
"""Accept a Login Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
(sometimes called \"identity provider\") to authenticate the subject and then tell ORY Hydra now
|
||||
about it. The login
|
||||
provider is an web-app you write and host, and it must be able to authenticate (\"show the subject a
|
||||
login screen\")
|
||||
a subject (in OAuth2 the proper name for subject is \"resource owner\").
|
||||
|
||||
The authentication challenge is appended to the login provider URL to which the subject's user-agent
|
||||
(browser) is redirected to. The login
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then accept or reject
|
||||
the requested authentication process.
|
||||
|
||||
This endpoint tells ORY Hydra that the subject has successfully authenticated and includes
|
||||
additional information such as
|
||||
the subject's ID and if ORY Hydra should remember the subject's subject agent for future
|
||||
authentication attempts by setting
|
||||
a cookie.
|
||||
|
||||
The response contains a redirect URL which the login provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
login_challenge (str):
|
||||
json_body (AcceptLoginRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
login_challenge=login_challenge,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: AcceptLoginRequest,
|
||||
login_challenge: str,
|
||||
) -> Optional[Union[CompletedRequest, GenericError]]:
|
||||
"""Accept a Login Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
(sometimes called \"identity provider\") to authenticate the subject and then tell ORY Hydra now
|
||||
about it. The login
|
||||
provider is an web-app you write and host, and it must be able to authenticate (\"show the subject a
|
||||
login screen\")
|
||||
a subject (in OAuth2 the proper name for subject is \"resource owner\").
|
||||
|
||||
The authentication challenge is appended to the login provider URL to which the subject's user-agent
|
||||
(browser) is redirected to. The login
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then accept or reject
|
||||
the requested authentication process.
|
||||
|
||||
This endpoint tells ORY Hydra that the subject has successfully authenticated and includes
|
||||
additional information such as
|
||||
the subject's ID and if ORY Hydra should remember the subject's subject agent for future
|
||||
authentication attempts by setting
|
||||
a cookie.
|
||||
|
||||
The response contains a redirect URL which the login provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
login_challenge (str):
|
||||
json_body (AcceptLoginRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
login_challenge=login_challenge,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: AcceptLoginRequest,
|
||||
login_challenge: str,
|
||||
) -> Response[Union[CompletedRequest, GenericError]]:
|
||||
"""Accept a Login Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
(sometimes called \"identity provider\") to authenticate the subject and then tell ORY Hydra now
|
||||
about it. The login
|
||||
provider is an web-app you write and host, and it must be able to authenticate (\"show the subject a
|
||||
login screen\")
|
||||
a subject (in OAuth2 the proper name for subject is \"resource owner\").
|
||||
|
||||
The authentication challenge is appended to the login provider URL to which the subject's user-agent
|
||||
(browser) is redirected to. The login
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then accept or reject
|
||||
the requested authentication process.
|
||||
|
||||
This endpoint tells ORY Hydra that the subject has successfully authenticated and includes
|
||||
additional information such as
|
||||
the subject's ID and if ORY Hydra should remember the subject's subject agent for future
|
||||
authentication attempts by setting
|
||||
a cookie.
|
||||
|
||||
The response contains a redirect URL which the login provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
login_challenge (str):
|
||||
json_body (AcceptLoginRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
login_challenge=login_challenge,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: AcceptLoginRequest,
|
||||
login_challenge: str,
|
||||
) -> Optional[Union[CompletedRequest, GenericError]]:
|
||||
"""Accept a Login Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
(sometimes called \"identity provider\") to authenticate the subject and then tell ORY Hydra now
|
||||
about it. The login
|
||||
provider is an web-app you write and host, and it must be able to authenticate (\"show the subject a
|
||||
login screen\")
|
||||
a subject (in OAuth2 the proper name for subject is \"resource owner\").
|
||||
|
||||
The authentication challenge is appended to the login provider URL to which the subject's user-agent
|
||||
(browser) is redirected to. The login
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then accept or reject
|
||||
the requested authentication process.
|
||||
|
||||
This endpoint tells ORY Hydra that the subject has successfully authenticated and includes
|
||||
additional information such as
|
||||
the subject's ID and if ORY Hydra should remember the subject's subject agent for future
|
||||
authentication attempts by setting
|
||||
a cookie.
|
||||
|
||||
The response contains a redirect URL which the login provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
login_challenge (str):
|
||||
json_body (AcceptLoginRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
login_challenge=login_challenge,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,176 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.completed_request import CompletedRequest
|
||||
from ...models.generic_error import GenericError
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
logout_challenge: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/auth/requests/logout/accept".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["logout_challenge"] = logout_challenge
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "put",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[CompletedRequest, GenericError]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = CompletedRequest.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 404:
|
||||
response_404 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_404
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[CompletedRequest, GenericError]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
logout_challenge: str,
|
||||
) -> Response[Union[CompletedRequest, GenericError]]:
|
||||
"""Accept a Logout Request
|
||||
|
||||
When a user or an application requests ORY Hydra to log out a user, this endpoint is used to confirm
|
||||
that logout request.
|
||||
No body is required.
|
||||
|
||||
The response contains a redirect URL which the consent provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
logout_challenge (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
logout_challenge=logout_challenge,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
logout_challenge: str,
|
||||
) -> Optional[Union[CompletedRequest, GenericError]]:
|
||||
"""Accept a Logout Request
|
||||
|
||||
When a user or an application requests ORY Hydra to log out a user, this endpoint is used to confirm
|
||||
that logout request.
|
||||
No body is required.
|
||||
|
||||
The response contains a redirect URL which the consent provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
logout_challenge (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
logout_challenge=logout_challenge,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
logout_challenge: str,
|
||||
) -> Response[Union[CompletedRequest, GenericError]]:
|
||||
"""Accept a Logout Request
|
||||
|
||||
When a user or an application requests ORY Hydra to log out a user, this endpoint is used to confirm
|
||||
that logout request.
|
||||
No body is required.
|
||||
|
||||
The response contains a redirect URL which the consent provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
logout_challenge (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
logout_challenge=logout_challenge,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
logout_challenge: str,
|
||||
) -> Optional[Union[CompletedRequest, GenericError]]:
|
||||
"""Accept a Logout Request
|
||||
|
||||
When a user or an application requests ORY Hydra to log out a user, this endpoint is used to confirm
|
||||
that logout request.
|
||||
No body is required.
|
||||
|
||||
The response contains a redirect URL which the consent provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
logout_challenge (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
logout_challenge=logout_challenge,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,207 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.json_web_key_set import JSONWebKeySet
|
||||
from ...models.json_web_key_set_generator_request import JsonWebKeySetGeneratorRequest
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: JsonWebKeySetGeneratorRequest,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/keys/{set}".format(_client.base_url, set=set_)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
json_json_body = json_body.to_dict()
|
||||
|
||||
return {
|
||||
"method": "post",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"json": json_json_body,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[GenericError, JSONWebKeySet]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = JSONWebKeySet.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
if response.status_code == 401:
|
||||
response_401 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_401
|
||||
if response.status_code == 403:
|
||||
response_403 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_403
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[GenericError, JSONWebKeySet]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: JsonWebKeySetGeneratorRequest,
|
||||
) -> Response[Union[GenericError, JSONWebKeySet]]:
|
||||
"""Generate a New JSON Web Key
|
||||
|
||||
This endpoint is capable of generating JSON Web Key Sets for you. There a different strategies
|
||||
available, such as symmetric cryptographic keys (HS256, HS512) and asymetric cryptographic keys
|
||||
(RS256, ECDSA). If the specified JSON Web Key Set does not exist, it will be created.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
json_body (JsonWebKeySetGeneratorRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
set_=set_,
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: JsonWebKeySetGeneratorRequest,
|
||||
) -> Optional[Union[GenericError, JSONWebKeySet]]:
|
||||
"""Generate a New JSON Web Key
|
||||
|
||||
This endpoint is capable of generating JSON Web Key Sets for you. There a different strategies
|
||||
available, such as symmetric cryptographic keys (HS256, HS512) and asymetric cryptographic keys
|
||||
(RS256, ECDSA). If the specified JSON Web Key Set does not exist, it will be created.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
json_body (JsonWebKeySetGeneratorRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
set_=set_,
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: JsonWebKeySetGeneratorRequest,
|
||||
) -> Response[Union[GenericError, JSONWebKeySet]]:
|
||||
"""Generate a New JSON Web Key
|
||||
|
||||
This endpoint is capable of generating JSON Web Key Sets for you. There a different strategies
|
||||
available, such as symmetric cryptographic keys (HS256, HS512) and asymetric cryptographic keys
|
||||
(RS256, ECDSA). If the specified JSON Web Key Set does not exist, it will be created.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
json_body (JsonWebKeySetGeneratorRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
set_=set_,
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: JsonWebKeySetGeneratorRequest,
|
||||
) -> Optional[Union[GenericError, JSONWebKeySet]]:
|
||||
"""Generate a New JSON Web Key
|
||||
|
||||
This endpoint is capable of generating JSON Web Key Sets for you. There a different strategies
|
||||
available, such as symmetric cryptographic keys (HS256, HS512) and asymetric cryptographic keys
|
||||
(RS256, ECDSA). If the specified JSON Web Key Set does not exist, it will be created.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
json_body (JsonWebKeySetGeneratorRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
set_=set_,
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,189 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.o_auth_2_client import OAuth2Client
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: OAuth2Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/clients".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
json_json_body = json_body.to_dict()
|
||||
|
||||
return {
|
||||
"method": "post",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"json": json_json_body,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[GenericError, OAuth2Client]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = OAuth2Client.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
if response.status_code == 400:
|
||||
response_400 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_400
|
||||
if response.status_code == 409:
|
||||
response_409 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_409
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[GenericError, OAuth2Client]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: OAuth2Client,
|
||||
) -> Response[Union[GenericError, OAuth2Client]]:
|
||||
"""Create an OAuth 2.0 Client
|
||||
|
||||
Create a new OAuth 2.0 client If you pass `client_secret` the secret will be used, otherwise a
|
||||
random secret will be generated. The secret will be returned in the response and you will not be
|
||||
able to retrieve it later on. Write the secret down and keep it somwhere safe.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
|
||||
Args:
|
||||
json_body (OAuth2Client):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, OAuth2Client]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: OAuth2Client,
|
||||
) -> Optional[Union[GenericError, OAuth2Client]]:
|
||||
"""Create an OAuth 2.0 Client
|
||||
|
||||
Create a new OAuth 2.0 client If you pass `client_secret` the secret will be used, otherwise a
|
||||
random secret will be generated. The secret will be returned in the response and you will not be
|
||||
able to retrieve it later on. Write the secret down and keep it somwhere safe.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
|
||||
Args:
|
||||
json_body (OAuth2Client):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, OAuth2Client]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: OAuth2Client,
|
||||
) -> Response[Union[GenericError, OAuth2Client]]:
|
||||
"""Create an OAuth 2.0 Client
|
||||
|
||||
Create a new OAuth 2.0 client If you pass `client_secret` the secret will be used, otherwise a
|
||||
random secret will be generated. The secret will be returned in the response and you will not be
|
||||
able to retrieve it later on. Write the secret down and keep it somwhere safe.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
|
||||
Args:
|
||||
json_body (OAuth2Client):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, OAuth2Client]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: OAuth2Client,
|
||||
) -> Optional[Union[GenericError, OAuth2Client]]:
|
||||
"""Create an OAuth 2.0 Client
|
||||
|
||||
Create a new OAuth 2.0 client If you pass `client_secret` the secret will be used, otherwise a
|
||||
random secret will be generated. The secret will be returned in the response and you will not be
|
||||
able to retrieve it later on. Write the secret down and keep it somwhere safe.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
|
||||
Args:
|
||||
json_body (OAuth2Client):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, OAuth2Client]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,193 @@
|
|||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
set_: str,
|
||||
kid: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/keys/{set}/{kid}".format(_client.base_url, set=set_, kid=kid)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "delete",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, GenericError]]:
|
||||
if response.status_code == 204:
|
||||
response_204 = cast(Any, None)
|
||||
return response_204
|
||||
if response.status_code == 401:
|
||||
response_401 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_401
|
||||
if response.status_code == 403:
|
||||
response_403 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_403
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, GenericError]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
set_: str,
|
||||
kid: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""Delete a JSON Web Key
|
||||
|
||||
Use this endpoint to delete a single JSON Web Key.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
kid (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
set_=set_,
|
||||
kid=kid,
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
set_: str,
|
||||
kid: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""Delete a JSON Web Key
|
||||
|
||||
Use this endpoint to delete a single JSON Web Key.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
kid (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
set_=set_,
|
||||
kid=kid,
|
||||
_client=_client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
set_: str,
|
||||
kid: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""Delete a JSON Web Key
|
||||
|
||||
Use this endpoint to delete a single JSON Web Key.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
kid (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
set_=set_,
|
||||
kid=kid,
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
set_: str,
|
||||
kid: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""Delete a JSON Web Key
|
||||
|
||||
Use this endpoint to delete a single JSON Web Key.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
kid (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
set_=set_,
|
||||
kid=kid,
|
||||
_client=_client,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,180 @@
|
|||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/keys/{set}".format(_client.base_url, set=set_)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "delete",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, GenericError]]:
|
||||
if response.status_code == 204:
|
||||
response_204 = cast(Any, None)
|
||||
return response_204
|
||||
if response.status_code == 401:
|
||||
response_401 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_401
|
||||
if response.status_code == 403:
|
||||
response_403 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_403
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, GenericError]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""Delete a JSON Web Key Set
|
||||
|
||||
Use this endpoint to delete a complete JSON Web Key Set and all the keys in that set.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
set_=set_,
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""Delete a JSON Web Key Set
|
||||
|
||||
Use this endpoint to delete a complete JSON Web Key Set and all the keys in that set.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
set_=set_,
|
||||
_client=_client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""Delete a JSON Web Key Set
|
||||
|
||||
Use this endpoint to delete a complete JSON Web Key Set and all the keys in that set.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
set_=set_,
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""Delete a JSON Web Key Set
|
||||
|
||||
Use this endpoint to delete a complete JSON Web Key Set and all the keys in that set.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
set_=set_,
|
||||
_client=_client,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,172 @@
|
|||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/clients/{id}".format(_client.base_url, id=id)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "delete",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, GenericError]]:
|
||||
if response.status_code == 204:
|
||||
response_204 = cast(Any, None)
|
||||
return response_204
|
||||
if response.status_code == 404:
|
||||
response_404 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_404
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, GenericError]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""Deletes an OAuth 2.0 Client
|
||||
|
||||
Delete an existing OAuth 2.0 Client by its ID.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""Deletes an OAuth 2.0 Client
|
||||
|
||||
Delete an existing OAuth 2.0 Client by its ID.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
_client=_client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""Deletes an OAuth 2.0 Client
|
||||
|
||||
Delete an existing OAuth 2.0 Client by its ID.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""Deletes an OAuth 2.0 Client
|
||||
|
||||
Delete an existing OAuth 2.0 Client by its ID.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
_client=_client,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,158 @@
|
|||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
client_id: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/tokens".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["client_id"] = client_id
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "delete",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, GenericError]]:
|
||||
if response.status_code == 204:
|
||||
response_204 = cast(Any, None)
|
||||
return response_204
|
||||
if response.status_code == 401:
|
||||
response_401 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_401
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, GenericError]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
client_id: str,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""Delete OAuth2 Access Tokens from a Client
|
||||
|
||||
This endpoint deletes OAuth2 access tokens issued for a client from the database
|
||||
|
||||
Args:
|
||||
client_id (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
client_id=client_id,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
client_id: str,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""Delete OAuth2 Access Tokens from a Client
|
||||
|
||||
This endpoint deletes OAuth2 access tokens issued for a client from the database
|
||||
|
||||
Args:
|
||||
client_id (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
client_id=client_id,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
client_id: str,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""Delete OAuth2 Access Tokens from a Client
|
||||
|
||||
This endpoint deletes OAuth2 access tokens issued for a client from the database
|
||||
|
||||
Args:
|
||||
client_id (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
client_id=client_id,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
client_id: str,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""Delete OAuth2 Access Tokens from a Client
|
||||
|
||||
This endpoint deletes OAuth2 access tokens issued for a client from the database
|
||||
|
||||
Args:
|
||||
client_id (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
client_id=client_id,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,172 @@
|
|||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.flush_inactive_o_auth_2_tokens_request import FlushInactiveOAuth2TokensRequest
|
||||
from ...models.generic_error import GenericError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: FlushInactiveOAuth2TokensRequest,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/flush".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
json_json_body = json_body.to_dict()
|
||||
|
||||
return {
|
||||
"method": "post",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"json": json_json_body,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, GenericError]]:
|
||||
if response.status_code == 204:
|
||||
response_204 = cast(Any, None)
|
||||
return response_204
|
||||
if response.status_code == 401:
|
||||
response_401 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_401
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, GenericError]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: FlushInactiveOAuth2TokensRequest,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""Flush Expired OAuth2 Access Tokens
|
||||
|
||||
This endpoint flushes expired OAuth2 access tokens from the database. You can set a time after which
|
||||
no tokens will be
|
||||
not be touched, in case you want to keep recent tokens for auditing. Refresh tokens can not be
|
||||
flushed as they are deleted
|
||||
automatically when performing the refresh flow.
|
||||
|
||||
Args:
|
||||
json_body (FlushInactiveOAuth2TokensRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: FlushInactiveOAuth2TokensRequest,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""Flush Expired OAuth2 Access Tokens
|
||||
|
||||
This endpoint flushes expired OAuth2 access tokens from the database. You can set a time after which
|
||||
no tokens will be
|
||||
not be touched, in case you want to keep recent tokens for auditing. Refresh tokens can not be
|
||||
flushed as they are deleted
|
||||
automatically when performing the refresh flow.
|
||||
|
||||
Args:
|
||||
json_body (FlushInactiveOAuth2TokensRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: FlushInactiveOAuth2TokensRequest,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""Flush Expired OAuth2 Access Tokens
|
||||
|
||||
This endpoint flushes expired OAuth2 access tokens from the database. You can set a time after which
|
||||
no tokens will be
|
||||
not be touched, in case you want to keep recent tokens for auditing. Refresh tokens can not be
|
||||
flushed as they are deleted
|
||||
automatically when performing the refresh flow.
|
||||
|
||||
Args:
|
||||
json_body (FlushInactiveOAuth2TokensRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: FlushInactiveOAuth2TokensRequest,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""Flush Expired OAuth2 Access Tokens
|
||||
|
||||
This endpoint flushes expired OAuth2 access tokens from the database. You can set a time after which
|
||||
no tokens will be
|
||||
not be touched, in case you want to keep recent tokens for auditing. Refresh tokens can not be
|
||||
flushed as they are deleted
|
||||
automatically when performing the refresh flow.
|
||||
|
||||
Args:
|
||||
json_body (FlushInactiveOAuth2TokensRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,228 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.consent_request import ConsentRequest
|
||||
from ...models.generic_error import GenericError
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
consent_challenge: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/auth/requests/consent".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["consent_challenge"] = consent_challenge
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[ConsentRequest, GenericError]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = ConsentRequest.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 404:
|
||||
response_404 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_404
|
||||
if response.status_code == 409:
|
||||
response_409 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_409
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[ConsentRequest, GenericError]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
consent_challenge: str,
|
||||
) -> Response[Union[ConsentRequest, GenericError]]:
|
||||
"""Get Consent Request Information
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
to authenticate the subject and then tell ORY Hydra now about it. If the subject authenticated,
|
||||
he/she must now be asked if
|
||||
the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the
|
||||
subject's behalf.
|
||||
|
||||
The consent provider which handles this request and is a web app implemented and hosted by you. It
|
||||
shows a subject interface which asks the subject to
|
||||
grant or deny the client access to the requested scope (\"Application my-dropbox-app wants write
|
||||
access to all your private files\").
|
||||
|
||||
The consent challenge is appended to the consent provider's URL to which the subject's user-agent
|
||||
(browser) is redirected to. The consent
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then tells ORY Hydra if
|
||||
the subject accepted
|
||||
or rejected the request.
|
||||
|
||||
Args:
|
||||
consent_challenge (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[ConsentRequest, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
consent_challenge=consent_challenge,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
consent_challenge: str,
|
||||
) -> Optional[Union[ConsentRequest, GenericError]]:
|
||||
"""Get Consent Request Information
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
to authenticate the subject and then tell ORY Hydra now about it. If the subject authenticated,
|
||||
he/she must now be asked if
|
||||
the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the
|
||||
subject's behalf.
|
||||
|
||||
The consent provider which handles this request and is a web app implemented and hosted by you. It
|
||||
shows a subject interface which asks the subject to
|
||||
grant or deny the client access to the requested scope (\"Application my-dropbox-app wants write
|
||||
access to all your private files\").
|
||||
|
||||
The consent challenge is appended to the consent provider's URL to which the subject's user-agent
|
||||
(browser) is redirected to. The consent
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then tells ORY Hydra if
|
||||
the subject accepted
|
||||
or rejected the request.
|
||||
|
||||
Args:
|
||||
consent_challenge (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[ConsentRequest, GenericError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
consent_challenge=consent_challenge,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
consent_challenge: str,
|
||||
) -> Response[Union[ConsentRequest, GenericError]]:
|
||||
"""Get Consent Request Information
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
to authenticate the subject and then tell ORY Hydra now about it. If the subject authenticated,
|
||||
he/she must now be asked if
|
||||
the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the
|
||||
subject's behalf.
|
||||
|
||||
The consent provider which handles this request and is a web app implemented and hosted by you. It
|
||||
shows a subject interface which asks the subject to
|
||||
grant or deny the client access to the requested scope (\"Application my-dropbox-app wants write
|
||||
access to all your private files\").
|
||||
|
||||
The consent challenge is appended to the consent provider's URL to which the subject's user-agent
|
||||
(browser) is redirected to. The consent
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then tells ORY Hydra if
|
||||
the subject accepted
|
||||
or rejected the request.
|
||||
|
||||
Args:
|
||||
consent_challenge (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[ConsentRequest, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
consent_challenge=consent_challenge,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
consent_challenge: str,
|
||||
) -> Optional[Union[ConsentRequest, GenericError]]:
|
||||
"""Get Consent Request Information
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
to authenticate the subject and then tell ORY Hydra now about it. If the subject authenticated,
|
||||
he/she must now be asked if
|
||||
the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the
|
||||
subject's behalf.
|
||||
|
||||
The consent provider which handles this request and is a web app implemented and hosted by you. It
|
||||
shows a subject interface which asks the subject to
|
||||
grant or deny the client access to the requested scope (\"Application my-dropbox-app wants write
|
||||
access to all your private files\").
|
||||
|
||||
The consent challenge is appended to the consent provider's URL to which the subject's user-agent
|
||||
(browser) is redirected to. The consent
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then tells ORY Hydra if
|
||||
the subject accepted
|
||||
or rejected the request.
|
||||
|
||||
Args:
|
||||
consent_challenge (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[ConsentRequest, GenericError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
consent_challenge=consent_challenge,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,167 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.json_web_key_set import JSONWebKeySet
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
set_: str,
|
||||
kid: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/keys/{set}/{kid}".format(_client.base_url, set=set_, kid=kid)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[GenericError, JSONWebKeySet]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = JSONWebKeySet.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 404:
|
||||
response_404 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_404
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[GenericError, JSONWebKeySet]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
set_: str,
|
||||
kid: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[GenericError, JSONWebKeySet]]:
|
||||
"""Fetch a JSON Web Key
|
||||
|
||||
This endpoint returns a singular JSON Web Key, identified by the set and the specific key ID (kid).
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
kid (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
set_=set_,
|
||||
kid=kid,
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
set_: str,
|
||||
kid: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[GenericError, JSONWebKeySet]]:
|
||||
"""Fetch a JSON Web Key
|
||||
|
||||
This endpoint returns a singular JSON Web Key, identified by the set and the specific key ID (kid).
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
kid (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
set_=set_,
|
||||
kid=kid,
|
||||
_client=_client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
set_: str,
|
||||
kid: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[GenericError, JSONWebKeySet]]:
|
||||
"""Fetch a JSON Web Key
|
||||
|
||||
This endpoint returns a singular JSON Web Key, identified by the set and the specific key ID (kid).
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
kid (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
set_=set_,
|
||||
kid=kid,
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
set_: str,
|
||||
kid: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[GenericError, JSONWebKeySet]]:
|
||||
"""Fetch a JSON Web Key
|
||||
|
||||
This endpoint returns a singular JSON Web Key, identified by the set and the specific key ID (kid).
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
kid (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
set_=set_,
|
||||
kid=kid,
|
||||
_client=_client,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,182 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.json_web_key_set import JSONWebKeySet
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/keys/{set}".format(_client.base_url, set=set_)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[GenericError, JSONWebKeySet]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = JSONWebKeySet.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 401:
|
||||
response_401 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_401
|
||||
if response.status_code == 403:
|
||||
response_403 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_403
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[GenericError, JSONWebKeySet]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[GenericError, JSONWebKeySet]]:
|
||||
"""Retrieve a JSON Web Key Set
|
||||
|
||||
This endpoint can be used to retrieve JWK Sets stored in ORY Hydra.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
set_=set_,
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[GenericError, JSONWebKeySet]]:
|
||||
"""Retrieve a JSON Web Key Set
|
||||
|
||||
This endpoint can be used to retrieve JWK Sets stored in ORY Hydra.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
set_=set_,
|
||||
_client=_client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[GenericError, JSONWebKeySet]]:
|
||||
"""Retrieve a JSON Web Key Set
|
||||
|
||||
This endpoint can be used to retrieve JWK Sets stored in ORY Hydra.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
set_=set_,
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[GenericError, JSONWebKeySet]]:
|
||||
"""Retrieve a JSON Web Key Set
|
||||
|
||||
This endpoint can be used to retrieve JWK Sets stored in ORY Hydra.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
set_=set_,
|
||||
_client=_client,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,212 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.login_request import LoginRequest
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
login_challenge: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/auth/requests/login".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["login_challenge"] = login_challenge
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[GenericError, LoginRequest]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = LoginRequest.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_400 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_400
|
||||
if response.status_code == 404:
|
||||
response_404 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_404
|
||||
if response.status_code == 409:
|
||||
response_409 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_409
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[GenericError, LoginRequest]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
login_challenge: str,
|
||||
) -> Response[Union[GenericError, LoginRequest]]:
|
||||
"""Get a Login Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
(sometimes called \"identity provider\") to authenticate the subject and then tell ORY Hydra now
|
||||
about it. The login
|
||||
provider is an web-app you write and host, and it must be able to authenticate (\"show the subject a
|
||||
login screen\")
|
||||
a subject (in OAuth2 the proper name for subject is \"resource owner\").
|
||||
|
||||
The authentication challenge is appended to the login provider URL to which the subject's user-agent
|
||||
(browser) is redirected to. The login
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then accept or reject
|
||||
the requested authentication process.
|
||||
|
||||
Args:
|
||||
login_challenge (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, LoginRequest]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
login_challenge=login_challenge,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
login_challenge: str,
|
||||
) -> Optional[Union[GenericError, LoginRequest]]:
|
||||
"""Get a Login Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
(sometimes called \"identity provider\") to authenticate the subject and then tell ORY Hydra now
|
||||
about it. The login
|
||||
provider is an web-app you write and host, and it must be able to authenticate (\"show the subject a
|
||||
login screen\")
|
||||
a subject (in OAuth2 the proper name for subject is \"resource owner\").
|
||||
|
||||
The authentication challenge is appended to the login provider URL to which the subject's user-agent
|
||||
(browser) is redirected to. The login
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then accept or reject
|
||||
the requested authentication process.
|
||||
|
||||
Args:
|
||||
login_challenge (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, LoginRequest]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
login_challenge=login_challenge,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
login_challenge: str,
|
||||
) -> Response[Union[GenericError, LoginRequest]]:
|
||||
"""Get a Login Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
(sometimes called \"identity provider\") to authenticate the subject and then tell ORY Hydra now
|
||||
about it. The login
|
||||
provider is an web-app you write and host, and it must be able to authenticate (\"show the subject a
|
||||
login screen\")
|
||||
a subject (in OAuth2 the proper name for subject is \"resource owner\").
|
||||
|
||||
The authentication challenge is appended to the login provider URL to which the subject's user-agent
|
||||
(browser) is redirected to. The login
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then accept or reject
|
||||
the requested authentication process.
|
||||
|
||||
Args:
|
||||
login_challenge (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, LoginRequest]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
login_challenge=login_challenge,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
login_challenge: str,
|
||||
) -> Optional[Union[GenericError, LoginRequest]]:
|
||||
"""Get a Login Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
(sometimes called \"identity provider\") to authenticate the subject and then tell ORY Hydra now
|
||||
about it. The login
|
||||
provider is an web-app you write and host, and it must be able to authenticate (\"show the subject a
|
||||
login screen\")
|
||||
a subject (in OAuth2 the proper name for subject is \"resource owner\").
|
||||
|
||||
The authentication challenge is appended to the login provider URL to which the subject's user-agent
|
||||
(browser) is redirected to. The login
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then accept or reject
|
||||
the requested authentication process.
|
||||
|
||||
Args:
|
||||
login_challenge (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, LoginRequest]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
login_challenge=login_challenge,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,160 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.logout_request import LogoutRequest
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
logout_challenge: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/auth/requests/logout".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["logout_challenge"] = logout_challenge
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[GenericError, LogoutRequest]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = LogoutRequest.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 404:
|
||||
response_404 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_404
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[GenericError, LogoutRequest]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
logout_challenge: str,
|
||||
) -> Response[Union[GenericError, LogoutRequest]]:
|
||||
"""Get a Logout Request
|
||||
|
||||
Use this endpoint to fetch a logout request.
|
||||
|
||||
Args:
|
||||
logout_challenge (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, LogoutRequest]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
logout_challenge=logout_challenge,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
logout_challenge: str,
|
||||
) -> Optional[Union[GenericError, LogoutRequest]]:
|
||||
"""Get a Logout Request
|
||||
|
||||
Use this endpoint to fetch a logout request.
|
||||
|
||||
Args:
|
||||
logout_challenge (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, LogoutRequest]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
logout_challenge=logout_challenge,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
logout_challenge: str,
|
||||
) -> Response[Union[GenericError, LogoutRequest]]:
|
||||
"""Get a Logout Request
|
||||
|
||||
Use this endpoint to fetch a logout request.
|
||||
|
||||
Args:
|
||||
logout_challenge (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, LogoutRequest]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
logout_challenge=logout_challenge,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
logout_challenge: str,
|
||||
) -> Optional[Union[GenericError, LogoutRequest]]:
|
||||
"""Get a Logout Request
|
||||
|
||||
Use this endpoint to fetch a logout request.
|
||||
|
||||
Args:
|
||||
logout_challenge (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, LogoutRequest]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
logout_challenge=logout_challenge,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,174 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.o_auth_2_client import OAuth2Client
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/clients/{id}".format(_client.base_url, id=id)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[GenericError, OAuth2Client]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = OAuth2Client.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 401:
|
||||
response_401 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_401
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[GenericError, OAuth2Client]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[GenericError, OAuth2Client]]:
|
||||
"""Get an OAuth 2.0 Client.
|
||||
|
||||
Get an OAUth 2.0 client by its ID. This endpoint never returns passwords.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, OAuth2Client]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[GenericError, OAuth2Client]]:
|
||||
"""Get an OAuth 2.0 Client.
|
||||
|
||||
Get an OAUth 2.0 client by its ID. This endpoint never returns passwords.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, OAuth2Client]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
_client=_client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[GenericError, OAuth2Client]]:
|
||||
"""Get an OAuth 2.0 Client.
|
||||
|
||||
Get an OAUth 2.0 client by its ID. This endpoint never returns passwords.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, OAuth2Client]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[GenericError, OAuth2Client]]:
|
||||
"""Get an OAuth 2.0 Client.
|
||||
|
||||
Get an OAUth 2.0 client by its ID. This endpoint never returns passwords.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, OAuth2Client]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
_client=_client,
|
||||
)
|
||||
).parsed
|
136
libs/ory-hydra-client/ory_hydra_client/api/admin/get_version.py
Normal file
136
libs/ory-hydra-client/ory_hydra_client/api/admin/get_version.py
Normal file
|
@ -0,0 +1,136 @@
|
|||
from typing import Any, Dict, Optional
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.version import Version
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/version".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Version]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Version.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Version]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Version]:
|
||||
"""Get Service Version
|
||||
|
||||
This endpoint returns the service version typically notated using semantic versioning.
|
||||
|
||||
If the service supports TLS Edge Termination, this endpoint does not require the
|
||||
`X-Forwarded-Proto` header to be set.
|
||||
|
||||
Returns:
|
||||
Response[Version]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Version]:
|
||||
"""Get Service Version
|
||||
|
||||
This endpoint returns the service version typically notated using semantic versioning.
|
||||
|
||||
If the service supports TLS Edge Termination, this endpoint does not require the
|
||||
`X-Forwarded-Proto` header to be set.
|
||||
|
||||
Returns:
|
||||
Response[Version]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Version]:
|
||||
"""Get Service Version
|
||||
|
||||
This endpoint returns the service version typically notated using semantic versioning.
|
||||
|
||||
If the service supports TLS Edge Termination, this endpoint does not require the
|
||||
`X-Forwarded-Proto` header to be set.
|
||||
|
||||
Returns:
|
||||
Response[Version]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Version]:
|
||||
"""Get Service Version
|
||||
|
||||
This endpoint returns the service version typically notated using semantic versioning.
|
||||
|
||||
If the service supports TLS Edge Termination, this endpoint does not require the
|
||||
`X-Forwarded-Proto` header to be set.
|
||||
|
||||
Returns:
|
||||
Response[Version]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,161 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.o_auth_2_token_introspection import OAuth2TokenIntrospection
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/introspect".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "post",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[GenericError, OAuth2TokenIntrospection]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = OAuth2TokenIntrospection.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 401:
|
||||
response_401 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_401
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[GenericError, OAuth2TokenIntrospection]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[GenericError, OAuth2TokenIntrospection]]:
|
||||
"""Introspect OAuth2 Tokens
|
||||
|
||||
The introspection endpoint allows to check if a token (both refresh and access) is active or not. An
|
||||
active token
|
||||
is neither expired nor revoked. If a token is active, additional information on the token will be
|
||||
included. You can
|
||||
set additional data for a token by setting `accessTokenExtra` during the consent flow.
|
||||
|
||||
For more information [read this blog post](https://www.oauth.com/oauth2-servers/token-introspection-
|
||||
endpoint/).
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, OAuth2TokenIntrospection]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[GenericError, OAuth2TokenIntrospection]]:
|
||||
"""Introspect OAuth2 Tokens
|
||||
|
||||
The introspection endpoint allows to check if a token (both refresh and access) is active or not. An
|
||||
active token
|
||||
is neither expired nor revoked. If a token is active, additional information on the token will be
|
||||
included. You can
|
||||
set additional data for a token by setting `accessTokenExtra` during the consent flow.
|
||||
|
||||
For more information [read this blog post](https://www.oauth.com/oauth2-servers/token-introspection-
|
||||
endpoint/).
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, OAuth2TokenIntrospection]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[GenericError, OAuth2TokenIntrospection]]:
|
||||
"""Introspect OAuth2 Tokens
|
||||
|
||||
The introspection endpoint allows to check if a token (both refresh and access) is active or not. An
|
||||
active token
|
||||
is neither expired nor revoked. If a token is active, additional information on the token will be
|
||||
included. You can
|
||||
set additional data for a token by setting `accessTokenExtra` during the consent flow.
|
||||
|
||||
For more information [read this blog post](https://www.oauth.com/oauth2-servers/token-introspection-
|
||||
endpoint/).
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, OAuth2TokenIntrospection]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[GenericError, OAuth2TokenIntrospection]]:
|
||||
"""Introspect OAuth2 Tokens
|
||||
|
||||
The introspection endpoint allows to check if a token (both refresh and access) is active or not. An
|
||||
active token
|
||||
is neither expired nor revoked. If a token is active, additional information on the token will be
|
||||
included. You can
|
||||
set additional data for a token by setting `accessTokenExtra` during the consent flow.
|
||||
|
||||
For more information [read this blog post](https://www.oauth.com/oauth2-servers/token-introspection-
|
||||
endpoint/).
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, OAuth2TokenIntrospection]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,157 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.health_status import HealthStatus
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/health/alive".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[GenericError, HealthStatus]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = HealthStatus.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[GenericError, HealthStatus]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[GenericError, HealthStatus]]:
|
||||
"""Check Alive Status
|
||||
|
||||
This endpoint returns a 200 status code when the HTTP server is up running.
|
||||
This status does currently not include checks whether the database connection is working.
|
||||
|
||||
If the service supports TLS Edge Termination, this endpoint does not require the
|
||||
`X-Forwarded-Proto` header to be set.
|
||||
|
||||
Be aware that if you are running multiple nodes of this service, the health status will never
|
||||
refer to the cluster state, only to a single instance.
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, HealthStatus]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[GenericError, HealthStatus]]:
|
||||
"""Check Alive Status
|
||||
|
||||
This endpoint returns a 200 status code when the HTTP server is up running.
|
||||
This status does currently not include checks whether the database connection is working.
|
||||
|
||||
If the service supports TLS Edge Termination, this endpoint does not require the
|
||||
`X-Forwarded-Proto` header to be set.
|
||||
|
||||
Be aware that if you are running multiple nodes of this service, the health status will never
|
||||
refer to the cluster state, only to a single instance.
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, HealthStatus]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[GenericError, HealthStatus]]:
|
||||
"""Check Alive Status
|
||||
|
||||
This endpoint returns a 200 status code when the HTTP server is up running.
|
||||
This status does currently not include checks whether the database connection is working.
|
||||
|
||||
If the service supports TLS Edge Termination, this endpoint does not require the
|
||||
`X-Forwarded-Proto` header to be set.
|
||||
|
||||
Be aware that if you are running multiple nodes of this service, the health status will never
|
||||
refer to the cluster state, only to a single instance.
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, HealthStatus]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[GenericError, HealthStatus]]:
|
||||
"""Check Alive Status
|
||||
|
||||
This endpoint returns a 200 status code when the HTTP server is up running.
|
||||
This status does currently not include checks whether the database connection is working.
|
||||
|
||||
If the service supports TLS Edge Termination, this endpoint does not require the
|
||||
`X-Forwarded-Proto` header to be set.
|
||||
|
||||
Be aware that if you are running multiple nodes of this service, the health status will never
|
||||
refer to the cluster state, only to a single instance.
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, HealthStatus]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,224 @@
|
|||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.o_auth_2_client import OAuth2Client
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
limit: Union[Unset, None, int] = UNSET,
|
||||
offset: Union[Unset, None, int] = UNSET,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/clients".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["limit"] = limit
|
||||
|
||||
params["offset"] = offset
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[GenericError, List[OAuth2Client]]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = []
|
||||
_response_200 = response.json()
|
||||
for response_200_item_data in _response_200:
|
||||
response_200_item = OAuth2Client.from_dict(response_200_item_data)
|
||||
|
||||
response_200.append(response_200_item)
|
||||
|
||||
return response_200
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[GenericError, List[OAuth2Client]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
limit: Union[Unset, None, int] = UNSET,
|
||||
offset: Union[Unset, None, int] = UNSET,
|
||||
) -> Response[Union[GenericError, List[OAuth2Client]]]:
|
||||
"""List OAuth 2.0 Clients
|
||||
|
||||
This endpoint lists all clients in the database, and never returns client secrets. As a default it
|
||||
lists the first 100 clients. The `limit` parameter can be used to retrieve more clients, but it has
|
||||
an upper bound at 500 objects. Pagination should be used to retrieve more than 500 objects.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
The \"Link\" header is also included in successful responses, which contains one or more links for
|
||||
pagination, formatted like so: '<https://hydra-url/admin/clients?limit={limit}&offset={offset}>;
|
||||
rel=\"{page}\"', where page is one of the following applicable pages: 'first', 'next', 'last', and
|
||||
'previous'.
|
||||
Multiple links can be included in this header, and will be separated by a comma.
|
||||
|
||||
Args:
|
||||
limit (Union[Unset, None, int]):
|
||||
offset (Union[Unset, None, int]):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, List[OAuth2Client]]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
limit: Union[Unset, None, int] = UNSET,
|
||||
offset: Union[Unset, None, int] = UNSET,
|
||||
) -> Optional[Union[GenericError, List[OAuth2Client]]]:
|
||||
"""List OAuth 2.0 Clients
|
||||
|
||||
This endpoint lists all clients in the database, and never returns client secrets. As a default it
|
||||
lists the first 100 clients. The `limit` parameter can be used to retrieve more clients, but it has
|
||||
an upper bound at 500 objects. Pagination should be used to retrieve more than 500 objects.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
The \"Link\" header is also included in successful responses, which contains one or more links for
|
||||
pagination, formatted like so: '<https://hydra-url/admin/clients?limit={limit}&offset={offset}>;
|
||||
rel=\"{page}\"', where page is one of the following applicable pages: 'first', 'next', 'last', and
|
||||
'previous'.
|
||||
Multiple links can be included in this header, and will be separated by a comma.
|
||||
|
||||
Args:
|
||||
limit (Union[Unset, None, int]):
|
||||
offset (Union[Unset, None, int]):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, List[OAuth2Client]]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
limit: Union[Unset, None, int] = UNSET,
|
||||
offset: Union[Unset, None, int] = UNSET,
|
||||
) -> Response[Union[GenericError, List[OAuth2Client]]]:
|
||||
"""List OAuth 2.0 Clients
|
||||
|
||||
This endpoint lists all clients in the database, and never returns client secrets. As a default it
|
||||
lists the first 100 clients. The `limit` parameter can be used to retrieve more clients, but it has
|
||||
an upper bound at 500 objects. Pagination should be used to retrieve more than 500 objects.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
The \"Link\" header is also included in successful responses, which contains one or more links for
|
||||
pagination, formatted like so: '<https://hydra-url/admin/clients?limit={limit}&offset={offset}>;
|
||||
rel=\"{page}\"', where page is one of the following applicable pages: 'first', 'next', 'last', and
|
||||
'previous'.
|
||||
Multiple links can be included in this header, and will be separated by a comma.
|
||||
|
||||
Args:
|
||||
limit (Union[Unset, None, int]):
|
||||
offset (Union[Unset, None, int]):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, List[OAuth2Client]]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
limit: Union[Unset, None, int] = UNSET,
|
||||
offset: Union[Unset, None, int] = UNSET,
|
||||
) -> Optional[Union[GenericError, List[OAuth2Client]]]:
|
||||
"""List OAuth 2.0 Clients
|
||||
|
||||
This endpoint lists all clients in the database, and never returns client secrets. As a default it
|
||||
lists the first 100 clients. The `limit` parameter can be used to retrieve more clients, but it has
|
||||
an upper bound at 500 objects. Pagination should be used to retrieve more than 500 objects.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
The \"Link\" header is also included in successful responses, which contains one or more links for
|
||||
pagination, formatted like so: '<https://hydra-url/admin/clients?limit={limit}&offset={offset}>;
|
||||
rel=\"{page}\"', where page is one of the following applicable pages: 'first', 'next', 'last', and
|
||||
'previous'.
|
||||
Multiple links can be included in this header, and will be separated by a comma.
|
||||
|
||||
Args:
|
||||
limit (Union[Unset, None, int]):
|
||||
offset (Union[Unset, None, int]):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, List[OAuth2Client]]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,205 @@
|
|||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.previous_consent_session import PreviousConsentSession
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
subject: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/auth/sessions/consent".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["subject"] = subject
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[GenericError, List[PreviousConsentSession]]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = []
|
||||
_response_200 = response.json()
|
||||
for response_200_item_data in _response_200:
|
||||
response_200_item = PreviousConsentSession.from_dict(response_200_item_data)
|
||||
|
||||
response_200.append(response_200_item)
|
||||
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_400 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_400
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[GenericError, List[PreviousConsentSession]]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
subject: str,
|
||||
) -> Response[Union[GenericError, List[PreviousConsentSession]]]:
|
||||
"""Lists All Consent Sessions of a Subject
|
||||
|
||||
This endpoint lists all subject's granted consent sessions, including client and granted scope.
|
||||
If the subject is unknown or has not granted any consent sessions yet, the endpoint returns an
|
||||
empty JSON array with status code 200 OK.
|
||||
|
||||
|
||||
The \"Link\" header is also included in successful responses, which contains one or more links for
|
||||
pagination, formatted like so: '<https://hydra-
|
||||
url/admin/oauth2/auth/sessions/consent?subject={user}&limit={limit}&offset={offset}>;
|
||||
rel=\"{page}\"', where page is one of the following applicable pages: 'first', 'next', 'last', and
|
||||
'previous'.
|
||||
Multiple links can be included in this header, and will be separated by a comma.
|
||||
|
||||
Args:
|
||||
subject (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, List[PreviousConsentSession]]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
subject=subject,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
subject: str,
|
||||
) -> Optional[Union[GenericError, List[PreviousConsentSession]]]:
|
||||
"""Lists All Consent Sessions of a Subject
|
||||
|
||||
This endpoint lists all subject's granted consent sessions, including client and granted scope.
|
||||
If the subject is unknown or has not granted any consent sessions yet, the endpoint returns an
|
||||
empty JSON array with status code 200 OK.
|
||||
|
||||
|
||||
The \"Link\" header is also included in successful responses, which contains one or more links for
|
||||
pagination, formatted like so: '<https://hydra-
|
||||
url/admin/oauth2/auth/sessions/consent?subject={user}&limit={limit}&offset={offset}>;
|
||||
rel=\"{page}\"', where page is one of the following applicable pages: 'first', 'next', 'last', and
|
||||
'previous'.
|
||||
Multiple links can be included in this header, and will be separated by a comma.
|
||||
|
||||
Args:
|
||||
subject (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, List[PreviousConsentSession]]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
subject=subject,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
subject: str,
|
||||
) -> Response[Union[GenericError, List[PreviousConsentSession]]]:
|
||||
"""Lists All Consent Sessions of a Subject
|
||||
|
||||
This endpoint lists all subject's granted consent sessions, including client and granted scope.
|
||||
If the subject is unknown or has not granted any consent sessions yet, the endpoint returns an
|
||||
empty JSON array with status code 200 OK.
|
||||
|
||||
|
||||
The \"Link\" header is also included in successful responses, which contains one or more links for
|
||||
pagination, formatted like so: '<https://hydra-
|
||||
url/admin/oauth2/auth/sessions/consent?subject={user}&limit={limit}&offset={offset}>;
|
||||
rel=\"{page}\"', where page is one of the following applicable pages: 'first', 'next', 'last', and
|
||||
'previous'.
|
||||
Multiple links can be included in this header, and will be separated by a comma.
|
||||
|
||||
Args:
|
||||
subject (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, List[PreviousConsentSession]]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
subject=subject,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
subject: str,
|
||||
) -> Optional[Union[GenericError, List[PreviousConsentSession]]]:
|
||||
"""Lists All Consent Sessions of a Subject
|
||||
|
||||
This endpoint lists all subject's granted consent sessions, including client and granted scope.
|
||||
If the subject is unknown or has not granted any consent sessions yet, the endpoint returns an
|
||||
empty JSON array with status code 200 OK.
|
||||
|
||||
|
||||
The \"Link\" header is also included in successful responses, which contains one or more links for
|
||||
pagination, formatted like so: '<https://hydra-
|
||||
url/admin/oauth2/auth/sessions/consent?subject={user}&limit={limit}&offset={offset}>;
|
||||
rel=\"{page}\"', where page is one of the following applicable pages: 'first', 'next', 'last', and
|
||||
'previous'.
|
||||
Multiple links can be included in this header, and will be separated by a comma.
|
||||
|
||||
Args:
|
||||
subject (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, List[PreviousConsentSession]]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
subject=subject,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,99 @@
|
|||
from typing import Any, Dict
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/metrics/prometheus".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Any]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=None,
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Any]:
|
||||
"""Get Snapshot Metrics from the Hydra Service.
|
||||
|
||||
If you're using k8s, you can then add annotations to your deployment like so:
|
||||
|
||||
```
|
||||
metadata:
|
||||
annotations:
|
||||
prometheus.io/port: \"4445\"
|
||||
prometheus.io/path: \"/metrics/prometheus\"
|
||||
```
|
||||
|
||||
If the service supports TLS Edge Termination, this endpoint does not require the
|
||||
`X-Forwarded-Proto` header to be set.
|
||||
|
||||
Returns:
|
||||
Response[Any]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Any]:
|
||||
"""Get Snapshot Metrics from the Hydra Service.
|
||||
|
||||
If you're using k8s, you can then add annotations to your deployment like so:
|
||||
|
||||
```
|
||||
metadata:
|
||||
annotations:
|
||||
prometheus.io/port: \"4445\"
|
||||
prometheus.io/path: \"/metrics/prometheus\"
|
||||
```
|
||||
|
||||
If the service supports TLS Edge Termination, this endpoint does not require the
|
||||
`X-Forwarded-Proto` header to be set.
|
||||
|
||||
Returns:
|
||||
Response[Any]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
|
@ -0,0 +1,265 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.completed_request import CompletedRequest
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.reject_request import RejectRequest
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: RejectRequest,
|
||||
consent_challenge: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/auth/requests/consent/reject".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["consent_challenge"] = consent_challenge
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
json_json_body = json_body.to_dict()
|
||||
|
||||
return {
|
||||
"method": "put",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"json": json_json_body,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[CompletedRequest, GenericError]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = CompletedRequest.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 404:
|
||||
response_404 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_404
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[CompletedRequest, GenericError]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: RejectRequest,
|
||||
consent_challenge: str,
|
||||
) -> Response[Union[CompletedRequest, GenericError]]:
|
||||
"""Reject a Consent Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
to authenticate the subject and then tell ORY Hydra now about it. If the subject authenticated,
|
||||
he/she must now be asked if
|
||||
the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the
|
||||
subject's behalf.
|
||||
|
||||
The consent provider which handles this request and is a web app implemented and hosted by you. It
|
||||
shows a subject interface which asks the subject to
|
||||
grant or deny the client access to the requested scope (\"Application my-dropbox-app wants write
|
||||
access to all your private files\").
|
||||
|
||||
The consent challenge is appended to the consent provider's URL to which the subject's user-agent
|
||||
(browser) is redirected to. The consent
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then tells ORY Hydra if
|
||||
the subject accepted
|
||||
or rejected the request.
|
||||
|
||||
This endpoint tells ORY Hydra that the subject has not authorized the OAuth 2.0 client to access
|
||||
resources on his/her behalf.
|
||||
The consent provider must include a reason why the consent was not granted.
|
||||
|
||||
The response contains a redirect URL which the consent provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
consent_challenge (str):
|
||||
json_body (RejectRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
consent_challenge=consent_challenge,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: RejectRequest,
|
||||
consent_challenge: str,
|
||||
) -> Optional[Union[CompletedRequest, GenericError]]:
|
||||
"""Reject a Consent Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
to authenticate the subject and then tell ORY Hydra now about it. If the subject authenticated,
|
||||
he/she must now be asked if
|
||||
the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the
|
||||
subject's behalf.
|
||||
|
||||
The consent provider which handles this request and is a web app implemented and hosted by you. It
|
||||
shows a subject interface which asks the subject to
|
||||
grant or deny the client access to the requested scope (\"Application my-dropbox-app wants write
|
||||
access to all your private files\").
|
||||
|
||||
The consent challenge is appended to the consent provider's URL to which the subject's user-agent
|
||||
(browser) is redirected to. The consent
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then tells ORY Hydra if
|
||||
the subject accepted
|
||||
or rejected the request.
|
||||
|
||||
This endpoint tells ORY Hydra that the subject has not authorized the OAuth 2.0 client to access
|
||||
resources on his/her behalf.
|
||||
The consent provider must include a reason why the consent was not granted.
|
||||
|
||||
The response contains a redirect URL which the consent provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
consent_challenge (str):
|
||||
json_body (RejectRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
consent_challenge=consent_challenge,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: RejectRequest,
|
||||
consent_challenge: str,
|
||||
) -> Response[Union[CompletedRequest, GenericError]]:
|
||||
"""Reject a Consent Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
to authenticate the subject and then tell ORY Hydra now about it. If the subject authenticated,
|
||||
he/she must now be asked if
|
||||
the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the
|
||||
subject's behalf.
|
||||
|
||||
The consent provider which handles this request and is a web app implemented and hosted by you. It
|
||||
shows a subject interface which asks the subject to
|
||||
grant or deny the client access to the requested scope (\"Application my-dropbox-app wants write
|
||||
access to all your private files\").
|
||||
|
||||
The consent challenge is appended to the consent provider's URL to which the subject's user-agent
|
||||
(browser) is redirected to. The consent
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then tells ORY Hydra if
|
||||
the subject accepted
|
||||
or rejected the request.
|
||||
|
||||
This endpoint tells ORY Hydra that the subject has not authorized the OAuth 2.0 client to access
|
||||
resources on his/her behalf.
|
||||
The consent provider must include a reason why the consent was not granted.
|
||||
|
||||
The response contains a redirect URL which the consent provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
consent_challenge (str):
|
||||
json_body (RejectRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
consent_challenge=consent_challenge,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: RejectRequest,
|
||||
consent_challenge: str,
|
||||
) -> Optional[Union[CompletedRequest, GenericError]]:
|
||||
"""Reject a Consent Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
to authenticate the subject and then tell ORY Hydra now about it. If the subject authenticated,
|
||||
he/she must now be asked if
|
||||
the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the
|
||||
subject's behalf.
|
||||
|
||||
The consent provider which handles this request and is a web app implemented and hosted by you. It
|
||||
shows a subject interface which asks the subject to
|
||||
grant or deny the client access to the requested scope (\"Application my-dropbox-app wants write
|
||||
access to all your private files\").
|
||||
|
||||
The consent challenge is appended to the consent provider's URL to which the subject's user-agent
|
||||
(browser) is redirected to. The consent
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then tells ORY Hydra if
|
||||
the subject accepted
|
||||
or rejected the request.
|
||||
|
||||
This endpoint tells ORY Hydra that the subject has not authorized the OAuth 2.0 client to access
|
||||
resources on his/her behalf.
|
||||
The consent provider must include a reason why the consent was not granted.
|
||||
|
||||
The response contains a redirect URL which the consent provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
consent_challenge (str):
|
||||
json_body (RejectRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
consent_challenge=consent_challenge,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,253 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.completed_request import CompletedRequest
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.reject_request import RejectRequest
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: RejectRequest,
|
||||
login_challenge: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/auth/requests/login/reject".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["login_challenge"] = login_challenge
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
json_json_body = json_body.to_dict()
|
||||
|
||||
return {
|
||||
"method": "put",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"json": json_json_body,
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[CompletedRequest, GenericError]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = CompletedRequest.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_400 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_400
|
||||
if response.status_code == 401:
|
||||
response_401 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_401
|
||||
if response.status_code == 404:
|
||||
response_404 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_404
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[CompletedRequest, GenericError]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: RejectRequest,
|
||||
login_challenge: str,
|
||||
) -> Response[Union[CompletedRequest, GenericError]]:
|
||||
"""Reject a Login Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
(sometimes called \"identity provider\") to authenticate the subject and then tell ORY Hydra now
|
||||
about it. The login
|
||||
provider is an web-app you write and host, and it must be able to authenticate (\"show the subject a
|
||||
login screen\")
|
||||
a subject (in OAuth2 the proper name for subject is \"resource owner\").
|
||||
|
||||
The authentication challenge is appended to the login provider URL to which the subject's user-agent
|
||||
(browser) is redirected to. The login
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then accept or reject
|
||||
the requested authentication process.
|
||||
|
||||
This endpoint tells ORY Hydra that the subject has not authenticated and includes a reason why the
|
||||
authentication
|
||||
was be denied.
|
||||
|
||||
The response contains a redirect URL which the login provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
login_challenge (str):
|
||||
json_body (RejectRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
login_challenge=login_challenge,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: RejectRequest,
|
||||
login_challenge: str,
|
||||
) -> Optional[Union[CompletedRequest, GenericError]]:
|
||||
"""Reject a Login Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
(sometimes called \"identity provider\") to authenticate the subject and then tell ORY Hydra now
|
||||
about it. The login
|
||||
provider is an web-app you write and host, and it must be able to authenticate (\"show the subject a
|
||||
login screen\")
|
||||
a subject (in OAuth2 the proper name for subject is \"resource owner\").
|
||||
|
||||
The authentication challenge is appended to the login provider URL to which the subject's user-agent
|
||||
(browser) is redirected to. The login
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then accept or reject
|
||||
the requested authentication process.
|
||||
|
||||
This endpoint tells ORY Hydra that the subject has not authenticated and includes a reason why the
|
||||
authentication
|
||||
was be denied.
|
||||
|
||||
The response contains a redirect URL which the login provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
login_challenge (str):
|
||||
json_body (RejectRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
login_challenge=login_challenge,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: RejectRequest,
|
||||
login_challenge: str,
|
||||
) -> Response[Union[CompletedRequest, GenericError]]:
|
||||
"""Reject a Login Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
(sometimes called \"identity provider\") to authenticate the subject and then tell ORY Hydra now
|
||||
about it. The login
|
||||
provider is an web-app you write and host, and it must be able to authenticate (\"show the subject a
|
||||
login screen\")
|
||||
a subject (in OAuth2 the proper name for subject is \"resource owner\").
|
||||
|
||||
The authentication challenge is appended to the login provider URL to which the subject's user-agent
|
||||
(browser) is redirected to. The login
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then accept or reject
|
||||
the requested authentication process.
|
||||
|
||||
This endpoint tells ORY Hydra that the subject has not authenticated and includes a reason why the
|
||||
authentication
|
||||
was be denied.
|
||||
|
||||
The response contains a redirect URL which the login provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
login_challenge (str):
|
||||
json_body (RejectRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
login_challenge=login_challenge,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: RejectRequest,
|
||||
login_challenge: str,
|
||||
) -> Optional[Union[CompletedRequest, GenericError]]:
|
||||
"""Reject a Login Request
|
||||
|
||||
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the
|
||||
login provider
|
||||
(sometimes called \"identity provider\") to authenticate the subject and then tell ORY Hydra now
|
||||
about it. The login
|
||||
provider is an web-app you write and host, and it must be able to authenticate (\"show the subject a
|
||||
login screen\")
|
||||
a subject (in OAuth2 the proper name for subject is \"resource owner\").
|
||||
|
||||
The authentication challenge is appended to the login provider URL to which the subject's user-agent
|
||||
(browser) is redirected to. The login
|
||||
provider uses that challenge to fetch information on the OAuth2 request and then accept or reject
|
||||
the requested authentication process.
|
||||
|
||||
This endpoint tells ORY Hydra that the subject has not authenticated and includes a reason why the
|
||||
authentication
|
||||
was be denied.
|
||||
|
||||
The response contains a redirect URL which the login provider should redirect the user-agent to.
|
||||
|
||||
Args:
|
||||
login_challenge (str):
|
||||
json_body (RejectRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[CompletedRequest, GenericError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
login_challenge=login_challenge,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,200 @@
|
|||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.reject_request import RejectRequest
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
form_data: RejectRequest,
|
||||
json_body: RejectRequest,
|
||||
logout_challenge: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/auth/requests/logout/reject".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["logout_challenge"] = logout_challenge
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
json_body.to_dict()
|
||||
|
||||
return {
|
||||
"method": "put",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"data": form_data.to_dict(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, GenericError]]:
|
||||
if response.status_code == 204:
|
||||
response_204 = cast(Any, None)
|
||||
return response_204
|
||||
if response.status_code == 404:
|
||||
response_404 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_404
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, GenericError]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
form_data: RejectRequest,
|
||||
json_body: RejectRequest,
|
||||
logout_challenge: str,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""Reject a Logout Request
|
||||
|
||||
When a user or an application requests ORY Hydra to log out a user, this endpoint is used to deny
|
||||
that logout request.
|
||||
No body is required.
|
||||
|
||||
The response is empty as the logout provider has to chose what action to perform next.
|
||||
|
||||
Args:
|
||||
logout_challenge (str):
|
||||
json_body (RejectRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
form_data=form_data,
|
||||
json_body=json_body,
|
||||
logout_challenge=logout_challenge,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
form_data: RejectRequest,
|
||||
json_body: RejectRequest,
|
||||
logout_challenge: str,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""Reject a Logout Request
|
||||
|
||||
When a user or an application requests ORY Hydra to log out a user, this endpoint is used to deny
|
||||
that logout request.
|
||||
No body is required.
|
||||
|
||||
The response is empty as the logout provider has to chose what action to perform next.
|
||||
|
||||
Args:
|
||||
logout_challenge (str):
|
||||
json_body (RejectRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
form_data=form_data,
|
||||
json_body=json_body,
|
||||
logout_challenge=logout_challenge,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
form_data: RejectRequest,
|
||||
json_body: RejectRequest,
|
||||
logout_challenge: str,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""Reject a Logout Request
|
||||
|
||||
When a user or an application requests ORY Hydra to log out a user, this endpoint is used to deny
|
||||
that logout request.
|
||||
No body is required.
|
||||
|
||||
The response is empty as the logout provider has to chose what action to perform next.
|
||||
|
||||
Args:
|
||||
logout_challenge (str):
|
||||
json_body (RejectRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
form_data=form_data,
|
||||
json_body=json_body,
|
||||
logout_challenge=logout_challenge,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
form_data: RejectRequest,
|
||||
json_body: RejectRequest,
|
||||
logout_challenge: str,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""Reject a Logout Request
|
||||
|
||||
When a user or an application requests ORY Hydra to log out a user, this endpoint is used to deny
|
||||
that logout request.
|
||||
No body is required.
|
||||
|
||||
The response is empty as the logout provider has to chose what action to perform next.
|
||||
|
||||
Args:
|
||||
logout_challenge (str):
|
||||
json_body (RejectRequest):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
form_data=form_data,
|
||||
json_body=json_body,
|
||||
logout_challenge=logout_challenge,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,182 @@
|
|||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...types import UNSET, Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
subject: str,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/auth/sessions/login".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["subject"] = subject
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "delete",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, GenericError]]:
|
||||
if response.status_code == 204:
|
||||
response_204 = cast(Any, None)
|
||||
return response_204
|
||||
if response.status_code == 400:
|
||||
response_400 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_400
|
||||
if response.status_code == 404:
|
||||
response_404 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_404
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, GenericError]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
subject: str,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""Invalidates All Login Sessions of a Certain User
|
||||
Invalidates a Subject's Authentication Session
|
||||
|
||||
This endpoint invalidates a subject's authentication session. After revoking the authentication
|
||||
session, the subject
|
||||
has to re-authenticate at ORY Hydra. This endpoint does not invalidate any tokens and does not work
|
||||
with OpenID Connect
|
||||
Front- or Back-channel logout.
|
||||
|
||||
Args:
|
||||
subject (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
subject=subject,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
subject: str,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""Invalidates All Login Sessions of a Certain User
|
||||
Invalidates a Subject's Authentication Session
|
||||
|
||||
This endpoint invalidates a subject's authentication session. After revoking the authentication
|
||||
session, the subject
|
||||
has to re-authenticate at ORY Hydra. This endpoint does not invalidate any tokens and does not work
|
||||
with OpenID Connect
|
||||
Front- or Back-channel logout.
|
||||
|
||||
Args:
|
||||
subject (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
subject=subject,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
subject: str,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""Invalidates All Login Sessions of a Certain User
|
||||
Invalidates a Subject's Authentication Session
|
||||
|
||||
This endpoint invalidates a subject's authentication session. After revoking the authentication
|
||||
session, the subject
|
||||
has to re-authenticate at ORY Hydra. This endpoint does not invalidate any tokens and does not work
|
||||
with OpenID Connect
|
||||
Front- or Back-channel logout.
|
||||
|
||||
Args:
|
||||
subject (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
subject=subject,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
subject: str,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""Invalidates All Login Sessions of a Certain User
|
||||
Invalidates a Subject's Authentication Session
|
||||
|
||||
This endpoint invalidates a subject's authentication session. After revoking the authentication
|
||||
session, the subject
|
||||
has to re-authenticate at ORY Hydra. This endpoint does not invalidate any tokens and does not work
|
||||
with OpenID Connect
|
||||
Front- or Back-channel logout.
|
||||
|
||||
Args:
|
||||
subject (str):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
subject=subject,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,200 @@
|
|||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
subject: str,
|
||||
client: Union[Unset, None, str] = UNSET,
|
||||
all_: Union[Unset, None, bool] = UNSET,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/auth/sessions/consent".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
params: Dict[str, Any] = {}
|
||||
params["subject"] = subject
|
||||
|
||||
params["client"] = client
|
||||
|
||||
params["all"] = all_
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
return {
|
||||
"method": "delete",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, GenericError]]:
|
||||
if response.status_code == 204:
|
||||
response_204 = cast(Any, None)
|
||||
return response_204
|
||||
if response.status_code == 400:
|
||||
response_400 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_400
|
||||
if response.status_code == 404:
|
||||
response_404 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_404
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, GenericError]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
subject: str,
|
||||
client: Union[Unset, None, str] = UNSET,
|
||||
all_: Union[Unset, None, bool] = UNSET,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""Revokes Consent Sessions of a Subject for a Specific OAuth 2.0 Client
|
||||
|
||||
This endpoint revokes a subject's granted consent sessions for a specific OAuth 2.0 Client and
|
||||
invalidates all
|
||||
associated OAuth 2.0 Access Tokens.
|
||||
|
||||
Args:
|
||||
subject (str):
|
||||
client (Union[Unset, None, str]):
|
||||
all_ (Union[Unset, None, bool]):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
subject=subject,
|
||||
client=client,
|
||||
all_=all_,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
subject: str,
|
||||
client: Union[Unset, None, str] = UNSET,
|
||||
all_: Union[Unset, None, bool] = UNSET,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""Revokes Consent Sessions of a Subject for a Specific OAuth 2.0 Client
|
||||
|
||||
This endpoint revokes a subject's granted consent sessions for a specific OAuth 2.0 Client and
|
||||
invalidates all
|
||||
associated OAuth 2.0 Access Tokens.
|
||||
|
||||
Args:
|
||||
subject (str):
|
||||
client (Union[Unset, None, str]):
|
||||
all_ (Union[Unset, None, bool]):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
subject=subject,
|
||||
client=client,
|
||||
all_=all_,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
subject: str,
|
||||
client: Union[Unset, None, str] = UNSET,
|
||||
all_: Union[Unset, None, bool] = UNSET,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""Revokes Consent Sessions of a Subject for a Specific OAuth 2.0 Client
|
||||
|
||||
This endpoint revokes a subject's granted consent sessions for a specific OAuth 2.0 Client and
|
||||
invalidates all
|
||||
associated OAuth 2.0 Access Tokens.
|
||||
|
||||
Args:
|
||||
subject (str):
|
||||
client (Union[Unset, None, str]):
|
||||
all_ (Union[Unset, None, bool]):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
subject=subject,
|
||||
client=client,
|
||||
all_=all_,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
subject: str,
|
||||
client: Union[Unset, None, str] = UNSET,
|
||||
all_: Union[Unset, None, bool] = UNSET,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""Revokes Consent Sessions of a Subject for a Specific OAuth 2.0 Client
|
||||
|
||||
This endpoint revokes a subject's granted consent sessions for a specific OAuth 2.0 Client and
|
||||
invalidates all
|
||||
associated OAuth 2.0 Access Tokens.
|
||||
|
||||
Args:
|
||||
subject (str):
|
||||
client (Union[Unset, None, str]):
|
||||
all_ (Union[Unset, None, bool]):
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
subject=subject,
|
||||
client=client,
|
||||
all_=all_,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,223 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.json_web_key import JSONWebKey
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
set_: str,
|
||||
kid: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: JSONWebKey,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/keys/{set}/{kid}".format(_client.base_url, set=set_, kid=kid)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
json_json_body = json_body.to_dict()
|
||||
|
||||
return {
|
||||
"method": "put",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"json": json_json_body,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[GenericError, JSONWebKey]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = JSONWebKey.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 401:
|
||||
response_401 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_401
|
||||
if response.status_code == 403:
|
||||
response_403 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_403
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[GenericError, JSONWebKey]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
set_: str,
|
||||
kid: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: JSONWebKey,
|
||||
) -> Response[Union[GenericError, JSONWebKey]]:
|
||||
"""Update a JSON Web Key
|
||||
|
||||
Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your
|
||||
own.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
kid (str):
|
||||
json_body (JSONWebKey): It is important that this model object is named JSONWebKey for
|
||||
"swagger generate spec" to generate only on definition of a
|
||||
JSONWebKey.
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKey]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
set_=set_,
|
||||
kid=kid,
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
set_: str,
|
||||
kid: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: JSONWebKey,
|
||||
) -> Optional[Union[GenericError, JSONWebKey]]:
|
||||
"""Update a JSON Web Key
|
||||
|
||||
Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your
|
||||
own.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
kid (str):
|
||||
json_body (JSONWebKey): It is important that this model object is named JSONWebKey for
|
||||
"swagger generate spec" to generate only on definition of a
|
||||
JSONWebKey.
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKey]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
set_=set_,
|
||||
kid=kid,
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
set_: str,
|
||||
kid: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: JSONWebKey,
|
||||
) -> Response[Union[GenericError, JSONWebKey]]:
|
||||
"""Update a JSON Web Key
|
||||
|
||||
Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your
|
||||
own.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
kid (str):
|
||||
json_body (JSONWebKey): It is important that this model object is named JSONWebKey for
|
||||
"swagger generate spec" to generate only on definition of a
|
||||
JSONWebKey.
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKey]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
set_=set_,
|
||||
kid=kid,
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
set_: str,
|
||||
kid: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: JSONWebKey,
|
||||
) -> Optional[Union[GenericError, JSONWebKey]]:
|
||||
"""Update a JSON Web Key
|
||||
|
||||
Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your
|
||||
own.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
kid (str):
|
||||
json_body (JSONWebKey): It is important that this model object is named JSONWebKey for
|
||||
"swagger generate spec" to generate only on definition of a
|
||||
JSONWebKey.
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKey]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
set_=set_,
|
||||
kid=kid,
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,222 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.json_web_key_set import JSONWebKeySet
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: JSONWebKeySet,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/keys/{set}".format(_client.base_url, set=set_)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
json_json_body = json_body.to_dict()
|
||||
|
||||
return {
|
||||
"method": "put",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"json": json_json_body,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[GenericError, JSONWebKeySet]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = JSONWebKeySet.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 401:
|
||||
response_401 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_401
|
||||
if response.status_code == 403:
|
||||
response_403 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_403
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[GenericError, JSONWebKeySet]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: JSONWebKeySet,
|
||||
) -> Response[Union[GenericError, JSONWebKeySet]]:
|
||||
"""Update a JSON Web Key Set
|
||||
|
||||
Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your
|
||||
own.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
json_body (JSONWebKeySet): It is important that this model object is named JSONWebKeySet
|
||||
for
|
||||
"swagger generate spec" to generate only on definition of a
|
||||
JSONWebKeySet. Since one with the same name is previously defined as
|
||||
client.Client.JSONWebKeys and this one is last, this one will be
|
||||
effectively written in the swagger spec.
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
set_=set_,
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: JSONWebKeySet,
|
||||
) -> Optional[Union[GenericError, JSONWebKeySet]]:
|
||||
"""Update a JSON Web Key Set
|
||||
|
||||
Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your
|
||||
own.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
json_body (JSONWebKeySet): It is important that this model object is named JSONWebKeySet
|
||||
for
|
||||
"swagger generate spec" to generate only on definition of a
|
||||
JSONWebKeySet. Since one with the same name is previously defined as
|
||||
client.Client.JSONWebKeys and this one is last, this one will be
|
||||
effectively written in the swagger spec.
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
set_=set_,
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: JSONWebKeySet,
|
||||
) -> Response[Union[GenericError, JSONWebKeySet]]:
|
||||
"""Update a JSON Web Key Set
|
||||
|
||||
Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your
|
||||
own.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
json_body (JSONWebKeySet): It is important that this model object is named JSONWebKeySet
|
||||
for
|
||||
"swagger generate spec" to generate only on definition of a
|
||||
JSONWebKeySet. Since one with the same name is previously defined as
|
||||
client.Client.JSONWebKeys and this one is last, this one will be
|
||||
effectively written in the swagger spec.
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
set_=set_,
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
set_: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: JSONWebKeySet,
|
||||
) -> Optional[Union[GenericError, JSONWebKeySet]]:
|
||||
"""Update a JSON Web Key Set
|
||||
|
||||
Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your
|
||||
own.
|
||||
|
||||
A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a
|
||||
cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key
|
||||
is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys
|
||||
used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined
|
||||
keys as well.
|
||||
|
||||
Args:
|
||||
set_ (str):
|
||||
json_body (JSONWebKeySet): It is important that this model object is named JSONWebKeySet
|
||||
for
|
||||
"swagger generate spec" to generate only on definition of a
|
||||
JSONWebKeySet. Since one with the same name is previously defined as
|
||||
client.Client.JSONWebKeys and this one is last, this one will be
|
||||
effectively written in the swagger spec.
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
set_=set_,
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,194 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.o_auth_2_client import OAuth2Client
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: OAuth2Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/clients/{id}".format(_client.base_url, id=id)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
json_json_body = json_body.to_dict()
|
||||
|
||||
return {
|
||||
"method": "put",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
"json": json_json_body,
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[GenericError, OAuth2Client]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = OAuth2Client.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[GenericError, OAuth2Client]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: OAuth2Client,
|
||||
) -> Response[Union[GenericError, OAuth2Client]]:
|
||||
"""Update an OAuth 2.0 Client
|
||||
|
||||
Update an existing OAuth 2.0 Client. If you pass `client_secret` the secret will be updated and
|
||||
returned via the API. This is the only time you will be able to retrieve the client secret, so write
|
||||
it down and keep it safe.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
json_body (OAuth2Client):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, OAuth2Client]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: OAuth2Client,
|
||||
) -> Optional[Union[GenericError, OAuth2Client]]:
|
||||
"""Update an OAuth 2.0 Client
|
||||
|
||||
Update an existing OAuth 2.0 Client. If you pass `client_secret` the secret will be updated and
|
||||
returned via the API. This is the only time you will be able to retrieve the client secret, so write
|
||||
it down and keep it safe.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
json_body (OAuth2Client):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, OAuth2Client]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: OAuth2Client,
|
||||
) -> Response[Union[GenericError, OAuth2Client]]:
|
||||
"""Update an OAuth 2.0 Client
|
||||
|
||||
Update an existing OAuth 2.0 Client. If you pass `client_secret` the secret will be updated and
|
||||
returned via the API. This is the only time you will be able to retrieve the client secret, so write
|
||||
it down and keep it safe.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
json_body (OAuth2Client):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, OAuth2Client]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
_client: Client,
|
||||
json_body: OAuth2Client,
|
||||
) -> Optional[Union[GenericError, OAuth2Client]]:
|
||||
"""Update an OAuth 2.0 Client
|
||||
|
||||
Update an existing OAuth 2.0 Client. If you pass `client_secret` the secret will be updated and
|
||||
returned via the API. This is the only time you will be able to retrieve the client secret, so write
|
||||
it down and keep it safe.
|
||||
|
||||
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients
|
||||
are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
||||
To manage ORY Hydra, you will need an OAuth 2.0 Client as well. Make sure that this endpoint is well
|
||||
protected and only callable by first-party components.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
json_body (OAuth2Client):
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, OAuth2Client]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
_client=_client,
|
||||
json_body=json_body,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,87 @@
|
|||
from typing import Any, Dict
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/sessions/logout".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Any]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=None,
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Any]:
|
||||
"""OpenID Connect Front-Backchannel Enabled Logout
|
||||
|
||||
This endpoint initiates and completes user logout at ORY Hydra and initiates OpenID Connect
|
||||
Front-/Back-channel logout:
|
||||
|
||||
https://openid.net/specs/openid-connect-frontchannel-1_0.html
|
||||
https://openid.net/specs/openid-connect-backchannel-1_0.html
|
||||
|
||||
Returns:
|
||||
Response[Any]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Any]:
|
||||
"""OpenID Connect Front-Backchannel Enabled Logout
|
||||
|
||||
This endpoint initiates and completes user logout at ORY Hydra and initiates OpenID Connect
|
||||
Front-/Back-channel logout:
|
||||
|
||||
https://openid.net/specs/openid-connect-frontchannel-1_0.html
|
||||
https://openid.net/specs/openid-connect-backchannel-1_0.html
|
||||
|
||||
Returns:
|
||||
Response[Any]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
|
@ -0,0 +1,165 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.well_known import WellKnown
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/.well-known/openid-configuration".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[GenericError, WellKnown]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = WellKnown.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 401:
|
||||
response_401 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_401
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[GenericError, WellKnown]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[GenericError, WellKnown]]:
|
||||
"""OpenID Connect Discovery
|
||||
|
||||
The well known endpoint an be used to retrieve information for OpenID Connect clients. We encourage
|
||||
you to not roll
|
||||
your own OpenID Connect client but to use an OpenID Connect client library instead. You can learn
|
||||
more on this
|
||||
flow at https://openid.net/specs/openid-connect-discovery-1_0.html .
|
||||
|
||||
Popular libraries for OpenID Connect clients include oidc-client-js (JavaScript), go-oidc (Golang),
|
||||
and others.
|
||||
For a full list of clients go here: https://openid.net/developers/certified/
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, WellKnown]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[GenericError, WellKnown]]:
|
||||
"""OpenID Connect Discovery
|
||||
|
||||
The well known endpoint an be used to retrieve information for OpenID Connect clients. We encourage
|
||||
you to not roll
|
||||
your own OpenID Connect client but to use an OpenID Connect client library instead. You can learn
|
||||
more on this
|
||||
flow at https://openid.net/specs/openid-connect-discovery-1_0.html .
|
||||
|
||||
Popular libraries for OpenID Connect clients include oidc-client-js (JavaScript), go-oidc (Golang),
|
||||
and others.
|
||||
For a full list of clients go here: https://openid.net/developers/certified/
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, WellKnown]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[GenericError, WellKnown]]:
|
||||
"""OpenID Connect Discovery
|
||||
|
||||
The well known endpoint an be used to retrieve information for OpenID Connect clients. We encourage
|
||||
you to not roll
|
||||
your own OpenID Connect client but to use an OpenID Connect client library instead. You can learn
|
||||
more on this
|
||||
flow at https://openid.net/specs/openid-connect-discovery-1_0.html .
|
||||
|
||||
Popular libraries for OpenID Connect clients include oidc-client-js (JavaScript), go-oidc (Golang),
|
||||
and others.
|
||||
For a full list of clients go here: https://openid.net/developers/certified/
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, WellKnown]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[GenericError, WellKnown]]:
|
||||
"""OpenID Connect Discovery
|
||||
|
||||
The well known endpoint an be used to retrieve information for OpenID Connect clients. We encourage
|
||||
you to not roll
|
||||
your own OpenID Connect client but to use an OpenID Connect client library instead. You can learn
|
||||
more on this
|
||||
flow at https://openid.net/specs/openid-connect-discovery-1_0.html .
|
||||
|
||||
Popular libraries for OpenID Connect clients include oidc-client-js (JavaScript), go-oidc (Golang),
|
||||
and others.
|
||||
For a full list of clients go here: https://openid.net/developers/certified/
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, WellKnown]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,161 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.health_not_ready_status import HealthNotReadyStatus
|
||||
from ...models.health_status import HealthStatus
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/health/ready".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[HealthNotReadyStatus, HealthStatus]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = HealthStatus.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 503:
|
||||
response_503 = HealthNotReadyStatus.from_dict(response.json())
|
||||
|
||||
return response_503
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[HealthNotReadyStatus, HealthStatus]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[HealthNotReadyStatus, HealthStatus]]:
|
||||
"""Check Readiness Status
|
||||
|
||||
This endpoint returns a 200 status code when the HTTP server is up running and the environment
|
||||
dependencies (e.g.
|
||||
the database) are responsive as well.
|
||||
|
||||
If the service supports TLS Edge Termination, this endpoint does not require the
|
||||
`X-Forwarded-Proto` header to be set.
|
||||
|
||||
Be aware that if you are running multiple nodes of this service, the health status will never
|
||||
refer to the cluster state, only to a single instance.
|
||||
|
||||
Returns:
|
||||
Response[Union[HealthNotReadyStatus, HealthStatus]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[HealthNotReadyStatus, HealthStatus]]:
|
||||
"""Check Readiness Status
|
||||
|
||||
This endpoint returns a 200 status code when the HTTP server is up running and the environment
|
||||
dependencies (e.g.
|
||||
the database) are responsive as well.
|
||||
|
||||
If the service supports TLS Edge Termination, this endpoint does not require the
|
||||
`X-Forwarded-Proto` header to be set.
|
||||
|
||||
Be aware that if you are running multiple nodes of this service, the health status will never
|
||||
refer to the cluster state, only to a single instance.
|
||||
|
||||
Returns:
|
||||
Response[Union[HealthNotReadyStatus, HealthStatus]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[HealthNotReadyStatus, HealthStatus]]:
|
||||
"""Check Readiness Status
|
||||
|
||||
This endpoint returns a 200 status code when the HTTP server is up running and the environment
|
||||
dependencies (e.g.
|
||||
the database) are responsive as well.
|
||||
|
||||
If the service supports TLS Edge Termination, this endpoint does not require the
|
||||
`X-Forwarded-Proto` header to be set.
|
||||
|
||||
Be aware that if you are running multiple nodes of this service, the health status will never
|
||||
refer to the cluster state, only to a single instance.
|
||||
|
||||
Returns:
|
||||
Response[Union[HealthNotReadyStatus, HealthStatus]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[HealthNotReadyStatus, HealthStatus]]:
|
||||
"""Check Readiness Status
|
||||
|
||||
This endpoint returns a 200 status code when the HTTP server is up running and the environment
|
||||
dependencies (e.g.
|
||||
the database) are responsive as well.
|
||||
|
||||
If the service supports TLS Edge Termination, this endpoint does not require the
|
||||
`X-Forwarded-Proto` header to be set.
|
||||
|
||||
Be aware that if you are running multiple nodes of this service, the health status will never
|
||||
refer to the cluster state, only to a single instance.
|
||||
|
||||
Returns:
|
||||
Response[Union[HealthNotReadyStatus, HealthStatus]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,173 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import AuthenticatedClient
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.oauth_2_token_response import Oauth2TokenResponse
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: AuthenticatedClient,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/token".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "post",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[GenericError, Oauth2TokenResponse]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Oauth2TokenResponse.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_400 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_400
|
||||
if response.status_code == 401:
|
||||
response_401 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_401
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[GenericError, Oauth2TokenResponse]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: AuthenticatedClient,
|
||||
) -> Response[Union[GenericError, Oauth2TokenResponse]]:
|
||||
"""The OAuth 2.0 Token Endpoint
|
||||
|
||||
The client makes a request to the token endpoint by sending the
|
||||
following parameters using the \"application/x-www-form-urlencoded\" HTTP
|
||||
request entity-body.
|
||||
|
||||
> Do not implement a client for this endpoint yourself. Use a library. There are many libraries
|
||||
> available for any programming language. You can find a list of libraries here:
|
||||
https://oauth.net/code/
|
||||
>
|
||||
> Do note that Hydra SDK does not implement this endpoint properly. Use one of the libraries listed
|
||||
above!
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, Oauth2TokenResponse]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: AuthenticatedClient,
|
||||
) -> Optional[Union[GenericError, Oauth2TokenResponse]]:
|
||||
"""The OAuth 2.0 Token Endpoint
|
||||
|
||||
The client makes a request to the token endpoint by sending the
|
||||
following parameters using the \"application/x-www-form-urlencoded\" HTTP
|
||||
request entity-body.
|
||||
|
||||
> Do not implement a client for this endpoint yourself. Use a library. There are many libraries
|
||||
> available for any programming language. You can find a list of libraries here:
|
||||
https://oauth.net/code/
|
||||
>
|
||||
> Do note that Hydra SDK does not implement this endpoint properly. Use one of the libraries listed
|
||||
above!
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, Oauth2TokenResponse]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: AuthenticatedClient,
|
||||
) -> Response[Union[GenericError, Oauth2TokenResponse]]:
|
||||
"""The OAuth 2.0 Token Endpoint
|
||||
|
||||
The client makes a request to the token endpoint by sending the
|
||||
following parameters using the \"application/x-www-form-urlencoded\" HTTP
|
||||
request entity-body.
|
||||
|
||||
> Do not implement a client for this endpoint yourself. Use a library. There are many libraries
|
||||
> available for any programming language. You can find a list of libraries here:
|
||||
https://oauth.net/code/
|
||||
>
|
||||
> Do note that Hydra SDK does not implement this endpoint properly. Use one of the libraries listed
|
||||
above!
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, Oauth2TokenResponse]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: AuthenticatedClient,
|
||||
) -> Optional[Union[GenericError, Oauth2TokenResponse]]:
|
||||
"""The OAuth 2.0 Token Endpoint
|
||||
|
||||
The client makes a request to the token endpoint by sending the
|
||||
following parameters using the \"application/x-www-form-urlencoded\" HTTP
|
||||
request entity-body.
|
||||
|
||||
> Do not implement a client for this endpoint yourself. Use a library. There are many libraries
|
||||
> available for any programming language. You can find a list of libraries here:
|
||||
https://oauth.net/code/
|
||||
>
|
||||
> Do note that Hydra SDK does not implement this endpoint properly. Use one of the libraries listed
|
||||
above!
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, Oauth2TokenResponse]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
)
|
||||
).parsed
|
147
libs/ory-hydra-client/ory_hydra_client/api/public/oauth_auth.py
Normal file
147
libs/ory-hydra-client/ory_hydra_client/api/public/oauth_auth.py
Normal file
|
@ -0,0 +1,147 @@
|
|||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/auth".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, GenericError]]:
|
||||
if response.status_code == 302:
|
||||
response_302 = cast(Any, None)
|
||||
return response_302
|
||||
if response.status_code == 401:
|
||||
response_401 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_401
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, GenericError]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""The OAuth 2.0 Authorize Endpoint
|
||||
|
||||
This endpoint is not documented here because you should never use your own implementation to perform
|
||||
OAuth2 flows.
|
||||
OAuth2 is a very popular protocol and a library for your programming language will exists.
|
||||
|
||||
To learn more about this flow please refer to the specification: https://tools.ietf.org/html/rfc6749
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""The OAuth 2.0 Authorize Endpoint
|
||||
|
||||
This endpoint is not documented here because you should never use your own implementation to perform
|
||||
OAuth2 flows.
|
||||
OAuth2 is a very popular protocol and a library for your programming language will exists.
|
||||
|
||||
To learn more about this flow please refer to the specification: https://tools.ietf.org/html/rfc6749
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""The OAuth 2.0 Authorize Endpoint
|
||||
|
||||
This endpoint is not documented here because you should never use your own implementation to perform
|
||||
OAuth2 flows.
|
||||
OAuth2 is a very popular protocol and a library for your programming language will exists.
|
||||
|
||||
To learn more about this flow please refer to the specification: https://tools.ietf.org/html/rfc6749
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""The OAuth 2.0 Authorize Endpoint
|
||||
|
||||
This endpoint is not documented here because you should never use your own implementation to perform
|
||||
OAuth2 flows.
|
||||
OAuth2 is a very popular protocol and a library for your programming language will exists.
|
||||
|
||||
To learn more about this flow please refer to the specification: https://tools.ietf.org/html/rfc6749
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
)
|
||||
).parsed
|
|
@ -0,0 +1,155 @@
|
|||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import AuthenticatedClient
|
||||
from ...models.generic_error import GenericError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: AuthenticatedClient,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/oauth2/revoke".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "post",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, GenericError]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = cast(Any, None)
|
||||
return response_200
|
||||
if response.status_code == 401:
|
||||
response_401 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_401
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, GenericError]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: AuthenticatedClient,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""Revoke OAuth2 Tokens
|
||||
|
||||
Revoking a token (both access and refresh) means that the tokens will be invalid. A revoked access
|
||||
token can no
|
||||
longer be used to make access requests, and a revoked refresh token can no longer be used to refresh
|
||||
an access token.
|
||||
Revoking a refresh token also invalidates the access token that was created with it. A token may
|
||||
only be revoked by
|
||||
the client the token was generated for.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: AuthenticatedClient,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""Revoke OAuth2 Tokens
|
||||
|
||||
Revoking a token (both access and refresh) means that the tokens will be invalid. A revoked access
|
||||
token can no
|
||||
longer be used to make access requests, and a revoked refresh token can no longer be used to refresh
|
||||
an access token.
|
||||
Revoking a refresh token also invalidates the access token that was created with it. A token may
|
||||
only be revoked by
|
||||
the client the token was generated for.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: AuthenticatedClient,
|
||||
) -> Response[Union[Any, GenericError]]:
|
||||
"""Revoke OAuth2 Tokens
|
||||
|
||||
Revoking a token (both access and refresh) means that the tokens will be invalid. A revoked access
|
||||
token can no
|
||||
longer be used to make access requests, and a revoked refresh token can no longer be used to refresh
|
||||
an access token.
|
||||
Revoking a refresh token also invalidates the access token that was created with it. A token may
|
||||
only be revoked by
|
||||
the client the token was generated for.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: AuthenticatedClient,
|
||||
) -> Optional[Union[Any, GenericError]]:
|
||||
"""Revoke OAuth2 Tokens
|
||||
|
||||
Revoking a token (both access and refresh) means that the tokens will be invalid. A revoked access
|
||||
token can no
|
||||
longer be used to make access requests, and a revoked refresh token can no longer be used to refresh
|
||||
an access token.
|
||||
Revoking a refresh token also invalidates the access token that was created with it. A token may
|
||||
only be revoked by
|
||||
the client the token was generated for.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, GenericError]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
)
|
||||
).parsed
|
149
libs/ory-hydra-client/ory_hydra_client/api/public/userinfo.py
Normal file
149
libs/ory-hydra-client/ory_hydra_client/api/public/userinfo.py
Normal file
|
@ -0,0 +1,149 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import AuthenticatedClient
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.userinfo_response import UserinfoResponse
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: AuthenticatedClient,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/userinfo".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[GenericError, UserinfoResponse]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UserinfoResponse.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 401:
|
||||
response_401 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_401
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[GenericError, UserinfoResponse]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: AuthenticatedClient,
|
||||
) -> Response[Union[GenericError, UserinfoResponse]]:
|
||||
"""OpenID Connect Userinfo
|
||||
|
||||
This endpoint returns the payload of the ID Token, including the idTokenExtra values, of
|
||||
the provided OAuth 2.0 Access Token.
|
||||
|
||||
For more information please [refer to the spec](http://openid.net/specs/openid-connect-
|
||||
core-1_0.html#UserInfo).
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, UserinfoResponse]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: AuthenticatedClient,
|
||||
) -> Optional[Union[GenericError, UserinfoResponse]]:
|
||||
"""OpenID Connect Userinfo
|
||||
|
||||
This endpoint returns the payload of the ID Token, including the idTokenExtra values, of
|
||||
the provided OAuth 2.0 Access Token.
|
||||
|
||||
For more information please [refer to the spec](http://openid.net/specs/openid-connect-
|
||||
core-1_0.html#UserInfo).
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, UserinfoResponse]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: AuthenticatedClient,
|
||||
) -> Response[Union[GenericError, UserinfoResponse]]:
|
||||
"""OpenID Connect Userinfo
|
||||
|
||||
This endpoint returns the payload of the ID Token, including the idTokenExtra values, of
|
||||
the provided OAuth 2.0 Access Token.
|
||||
|
||||
For more information please [refer to the spec](http://openid.net/specs/openid-connect-
|
||||
core-1_0.html#UserInfo).
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, UserinfoResponse]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: AuthenticatedClient,
|
||||
) -> Optional[Union[GenericError, UserinfoResponse]]:
|
||||
"""OpenID Connect Userinfo
|
||||
|
||||
This endpoint returns the payload of the ID Token, including the idTokenExtra values, of
|
||||
the provided OAuth 2.0 Access Token.
|
||||
|
||||
For more information please [refer to the spec](http://openid.net/specs/openid-connect-
|
||||
core-1_0.html#UserInfo).
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, UserinfoResponse]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
)
|
||||
).parsed
|
141
libs/ory-hydra-client/ory_hydra_client/api/public/well_known.py
Normal file
141
libs/ory-hydra-client/ory_hydra_client/api/public/well_known.py
Normal file
|
@ -0,0 +1,141 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.generic_error import GenericError
|
||||
from ...models.json_web_key_set import JSONWebKeySet
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/.well-known/jwks.json".format(_client.base_url)
|
||||
|
||||
headers: Dict[str, str] = _client.get_headers()
|
||||
cookies: Dict[str, Any] = _client.get_cookies()
|
||||
|
||||
return {
|
||||
"method": "get",
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": _client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[GenericError, JSONWebKeySet]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = JSONWebKeySet.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
if response.status_code == 500:
|
||||
response_500 = GenericError.from_dict(response.json())
|
||||
|
||||
return response_500
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[GenericError, JSONWebKeySet]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[GenericError, JSONWebKeySet]]:
|
||||
"""JSON Web Keys Discovery
|
||||
|
||||
This endpoint returns JSON Web Keys to be used as public keys for verifying OpenID Connect ID Tokens
|
||||
and,
|
||||
if enabled, OAuth 2.0 JWT Access Tokens. This endpoint can be used with client libraries like
|
||||
[node-jwks-rsa](https://github.com/auth0/node-jwks-rsa) among others.
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
response = httpx.request(
|
||||
verify=_client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[GenericError, JSONWebKeySet]]:
|
||||
"""JSON Web Keys Discovery
|
||||
|
||||
This endpoint returns JSON Web Keys to be used as public keys for verifying OpenID Connect ID Tokens
|
||||
and,
|
||||
if enabled, OAuth 2.0 JWT Access Tokens. This endpoint can be used with client libraries like
|
||||
[node-jwks-rsa](https://github.com/auth0/node-jwks-rsa) among others.
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
_client=_client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Response[Union[GenericError, JSONWebKeySet]]:
|
||||
"""JSON Web Keys Discovery
|
||||
|
||||
This endpoint returns JSON Web Keys to be used as public keys for verifying OpenID Connect ID Tokens
|
||||
and,
|
||||
if enabled, OAuth 2.0 JWT Access Tokens. This endpoint can be used with client libraries like
|
||||
[node-jwks-rsa](https://github.com/auth0/node-jwks-rsa) among others.
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
_client=_client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=_client.verify_ssl) as __client:
|
||||
response = await __client.request(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
_client: Client,
|
||||
) -> Optional[Union[GenericError, JSONWebKeySet]]:
|
||||
"""JSON Web Keys Discovery
|
||||
|
||||
This endpoint returns JSON Web Keys to be used as public keys for verifying OpenID Connect ID Tokens
|
||||
and,
|
||||
if enabled, OAuth 2.0 JWT Access Tokens. This endpoint can be used with client libraries like
|
||||
[node-jwks-rsa](https://github.com/auth0/node-jwks-rsa) among others.
|
||||
|
||||
Returns:
|
||||
Response[Union[GenericError, JSONWebKeySet]]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
_client=_client,
|
||||
)
|
||||
).parsed
|
Loading…
Add table
Add a link
Reference in a new issue