summaryrefslogtreecommitdiff
path: root/yarns
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-11-05 12:20:01 +0100
committerLars Wirzenius <liw@liw.fi>2017-11-05 12:20:01 +0100
commite213b794bfa6bc04679e0c99b3f495995b6c0520 (patch)
tree53bbc4080e16609a3aedc56b20799c43dc36ce48 /yarns
parent4b9774a416f917e6d8048c9260b232fc6718a11e (diff)
downloadick2-e213b794bfa6bc04679e0c99b3f495995b6c0520.tar.gz
Add: implement getting access token for named user
Diffstat (limited to 'yarns')
-rw-r--r--yarns/900-local.yarn13
1 files changed, 12 insertions, 1 deletions
diff --git a/yarns/900-local.yarn b/yarns/900-local.yarn
index 18bf056..43f710c 100644
--- a/yarns/900-local.yarn
+++ b/yarns/900-local.yarn
@@ -41,7 +41,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
vars['audience'] = 'localhost'
IMPLEMENTS GIVEN an access token for (\S+) with scopes (.+)
- assert 0
+ user = get_next_match()
+ scopes = get_next_match()
+ key = open('token.key').read()
+ argv = [
+ os.path.join(srcdir, 'create-token'),
+ scopes,
+ ]
+ token = cliapp.runcmd(argv, feed_stdin=key)
+ filename = '{}.jwt'.format(user)
+ write(filename, token)
+ vars['issuer'] = 'localhost'
+ vars['audience'] = 'localhost'
## Controller configuration