Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin-decker committed Sep 25, 2017
1 parent 10b4d08 commit 27a74e8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
2 changes: 1 addition & 1 deletion samlidp/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (s *Server) GetSession(w http.ResponseWriter, r *http.Request, req *saml.Id
Value: session.ID,
MaxAge: int(sessionMaxAge.Seconds()),
HttpOnly: true,
Secure: saml.IsHTTPS(r),
Secure: r.URL.Scheme == "https",
Path: "/",
})
return session
Expand Down
4 changes: 2 additions & 2 deletions samlsp/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (m *Middleware) RequireAccount(handler http.Handler) http.Handler {
Value: signedState,
MaxAge: int(saml.MaxIssueDelay.Seconds()),
HttpOnly: true,
Secure: saml.IsHTTPS(r),
Secure: r.URL.Scheme == "https",
Path: m.ServiceProvider.AcsURL.Path,
})

Expand Down Expand Up @@ -283,7 +283,7 @@ func (m *Middleware) Authorize(w http.ResponseWriter, r *http.Request, assertion
Value: signedToken,
MaxAge: int(m.CookieMaxAge.Seconds()),
HttpOnly: true,
Secure: saml.IsHTTPS(r),
Secure: r.URL.Scheme == "https",
Path: "/",
})

Expand Down
9 changes: 0 additions & 9 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package saml

import (
"crypto/rand"
"net/http"
"time"

dsig "github.com/russellhaering/goxmldsig"
Expand All @@ -28,11 +27,3 @@ func randomBytes(n int) []byte {
}
return rv
}

// IsHTTPS returns true if the given request is for an https host
func IsHTTPS(r *http.Request) bool {
if r.URL.Scheme == "https" {
return true
}
return false
}

0 comments on commit 27a74e8

Please sign in to comment.