choria-io / aaasvc

Choria Centralized AAA Service
https://choria.io
Apache License 2.0
6 stars 8 forks source link

CHORIA_TOKEN should be token rather than json #80

Closed traylenator closed 3 years ago

traylenator commented 3 years ago

As the example stands the result is.

$ export CHORIA_TOKEN=$(curl -s --request POST -d '{"username":"user", "password":"pass"}' -H "Content-type: application/json" -k http://localhost:8080/choria/v1/login )
$ choria ping
WARN[0000] Puppet security system requesting legacy TLS support  component=security ssl=puppet
FATA[0000] Could not run Choria: could not perform request: could not connect: could not create connector: could not parse JWT: illegal base64 data at input byte 0

pulling out just the token string.


$ export CHORIA_TOKEN=$(curl -s --request POST -d '{"username":"user", "password":"pass"}' -H "Content-type: application/json" -k http://localhost:8080/choria/v1/login | jq -r .token )
$ choria ping -d
...
INFO[0000] Setting JWT token and unique reply queues based on JWT for "up=user"  component=client connection=user-efbebc7607314ffd93c3$
f4d4d3b5c5b-publisher
DEBU[0000] Setting anonymous TLS for NATS connection     component=client connection=user-efbebc7607314ffd93c3df4d4d3b5c5b-publisher
INFO[0000] Attempting to connect to: nats://ch-broke-client.cern.ch:4222  component=client connection=user-efbebc7607314ffd93c3df4d4d3b5c5$
-publisher
INFO[0000] Setting JWT token and unique reply queues based on JWT for "up=user"  component=client connection=user-efbebc7607314ffd93c3$
f4d4d3b5c5b-receiver0
DEBU[0000] Setting anonymous TLS for NATS connection     component=client connection=user-efbebc7607314ffd93c3df4d4d3b5c5b-receiver0
...
ripienaar commented 3 years ago

Thanks 👍