Skip to content

Repository files navigation

Open Tree Hole Auth Next

Next Generation of Auth microservice integrated with Kong Gateway for registration and issuing tokens

Features

  • White-listed email registration
  • Anonymous: Shamir encrypted email and random identity
  • issue and revoke JWT tokens

Usage

Configurations

Environment Variables

NameDefaultValid valuesDescription
MODEdevdev, production, test, benchif dev, log gorm debug sql
DB_URLDatabase DSN, required in "production" mode
KONG_URLif STANDALONE is false, required to connect to kong gateway
REDIS_URLif not set, use go-cache instead
NOTIFICATION_URLif not set, no notification will be sent
EMAIL_WHITELISTuse ',' to separate emails; if not set, allow all emails
VALIDATE_EMAIL_WHITELISTuse ',' to separate emails; the emails in it will not be checked for year vs. suffix
EMAIL_SERVER_NO_REPLY_URLrequired in "production" mode; if not set, unable to send verification email
EMAIL_DOMAINrequired in "production" mode; if not set, unable to send verification email
EMAIL_DEVdev@danta.techsend email if shamir update failed
SHAMIR_FEATUREtrueif enabled, check email shamir encryption when users register and login
STANDALONEfalseif not set, this application not required to set KONG_URL
VERIFICATION_CODE_EXPIRES10integersregister verification code expiration time
SITE_NAMEOpen Tree Holetitle prefix of verification email
ENABLE_REGISTER_QUESTIONSfalseif set, user will be set "have not answered questions" when registered

File settings, required in production mode

Env NameDefault PathDefaultDescription
IDENTIFIER_SALT/var/run/secrets/identifier_salt123456hash salt for encrypting email; required in production mode
REGISTER_APIKEY_SEED/var/run/secrets/register_apikey_seedregister apikey; if not set, disable apikey register function
KONG_TOKEN/var/run/secrets/kong_tokenkong api token

Debug Development Prerequisite

  1. set STANDALONE environment to true
  2. if SHAMIR_FEATURE set true, it will create table shamir_public_key automatically, and insert default shamir private keys defined in ./data/*-private.key

Production Deploy Prerequisite

  1. Kong Gateway deployed, see https://docs.konghq.com/gateway/latest/

  2. Prepare mysql/sqlite database, if SHAMIR_FEATURE set true or default

Create table shamir_public_key

CREATETABLE `shamir_public_key`
(
`id`bigintNOT NULL AUTO_INCREMENT,
`identity_name` longtext NOT NULL,
`armored_public_key` longtext NOT NULL,
PRIMARY KEY (`id`)
);

Insert an odd number of PGP key administrator records greater than 1 into this table. The Shamir threshold is calculated as more than half of the current key count.

identity_name: PGP identity name or uid, including username, ( comment ) and < email >

armored_public_key: the public key begin with -----BEGIN PGP PUBLIC KEY BLOCK----- and end with -----END PGP PUBLIC KEY BLOCK-----

Docker Deploy

This project continuously integrates with docker. Go check it out if you don't have docker locally installed.

Note: this docker image use MODE production as default, please check your configuration when deploying.

docker run -d -p 8000:8000 opentreehole/auth_next

or use docker compose

For api documentation, please open http://localhost:8000/docs after running app

Badge

starsissuespull requests

standard-readme compliant

Powered by

GoSwagger

Contributing

Feel free to dive in! Open an issue or Submit PRs.

Contributors

This project exists thanks to all the people who contribute.

contributors

Licence

license © OpenTreeHole

About

Next Generation of Auth microservice integrated with kong for registration and issuing tokens

Resources

Stars

11 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages