AuthURLs

class pyvo.auth.AuthURLs[source]

Bases: object

AuthURLs helps determine which security method should be used with a given URL. It learns the security methods through the VOSI capabilities, which are passed in via update_from_capabilities.

Three collections are used internally:

full_urls

Exact-match entries, populated when a capability declares use="full". An exact match takes priority and is returned without consulting any other collection.

_explicit_urls

Prefix-match entries registered by callers via add_security_method_for_url. All matching entries are combined, so a registration for a base URL propagates to every sub-path beneath it.

_capability_urls

Prefix-match entries loaded from VOSI capabilities (use="base"). Only the most-specific (longest) matching entry is used.

For a given URL allowed_auth_methods returns the union of:

  1. The full_urls exact match, if one exists (short-circuits).

  2. All matching _explicit_urls entries.

  3. The single most-specific matching _capability_urls entry.

Methods Summary

add_security_method_for_url(url, security_method)

Add a security method for a url.

allowed_auth_methods(url)

Return the authentication methods allowed for a particular URL.

update_from_capabilities(capabilities)

Update the URL to security method mapping using the capabilities provided.

Methods Documentation

add_security_method_for_url(url, security_method, exact=False)[source]

Add a security method for a url. This is additive with update_from_capabilities. This can be useful to set additional security methods that aren’t set in the capabilities for whatever reason.

Parameters:
urlstr

URL to set a security method for

security_methodstr

URI of the security method to set

exactbool

If True, match only this URL. If False, match all URLs that start with this URL as a base.

allowed_auth_methods(url)[source]

Return the authentication methods allowed for a particular URL. The methods are returned as URIs that represent security methods.

Parameters:
urlstr

the URL to determine authentication methods

update_from_capabilities(capabilities)[source]

Update the URL to security method mapping using the capabilities provided.

Parameters:
capabilitiesobject

List of Capability