| Crates.io | gobsg |
| lib.rs | gobsg |
| version | 3.2.4 |
| created_at | 2025-11-17 02:19:15.128058+00 |
| updated_at | 2026-01-08 23:09:07.623064+00 |
| description | A secure OIDC Backend-for-Frontend gateway providing cookie-based session management for web clients |
| homepage | https://github.com/Gistyr/GOBSG |
| repository | https://github.com/Gistyr/GOBSG |
| max_upload_size | |
| id | 1936153 |
| size | 169,360 |
G -> Gistyr
O -> OpenID Connect
B -> Backend for Frontend
S -> Session
G -> Gateway
This project is licensed under the PolyForm Small Business License 1.0.0
See LICENSES/LICENSE-POLYFORM-SMALL-BUSINESS.md or visit https://polyformproject.org/licenses/small-business/1.0.0.
The best way to understand this code is to read it.
The codebase is not very large, and there are descriptive comments.
Or have an LLM summarize it for you.
Three components are needed: web client, GOBSG, OpenID Provider
web client -> GOBSG -> OpenID Provider -> GOBSG -> web client
/login route.web client -> GOBSG -> web client
/sessionstatus route."logged_in" or "not_logged_in", allowing the web client to update its UI accordingly.web client -> GOBSG -> web client
/details route.username and user_id stored in the session.
username and user_id or an error, depending on your configuration.web client -> GOBSG -> OpenID Provider -> GOBSG -> web client
/logout route.Must be named main-config.toml
Must be located in the same directory as the executable
Read Mandatory Settings and Optional Settings below
Do not change the order of any values in this file, because of serialization
# --- MANDATORY --- #
# --- See Mandatory Settings in README --- #
this_server_url = ""
cookie_name = ""
cookie_domain = ""
secret_cookie_hex_key = ""
requesting_client_url = ""
issuer_url = ""
logout_url = ""
client = ""
client_secret = ""
# --- OPTIONAL --- #
# --- See Optional Settings in README --- #
# The values below above are the default values
# Leave commented out to use the default, uncomment to set your own
#listen_address = "0.0.0.0"
#listen_port = 3090
#workers = 1 #default is: num_cpus::get() aka number of logical cores on the system
#redis_address = "redis://127.0.0.1:6379"
#heartbeat_logging = false
#heartbeat_interval_hours = 12
#machine_name = "machine"
#container_name = "container"
#provider = "provider"
#keep_alive_time_secs = 75
#client_request_timeout_secs = 30
#client_disconnect_timeout_secs = 5
#max_connections = 25000
#early_refresh_skew_secs = 120
#user_details_fail_when_not_authenticated = true
#default_username = "0"
#default_user_id = "0"
this_server_url: The URL for this server
cookie_name: The name of the cookie stored on the user's device
cookie_domain: The domain for this server
secret_cookie_hex_key: Cryptographic key used to encrypt and sign session cookies
requesting_client_url: The URL of your client side application
issuer_url: Your OpenID Connect provider’s “issuer”
logout_url: Your OpenID Connect provider's logout url
client: Your client ID
client_secret: Your client secret
listen_address: IP/interface the server binds tolisten_port: TCP port the server listens onworkers: Number of Actix workers
redis_address: User sessions are stored in Redis
heartbeat_logging: Periodically emits a heartbeat log message
heartbeat_interval_hours: Interval between heartbeat logs, in hoursmachine_name: The name of your machinecontainer_name: The name of your containerprovider: The name of your providerkeep_alive_time_secs: HTTP keep-alive timeout for idle connectionsclient_request_timeout_secs: Max time to wait for a full request from a client before timing outclient_disconnect_timeout_secs: Grace period to finish work after a client disconnectsmax_connections: Upper limit on concurrent TCP connections accepted by the serverearly_refresh_skew_secs: grace period to refresh the access token slightly before it actually expires
user_details_fail_when_not_authenticated: By default /details will fail if there is no session for the user
true to return default valuesdefault_username: Return this username for unauthenticated usersdefault_user_id: Return this user id for unauthenticated usersMust be named logging-config.toml
Must be located in the same directory as the executable
Do not change the order of any values in this file, because of serialization
better-logger crate: GitHub Link - crates.io LinkRead the better-logger README for more information
better-logger documentation, except in TOML formatwasm_logging and async_logging are purposely not a configurable option in GOBSG
wasm_logging must be false and async_logging must be truebetter-logger documentationterminal_logs = true
terminal_log_lvl = ""
file_logs = false
file_log_lvl = ""
log_file_path = ""
network_logs = false
network_log_lvl = ""
network_endpoint_url = ""
debug_extra = true
[network_format]
type = "JsonText"
field = "text"
concat.sh here: LINKcargo build --release --target x86_64-unknown-linux-gnu
/target/x86_64-unknown-linux-gnu/release/gobsg is committed:
I do this so I don't have to build on the production VM.
You should clean and rebuild your own executable.
Contributions are welcome if you want to.