mirror of
				https://github.com/steveiliop56/tinyauth.git
				synced 2025-10-31 14:15:50 +00:00 
			
		
		
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			dc67be2ba0
			...
			docs/updat
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | f79c3f6ca1 | 
| @@ -38,7 +38,7 @@ COPY ./cmd ./cmd | |||||||
| COPY ./internal ./internal | COPY ./internal ./internal | ||||||
| COPY --from=frontend-builder /frontend/dist ./internal/assets/dist | COPY --from=frontend-builder /frontend/dist ./internal/assets/dist | ||||||
|  |  | ||||||
| RUN mkdir -p data | RUN mkdir -p /data | ||||||
|  |  | ||||||
| RUN CGO_ENABLED=0 go build -ldflags "-s -w -X tinyauth/internal/config.Version=${VERSION} -X tinyauth/internal/config.CommitHash=${COMMIT_HASH} -X tinyauth/internal/config.BuildTimestamp=${BUILD_TIMESTAMP}"  | RUN CGO_ENABLED=0 go build -ldflags "-s -w -X tinyauth/internal/config.Version=${VERSION} -X tinyauth/internal/config.CommitHash=${COMMIT_HASH} -X tinyauth/internal/config.BuildTimestamp=${BUILD_TIMESTAMP}"  | ||||||
|   |   | ||||||
|   | |||||||
| @@ -23,7 +23,7 @@ Tinyauth is a simple authentication middleware that adds a simple login screen o | |||||||
|  |  | ||||||
| ## Getting Started | ## Getting Started | ||||||
|  |  | ||||||
| You can easily get started with Tinyauth by following the guide in the [documentation](https://tinyauth.app/docs/getting-started). There is also an available [docker compose](./docker-compose.example.yml) file that has Traefik, Whoami and Tinyauth to demonstrate its capabilities. | You can easily get started with Tinyauth by following the guide in the [documentation](https://tinyauth.app/docs/getting-started.html). There is also an available [docker compose](./docker-compose.example.yml) file that has Traefik, Whoami and Tinyauth to demonstrate its capabilities. | ||||||
|  |  | ||||||
| ## Demo | ## Demo | ||||||
|  |  | ||||||
|   | |||||||
| @@ -112,10 +112,6 @@ func (c *rootCmd) run(cmd *cobra.Command, args []string) { | |||||||
| 	log.Logger = log.Level(zerolog.Level(utils.GetLogLevel(conf.LogLevel))) | 	log.Logger = log.Level(zerolog.Level(utils.GetLogLevel(conf.LogLevel))) | ||||||
| 	log.Info().Str("version", strings.TrimSpace(config.Version)).Msg("Starting Tinyauth") | 	log.Info().Str("version", strings.TrimSpace(config.Version)).Msg("Starting Tinyauth") | ||||||
|  |  | ||||||
| 	if log.Logger.GetLevel() == zerolog.TraceLevel { |  | ||||||
| 		log.Warn().Msg("Log level set to trace, this will log sensitive information!") |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	app := bootstrap.NewBootstrapApp(conf) | 	app := bootstrap.NewBootstrapApp(conf) | ||||||
|  |  | ||||||
| 	err = app.Setup() | 	err = app.Setup() | ||||||
|   | |||||||
| @@ -7,7 +7,6 @@ import ( | |||||||
| 	"net/http" | 	"net/http" | ||||||
| 	"net/url" | 	"net/url" | ||||||
| 	"os" | 	"os" | ||||||
| 	"sort" |  | ||||||
| 	"strings" | 	"strings" | ||||||
| 	"time" | 	"time" | ||||||
| 	"tinyauth/internal/config" | 	"tinyauth/internal/config" | ||||||
| @@ -158,10 +157,6 @@ func (app *BootstrapApp) Setup() error { | |||||||
| 		}) | 		}) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	sort.Slice(configuredProviders, func(i, j int) bool { |  | ||||||
| 		return configuredProviders[i].Name < configuredProviders[j].Name |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	if authService.UserAuthConfigured() || ldapService != nil { | 	if authService.UserAuthConfigured() || ldapService != nil { | ||||||
| 		configuredProviders = append(configuredProviders, controller.Provider{ | 		configuredProviders = append(configuredProviders, controller.Provider{ | ||||||
| 			Name:  "Username", | 			Name:  "Username", | ||||||
| @@ -178,7 +173,6 @@ func (app *BootstrapApp) Setup() error { | |||||||
|  |  | ||||||
| 	// Create engine | 	// Create engine | ||||||
| 	engine := gin.New() | 	engine := gin.New() | ||||||
| 	engine.Use(gin.Recovery()) |  | ||||||
|  |  | ||||||
| 	if len(app.config.TrustedProxies) > 0 { | 	if len(app.config.TrustedProxies) > 0 { | ||||||
| 		err := engine.SetTrustedProxies(strings.Split(app.config.TrustedProxies, ",")) | 		err := engine.SetTrustedProxies(strings.Split(app.config.TrustedProxies, ",")) | ||||||
|   | |||||||
| @@ -162,7 +162,7 @@ func (controller *OAuthController) oauthCallbackHandler(c *gin.Context) { | |||||||
|  |  | ||||||
| 	var name string | 	var name string | ||||||
|  |  | ||||||
| 	if strings.TrimSpace(user.Name) != "" { | 	if user.Name != "" { | ||||||
| 		log.Debug().Msg("Using name from OAuth provider") | 		log.Debug().Msg("Using name from OAuth provider") | ||||||
| 		name = user.Name | 		name = user.Name | ||||||
| 	} else { | 	} else { | ||||||
| @@ -172,7 +172,7 @@ func (controller *OAuthController) oauthCallbackHandler(c *gin.Context) { | |||||||
|  |  | ||||||
| 	var username string | 	var username string | ||||||
|  |  | ||||||
| 	if strings.TrimSpace(user.PreferredUsername) != "" { | 	if user.PreferredUsername != "" { | ||||||
| 		log.Debug().Msg("Using preferred username from OAuth provider") | 		log.Debug().Msg("Using preferred username from OAuth provider") | ||||||
| 		username = user.PreferredUsername | 		username = user.PreferredUsername | ||||||
| 	} else { | 	} else { | ||||||
|   | |||||||
| @@ -84,8 +84,6 @@ func (controller *ProxyController) proxyHandler(c *gin.Context) { | |||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	log.Trace().Interface("labels", labels).Msg("Labels for resource") |  | ||||||
|  |  | ||||||
| 	clientIP := c.ClientIP() | 	clientIP := c.ClientIP() | ||||||
|  |  | ||||||
| 	if controller.auth.IsBypassedIP(labels.IP, clientIP) { | 	if controller.auth.IsBypassedIP(labels.IP, clientIP) { | ||||||
| @@ -152,8 +150,6 @@ func (controller *ProxyController) proxyHandler(c *gin.Context) { | |||||||
| 		userContext = context | 		userContext = context | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	log.Trace().Interface("context", userContext).Msg("User context from request") |  | ||||||
|  |  | ||||||
| 	if userContext.Provider == "basic" && userContext.TotpEnabled { | 	if userContext.Provider == "basic" && userContext.TotpEnabled { | ||||||
| 		log.Debug().Msg("User has TOTP enabled, denying basic auth access") | 		log.Debug().Msg("User has TOTP enabled, denying basic auth access") | ||||||
| 		userContext.IsLoggedIn = false | 		userContext.IsLoggedIn = false | ||||||
|   | |||||||
| @@ -318,7 +318,6 @@ func (auth *AuthService) IsInOAuthGroup(c *gin.Context, context config.UserConte | |||||||
|  |  | ||||||
| 	for userGroup := range strings.SplitSeq(context.OAuthGroups, ",") { | 	for userGroup := range strings.SplitSeq(context.OAuthGroups, ",") { | ||||||
| 		if utils.CheckFilter(requiredGroups, strings.TrimSpace(userGroup)) { | 		if utils.CheckFilter(requiredGroups, strings.TrimSpace(userGroup)) { | ||||||
| 			log.Trace().Str("group", userGroup).Str("required", requiredGroups).Msg("User group matched") |  | ||||||
| 			return true | 			return true | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -89,12 +89,12 @@ func (docker *DockerService) GetLabels(appDomain string) (config.App, error) { | |||||||
|  |  | ||||||
| 		for appName, appLabels := range labels.Apps { | 		for appName, appLabels := range labels.Apps { | ||||||
| 			if appLabels.Config.Domain == appDomain { | 			if appLabels.Config.Domain == appDomain { | ||||||
| 				log.Debug().Str("id", inspect.ID).Str("name", inspect.Name).Msg("Found matching container by domain") | 				log.Debug().Str("id", inspect.ID).Msg("Found matching container by domain") | ||||||
| 				return appLabels, nil | 				return appLabels, nil | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			if strings.TrimPrefix(inspect.Name, "/") == appName { | 			if strings.TrimPrefix(inspect.Name, "/") == appName { | ||||||
| 				log.Debug().Str("id", inspect.ID).Str("name", inspect.Name).Msg("Found matching container by app name") | 				log.Debug().Str("id", inspect.ID).Msg("Found matching container by app name") | ||||||
| 				return appLabels, nil | 				return appLabels, nil | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -12,7 +12,6 @@ import ( | |||||||
| 	"time" | 	"time" | ||||||
| 	"tinyauth/internal/config" | 	"tinyauth/internal/config" | ||||||
|  |  | ||||||
| 	"github.com/rs/zerolog/log" |  | ||||||
| 	"golang.org/x/oauth2" | 	"golang.org/x/oauth2" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -111,8 +110,6 @@ func (generic *GenericOAuthService) Userinfo() (config.Claims, error) { | |||||||
| 		return user, err | 		return user, err | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	log.Trace().Str("body", string(body)).Msg("Userinfo response body") |  | ||||||
|  |  | ||||||
| 	err = json.Unmarshal(body, &user) | 	err = json.Unmarshal(body, &user) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return user, err | 		return user, err | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user