Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support validUntil as optional #584

Open
wz2b opened this issue Dec 30, 2024 · 0 comments
Open

Support validUntil as optional #584

wz2b opened this issue Dec 30, 2024 · 0 comments

Comments

@wz2b
Copy link

wz2b commented Dec 30, 2024

My organization asked me to provide them with SP metadata that doesn't have a validUntil. There doesn't seem to be a way to do this, so I modified the library to have a special validDuration value (a const that's set to -1) to indicate that validUntil should be nil, causing it to not be emitted at all in the metadata. Unfortunately, it was kind of messy implementing this without breaking backward compatibility.

Looking at the specification, ValidUntil is optional, but the specification says you should provide either that or CacheDuration. However, the XML schema for metadata does not enforce that. Further, the specification recommends you only have validDuration on the root element of the metadata, but in this implementation it appears both in the EntityDescriptor and the SPSSODescriptor. My gut feel tells me there's no good reason to do this, though it may be required if for some reason you had multiple SPSSODesctiptors. The comments in the spec say you might want to do this to set shorter expiration or cache duration intervals than in the root document.

The standard says:

  • When used as the root element of a metadata instance, this element MUST contain either a validUntil or cacheDuration attribute.
  • It is RECOMMENDED that only the root element of a metadata instance contain either attribute.

One odd thing is that there is an omitempty decorator on these fields, but neither of them can actually be empty so I can't see how it has any effect:

	ValidUntil                    time.Time     `xml:"validUntil,attr,omitempty"`
	CacheDuration                 time.Duration `xml:"cacheDuration,attr,omitempty"`

What is the recommendation here? Is it time for a /v2 api?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant