-
Notifications
You must be signed in to change notification settings - Fork 51
Add authorization to GO library #554
Add authorization to GO library #554
Conversation
kuksa_go_client/README.md
Outdated
If you want the GO client to work with the KUKSA.val server specify protocol as ws if you want to use the KUKSA.val databroker set protocol to grpc. On command line it's available thorugh -protocol ws/grpc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not "thorugh" I assume? The first sentence could also benefit from rephrasing, or a dot/period after as ws
bf153f2
to
6b167b5
Compare
var token string | ||
if *protocol == "ws" { | ||
// example token from kuksa.val/kuksa_certificates/jwt/all-read-write.json.token | ||
token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJrdWtzYS52YWwiLCJpc3MiOiJFY2xpcHNlIEtVS1NBIERldiIsImFkbWluIjp0cnVlLCJpYXQiOjE1MTYyMzkwMjIsImV4cCI6MTc2NzIyNTU5OSwia3Vrc2EtdnNzIjp7IioiOiJydyJ9fQ.QQcVR0RuRJIoasPXYsMGZhdvhLjUalk4GcRaxhh3-0_j3CtVSZ0lTbv_Z3As5BfIYzaMlwUzFGvCVOq2MXVjRK81XOAZ6wIsyKOxva16zjbZryr2V_m3yZ4twI3CPEzJch11_qnhInirHltej-tGg6ySfLaTYeAkw4xYGwENMBBhN5t9odANpScZP_xx5bNfwdW1so6FkV1WhpKlCywoxk_vYZxo187d89bbiu-xOZUa5D-ycFkd1-1rjPXLGE_g5bc4jcQBvNBc-5FDbvt4aJlTQqjpdeppxhxn_gjkPGIAacYDI7szOLC-WYajTStbksUju1iQCyli11kPx0E66me_ZVwOX07f1lRF6D2brWm1LcMAHM3bQUK0LuyVwWPxld64uSAEsvSKsRyJERc7nZUgLf7COnUrrkxgIUNjukbdT2JVN_I-3l3b4YXg6JVD7Y5g0QYBKgXEFpZrDbBVhzo7PXPAhJD6-c3DcUQyRZExbrnFV56RwWuExphw8lYnbMvxPWImiVmB9nRVgFKD0TYaw1sidPSSlZt8Uw34VZzHWIZQAQY0BMjR33fefg42XQ1YzIwPmDx4GYXLl7HNIIVbsRsibKaJnf49mz2qnLC1K272zXSPljO11Ke1MNnsnKyUH7mcwEs9nhTsnMgEOx_TyMLRYo-VEHBDLuEOiBo" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hard-coded token here means that we practically ignore what has been defined in https://github.com/eclipse/kuksa.val/blob/master/kuksa_go_client/kuksa-client.json right? As we only use it as backup? Or?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but since these are some examples how to use the go client, I thought this would be the best way to showcase it.
kuksa_go_client/kuksa_client/grpc.go
Outdated
func (cg *KuksaClientCommGrpc) AuthorizeKuksaValConn(TokenOrTokenfile string) error { | ||
var tokenString string | ||
if TokenOrTokenfile == "" { | ||
if cg.Config.TokenOrTokenfile != ""{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be an idea to reverse the logic here
if cg.Config.TokenOrTokenfile != ""
else
Then we have no "dead" code, and one could actually use the config in https://github.com/eclipse/kuksa.val/blob/master/kuksa_go_client/kuksa-client.json (which by the way needs a changed keyword for "token", and also another port if the default is for a kuksa-val server connection (port 8090)
I have verified:
|
6b167b5
to
3b42f4b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reviewed the original changes and have tested towards both databroker and server.
As Lukas is on vacation I have performed the updates I requested.
Tests performed for both Broker and Server:
- Using hardcoded token from code
- Using token file specified in config file
- Checking that you get an error (although not always easy to understand if tokenfile in config does not exist
@SebastianSchildt - As I did some updates on the PR from Lukas I think it would be good if you could do a sanity check, and if ok merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did some basic checks, runs for me as well
No description provided.