chore: update crewjam/saml to v0.5.1 (#10652)

# Which Problems Are Solved

No usage of the current version of crewjam/saml.

# How the Problems Are Solved

Update dependency to v0.5.1.

# Additional Changes

None

# Additional Context

Closes #9783

---------

Co-authored-by: Livio Spring <[email protected]>
This commit is contained in:
Stefan Benz
2025-10-08 11:38:48 +02:00
committed by GitHub
co-authored by Livio Spring
parent f69a6ed4f3
commit d5cfbc7b00
5 changed files with 15 additions and 50 deletions
@@ -1277,7 +1277,7 @@ func getSAMLResponseAttributes(t *testing.T, samlResponse string, sp *samlsp.Mid
data, err := base64.StdEncoding.DecodeString(samlResponse)
require.NoError(t, err)
sp.ServiceProvider.AllowIDPInitiated = true
assertion, err := sp.ServiceProvider.ParseXMLResponse(data, []string{})
assertion, err := sp.ServiceProvider.ParseXMLResponse(data, []string{}, sp.ServiceProvider.AcsURL)
require.NoError(t, err)
return assertion.AttributeStatements[0].Attributes
}
@@ -1325,7 +1325,7 @@ func getSAMLResponseAttributes(t *testing.T, samlResponse string, sp *samlsp.Mid
data, err := base64.StdEncoding.DecodeString(samlResponse)
require.NoError(t, err)
sp.ServiceProvider.AllowIDPInitiated = true
assertion, err := sp.ServiceProvider.ParseXMLResponse(data, []string{})
assertion, err := sp.ServiceProvider.ParseXMLResponse(data, []string{}, sp.ServiceProvider.AcsURL)
require.NoError(t, err)
return assertion.AttributeStatements[0].Attributes
}
+1 -24
View File
@@ -133,7 +133,7 @@ func ParseMetadata(metadata []byte) (*saml.EntityDescriptor, error) {
if _, err := reader.Seek(0, io.SeekStart); err != nil {
return nil, err
}
entities := &EntitiesDescriptor{}
entities := &saml.EntitiesDescriptor{}
if err := decoder.Decode(entities); err != nil {
return nil, err
}
@@ -263,26 +263,3 @@ func nameIDFormatFromDomain(format domain.SAMLNameIDFormat) saml.NameIDFormat {
return saml.UnspecifiedNameIDFormat
}
}
// EntitiesDescriptor is a workaround until we eventually fork the crewjam/saml library, since maintenance on that repo seems to have stopped.
// This is to be able to handle xsd:duration format using the UnmarshalXML method.
// crewjam/saml only implements the xsd:dateTime format for EntityDescriptor, but not EntitiesDescriptor.
type EntitiesDescriptor saml.EntitiesDescriptor
// UnmarshalXML implements xml.Unmarshaler
func (m *EntitiesDescriptor) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
type Alias EntitiesDescriptor
aux := &struct {
ValidUntil *saml.RelaxedTime `xml:"validUntil,attr,omitempty"`
CacheDuration *saml.Duration `xml:"cacheDuration,attr,omitempty"`
*Alias
}{
Alias: (*Alias)(m),
}
if err := d.DecodeElement(aux, &start); err != nil {
return err
}
m.ValidUntil = (*time.Time)(aux.ValidUntil)
m.CacheDuration = (*time.Duration)(aux.CacheDuration)
return nil
}