Documentation
¶
Index ¶
- type SAMLAssertion
- type Service
- func (s *Service) GenerateAuthnRequest(idpURL, relayState string) (string, string, error)
- func (s *Service) Metadata() string
- func (s *Service) NewServiceProvider(entityID, acsURL, metadataURL string) error
- func (s *Service) ParseAndValidateResponse(b64Response, expectedIssuer, relayState string, idpCert *x509.Certificate) (*SAMLAssertion, error)
- func (s *Service) ParseResponse(b64, expectedIssuer string) (string, error)
- func (s *Service) ValidateRelayState(relayState, expectedState string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SAMLAssertion ¶
type SAMLAssertion struct {
Issuer string
Subject string
NotBefore *time.Time
NotOnOrAfter *time.Time
Attributes map[string][]string
}
SAMLAssertion represents a parsed and validated SAML assertion
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides minimal SAML capabilities: SP metadata generation and assertion parsing
func NewService ¶
func NewService() *Service
NewService creates a SAML service without SP configured (parsing only)
func (*Service) GenerateAuthnRequest ¶
GenerateAuthnRequest creates a SAML AuthnRequest for login initiation
func (*Service) Metadata ¶
Metadata returns SP metadata XML using crewjam/saml if configured, else minimal fallback
func (*Service) NewServiceProvider ¶
NewServiceProvider initializes a ServiceProvider with self-signed certificate for metadata
func (*Service) ParseAndValidateResponse ¶
func (s *Service) ParseAndValidateResponse(b64Response, expectedIssuer, relayState string, idpCert *x509.Certificate) (*SAMLAssertion, error)
ParseAndValidateResponse performs full SAML response validation including signatures
func (*Service) ParseResponse ¶
ParseResponse decodes a base64-encoded SAMLResponse and extracts Issuer and NameID Returns NameID on success when Issuer matches expectedIssuer
func (*Service) ValidateRelayState ¶
ValidateRelayState checks if the RelayState matches expected format