summaryrefslogtreecommitdiff
path: root/create-token
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-10-13 13:50:29 +0300
committerLars Wirzenius <liw@liw.fi>2017-10-13 13:50:29 +0300
commit8cfe621c69abab445c370b22435f9c800159a029 (patch)
treef5f0c56fb0ef3c0eafff639ed7ef2718d595fd4e /create-token
parent21ed1fe8615dcc086cf2f5eabf2693b42f8a88c9 (diff)
downloadick2-8cfe621c69abab445c370b22435f9c800159a029.tar.gz
Change: make create-token be more easily useable
Diffstat (limited to 'create-token')
-rwxr-xr-xcreate-token15
1 files changed, 9 insertions, 6 deletions
diff --git a/create-token b/create-token
index bbcee42..a99b611 100755
--- a/create-token
+++ b/create-token
@@ -23,20 +23,23 @@ import Crypto.PublicKey.RSA
import apifw
-filename = sys.argv[1]
-iss = sys.argv[2]
-aud = sys.argv[3]
-scopes = ' '.join(sys.argv[4].split())
+# FIXME: These should agree with how ick controller is configured.
+# See the Ansible playbook.
+iss = 'localhost'
+aud = 'localhost'
-key_text = open(filename, 'r').read()
+
+key_text = sys.stdin.read()
key = Crypto.PublicKey.RSA.importKey(key_text)
+scopes = ' '.join(sys.argv[1].split())
+
now = time.time()
claims = {
'iss': iss,
'sub': 'subject-uuid',
'aud': aud,
- 'exp': now + 3600,
+ 'exp': now + 86400, # FIXME: This is silly long
'scope': scopes,
}