specCoreIDPRequest returns a validated IdpAuthnRequest from NewIdentityProviderTest, issued at 2015-12-01T01:57:09Z. It restores the globals NewIdentityProviderTest changes.
(t *testing.T)
| 40 | // NewIdentityProviderTest, issued at 2015-12-01T01:57:09Z. It restores the globals |
| 41 | // NewIdentityProviderTest changes. |
| 42 | func specCoreIDPRequest(t *testing.T) *IdpAuthnRequest { |
| 43 | t.Helper() |
| 44 | oldTimeNow, oldRandReader, oldXMLEncRandReader := TimeNow, RandReader, xmlenc.RandReader |
| 45 | t.Cleanup(func() { |
| 46 | TimeNow, RandReader, xmlenc.RandReader = oldTimeNow, oldRandReader, oldXMLEncRandReader |
| 47 | }) |
| 48 | test := NewIdentityProviderTest(t, applyKey) |
| 49 | req := &IdpAuthnRequest{ |
| 50 | Now: TimeNow(), |
| 51 | IDP: &test.IDP, |
| 52 | RequestBuffer: []byte(`<AuthnRequest xmlns="urn:oasis:names:tc:SAML:2.0:protocol"` + |
| 53 | ` AssertionConsumerServiceURL="https://sp.example.com/saml2/acs"` + |
| 54 | ` Destination="https://idp.example.com/saml/sso"` + |
| 55 | ` ID="id-00020406080a0c0e10121416181a1c1e"` + |
| 56 | ` IssueInstant="2015-12-01T01:57:09Z" Version="2.0">` + |
| 57 | `<Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">https://sp.example.com/saml2/metadata</Issuer>` + |
| 58 | `</AuthnRequest>`), |
| 59 | } |
| 60 | var err error |
| 61 | req.HTTPRequest, err = http.NewRequest(http.MethodPost, "https://idp.example.com/saml/sso", nil) |
| 62 | assert.NilError(t, err) |
| 63 | assert.NilError(t, req.Validate()) |
| 64 | return req |
| 65 | } |
| 66 | |
| 67 | // saml-core §2.4.1.2 (lines 756-757): the SubjectConfirmationData |
| 68 | // NotBefore/NotOnOrAfter period "SHOULD fall within the overall assertion |
no test coverage detected