Documentation
¶
Overview ¶
Package saml 使用维护中的 SAML2 验证器处理签名和加密响应,禁用未经请求的登录。
Index ¶
- type Config
- type Endpoint
- type EndpointConfig
- type Service
- func (s *Service) Begin(ctx context.Context, binding string) (string, error)
- func (s *Service) BeginLogout(ctx context.Context, binding, nameID, index string) (string, error)
- func (s *Service) Close() error
- func (s *Service) Complete(ctx context.Context, binding string, r *http.Request) (security.Principal, error)
- func (s *Service) LogoutURL(nameID, state string) (string, error)
- func (s *Service) Metadata() ([]byte, error)
- func (s *Service) RefreshIDP(ctx context.Context) error
- func (s *Service) RotateKey(key crypto.Signer, certificate *x509.Certificate) error
- func (s *Service) SingleLogout(ctx context.Context, binding string, r *http.Request, ...) (string, error)
- func (s *Service) UpdateIDP(m *protocol.EntityDescriptor) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
IDPMetadataURL string
HTTPClient *http.Client
VerifyMetadata func(context.Context, []byte) error
EntityID, MetadataURL, ACSURL, LogoutURL string
Key crypto.Signer
Certificate *x509.Certificate
IDP *protocol.EntityDescriptor
Store oauth2.StateStore
TTL time.Duration
MaxPending int
AllowHTTP bool
Map func(context.Context, *protocol.Assertion) (security.Principal, error)
}
Config 声明SAML2 登录及单点退出所需的可信配置及实现。
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
Endpoint 承载SAML2 登录及单点退出的运行状态与显式操作。
func NewEndpoint ¶
func NewEndpoint(config EndpointConfig) (*Endpoint, error)
NewEndpoint 校验配置并创建SAML2 登录及单点退出组件。
type EndpointConfig ¶
type EndpointConfig struct {
// BindingCookie 隔离并行提供者的浏览器挑战,空值保留默认名称。
BindingCookie string
Service *Service
Sessions *session.Manager
Cookies *securityhttp.CookieSource
Links *federation.Service
LoginPath, LogoutPath, SuccessPath string
AllowHTTP bool
}
EndpointConfig 声明SAML2 登录及单点退出所需的可信配置及实现。
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service 承载SAML2 登录及单点退出的运行状态与显式操作。
func (*Service) BeginLogout ¶
BeginLogout 保存请求关联并签名会话索引,响应不能只靠 RelayState 判断有效。
func (*Service) Complete ¶
func (s *Service) Complete(ctx context.Context, binding string, r *http.Request) (security.Principal, error)
Complete 只接受与 SP 请求及浏览器绑定一致的响应;断言签名、受众、目的地和期限由协议库校验。
func (*Service) RefreshIDP ¶
RefreshIDP 从固定配置源读取有界 XML,禁用重定向,并在校验后原子更新证书。 VerifyMetadata 可验证签名或应用自己的固定指纹,网络客户端生命周期归应用。
func (*Service) RotateKey ¶
RotateKey 更换 SP 签名与解密密钥,旧密钥保留一个请求 TTL,以完成轮换前的在途响应。 最多保留八个有效旧密钥;超过额度时拒绝轮换,外部 Signer 生命周期归应用。