Skip to content

Commit

Permalink
made selected binding configureable (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
tux21b authored and crewjam committed Aug 20, 2018
1 parent e8774a4 commit 42c78b1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions samlsp/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type Middleware struct {
TokenMaxAge time.Duration
ClientState ClientState
ClientToken ClientToken
Binding string
}

var jwtSigningMethod = jwt.SigningMethodHS256
Expand Down Expand Up @@ -110,11 +111,17 @@ func (m *Middleware) RequireAccount(handler http.Handler) http.Handler {
panic("don't wrap Middleware with RequireAccount")
}

binding := saml.HTTPRedirectBinding
bindingLocation := m.ServiceProvider.GetSSOBindingLocation(binding)
if bindingLocation == "" {
binding = saml.HTTPPostBinding
var binding, bindingLocation string
if m.Binding != "" {
binding = m.Binding
bindingLocation = m.ServiceProvider.GetSSOBindingLocation(binding)
} else {
binding = saml.HTTPRedirectBinding
bindingLocation = m.ServiceProvider.GetSSOBindingLocation(binding)
if bindingLocation == "" {
binding = saml.HTTPPostBinding
bindingLocation = m.ServiceProvider.GetSSOBindingLocation(binding)
}
}

req, err := m.ServiceProvider.MakeAuthenticationRequest(bindingLocation)
Expand Down

0 comments on commit 42c78b1

Please sign in to comment.