Added support for SAML HTTP binding

This commit is contained in:
Peter Grlica
2022-01-11 08:26:24 +01:00
parent 4b264798ea
commit 717cae5c0b
5 changed files with 17 additions and 0 deletions
+2
View File
@@ -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,
+1
View File
@@ -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
+8
View File
@@ -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,
+3
View File
@@ -32,6 +32,9 @@ type (
// Signature method for signing
SignMethod string
// Post or redirect binding
Binding string
// Identity provider hostname
IDP struct {
URL string
+3
View File
@@ -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"`