mirror of
				https://github.com/steveiliop56/tinyauth.git
				synced 2025-10-31 22:25:43 +00:00 
			
		
		
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			dc67be2ba0
			...
			docs/updat
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | f79c3f6ca1 | 
| @@ -38,7 +38,7 @@ COPY ./cmd ./cmd | ||||
| COPY ./internal ./internal | ||||
| 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}"  | ||||
|   | ||||
|   | ||||
| @@ -23,7 +23,7 @@ Tinyauth is a simple authentication middleware that adds a simple login screen o | ||||
|  | ||||
| ## 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 | ||||
|  | ||||
|   | ||||
| @@ -112,10 +112,6 @@ func (c *rootCmd) run(cmd *cobra.Command, args []string) { | ||||
| 	log.Logger = log.Level(zerolog.Level(utils.GetLogLevel(conf.LogLevel))) | ||||
| 	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) | ||||
|  | ||||
| 	err = app.Setup() | ||||
|   | ||||
| @@ -7,7 +7,6 @@ import ( | ||||
| 	"net/http" | ||||
| 	"net/url" | ||||
| 	"os" | ||||
| 	"sort" | ||||
| 	"strings" | ||||
| 	"time" | ||||
| 	"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 { | ||||
| 		configuredProviders = append(configuredProviders, controller.Provider{ | ||||
| 			Name:  "Username", | ||||
| @@ -178,7 +173,6 @@ func (app *BootstrapApp) Setup() error { | ||||
|  | ||||
| 	// Create engine | ||||
| 	engine := gin.New() | ||||
| 	engine.Use(gin.Recovery()) | ||||
|  | ||||
| 	if len(app.config.TrustedProxies) > 0 { | ||||
| 		err := engine.SetTrustedProxies(strings.Split(app.config.TrustedProxies, ",")) | ||||
|   | ||||
| @@ -162,7 +162,7 @@ func (controller *OAuthController) oauthCallbackHandler(c *gin.Context) { | ||||
|  | ||||
| 	var name string | ||||
|  | ||||
| 	if strings.TrimSpace(user.Name) != "" { | ||||
| 	if user.Name != "" { | ||||
| 		log.Debug().Msg("Using name from OAuth provider") | ||||
| 		name = user.Name | ||||
| 	} else { | ||||
| @@ -172,7 +172,7 @@ func (controller *OAuthController) oauthCallbackHandler(c *gin.Context) { | ||||
|  | ||||
| 	var username string | ||||
|  | ||||
| 	if strings.TrimSpace(user.PreferredUsername) != "" { | ||||
| 	if user.PreferredUsername != "" { | ||||
| 		log.Debug().Msg("Using preferred username from OAuth provider") | ||||
| 		username = user.PreferredUsername | ||||
| 	} else { | ||||
|   | ||||
| @@ -84,8 +84,6 @@ func (controller *ProxyController) proxyHandler(c *gin.Context) { | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	log.Trace().Interface("labels", labels).Msg("Labels for resource") | ||||
|  | ||||
| 	clientIP := c.ClientIP() | ||||
|  | ||||
| 	if controller.auth.IsBypassedIP(labels.IP, clientIP) { | ||||
| @@ -152,8 +150,6 @@ func (controller *ProxyController) proxyHandler(c *gin.Context) { | ||||
| 		userContext = context | ||||
| 	} | ||||
|  | ||||
| 	log.Trace().Interface("context", userContext).Msg("User context from request") | ||||
|  | ||||
| 	if userContext.Provider == "basic" && userContext.TotpEnabled { | ||||
| 		log.Debug().Msg("User has TOTP enabled, denying basic auth access") | ||||
| 		userContext.IsLoggedIn = false | ||||
|   | ||||
| @@ -318,7 +318,6 @@ func (auth *AuthService) IsInOAuthGroup(c *gin.Context, context config.UserConte | ||||
|  | ||||
| 	for userGroup := range strings.SplitSeq(context.OAuthGroups, ",") { | ||||
| 		if utils.CheckFilter(requiredGroups, strings.TrimSpace(userGroup)) { | ||||
| 			log.Trace().Str("group", userGroup).Str("required", requiredGroups).Msg("User group matched") | ||||
| 			return true | ||||
| 		} | ||||
| 	} | ||||
|   | ||||
| @@ -89,12 +89,12 @@ func (docker *DockerService) GetLabels(appDomain string) (config.App, error) { | ||||
|  | ||||
| 		for appName, appLabels := range labels.Apps { | ||||
| 			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 | ||||
| 			} | ||||
|  | ||||
| 			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 | ||||
| 			} | ||||
| 		} | ||||
|   | ||||
| @@ -12,7 +12,6 @@ import ( | ||||
| 	"time" | ||||
| 	"tinyauth/internal/config" | ||||
|  | ||||
| 	"github.com/rs/zerolog/log" | ||||
| 	"golang.org/x/oauth2" | ||||
| ) | ||||
|  | ||||
| @@ -111,8 +110,6 @@ func (generic *GenericOAuthService) Userinfo() (config.Claims, error) { | ||||
| 		return user, err | ||||
| 	} | ||||
|  | ||||
| 	log.Trace().Str("body", string(body)).Msg("Userinfo response body") | ||||
|  | ||||
| 	err = json.Unmarshal(body, &user) | ||||
| 	if err != nil { | ||||
| 		return user, err | ||||
|   | ||||
		Reference in New Issue
	
	Block a user