mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-04 01:09:36 +02:00
core/go: use hashicorp/go-set (#5278)
This commit is contained in:
parent
5679589014
commit
410354bc00
12 changed files with 66 additions and 176 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/go-jose/go-jose/v3"
|
||||
"github.com/hashicorp/go-set/v3"
|
||||
"github.com/open-policy-agent/opa/rego"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
|
@ -18,7 +19,6 @@ import (
|
|||
"github.com/pomerium/pomerium/internal/errgrouputil"
|
||||
"github.com/pomerium/pomerium/internal/httputil"
|
||||
"github.com/pomerium/pomerium/internal/log"
|
||||
"github.com/pomerium/pomerium/internal/sets"
|
||||
"github.com/pomerium/pomerium/internal/telemetry/trace"
|
||||
"github.com/pomerium/pomerium/pkg/contextutil"
|
||||
"github.com/pomerium/pomerium/pkg/cryptutil"
|
||||
|
@ -240,14 +240,14 @@ func (e *Evaluator) Evaluate(ctx context.Context, req *Request) (*Result, error)
|
|||
}
|
||||
|
||||
// Internal endpoints that require a logged-in user.
|
||||
var internalPathsNeedingLogin = sets.NewHash(
|
||||
var internalPathsNeedingLogin = set.From([]string{
|
||||
"/.pomerium/jwt",
|
||||
"/.pomerium/user",
|
||||
"/.pomerium/webauthn",
|
||||
)
|
||||
})
|
||||
|
||||
func (e *Evaluator) evaluateInternal(_ context.Context, req *Request) (*PolicyResponse, error) {
|
||||
if internalPathsNeedingLogin.Has(req.HTTP.Path) {
|
||||
if internalPathsNeedingLogin.Contains(req.HTTP.Path) {
|
||||
if req.Session.ID == "" {
|
||||
return &PolicyResponse{
|
||||
Allow: NewRuleResult(false, criteria.ReasonUserUnauthenticated),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue