Documentation
¶
Index ¶
- func NewSaml(opts samlsp.Options, claims []string) (*samlsp.Middleware, error)
- func SamlSessionProvider(opts samlsp.Options, claims []string) samlsp.CookieSessionProvider
- type Attributes
- type Middleware
- func (Middleware) CaddyModule() caddy.ModuleInfo
- func (m *Middleware) Provision(ctx caddy.Context) error
- func (m *Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
- func (m *Middleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
- func (m *Middleware) Validate() error
- type SamlJWTSessionClaims
- type SamlJWTSessionCodec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSaml ¶
NewSaml creates a new Middleware with the default providers for the given options.
You can customize the behavior of the middleware in more detail by replacing and/or changing Session, RequestTracker, and ServiceProvider in the returned Middleware.
func SamlSessionProvider ¶
func SamlSessionProvider(opts samlsp.Options, claims []string) samlsp.CookieSessionProvider
SamlSessionProvider returns the default SessionProvider for the provided options, a CookieSessionProvider configured to store sessions in a cookie.
Types ¶
type Attributes ¶
Attributes is a map of attributes provided in the SAML assertion
func (Attributes) Get ¶
func (a Attributes) Get(key string) string
Get returns the first attribute named `key` or an empty string if no such attributes is present.
type Middleware ¶
type Middleware struct {
SamlIdpUrl string `json:"saml_idp_url,omitempty"`
SamlCertFile string `json:"saml_cert_file,omitempty"`
SamlKeyFile string `json:"saml_cert_key,omitempty"`
SamlRootUrl string `json:"saml_root_url,omitempty"`
SamlEntityID string `json:"saml_entity_id,omitempty"`
SamlUserIdClaim string `json:"saml_userid_claim,omitempty"`
SamlClaims []string `json:"saml_claims,omitempty"`
SamlCookieName string `json:"saml_cookie_name,omitempty"`
SamlCookieSameSite string `json:"saml_cookie_samesite,omitempty"`
SamlRemoteUserVar string `json:"saml_remote_user_var,omitempty"`
SamlVarPrefix string `json:"saml_var_prefix,omitempty"`
SamlSP *samlsp.Middleware
SamlHandler http.Handler
}
Holds all the module's data
func (Middleware) CaddyModule ¶
func (Middleware) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*Middleware) Provision ¶
func (m *Middleware) Provision(ctx caddy.Context) error
Provision implements caddy.Provisioner.
func (*Middleware) ServeHTTP ¶
func (m *Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
ServeHTTP implements caddyhttp.MiddlewareHandler.
func (*Middleware) UnmarshalCaddyfile ¶
func (m *Middleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
UnmarshalCaddyfile implements caddyfile.Unmarshaler.
func (*Middleware) Validate ¶
func (m *Middleware) Validate() error
Validate implements caddy.Validator.
type SamlJWTSessionClaims ¶
type SamlJWTSessionClaims struct {
jwt.StandardClaims
Attributes Attributes `json:"attr"`
SAMLSession bool `json:"saml-session"`
}
SamlJWTSessionClaims represents the JWT claims in the encoded session
func (SamlJWTSessionClaims) GetAttributes ¶
func (c SamlJWTSessionClaims) GetAttributes() Attributes
GetAttributes implements SessionWithAttributes. It returns the SAMl attributes.
type SamlJWTSessionCodec ¶
type SamlJWTSessionCodec struct {
SigningMethod jwt.SigningMethod
Audience string
Issuer string
MaxAge time.Duration
Key crypto.Signer
Claims []string
}
SamlJWTSessionCodec implements SessionCoded to encode and decode Sessions from the corresponding JWT.
func SamlSessionCodec ¶
func SamlSessionCodec(opts samlsp.Options, claims []string) SamlJWTSessionCodec
SamltSessionCodec returns the default SessionCodec for the provided options, a SamlJWTSessionCodec configured to issue signed tokens.
func (SamlJWTSessionCodec) Decode ¶
func (c SamlJWTSessionCodec) Decode(signed string) (samlsp.Session, error)
Decode parses the serialized session that may have been returned by Encode and returns a Session.