Commit Graph

54 Commits

Author SHA1 Message Date
Scott McKendry 04b8e9884b feat(db): add memory storage driver
removes the sqlite dependency for tests, also brings back the option for
users to run zero persistence instances of tinyauth.

adds new mapErr fn for sqlc wrapper gen to prevent sql errors from
leaking out of the store implementation.
2026-05-04 05:02:27 +12:00
Scott McKendry 0244f39387 feat(db): add code gen to build sqlc-compatible wrappers 2026-05-03 14:11:54 +12:00
Scott McKendry 1d0a4627a9 refactor(db): use new store interface 2026-04-30 19:18:33 +12:00
Contre 956d2f55c3 feat(access-control): Add support for Kubernetes Label (#627)
* feat(access-control): Add support for Kubernetes Label

* feat(access-control): Defaults to Docker

* feat(access-control): Remove kubeconfig fallback

* feat(watcher): Watcher for kubernetes service

* feat(watcher): Merge with main + remove nightly fix redirect

* fix(go): Go mod + Go sum after sync with main

* fix(config): Ser default value for LabelProvider to Docker

* feat(go): go mod tidy

* feat(k8s_service): Remove logic for deprecated Ingress k8s v1.22

* feat(k8s_service): (Watcher) -> Wait 5s before breaking to outer loop again

* feat(k8s_service): Remove logic for deprecated Ingress k8s v1.22

* feat(k8s_service): Remove logic for deprecated Ingress k8s v1.22

* feat(k8s_service): Remove logic for deprecated Ingress k8s v1.22

* feat(k8s_service): Remove
var _ = unstructured.Unstructured{} + comments + msg edits

* feat(bootstrap): Remove dockerService from bootstrap svc

* feat(auth_svc): Remove dockerService from authservice

* feat(test): Add tests for kubernetes_services

* feat(test): Remove docker serivce form proxy/user test

* fix(refactor): Remove update logic from watcher and resync

* fix(refactor): Split watchGVR to make it more readable

* fix(refactor): Remove discovery + drop K 1.22 completely

* fix(refactor): Move interface to acess_controls_service

* feat: Autodetect labelprovider if TINYAUTH_LABELPROVIDER not set

* fix(test): Match testing scheme to the controllers

* fix: service bootstrap import after merge

* fix: service bootstrap import after merge
2026-04-29 16:16:21 +03:00
Scott McKendry 5d95123dcb feat(oidc): support for all in-spec attributes and scopes (#777)
* feat(oidc): support for all in-spec attributes and scopes

* add tests

* assert phone/email verified when either is set

* update tests

* add claims back to userinfo

* remove redundant column drop in migration

* fix duplicate migration id

* fix clobbered imports post-rebase
2026-04-27 19:25:52 +03:00
Ryc O'Chet f3186571cc Organisation update, steveiliop56 to tinyauthapp (#793)
* infrastructure and docs

* code

* fix issue templates

* chore: fix scoreboard url

* chore: remove migration warning

* chore: fix readme docs link

---------

Co-authored-by: Stavros <steveiliop56@gmail.com>
2026-04-26 17:13:53 +03:00
Stavros 479f165781 fix: fail app on empty app url before parsing 2026-04-16 12:44:24 +03:00
Stavros f257d00648 fix: use fmt println to show warning regardless of log level 2026-04-14 13:43:24 +03:00
Stavros 9f77816a1d feat: add organization migration note 2026-04-14 13:26:55 +03:00
Stavros f26c217161 refactor: oauth flow (#726)
* wip

* feat: add oauth session impl in auth service

* feat: move oauth logic into auth service and handle multiple sessions

* tests: fix tests

* fix: review comments

* fix: prevent ddos attacks in oauth rate limit
2026-03-22 21:03:32 +02:00
Stavros cd410b6cdf refactor: categorize leftover config options (#682)
* refactor: categorize leftover config options

* chore: update config description
2026-03-02 19:49:59 +02:00
Stavros e078e8a3f0 refactor: move disable ui warnings to ui cfg and trusted proxies to auth
cfg
2026-02-16 19:18:40 +02:00
Stavros 285edba88c refactor: better is configured check for ldap and oidc service 2026-02-02 16:25:49 +02:00
Stavros fb671139cd feat: auto generate redirect url if empty 2026-02-02 16:25:49 +02:00
Stavros eff5fc8b71 refactor: use is configured check in ldap service 2026-02-01 19:05:42 +02:00
Stavros 671343f677 feat: oidc (#605)
* chore: add oidc base config

* wip: authorize page

* feat: implement basic oidc functionality

* refactor: implement oidc following tinyauth patterns

* feat: adapt frontend to oidc flow

* fix: review comments

* fix: oidc review comments

* feat: refresh token grant type support

* feat: cleanup expired oidc sessions

* feat: frontend i18n

* fix: fix typo in error screen

* tests: add basic testing

* fix: more review comments

* refactor: rework oidc error messages

* feat: openid discovery endpoint

* feat: jwk endpoint

* i18n: fix typo

* fix: more rabbit nitpicks

* fix: final review comments

* i18n: authorize page error messages
2026-02-01 19:00:59 +02:00
Stavros 87e2b52a04 fix: set gin mode correctly 2026-01-17 20:26:48 +02:00
Stavros 4926e53409 feat: ldap group acls (#590)
* wip

* refactor: remove useless session struct abstraction

* feat: retrieve and store groups from ldap provider

* chore: fix merge issue

* refactor: rework ldap group fetching logic

* feat: store ldap group results in cache

* fix: review nitpicks

* fix: review feedback
2026-01-17 20:03:29 +02:00
Pushpinder Singh 53bd413046 feat: configurable component-level logging (#575)
* Refactor logging to use centralized logger utility

- Removed direct usage of zerolog in multiple files and replaced it with a centralized logging utility in the `utils` package.
- Introduced `Loggers` struct to manage different loggers (Audit, HTTP, App) with configurable levels and outputs.
- Updated all relevant files to utilize the new logging structure, ensuring consistent logging practices across the application.
- Enhanced error handling and logging messages for better traceability and debugging.

* refactor: update logging implementation to use new logger structure

* Refactor logging to use tlog package

- Replaced instances of utils logging with tlog in various controllers, services, and middleware.
- Introduced audit logging for login success, login failure, and logout events.
- Created tlog package with structured logging capabilities using zerolog.
- Added tests for the new tlog logger functionality.

* refactor: update logging configuration in environment files

* fix: adding coderabbit suggestions

* fix: ensure correct audit caller

* fix: include reason in audit login failure logs
2026-01-15 15:57:19 +02:00
Stavros e3f92ce4fc refactor: simplify user parsing (#571) 2026-01-08 16:03:37 +02:00
Stavros 1ffb838c0f feat: add support for global ip filters (#567) 2026-01-08 15:26:53 +02:00
Pushpinder Singh e3c98faf36 fix: username provider appearing when no auth is configured (#568)
* feat: allow any HTTP method for /api/auth/envoy and restrict methods for non-envoy proxies

* feat: add Allow header for invalid methods in proxyHandler

* feat: add session max lifetime and fix refresh logic

* fix: set default value for created_at column and improve session expiration logic

* fix: correct ldapService reference in authService initialization

---------

Co-authored-by: Stavros <steveiliop56@gmail.com>
2026-01-08 10:28:54 +02:00
Pushpinder Singh e7bd64d7a3 feat: add session max lifetime and fix refresh logic (#559)
* feat: allow any HTTP method for /api/auth/envoy and restrict methods for non-envoy proxies

* feat: add Allow header for invalid methods in proxyHandler

* feat: add session max lifetime and fix refresh logic

* fix: set default value for created_at column and improve session expiration logic

---------

Co-authored-by: Stavros <steveiliop56@gmail.com>
2026-01-07 13:37:23 +02:00
Priit Laes f564032a11 LDAP: Add mTLS / client certificate authentication support (#509)
* ldap: Add mTLS authentication support to LDAP backend

* ldap: Reuse BindService() for initial bind attempt

* ldap: Make LdapService.config private

Now that we have ldap.BindService(), we don't need to access any
members of LdapService.config externally.

* ldap: Add TODO note about STARTTLS/SASL authentication

* ldap: Add TODO note about mTLS and extra CA certificates

* chore: fix typo

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: Stavros <steveiliop56@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-31 18:01:21 +02:00
Stavros 7e17a4ad86 refactor: replace gorm with vanilla sql and sqlc (#541)
* refactor: replace gorm with vanilla sql and sqlc

* chore: go mod tidy

* refactor: rebase for main

* tests: fix tests

* fix: review comments
2025-12-31 17:59:21 +02:00
Stavros 9a3fecd565 feat: non-docker acls (#549)
* wip

* feat: add paerser as submodule and apply patch for nested maps

* refactor: update release workflows to include submodule and patches

* chore: update contributing instructions
2025-12-30 18:26:57 +02:00
Stavros a1c3e416b6 refactor: use proper module name (#542)
* chore: reorganize go mod

* refactor: use proper module name
2025-12-26 17:53:24 +02:00
Stavros 03ed18343e feat: unified config (#533)
* chore: add yaml config ref

* feat: add initial implementation of a traefik like cli

* refactor: remove dependency on traefik

* chore: update example env

* refactor: update build

* chore: remove unused code

* fix: fix translations not loading

* feat: add experimental config file support

* chore: mod tidy

* fix: review comments

* refactor: move tinyauth to separate package

* chore: add quotes to all env variables

* chore: resolve go mod and sum conflicts

* chore: go mod tidy

* fix: review comments
2025-12-22 22:13:40 +02:00
Stavros 78f97c8550 refactor: split bootstrap to smaller files for better readability (#518)
* refactor: split bootstrap to smaller files for better readability

* chore: rename setup routes to setup router

* fix: assign configured providers to app context
2025-12-17 15:04:09 +02:00
Stavros 6c90046343 feat: add option to disable ui warnings 2025-11-21 17:37:08 +02:00
Stavros 6d663bb1e8 fix: use unix seconds in db cleanup 2025-11-15 11:45:19 +02:00
Stavros 60dada86a6 feat: add support for listening on unix sockets 2025-11-04 18:42:04 +02:00
Chris Ellrich c5bb389258 feat: ACL labels from environment variables (#422)
* feat: add LabelService to retrieve application labels from environment variables

* feat: allow usage of labels from docker and env variables simultaneously

Prioritize labels from environment variables over labels from docker
labels

* fix: handle error returned by label_serive.go/LoadLabels

see https://github.com/steveiliop56/tinyauth/pull/422#discussion_r2443443032

* refactor(label_service): use simple loop instead of slices.ContainsFunc to avoid experimental slices package
see https://github.com/steveiliop56/tinyauth/pull/422#pullrequestreview-3354632045

* refactor: merge acl logic into one service

---------

Co-authored-by: Stavros <steveiliop56@gmail.com>
2025-10-21 16:02:31 +03:00
Stavros 7231efcbc3 feat: add routine to cleanup expired sessions 2025-10-19 19:10:24 +03:00
Stavros 1b87ed9b99 feat: add config dumps to trace log level 2025-10-12 11:29:31 +03:00
Stavros fc7e395e66 feat: sort configured providers based on name length 2025-10-10 17:16:22 +03:00
Stavros b940d681c3 feat: use recovery gin middleware in engine 2025-10-10 16:42:19 +03:00
Stavros c77da30d87 refactor: set gin mode using env 2025-10-08 16:24:14 +03:00
Stavros adffb4ac0a fix: names in oauth broker 2025-10-08 15:15:30 +03:00
Stavros 085f6257c5 fix: fix oauth group provider check 2025-09-25 22:35:44 +03:00
Stavros c307f7eb2e fix: handle 201 status for heartbeat 2025-09-22 19:56:59 +03:00
Stavros e8558b89b4 fix: set gin mode correctly 2025-09-22 16:15:55 +03:00
Stavros f8047a6c2e feat: add option to disable resources server 2025-09-22 15:52:43 +03:00
Stavros d70cbea546 chore: handle trusted proxies config error 2025-09-19 14:53:10 +03:00
Stavros 50105e4e9d feat: version info analytics (#363)
* feat: version info analytics

* refactor: don't create new client everytime
2025-09-19 14:44:22 +03:00
Stavros b62b2932fe fix: only set trusted proxies if config option is not empty 2025-09-16 15:14:42 +03:00
Stavros 5c866bad1a feat: multiple oauth providers (#355)
* feat: add flag decoder (candidate)

* refactor: finalize flags decoder

* feat: add env decoder

* feat: add oauth config parsing logic

* feat: implement backend logic for multiple oauth providers

* feat: implement multiple oauth providers in the frontend

* feat: add some default icons

* chore: add credits for parser

* feat: style oauth auto redirect screen

* fix: bot suggestions

* refactor: rework decoders using simpler and more efficient pattern

* refactor: rework oauth name database migration
2025-09-16 13:28:28 +03:00
Stavros 2d78e6b598 feat: add cookie domain back to context controller 2025-09-10 13:47:48 +03:00
Stavros e03eaf4f08 feat: add psl check in cookie domain 2025-09-10 13:43:08 +03:00
Stavros 773cd6d171 feat: add trusted proxies config value 2025-09-03 12:14:13 +03:00