Versent / saml2aws

CLI tool which enables you to login and retrieve AWS temporary credentials using a SAML IDP
https://github.com/Versent/saml2aws
MIT License
2.07k stars 563 forks source link

Browser provider - Autofill works with more authentication forms #1242

Closed vjeantet closed 6 months ago

vjeantet commented 6 months ago

Hello,

This PR proposition updates the way the autofill func submits the form: Instead of locating the submit button and clicking on it, it send an Enter keypress.

I had to implement this to make it works with my company authentification web form, which has no html submit button, but an image with javascript events linked to it.

vjeantet commented 6 months ago

Hello, That won't work.

I can suggest something that covers all cases:

WHEN the input[type="submit"] exists, THEN click on it. WHEN the input[type="submit"] does not exist THEN press ENTER.

mapkon commented 6 months ago

Hello, That won't work.

I can suggest something that covers all cases:

WHEN the input[type="submit"] exists, THEN click on it. WHEN the input[type="submit"] does not exist THEN press ENTER.

Sounds much more resilient. If you don't mind, please add some tests to hasten the reviews.

vjeantet commented 6 months ago

updated to handle the two cases, with tests.

codecov-commenter commented 6 months ago

Codecov Report

Attention: Patch coverage is 80.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 41.96%. Comparing base (9a4c5b6) to head (b5bcd39). Report is 61 commits behind head on master.

Files Patch % Lines
pkg/provider/browser/browser.go 80.00% 1 Missing and 1 partial :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1242 +/- ## ========================================== + Coverage 40.44% 41.96% +1.52% ========================================== Files 54 54 Lines 8276 6381 -1895 ========================================== - Hits 3347 2678 -669 + Misses 4491 3266 -1225 + Partials 438 437 -1 ``` | [Flag](https://app.codecov.io/gh/Versent/saml2aws/pull/1242/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Versent) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/Versent/saml2aws/pull/1242/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Versent) | `41.96% <80.00%> (+1.52%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Versent#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.