dbeck121 / CPI-Helper-Chrome-Extension

56 stars 19 forks source link

Plugin Credential Helper #169

Closed DevGregor closed 5 months ago

DevGregor commented 5 months ago

Description This plugin helps find existing aliases from Security Material and Key Store. It was wished for in https://github.com/dbeck121/CPI-Helper-Chrome-Extension/issues/151.

Steps

  1. An Event Listener is added for the click events when CPI Helper is rendered and the plugin has been activated

  2. If an input field for credentials is clicked it will get all the aliases from the Security Material and Key Store and add a new Event Listener for typing to that input field. The credential input field is distinguished by checking parts of the id.

  3. Each letter that is typed will be compared to the list of aliases by using the include() function and toLowerCase(). E.g. typing 'test' will trigger 4 checks with the following strings: 't', 'te', 'tes' and 'test'

  4. A dropdown will be added containing a div element for every matching alias. If there is no matching alias, a single item will be displayed, indicating that there are no matching aliases.

Info I have tested this in both CF and Neo and it works for the following adapters with every auth type that you can choose and also every "sub" version (e.g. OData -> V2/V4 or SOAP -> SOAP 1.X/SAP RM):

DevGregor commented 5 months ago

If we want, we can add it as a sort of "Beta" Version. Any adjustments are welcome (especially adressing the issues mentioned). @dbeck121

Issues

  • If the item is selected it will only be saved if you click onto the input field once more after selection.
DevGregor commented 5 months ago

@incpi Do you want to take a look at the issues here as well? I think your skills (especially in the frontend) would come in handy here! 😅

Incpi commented 5 months ago

Hi @DevGregor / @dbeck121 ,

Sure, i will be grateful if i can contribute.

I am doing testing with default settings from the new trial account with basic capabilities of building integration scenarios and manage API only. Where this user credentials Api is not available

Yes i do have mpl api but not security material apis.

I also deployed a few materials via ui as well.

If it is restricted to only s-user. No analysis yet. Please let me know if you also facing it.

Thanks, Omkar

DevGregor commented 5 months ago

Hi @DevGregor / @dbeck121 ,

Sure, i will be grateful if i can contribute.

I am doing testing with default settings from the new trial account with basic capabilities of building integration scenarios and manage API only. Where this Api is not available

Yes i do have mpl api but not security material apis.

I also deployed a few materials via ui as well.

If it is restricted to only s-user. No analysis yet. Please let me know if you also facing it.

Thanks, Omkar

Getting the data should already be working quite right. I have also adjusted some frontend issues with the most recent commits. Now I'm trying to set the value in the input field but I've only gotten so far that you have to click the input field again once a value has been chosen and I don't really know why yet: image image After closing the adapter and reopening it is set back to what I typed initially (if I don't click onto the input field once more): image If you retype or choose a different value than it's resetted and we need to do the same over.

EDIT Fixed by setting the focus to the input field after selection.

DevGregor commented 5 months ago

Hi @DevGregor / @dbeck121 ,

Sure, i will be grateful if i can contribute.

I am doing testing with default settings from the new trial account with basic capabilities of building integration scenarios and manage API only. Where this user credentials Api is not available

Yes i do have mpl api but not security material apis.

I also deployed a few materials via ui as well.

If it is restricted to only s-user. No analysis yet. Please let me know if you also facing it.

Thanks, Omkar

Check the latest commits. I noticed that as well so I switched it to something I had before and it works for me on Neo and CF. Don't know about trial.

DevGregor commented 5 months ago

All major issues should be fixed now. Obviously it's not perfect but I think you can already use this in a good way. @incpi @dbeck121

Incpi commented 5 months ago

@DevGregor Thanks, I also switched that API URL for this reason. I was testing your plugin & when your plugin is enabled. downstream plugin are not working due to some info missing. Would you mind take a look at that issue? I didn't do why cuz its almost 3 am here.

DevGregor commented 5 months ago

@DevGregor Thanks, I also switched that API URL for this reason. I was testing your plugin & when your plugin is enabled. downstream plugin are not working due to some info missing. Would you mind take a look at that issue? I didn't do why cuz its almost 3 am here.

What do you exactly mean with "downstream plugin"? I have multiple plugins activated and all of them seem to be working. Maybe it is related to my other pull request (#171) with the unlock plugin. My plugin is also in the messageSidebarContent section but I don't return anything like a div with a button, since I don't need that.

dbeck121 commented 5 months ago

Hey!

Thank you both @DevGregor and @incpi working together. It is great to see. I love our community :-)

I am testing right now. I reverted last commit to reapply the plugin. I have no problem with other plugins. The box with credentials appears after typing in a credentials box. Looks super nice.

Do you want the name of the credential to be put in the field after clicking?

DevGregor commented 5 months ago

Hey!

Thank you both @DevGregor and @incpi working together. It is great to see. I love our community :-)

I am testing right now. I reverted last commit to reapply the plugin. I have no problem with other plugins. The box with credentials appears after typing in a credentials box. Looks super nice.

Do you want the name of the credential to be put in the field after clicking?

Hello :)

Yes, with the latest commits here it should be working so that it is set into the input field after selecting and also "saved" when you leave the adapter and reenter it.

Incpi commented 5 months ago

@dbeck121 ,

Issue I mentioned was as follow,

Code change was minimal 2-5 LOC (Line of code) at the plugin engine script.

Fixed #167 as return made non mandatory.

DevGregor commented 5 months ago

@dbeck121 ,

Issue I mentioned was as follow,

  • As this plugin render doesn't return any element. due to this below plugin sidebar content was not rendering,following below Plugin working but with No content rendered.
  • Cond: I have trace modifier and simple ref are active. in between i have this plugin.
  • Behaviour: simple ref rendered, trace modifier data not rendered.

Fixed #167 as return made non mandatory.

Okay, thanks for the fix! @incpi Do we want to make a new "type" for plugins? I guess this plugin doesn't really make sense in the messageSidebarContent then but I didn't see a different way.

fippu82 commented 5 months ago

@DevGregor I thought about that too yesterday and think we need an option for kind of "headless" plugins. Or is that already provided by @incpi's fix?

DevGregor commented 5 months ago

@DevGregor I thought about that too yesterday and think we need an option for kind of "headless" plugins. Or is that already provided by @incpi's fix?

If I understood this correctly, then his fix means that it is not mandatory anymore to return a value in the "onRender" function for messageSidebarContent.

fippu82 commented 5 months ago

Which would fullfil the point. However, to make it more explicit, we could add a boolean property like "headless" to the settings list. If set to true, no return value would be expected. But that's a detail.

dbeck121 commented 5 months ago

I am a bit lost in your discussion. Just tell me when to pull :)

DevGregor commented 5 months ago

I am a bit lost in your discussion. Just tell me when to pull :)

It is ready to be pulled. The issue that @incpi has mentioned is fixed in his pull request (#167).