1
0
mirror of https://github.com/Yubico/yubiadmin.git synced 2025-02-20 14:54:30 +01:00

Added db settings to auth.

This commit is contained in:
Dain Nilsson 2013-05-08 12:05:32 +02:00
parent 1b31251430
commit 49b235e6f0
2 changed files with 33 additions and 9 deletions

View File

@ -25,9 +25,7 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
from wtforms.fields import (SelectField, TextField, PasswordField,
BooleanField, IntegerField)
from wtforms.widgets import PasswordInput
from wtforms.fields import SelectField, TextField, BooleanField, IntegerField
from wtforms.validators import NumberRange, URL
from yubiadmin.util.app import App
from yubiadmin.util.config import (python_handler, python_list_handler,
@ -61,6 +59,8 @@ auth_config = FileConfig(
('yubikey_id', python_handler('YUBIKEY_IDENTIFICATION', False)),
('use_hsm', python_handler('USE_HSM', False)),
('hsm_device', python_handler('YHSM_DEVICE', 'yhsm://localhost:5348')),
('db_config', python_handler('DATABASE_CONFIGURATION',
'sqlite:///:memory:')),
]
)
@ -122,6 +122,24 @@ class HSMForm(ConfigForm):
hsm_device = TextField('YubiHSM device')
class DatabaseForm(ConfigForm):
legend = 'Database'
description = 'Settings for connecting to the database'
config = auth_config
attrs = {'db_config': {'class': 'input-xxlarge'}}
db_config = TextField(
'Connection String',
description="""
SQLAlchemy connection string. For full details on syntax and supported
database engines, see this section of the <a
href="http://docs.sqlalchemy.org/en/rel_0_8/core/engines.html"
>SQLAlchemy documentation</a>.
Example: <code>postgresql://yubiauth:password@localhost/yubiauth</code>
"""
)
class ValidationServerForm(ConfigForm):
legend = 'Validation Servers'
description = 'Configure servers used for YubiKey OTP validation'
@ -149,7 +167,7 @@ class YubiAuth(App):
"""
name = 'auth'
sections = ['general', 'validation', 'advanced']
sections = ['general', 'database', 'validation', 'advanced']
def general(self, request):
"""
@ -157,6 +175,12 @@ class YubiAuth(App):
"""
return self.render_forms(request, [SecurityForm(), HSMForm()])
def database(self, request):
"""
Database
"""
return self.render_forms(request, [DatabaseForm()])
def validation(self, request):
"""
Validation Server(s)

View File

@ -168,14 +168,14 @@ class SyncPoolForm(ConfigForm):
sync_pool = ListField(
'Sync Pool URLs', [URL()],
description="""
List of URLs to other servers in the sync pool.<br />
List of URLs to other servers in the sync pool.
Example: <code>http://example.com/wsapi/2.0/sync</code>
""")
allowed_sync_pool = ListField(
'Allowed Sync IPs', [IPAddress()],
description="""
List of IP-addresses of other servers that are allowed to sync with
this server.<br />
this server.
Example: <code>10.0.0.1</code>
""")
@ -193,9 +193,9 @@ class KSMForm(ConfigForm):
ksm_urls = ListField(
'KSM URLs', [URL()],
description="""
List of URLs to KSMs.<br />
The URLs must be fully qualified, i.e., contain the OTP itself.<br />
Example: <code>http://example.com/wsapi/decrypt?otp=$otp</code><br />
List of URLs to KSMs.
The URLs must be fully qualified, i.e., contain the OTP itself.
Example: <code>http://example.com/wsapi/decrypt?otp=$otp</code>
More advanced OTP to KSM mapping is possible by manually editing the
configuration file.
""")