tgauth

package module
v0.0.0-...-8101a8f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2022 License: MIT Imports: 3 Imported by: 0

README

Authentication/authorization middleware with Telegram.

tg-auth enables drop-in Telegram based authn/z to your service. No modifications needed for your application's code.

Settings

tg-auth runs with following environment variables:

Variable Name Description Sample
BOT_NAME Telegram bot name
BOT_TOKEN Telegram bot token
SIGNIN_URL URL endpoint of the signin protoal https://example.com/signin
SIGNIN_REDIRECT_CALLBACK_URL URL endpoint of the Telegram signin callback https://example.com/signin/callback
SIGNIN_AFTER_SIGNIN_URL URL endpoint after succeeded authentication https://example.com
AUTHZ_CHANNEL_IDS , separated Telegram channel id for checking user access permission -12345,-67890
AUTHZ_CACHE User access check cache TTL. Defaults to 5 minutes 5m
AUTHN_COOKIE_SIGNING_KEY Base64 encoded AES signing key for encrypting cookie value.
AUTHN_COOKIE_NAME Name of the cookie
AUTHN_COOKIE_DOMAIN The domain of the cookie example.com
AUTHN_SESSION_TTL TTL of the cookie. Defaults to 1 hour 1h

Examples

LICENSE

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LoadEnvSettings = settings.LoadEnvSettings

	NewDefaultHTTPServer = httpserver.Default

	NewTelegramChannelAdmissioner = admission.NewTelegramChannelAdmission
	AdmissionerWithCache          = admission.WithCache
	AdmissionerWithSingleFlight   = admission.WithSingleFlight
)

Functions

This section is empty.

Types

type Admissioner

type Admissioner = admission.Admissioner

type AuthnSettings

type AuthnSettings = settings.AuthnSettings

type AuthzSettings

type AuthzSettings = settings.AuthzSettings

type BotSettings

type BotSettings = settings.BotSettings

type Settings

type Settings = settings.Settings

type SigninSettings

type SigninSettings = settings.SigninSettings

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL