From ac04ceb8fc2953c600d632107e118273f2e0faac Mon Sep 17 00:00:00 2001 From: Erik Jaegervall Date: Fri, 9 Jun 2023 13:46:52 +0200 Subject: [PATCH] Add example token for actuation and provision Intended use-case is tests with KUKSA.val Client if you want to be able to do both setValue and setTargetValue Also removing "width" from provide-vehicle-speed. If needed in some form that seems more to be a use-case-specific token which then better shall be stored within the service or test-case using it. --- jwt/README.md | 28 ++++++++++++++++++++++++++++ jwt/actuate-provide-all.json | 10 ++++++++++ jwt/actuate-provide-all.token | 1 + jwt/provide-vehicle-speed.json | 2 +- jwt/provide-vehicle-speed.token | 2 +- 5 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 jwt/README.md create mode 100644 jwt/actuate-provide-all.json create mode 100644 jwt/actuate-provide-all.token diff --git a/jwt/README.md b/jwt/README.md new file mode 100644 index 000000000..f84f0030d --- /dev/null +++ b/jwt/README.md @@ -0,0 +1,28 @@ +# Databroker Example Tokens + +This directory contains example tokens for demo and test purposes for KUKSA.val Databroker. +For more information on token format see [documentation](../doc/KUKSA.val_data_broker/authorization.md). + +## Available tokens + + +* `actuate-provide-all.token` - gives access to set target value and actual value for all signals +* `provide-all.token` - gives access to set actual value for all signals, but not target value +* `read-all.token` - gives access to read actual and current value for all signals +* `provide-vehicle-speed.token` - gives access to write and read actual value for Vehicle.Speed. Does not give access to other signals +* `read-vehicle-speed.token` - gives access to read actual value for Vehicle.Speed. Does not give access to other signals + + +## Create new tokens + +Tokens can be generated as described in [documentation](../kuksa_certificates/README.md). +Note that token generation must take place from the directory containing `createToken.py` + +An example is shown below: + +``` +~/kuksa.val/kuksa_certificates/jwt$ python -m createToken ../../jwt/actuate-provide-all.json +Reading private key from jwt.key +Reading JWT payload from ../../jwt/actuate-provide-all.json +Writing signed access token to ../../jwt/actuate-provide-all.token +``` diff --git a/jwt/actuate-provide-all.json b/jwt/actuate-provide-all.json new file mode 100644 index 000000000..c049a9353 --- /dev/null +++ b/jwt/actuate-provide-all.json @@ -0,0 +1,10 @@ +{ + "sub": "local dev", + "iss": "createToken.py", + "aud": [ + "kuksa.val" + ], + "iat": 1516239022, + "exp": 1767225599, + "scope": "actuate provide" +} \ No newline at end of file diff --git a/jwt/actuate-provide-all.token b/jwt/actuate-provide-all.token new file mode 100644 index 000000000..110d3c413 --- /dev/null +++ b/jwt/actuate-provide-all.token @@ -0,0 +1 @@ +eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJsb2NhbCBkZXYiLCJpc3MiOiJjcmVhdGVUb2tlbi5weSIsImF1ZCI6WyJrdWtzYS52YWwiXSwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjE3NjcyMjU1OTksInNjb3BlIjoiYWN0dWF0ZSBwcm92aWRlIn0.x-bUZwDCC663wGYrWCYjQZwQWhN1CMuKgxuIN5dUF_izwMutiqF6Xc-tnXgZa93BbT3I74WOMk4awKHBUSTWekGs3-qF6gajorbat6n5180TOqvNu4CXuIPZN5zpngf4id3smMkKOT699tPnSEbmlkj4vk-mIjeOAU-FcYA-VbkKBTsjvfFgKa2OdB5h9uZARBg5Rx7uBN3JsH1I6j9zoLid184Ewa6bhU2qniFt5iPsGJniNsKsRrrndN1KzthO13My44s56yvwSHIOrgDGbXdja_eLuOVOq9pHCjCtorPScgEuUUE4aldIuML-_j397taNP9Y3VZYVvofEK7AuiePTbzwxrZ1RAjK74h1-4ued3A2gUTjr5BsRlc9b7eLZzxLJkrqdfGAzBh_rtrB7p32TbvpjeFP30NW6bB9JS43XACUUm_S_RcyI7BLuUdnFyQDQr6l6sRz9XayYXceilHdCxbAVN0HVnBeui5Bb0mUZYIRZeY8k6zcssmokANTD8ZviDMpKlOU3t5AlXJ0nLkgyMhV9IUTwPUv6F8BTPc-CquJCUNbTyo4ywTSoODWbm3PmQ3Y46gWF06xqnB4wehLscBdVk3iAihQp3tckGhMnx5PI_Oy7utIncr4pRCMos63TnBkfrl7d43cHQTuK0kO76EWtv4ODEHgLvEAv4HA \ No newline at end of file diff --git a/jwt/provide-vehicle-speed.json b/jwt/provide-vehicle-speed.json index 55c4d3cd4..c5780b337 100644 --- a/jwt/provide-vehicle-speed.json +++ b/jwt/provide-vehicle-speed.json @@ -6,5 +6,5 @@ ], "iat": 1516239022, "exp": 1767225599, - "scope": "read:Vehicle.Width provide:Vehicle.Speed" + "scope": "provide:Vehicle.Speed" } \ No newline at end of file diff --git a/jwt/provide-vehicle-speed.token b/jwt/provide-vehicle-speed.token index 629c39f1b..8f33ac2c8 100644 --- a/jwt/provide-vehicle-speed.token +++ b/jwt/provide-vehicle-speed.token @@ -1 +1 @@ -eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJsb2NhbCBkZXYiLCJpc3MiOiJjcmVhdGVUb2tlbi5weSIsImF1ZCI6WyJrdWtzYS52YWwiXSwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjE3NjcyMjU1OTksInNjb3BlIjoicmVhZDpWZWhpY2xlLldpZHRoIHByb3ZpZGU6VmVoaWNsZS5TcGVlZCJ9.w2c8xrYwBVgMav3f0Se6E8H8E36Nd03rJiSS2A8s-CL3GtlwB7wVanjXHhppNsCdWym3tK4JwgslQdMQF-UL4hd7vzdtt-Mx6VjH_jO9mDxz4Z0Uzw7aJtbtQSpi2h6kwceTVTllkbLRF7WRHWIpwzXFF9yZolX6lH-BE9xf1AB62d6icd9SKxFnVvYs3MVK5D1xNmDNOmm-Fr0d2K604MmIIXGW5kPZJYIvBKO4NYRLklhJe47It_lGo3gnh1ppmzTOIo1kB4sDe55hplUCbTCJVricpyQSgTYsf7aFRPK51XMRwwwJ8kShWeaTggMLKpv1W-9dhVWDk4isC8BxsOjaVloArausMmjLmTz6KwAsfARgfXtaCrMsESUBNXi5KIdAyHVXZpmERvc9yeYPcaWlknVFrFsHbV6bw4nwqBX-0Ubuga0NGNQDFKmyTKQrbuZmQ3L9iipxY8_BOSCkdiYtWbE3lpplxpS_PaZl10KAaMmUfbcF9aYZunDEzEtoJgJe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