Added support for SAML HTTP binding
This commit is contained in:
@@ -300,6 +300,8 @@ func (svc *service) LoadSamlService(ctx context.Context, s *settings.Settings) (
|
||||
SignRequests: s.Saml.SignRequests,
|
||||
SignatureMethod: s.Saml.SignMethod,
|
||||
|
||||
Binding: s.Saml.Binding,
|
||||
|
||||
IdentityPayload: saml.IdpIdentityPayload{
|
||||
Name: s.Saml.IDP.IdentName,
|
||||
Handle: s.Saml.IDP.IdentHandle,
|
||||
|
||||
@@ -48,6 +48,7 @@ func UpdateSettings(source *types.AppSettings, dest *settings.Settings) {
|
||||
dest.Saml.Key = saml.Key
|
||||
dest.Saml.SignRequests = saml.SignRequests
|
||||
dest.Saml.SignMethod = saml.SignMethod
|
||||
dest.Saml.Binding = saml.Binding
|
||||
|
||||
dest.Saml.IDP.URL = saml.IDP.URL
|
||||
dest.Saml.IDP.IdentName = saml.IDP.IdentName
|
||||
|
||||
@@ -40,6 +40,8 @@ type (
|
||||
SignRequests bool
|
||||
SignatureMethod string
|
||||
|
||||
Binding string
|
||||
|
||||
// user meta from idp
|
||||
IdentityPayload IdpIdentityPayload
|
||||
|
||||
@@ -72,6 +74,11 @@ func NewSamlSPService(log *zap.Logger, args SamlSPArgs) (s *SamlSPService, err e
|
||||
sp.SignatureMethod = args.SignatureMethod
|
||||
}
|
||||
|
||||
// default to GET
|
||||
if args.Binding == "" {
|
||||
args.Binding = saml.HTTPRedirectBinding
|
||||
}
|
||||
|
||||
opts := samlsp.Options{
|
||||
URL: args.Host,
|
||||
Key: sp.Key,
|
||||
@@ -88,6 +95,7 @@ func NewSamlSPService(log *zap.Logger, args SamlSPArgs) (s *SamlSPService, err e
|
||||
|
||||
handler.RequestTracker = samlsp.DefaultRequestTracker(opts, &handler.ServiceProvider)
|
||||
handler.ServiceProvider = sp
|
||||
handler.Binding = args.Binding
|
||||
|
||||
s = &SamlSPService{
|
||||
log: log,
|
||||
|
||||
@@ -32,6 +32,9 @@ type (
|
||||
// Signature method for signing
|
||||
SignMethod string
|
||||
|
||||
// Post or redirect binding
|
||||
Binding string
|
||||
|
||||
// Identity provider hostname
|
||||
IDP struct {
|
||||
URL string
|
||||
|
||||
@@ -107,6 +107,9 @@ type (
|
||||
// Signature method for signing
|
||||
SignMethod string `kv:"sign-method"`
|
||||
|
||||
// Post or redirect binding
|
||||
Binding string `kv:"binding"`
|
||||
|
||||
// Identity provider settings
|
||||
IDP struct {
|
||||
URL string `kv:"url"`
|
||||
|
||||
Reference in New Issue
Block a user