summaryrefslogtreecommitdiff
path: root/create-token
diff options
context:
space:
mode:
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,
}