Documentation ¶
Index ¶
- Constants
- type ResponseOption
- type SAMLResponsePostData
- type TestProvider
- func (p *TestProvider) Close()
- func (p *TestProvider) ExpectedInvalidRequestID()
- func (p *TestProvider) SamlResponse(t *testing.T, opts ...ResponseOption) string
- func (p *TestProvider) ServerURL() string
- func (p *TestProvider) SetExpectedACSURL(acs string)
- func (p *TestProvider) SetExpectedBase64EncodedSAMLRequest(sr string)
- func (p *TestProvider) SetExpectedIssueInstant(ii time.Time)
- func (p *TestProvider) SetExpectedIssuer(sr string)
- func (p *TestProvider) SetExpectedProtocolBinding(pb string)
- func (p *TestProvider) SetExpectedRelayState(rs string)
- func (p *TestProvider) SetExpectedRequestID(id string)
Constants ¶
const ResponseSigned = `` /* 4524-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResponseOption ¶
type ResponseOption func(*responseOptions)
func WithResponseExpired ¶
func WithResponseExpired() ResponseOption
func WithResponseSigned ¶
func WithResponseSigned() ResponseOption
type SAMLResponsePostData ¶
type SAMLResponsePostData struct { SAMLResponse string `json:"saml_response"` RelayState string `json:"relay_state"` Destination string `json:"destination"` }
SAMLResponsePostData represents the SAML response data that is expected in the form data of a POST request.
func (*SAMLResponsePostData) PostRequest ¶
func (s *SAMLResponsePostData) PostRequest(t *testing.T) *http.Request
PostRequest creates an http POST request with the SAML response and relay state included as form data.
type TestProvider ¶
type TestProvider struct {
// contains filtered or unexported fields
}
TestProvider is an identity provider that can be used for testing SAML federeation and authentication flows.
func StartTestProvider ¶
func StartTestProvider(t *testing.T) *TestProvider
StartTestProvider starts a new identity provider for testing. The metadata XML is served at the "/saml/metadata" path. The server URL can be obtained by calling the ServerURL() method.
The metadata XML contains the HTTP-Post and Redirect sign-on endpoints. The sign-on endpoints will validate the incoming requests on their correctness. The SAMLResponse, RelayState, and Destination URL will be returned in a JSON file, that can be unmarshalled into testprovider.SAMLResponsePostData.
func (*TestProvider) Close ¶
func (p *TestProvider) Close()
Close shut downs the server and waits for all requests to complete.
func (*TestProvider) ExpectedInvalidRequestID ¶
func (p *TestProvider) ExpectedInvalidRequestID()
ExpectInvalidRequestID expects that the ID isn't XSD:ID conform.
func (*TestProvider) SamlResponse ¶
func (p *TestProvider) SamlResponse(t *testing.T, opts ...ResponseOption) string
func (*TestProvider) ServerURL ¶
func (p *TestProvider) ServerURL() string
ServerURL returns the test server URL.
func (*TestProvider) SetExpectedACSURL ¶
func (p *TestProvider) SetExpectedACSURL(acs string)
SetExpectedACSURL sets the in the SAML request expected assertion consumer service URL.
func (*TestProvider) SetExpectedBase64EncodedSAMLRequest ¶
func (p *TestProvider) SetExpectedBase64EncodedSAMLRequest(sr string)
SetExpectedSAMLRequest sets the expected SAML request.
func (*TestProvider) SetExpectedIssueInstant ¶
func (p *TestProvider) SetExpectedIssueInstant(ii time.Time)
SetExpectedACSURL sets the in the SAML request expected issue instant value.
func (*TestProvider) SetExpectedIssuer ¶
func (p *TestProvider) SetExpectedIssuer(sr string)
SetExpectedIssuer sets the in the SAML request expected issuer value.
func (*TestProvider) SetExpectedProtocolBinding ¶
func (p *TestProvider) SetExpectedProtocolBinding(pb string)
SetExpectedProtocolBinding sets the in the SAML request expected protocol binding. Defaults to the HTTP-POST binding.
func (*TestProvider) SetExpectedRelayState ¶
func (p *TestProvider) SetExpectedRelayState(rs string)
SetExpectedRelayState sets the expected RelayState value.
func (*TestProvider) SetExpectedRequestID ¶
func (p *TestProvider) SetExpectedRequestID(id string)
SetExpectedRequestID sets the in the SAML request expected request ID.