Skip to content

Automate AzureMFA metadata retrieval and update #194

@phavekes

Description

@phavekes

Currently, the institution.yaml (definition of accepted endpoints) is generated manually, based upon the Federation Metadata url. The certificate in this configuration expires. This does not cause an issue, because the certificate validity date is not validated.

However, the expiration of the certificate does cause institutions to generate and apply a new certificate, and this causes authentications to fail, because then the validation of XML signature on the SAML assertion / response will fail.

To solve this, we want to load and cache the information from the Federation Metadata url. There are two places where metadata refresh can be triggered

  1. Before sending an AuthnRequest - we need tot sso_location and entity_id to send and AuthnRequest to the Azure IdP.
  2. We also need to use an unusual "just-in-time" trigger for refreshing the metadata of an entity – we refresh the metadata when we receive a SAML Response that was signed with a different certificate than that we have in our cache for the entity / institution. See Automate AzureMFA metadata retrieval and update #194 (comment) for why.
  • Add global config parameters for federation_metadata_cache_location

  • Be backwards compatible. If no metadata_url is configured for an entry in institution.yml, use the current behaviour

  • If :

    • a SAML Response is received, AND
    • metadata_url is present for an entry in institutions.yml, AND
    • no cache entry is present when sending the AutnRequest OR the certificate in the Signature in the SAML Response does not match one of the certificates from the cache then:
      • fetch the new metadata for the institution from the metadata_url
      • cache the information from the metadata (entityid, ssolocation, certificate) in a configurable file path.
      • use a separate cache file for each key in institutions.yml, using the key in the filename of the cash file.
  • An entry in institution.yml must at least hold:

    • identifier
    • email_domains
    • and either
      • metadata_location
    • or
      • entity_id
      • sso_location
      • certificates
  • log:

    • metadata cache-misses
    • signature validation failures
    • refreshing of metadata (start, success, failure),
    • the certificate that triggered a cache refresh.
    • on cache write all the info that was written to the cache:
      • certificates
      • entity_id
      • sso_location

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Delivered

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions