Skip to content

Commit

Permalink
middleware: add a flag to allow IDP initiated requests
Browse files Browse the repository at this point in the history
In IDP-initiated requests, we do not have a cookie with information about the
pending request.
  • Loading branch information
crewjam committed Jan 4, 2016
1 parent e8246e7 commit 72821a4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion samlmiddleware/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import (
// implementations of these functions issue and verify a signed cookie containing
// information from the SAML assertion.
type ServiceProviderMiddleware struct {
ServiceProvider *saml.ServiceProvider
ServiceProvider *saml.ServiceProvider
AllowIDPInitiated bool
}

const cookieMaxAge = time.Hour // TODO(ross): must be configurable
Expand Down Expand Up @@ -152,6 +153,12 @@ func (m *ServiceProviderMiddleware) getPossibleRequestIDs(r *http.Request) []str
}
rv = append(rv, token.Claims["id"].(string))
}

// If IDP initiated requests are allowed, then we can expect an empty response ID.
if m.AllowIDPInitiated {
rv = append(rv, "")
}

return rv
}

Expand Down

0 comments on commit 72821a4

Please sign in to comment.