ExSaml.Metadata (ex_saml v1.1.0)

Copy Markdown View Source

Public entry point for validating SAML 2.0 metadata documents.

validate/2 parses an XML document (raw binary) and returns a structured report of structural / spec-conformance violations. It is intended to be called at system boundaries — for example, before persisting IdP metadata uploaded through an administration form, or before publishing SP metadata to a partner.

This module currently implements spec-conformance rules only — every finding is an :error. Best-practice rules (warnings, strict mode, certificate linting) are added in subsequent releases.

Example

iex> ExSaml.Metadata.validate(xml)
{:ok, %ExSaml.Metadata.ValidationResult{errors: [], warnings: []}}

Options

  • :ignore — list of violation codes to silence. Matching violations are removed from both errors and warnings before the result is returned.

Return semantics

  • {:ok, %ValidationResult{errors: [], warnings: _}} when no error-level violation remains after :ignore is applied.
  • {:error, %ValidationResult{errors: errors, warnings: _}} otherwise.

See ExSaml.Metadata.ValidationResult for the shape of the returned struct.

Summary

Types

option()

@type option() :: {:ignore, [atom()]}

opts()

@type opts() :: [option()]

Functions

validate(xml)

validate(xml, opts)

@spec validate(binary(), opts()) ::
  {:ok, ExSaml.Metadata.ValidationResult.t()}
  | {:error, ExSaml.Metadata.ValidationResult.t()}