ScriptCasCredentialsManager

class ScriptCasCredentialsManager.CasCredentialsManager

Bases: object

Operations on stored credentials for servers or proxies.

Use cas.credentials to manage server credentials, and cas.proxy_credentials to manage proxy credentials for the connector accessing the server.

Note

The credentials are stored using the windows credentials api, and secured with your current user session.

exists_for(server_url) bool

Checks whether we have credentials for a specific server (or proxy).

Parameters:

server_url (str | Uri) – The server (or proxy) URL or hostname

Return type:

bool

Returns:

True if we have stored credentials for the given server (or proxy).

store(server_url, username: str, password: str, overwrite: bool = True)

Adds or replaces credentials for a specific server (or proxy).

Parameters:
  • server_url (str | Uri) – The server (or proxy) URL or hostname

  • username (str) – The username to use on this server (or proxy).

  • password (str) – The password to use on this server (or proxy).

  • overwrite (bool) – Whether to overwrite existing credentials for the server (or proxy), default is True. If set to False, an InvalidOperationExeption will be thrown.

delete(server_url)

Deletes any credentials for a specific server (or proxy), if there are some.

Parameters:

server_url (str | Uri) – The server (or proxy) URL or hostname

delete_all()

Deletes any credentials we have for servers (or proxies).

get_urls_and_users() dict[str, str]

Assembles a dictionary of known server (or proxy) URLs and usernames.

Return type:

dict[str, str]

Returns:

A dict with the server urls as keys, and the usernames as values.