-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add native token based authentication #247
Conversation
Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
…arameter. Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
Hey @CWempe here is my announced ping for you. The extension now checks for the presence of a configured openHAB auth token. I have changed the configuration options heavily, so there should be tons of warnings and errors, when using this extension version. Here is how it should look in settings UI and editor: Basically i just want to make sure that the extension runs for the basic things like items/things explorer, hovering action and base lsp stuff. |
I have also changed some parts of the Remote LSP Server. |
Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
Finally found out to download the latest file. This is my config (openHAB 2.4)FeedbackThis is what I got after installing the new version ( It might be correct that not connection to the server is an error. Maybe a nice warning like "There have been changes to the openHAB addon. Please edit your setting." would help. After clicking "Show Output" in the error dialog I get this error: Again, I think this error is to technical. We should tell the user how to fix it. Not only what is not working. ;) You might have done this already with 02ff868. But I do not see it before looking at my Why are there hashes in the warnings? After changing my config, I can use the hover features, which indicates that the connection is working, I guess. 👍
|
Hm we could use both configuration entries parallel for now, but that would be a ton of extra code.
This is mainly meant for copypasting it into the forum.
Those hashes are coming from the markdown description. Thanks for the early look. |
I just noticed the "No quick fix available" message. Is it possible to add a "Quick fix" that adapts the config to the new syntax? Again: I do not know how many users are using this addon. |
I made some thoughts yesterday and decided to cut out config management into its own class. Maybe such a function can be added there too. My idea was to prompt a warning and add a button to do this like we already have with |
I will also do the same for api calls, so that we will have all api logic in one place for the future. |
Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
…gic. Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
OK @CWempe you can get the latest build, if you still know where to find it. 😛 It should work as following:
Basically you should get a more or less working extension with this already without the need to configure anything. One culprit: I have left the default values for the LSP settings. |
Ah forgot: I did not yet create the warning message. |
Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
…ecated config values. Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
I used the new settings (host/API token) with the version provided above and the things & items appear properly. But when I try to expand a group I get:
Try to debug in the developer tools but wasn't able to get a proper stacktrace. |
The warning appears after installing the new version (
Looks good so far. 👍 |
Searched for this but did not find a solution yet. Indeed. |
Just realized I have two other settings configured that seem to be deprecated. I do not get a "deprecated" warning for these. They are just greyed out. It appears the old value for But I do not find a setting to define To be honest: It is the |
Another thought: Should the new version be named |
Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
I have seen that behavior too. I could remove the default for the deprecated port setting, but this will then break all users installations, where default port is used. (I would expect this to be a wide range of users.) I could also supress the warning for port for now and/or provide a special check for the new port parameter and anly provide a warning when the new port parameter us Edit: Maybe it would indeed be better to provide a little migration script which updates the deprecated values with the values from their deprecated ancestor parameters. |
I think you could implement the check for the "host" parameter only, since most users will probably have set it, and once they receive the warning they're likely to fix the rest of the config. (especially if they're prominently marked as deprecated). Also I noticed the "Open config file (JSON)" button created a file in the current workspace in my case, which I didn't want and isn't ideal since my parameters are in the global settings.json file. |
I am using a |
This is really tricky. I will have to do some research next week, how we can determine where the settings are from and save it to the correct location. I have made a quick migration script meanwhile, which i will commit now. It will also recognize, when a username contains an auth token and will then use the new authTOken parameter instead of username. |
Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
We can of course remove that, if it won't fit our needs. |
So.... Vscode can Here are the tricky ones:
|
I made some thoughts and i think we should migrate a minimum config of host, port and username to authToken when one has set it this way. This should solve most of the warnings in the majority of installations. Also i will remove the "Open Config" Buttons for now, until i have a idea of how to open the "correct" configuration page properly. |
Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
So the migration script will now check where the old config value was stored (global or workspace) and add the new config into the same scope. Or to be more precise: |
Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
Just tried The dialog about the new config appeared and I clicked " Migrate now".
When adding
|
I am not able to decide, which UI should be opened in some cases.
That's on purpose. See: #247 (comment)
This will appear until no old settings are found anymore.
I have to check those behaviors. For now it looks like you have/had set a username parameter (mabye parallel in a different scope)?!
This is a LSP Server Warning (i have just merged all output channels and it is shown within the extension now.) Should we check for a different setting than the default value and ask the user if he wants to disable it again? |
Another thing @CWempe Maybe we should make a cut here and avoid blowing up this PR endless. But that will be another big change in the codebase. So are you and maybe @ghys fine with this? |
Like I said in #247 (comment): Maybe we do not even need all this migration process.
I like this idea.
To be honest, I have no idea what you are talking about. 😅 This is all I had configured for the addon (in all scopes I think): "openhab.host": "192.168.1.149",
"openhab.port": 8080,
"openhab.username": "",
"openhab.karafCommand": "ssh openhab@%openhabhost% -p 8101",
"openhab.sitemapPreviewUI": "basicui", |
Yep, but that's because i thought it was worth it. Also the Migration Logic is something i think is worth the effort. So i will try to cut out the migration stuff here and store it in another branch.
Then you are running on default settings. (especially if you heard about this setting the first time now.) |
Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
If you're planning a major release I'd skip the obsolete config check and migration too. |
I have solved that in the last pr. I will do this in another PR with some minimal setup. see #249 for the thoughts i made about it. |
Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
OK i think this is it for now. I have readded karafCommand and SitemapPreview based on #247 (comment) to show a deprecation message and also include them in my checks. I will merge, if the build is fine and then work on a proper migration/release notes page that will be included in vscode. |
Heads up, I just checked and there's a new Authentication Provider API in VS Code that has just been promoted to stable last month; not sure what it can do right now but if it ends up easing the OAuth flows, then that could be very interesting: you could have a button to authorize VS Code to your openHAB instance, let the user authenticate on the standard authorize page, open a session, receive a refresh token and use that to get access tokens - the regular OAuth2 flow that the UI does. No need to have the user manually generate a token then. |
I already have an eye on that, but it currently is only capable of github and microsoft as authentication providers. https://code.visualstudio.com/api/references/vscode-api#authentication |
Finally thanks to all of your feedback. I will catch up on you for the beta then. |
This will add/change several things:
auth header
configuration so basic auth settings won't need to handle thisFixes #88
Fixes #171
Fixes #194
Fixes #233