feat: several improvements to azlux's token auth scheme #154

1. 'auth_method' in config, where users can select between
   'password' and 'token'.
2. create index for token, avoid iterating the entire user
   section when validating tokens.
3. only generate token for a user when there's no token for
   him in the db, avoid tokens fill the db.
This commit is contained in:
Terry Geng
2020-05-18 10:17:08 +08:00
parent 4017e7bff0
commit edf5495fe5
5 changed files with 64 additions and 69 deletions

View File

@ -108,33 +108,35 @@ port = 64738
# - "pause",
# - "pause_resume" (pause and resume once somebody re-enters the channel)
# - "stop" (also clears playlist)
# - "nothing" or leave empty (do nothing)
#when_nobody_in_channel = nothing
# - leave empty (do nothing)
#when_nobody_in_channel =
# [webinterface] stores settings related to the web interface.
[webinterface]
# 'enable': Set 'enabled' to True if you'd like to use the web interface to manage
# your playlist, upload files, etc.
# The web interface is disable by default for security and performance reason.
# 'access_address': Used when user are questing the address to access the web interface.
#enabled = False
#listening_addr = 127.0.0.1
#listening_port = 8181
#is_web_proxified = True
#access_address = http://127.0.0.1:8181
# 'web_logfile': write access logs of the web server into this file.
#web_logfile =
# 'required_auth': Set this to True to enable password protection for the web interface.
#require_auth = False
#user =
#password =
# 'auth_method': Method used to authenticate users accessing the web interface.
# Options are 'password', 'token', 'none'
#auth_method = password
# Set this option to match mumble user with user on the webinterface
# It's working with an unique token an user can ask to the bot with token and to add music to the bot.
# It's also allow users to know who have add a music from the webinterface
# match_mumble_user = True
# 'user', 'password': If auth_method set to 'password', you need to set the username and
# password.
#user = botamusique
#password = mumble
# To use token (need session) flask need a password to encrypt/sign cookies used. !! YOU NEED TO CHANGE IT IF PREVIOUS OPTION IS TRUE!!
# 'flask_secret': To use token, flask need a password to encrypt/sign cookies.
# !! YOU NEED TO CHANGE IT IF auth_method IS 'token'!!
# flask_secret = ChangeThisPassword
# [debug] stores some debug settings.