Skip to content

Commit 1688b08

Browse files
committed
add option to allow all users
will not reject any user based on domain matching. useful when using Lasso to identify users rather than determine whether they are authorized.
1 parent a429e4e commit 1688b08

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

config/config.yml_example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ lasso:
77
logLevel: info
88
listen: 0.0.0.0
99
port: 9090
10+
# set allowAllUsers: true to use Lasso to just identify users rather than determine whether they are authorized
11+
allowAllUsers: false
1012
# each of these domains must serve the url https://lasso.$domains[0] https://lasso.$domains[1] ...
1113
# usually you'll just have one
1214
domains:

handlers/handlers.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,11 @@ func ValidateRequestHandler(w http.ResponseWriter, r *http.Request) {
201201
}
202202
log.Infof("email from jwt cookie: %s", claims.Email)
203203

204-
if !jwtmanager.SiteInClaims(r.Host, &claims) {
205-
error401(w, r, AuthError{"not authorized for " + r.Host, jwt})
206-
return
204+
if !cfg.Cfg.AllowAllUsers {
205+
if !jwtmanager.SiteInClaims(r.Host, &claims) {
206+
error401(w, r, AuthError{"not authorized for " + r.Host, jwt})
207+
return
208+
}
207209
}
208210

209211
// renderIndex(w, "user found from email "+user.Email)
@@ -325,6 +327,7 @@ func VerifyUser(u interface{}) (ok bool, err error) {
325327
// } else if !domains.IsUnderManagement(user.HostDomain) {
326328
// err = fmt.Errorf("HostDomain %s is not within a lasso managed domain", u.HostDomain)
327329
} else {
330+
log.Debugf("no domains configured")
328331
ok = true
329332
}
330333
return ok, err

pkg/cfg/cfg.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type CfgT struct {
1515
Listen string `mapstructure:"listen"`
1616
Port int `mapstructure:"port"`
1717
Domains []string `mapstructure:"domains"`
18+
AllowAllUsers bool `mapstructure:"allowAllUsers"`
1819
JWT struct {
1920
MaxAge int `mapstructure:"maxAge"`
2021
Issuer string `mapstructure:"issuer"`

0 commit comments

Comments
 (0)