Backend Class

MSAL based RESTful API wrapper implementation

Constructor

Backend(config_path, token_path, config: typing.Union[typing.Dict[str, str], NoneType] = None)

Methods

client_secret

Create a MSAL app based on a client id & secret

device_login

Create a MSAL app using the devicelogin workflow

get_access_token

Get an Oauth2 token

get_my_id

Extract the current user's OID

get_sas_parts

Parse a SAS URL into component parts

get_url

Get a URL directly without the MSAL integration

headers

Build the HTTP Headers with an Authentication header as appropriate

init_cache

Initialize MSAL token cache

load_config

Update current config with saved data

logout

Forget any saved access token. Deletes the token_path file.

request

Perform a RESTful API call using the MSAL app as appropriate

save_cache

Save the MSAL token cache as appropriate

save_config

Save a config as json

upload_blob

Upload a blob to a given sas path

client_secret

Create a MSAL app based on a client id & secret

client_secret(scopes)

Parameters

Name Description
scopes
Required

device_login

Create a MSAL app using the devicelogin workflow

device_login(scopes)

Parameters

Name Description
scopes
Required

get_access_token

Get an Oauth2 token

get_access_token()

get_my_id

Extract the current user's OID

get_my_id()

get_sas_parts

Parse a SAS URL into component parts

get_sas_parts(sas_uri)

Parameters

Name Description
cls
Required
sas_uri
Required

get_url

Get a URL directly without the MSAL integration

get_url(url)

Parameters

Name Description
url
Required

headers

Build the HTTP Headers with an Authentication header as appropriate

headers()

init_cache

Initialize MSAL token cache

init_cache()

load_config

Update current config with saved data

load_config()

logout

Forget any saved access token. Deletes the token_path file.

logout()

request

Perform a RESTful API call using the MSAL app as appropriate

request(method, path, json_data=None, params=None)

Parameters

Name Description
method
Required
path
Required
json_data
Default value: None
params
Default value: None

save_cache

Save the MSAL token cache as appropriate

save_cache()

save_config

Save a config as json

save_config()

upload_blob

Upload a blob to a given sas path

upload_blob(sas_token, path)

Parameters

Name Description
sas_token
Required
path
Required