From 0c4b14da0e78fb8e72f2f9a1f3f25b612d73a77d Mon Sep 17 00:00:00 2001 From: Manpreet Singh Date: Tue, 12 Dec 2017 11:26:55 -0800 Subject: [PATCH] Fix for #123 --- samlsp/middleware_test.go | 2 +- service_provider.go | 6 ++++-- service_provider_test.go | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/samlsp/middleware_test.go b/samlsp/middleware_test.go index cb225bf1..8b519f3d 100644 --- a/samlsp/middleware_test.go +++ b/samlsp/middleware_test.go @@ -92,7 +92,7 @@ func (test *MiddlewareTest) TestCanProduceMetadata(c *C) { c.Assert(resp.Header().Get("Content-type"), Equals, "application/samlmetadata+xml") c.Assert(string(resp.Body.Bytes()), DeepEquals, ""+ "\n"+ - " \n"+ + " \n"+ " \n"+ " \n"+ " \n"+ diff --git a/service_provider.go b/service_provider.go index bf730118..53028cf7 100644 --- a/service_provider.go +++ b/service_provider.go @@ -105,11 +105,12 @@ func (sp *ServiceProvider) Metadata() *EntityDescriptor { validDuration = sp.MetadataValidDuration } + validUntil := TimeNow().Add(validDuration) authnRequestsSigned := false wantAssertionsSigned := true return &EntityDescriptor{ EntityID: sp.MetadataURL.String(), - ValidUntil: TimeNow().Add(validDuration), + ValidUntil: validUntil, SPSSODescriptors: []SPSSODescriptor{ SPSSODescriptor{ @@ -136,6 +137,7 @@ func (sp *ServiceProvider) Metadata() *EntityDescriptor { }, }, }, + ValidUntil: validUntil, }, }, AuthnRequestsSigned: &authnRequestsSigned, @@ -401,7 +403,7 @@ func (sp *ServiceProvider) ParseResponse(req *http.Request, possibleRequestIDs [ return nil, retErr } if resp.Destination != sp.AcsURL.String() { - retErr.PrivateErr = fmt.Errorf("`Destination` does not match AcsURL (expected %q)", sp.AcsURL.String()) + retErr.PrivateErr = fmt.Errorf("Response `Destination` %v does not match AcsURL (expected %q)", resp.Destination, sp.AcsURL.String()) return nil, retErr } diff --git a/service_provider_test.go b/service_provider_test.go index a523b7b1..df55d1cc 100644 --- a/service_provider_test.go +++ b/service_provider_test.go @@ -115,7 +115,7 @@ func (test *ServiceProviderTest) TestCanProduceMetadata(c *C) { c.Assert(err, IsNil) c.Assert(string(spMetadata), DeepEquals, ""+ "\n"+ - " \n"+ + " \n"+ " \n"+ " \n"+ " \n"+