AuthenticationContext Class
Retrieves authentication tokens from Azure Active Directory.
For usages, check out the "sample" folder at: https://github.com/AzureAD/azure-activedirectory-library-for-python
- Inheritance
-
builtins.objectAuthenticationContext
Constructor
AuthenticationContext(authority, validate_authority=None, cache=None, api_version=None, timeout=None, enable_pii=False, verify_ssl=None, proxies=None)
Parameters
- authority
- validate_authority
- cache
- api_version
- timeout
- enable_pii
- verify_ssl
- proxies
Methods
| acquire_token |
Gets a token for a given resource via cached tokens. |
| acquire_token_with_authorization_code |
Gets a token for a given resource via authorization code for a server app. |
| acquire_token_with_client_certificate |
Gets a token for a given resource via certificate credentials |
| acquire_token_with_client_credentials |
Gets a token for a given resource via client credentials. |
| acquire_token_with_device_code |
Gets a new access token using via a device code. |
| acquire_token_with_refresh_token |
Gets a token for a given resource via refresh tokens |
| acquire_token_with_username_password |
Gets a token for a given resource via user credentails. |
| acquire_user_code |
Gets the user code info which contains user_code, device_code for authenticating user on device. |
| cancel_request_to_get_token_with_device_code |
Cancels the polling request to get token with device code. |
acquire_token
Gets a token for a given resource via cached tokens.
acquire_token(resource, user_id, client_id)
Parameters
Returns
dic with several keys, include "accessToken" and "refreshToken".
acquire_token_with_authorization_code
Gets a token for a given resource via authorization code for a server app.
acquire_token_with_authorization_code(authorization_code, redirect_uri, resource, client_id, client_secret=None, code_verifier=None)
Parameters
- client_secret
- str
(only for confidential clients)The OAuth client secret of the calling application. This parameter if not set, defaults to None
- code_verifier
- str
(optional)The code verifier that was used to obtain authorization code if PKCE was used in the authorization code grant request.(usually used by public clients) This parameter if not set, defaults to None
Returns
dict with several keys, include "accessToken" and "refreshToken".
acquire_token_with_client_certificate
Gets a token for a given resource via certificate credentials
acquire_token_with_client_certificate(resource, client_id, certificate, thumbprint, public_certificate=None)
Parameters
- public_certificate
- <xref:optional>
if not None, it will be sent to the service for subject name and issuer based authentication, which is to support cert auto rolls. The value must match the certificate private key parameter.
Returns
dict with several keys, include "accessToken".
acquire_token_with_client_credentials
Gets a token for a given resource via client credentials.
acquire_token_with_client_credentials(resource, client_id, client_secret)
Parameters
Returns
dict with several keys, include "accessToken".
acquire_token_with_device_code
Gets a new access token using via a device code.
acquire_token_with_device_code(resource, user_code_info, client_id)
Parameters
Returns
dict with several keys, include "accessToken" and "refreshToken".
acquire_token_with_refresh_token
Gets a token for a given resource via refresh tokens
acquire_token_with_refresh_token(refresh_token, client_id, resource, client_secret=None)
Parameters
- refresh_token
- str
A refresh token returned in a tokne response from a previous invocation of acquireToken.
Returns
dict with several keys, include "accessToken" and "refreshToken".
acquire_token_with_username_password
Gets a token for a given resource via user credentails.
acquire_token_with_username_password(resource, username, password, client_id)
Parameters
Returns
dict with several keys, include "accessToken" and "refreshToken".
acquire_user_code
Gets the user code info which contains user_code, device_code for authenticating user on device.
acquire_user_code(resource, client_id, language=None)
Parameters
- resource
- str
A URI that identifies the resource for which the device_code and user_code is valid for.
- language
- str
The language code specifying how the message should be localized to.
Returns
dict contains code and uri for users to login through browser.
cancel_request_to_get_token_with_device_code
Cancels the polling request to get token with device code.
cancel_request_to_get_token_with_device_code(user_code_info)
Parameters
Returns
None
Attributes
options
الملاحظات
إرسال الملاحظات وعرضها المتعلقة بـ