awsauthenticationlib package

Submodules

awsauthenticationlib.awsauthenticationlib module

Main code for awsauthenticationlib.

class awsauthenticationlib.awsauthenticationlib.AwsAuthenticator(arn, session_duration=3600, region=None)[source]

Bases: awsauthenticationlib.awsauthenticationlib.LoggerMixin

Interfaces with aws authentication mechanisms, providing pre signed urls, or authenticated sessions.

property assumed_role_credentials

Valid credentials for an assumed session.

Returns

A properly structured dictionary of an assumed session credentials.

Return type

credentials (dict)

get_billing_authenticated_session()[source]

Authenticates to billing and returns an authenticated session.

Returns

An authenticated session with headers and cookies set.

Return type

session (requests.Session)

get_control_tower_authenticated_session()[source]

Authenticates to control tower and returns an authenticated session.

Returns

An authenticated session with headers and cookies set.

Return type

session (requests.Session)

get_signed_url(domain='Example.com')[source]

Returns a pre signed url that is authenticated.

Parameters

domain (str) – The domain to request the session as.

Returns

An authenticated pre signed url.

Return type

url (str)

get_sso_authenticated_session()[source]

Authenticates to Single Sign On and returns an authenticated session.

Returns

An authenticated session with headers and cookies set.

Return type

session (requests.Session)

property session_credentials

Valid credentials for a session.

Returns

A properly structured dictionary of session credentials.

Return type

credentials (dict)

class awsauthenticationlib.awsauthenticationlib.CsrfTokenData(entity_type: str, attributes: dict, attribute_value: str, headers_name: str)[source]

Bases: object

Object modeling the data required for csrf token filtering.

attribute_value: str
attributes: dict
entity_type: str
headers_name: str
class awsauthenticationlib.awsauthenticationlib.Domains(region: str, root: str = 'aws.amazon.com', sign_in: str = 'signin.aws.amazon.com', console: str = 'console.aws.amazon.com')[source]

Bases: object

Dataclass holding the domains required for authenticating.

console: str = 'console.aws.amazon.com'
region: str
property regional_console

The domain of the regional console.

Returns

The regional console domain.

Return type

regional_console (str)

root: str = 'aws.amazon.com'
sign_in: str = 'signin.aws.amazon.com'
class awsauthenticationlib.awsauthenticationlib.FilterCookie(name: str, domain: str = '', exact_match: bool = False)[source]

Bases: object

Object modeling a cookie for filtering.

domain: str = ''
exact_match: bool = False
name: str
class awsauthenticationlib.awsauthenticationlib.LoggerMixin[source]

Bases: object

Logger.

property logger

Exposes the logger to be used by objects using the Mixin.

Returns

The properly named logger.

Return type

logger (logger)

class awsauthenticationlib.awsauthenticationlib.Urls(region: str, scheme: str = 'https://', root_domain: str = 'aws.amazon.com', root: str = 'https://aws.amazon.com', sign_in: str = 'https://signin.aws.amazon.com', console: str = 'https://console.aws.amazon.com', federation: str = 'https://signin.aws.amazon.com/federation')[source]

Bases: object

Dataclass holding the urls required for authenticating.

console: str = 'https://console.aws.amazon.com'
federation: str = 'https://signin.aws.amazon.com/federation'
region: str
property regional_console

The url of the regional console.

Returns

The regional console url.

Return type

regional_console (str)

property regional_relay_state

The regional relay state url.

Returns

The regional relay state url.

Return type

relay_state (str)

property regional_single_sign_on

The url of the regional single sign on.

Returns

The regional single sign on url.

Return type

regional_single_sign_on (str)

root: str = 'https://aws.amazon.com'
root_domain: str = 'aws.amazon.com'
scheme: str = 'https://'
sign_in: str = 'https://signin.aws.amazon.com'

awsauthenticationlib.awsauthenticationlibexceptions module

Custom exception code for awsauthenticationlib.

exception awsauthenticationlib.awsauthenticationlibexceptions.ExpiredCredentials[source]

Bases: Exception

Credentials used to assume the role has expired.

exception awsauthenticationlib.awsauthenticationlibexceptions.InvalidCredentials[source]

Bases: Exception

No credentials or the credentials provided are not correct.

exception awsauthenticationlib.awsauthenticationlibexceptions.NoSigninTokenReceived[source]

Bases: Exception

No Signing token was received.

awsauthenticationlib.utils module

Main code for utils.

class awsauthenticationlib.utils.HarParser(har_file)[source]

Bases: object

Parses a provided har file.

get_communication_for_billing()[source]

Returns a text of the communication of a valid login to billing.

Returns

Returns a text of the communication of a valid login to billing.

Return type

text (str)

get_communication_for_control_tower()[source]

Returns a text of the communication of a valid login to control tower.

Returns

Returns a text of the communication of a valid login to control tower.

Return type

text (str)

get_communication_for_sso()[source]

Returns a text of the communication of a valid login to single sign on.

Returns

Returns a text of the communication of a valid login to single sign on.

Return type

text (str)

render_communication_for_billing()[source]

Prints a text of the communication of a valid login to billing.

Returns

None

render_communication_for_control_tower()[source]

Prints a text of the communication of a valid login to control tower.

Returns

None

render_communication_for_sso()[source]

Prints a text of the communication of a valid login to single sign on.

Returns

None

Module contents

awsauthenticationlib package.

Import all parts from awsauthenticationlib here