find_scitoken¶
- igwn_auth_utils.find_scitoken(audience, scope, issuer=None, timeleft=60, skip_errors=True, warn=False, **kwargs)¶
Find and load a
SciTokenfor the givenaudienceandscope.- Parameters:
audience (
str) – the required audience (aud).scope (
str) – the required scope (scope).issuer (
str) – the value of theissclaim to enforce.timeleft (
int) – minimum required time left until expiry (in seconds) for a token to be considered ‘valid’skip_errors (
bool, optional) – skip over errors encoutered when attempting to deserialise discovered tokens; this may be useful to skip over invalid or expired tokens that exist, for example, which is why it is the default behaviour.warn (
bool) – emit a warning when a token fails to deserialize, or fails validation.kwargs – all keyword arguments are passed on to
scitokens.SciToken.deserialize()
- Returns:
token – the first token that matches the requirements
- Return type:
scitokens.SciToken- Raises:
IgwnAuthError – if no valid token can be found
See also
scitokens.SciToken.deserializefor details of the deserialisation, and any valid keyword arguments