uotp-client added
This commit is contained in:
parent
106b7df5db
commit
78326a52df
3 changed files with 13 additions and 11 deletions
|
@ -1,11 +1,17 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import pyotp
|
import pyotp
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from .config import env_vars
|
from uotp.config import env_vars, etcd_client
|
||||||
|
from os.path import join as join_path
|
||||||
|
from etcd3_wrapper import Etcd3Wrapper
|
||||||
|
|
||||||
arg_parser = argparse.ArgumentParser()
|
arg_parser = argparse.ArgumentParser()
|
||||||
arg_parser.add_argument("action", choices=["list", "create", "verify", "delete"])
|
arg_parser.add_argument("action",
|
||||||
|
choices=["list", "create", "verify", "delete",
|
||||||
|
"get-admin"])
|
||||||
arg_parser.add_argument("--name")
|
arg_parser.add_argument("--name")
|
||||||
arg_parser.add_argument("--realm")
|
arg_parser.add_argument("--realm")
|
||||||
arg_parser.add_argument("--seed")
|
arg_parser.add_argument("--seed")
|
||||||
|
@ -80,3 +86,7 @@ elif action == "delete":
|
||||||
url = "http://localhost:{}/delete/".format(env_vars.get('PORT'))
|
url = "http://localhost:{}/delete/".format(env_vars.get('PORT'))
|
||||||
r = requests.post(url, json=data)
|
r = requests.post(url, json=data)
|
||||||
print(r.content.decode("utf-8"))
|
print(r.content.decode("utf-8"))
|
||||||
|
|
||||||
|
elif action == "get-admin":
|
||||||
|
admin_uotp = etcd_client.get(join_path(env_vars.get('BASE_PREFIX'), 'admin'))
|
||||||
|
print(admin_uotp.value)
|
2
setup.py
2
setup.py
|
@ -26,5 +26,5 @@ setup(name='uotp',
|
||||||
'pyotp',
|
'pyotp',
|
||||||
'click'
|
'click'
|
||||||
],
|
],
|
||||||
scripts=['bin/uotp'],
|
scripts=['bin/uotp', 'bin/uotp-client'],
|
||||||
zip_safe=False)
|
zip_safe=False)
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
import decouple
|
|
||||||
|
|
||||||
from os.path import join as join_path
|
|
||||||
from etcd3_wrapper import Etcd3Wrapper
|
|
||||||
|
|
||||||
client = Etcd3Wrapper()
|
|
||||||
admin_uotp = client.get(join_path(decouple.config('BASE_PREFIX'), 'admin'))
|
|
||||||
print(admin_uotp.value)
|
|
Loading…
Reference in a new issue