Skip to content

service.auth

Identities of the callers of the service and the priorities of their runs.

Identity

Bases: BaseModel

Who calls the service: a person or an agent acting for a person.

Attributes:

Name Type Description
name str

Name of the person or the agent.

kind Literal['person', 'agent']

person or agent.

owner str

The person responsible; a person's owner is the person.

load_tokens

load_tokens(path)

Read the tokens of the service from a YAML mapping of token to identity.

Parameters:

Name Type Description Default
path Path

The YAML file, e.g. {<token>: {name: mk, kind: person}}.

required

Returns:

Type Description
dict[str, Identity]

The identities by token.

Raises:

Type Description
ValueError

The file is no mapping, or a token is empty.

authenticate

authenticate(tokens, token)

The identity of a token, compared in constant time; None if unknown.

priority_of

priority_of(identity, owner)

The priority of the runs of an identity.

Parameters:

Name Type Description Default
identity Identity

The submitting identity.

required
owner str

The owner of the cluster.

required

Returns:

Type Description
Priority

OWNER for the owner and the owner's agents, STANDARD for other people,

Priority

AGENT for their agents.