Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate SAML/OIDC redirect JavaScript #9985

Merged
merged 6 commits into from
Jan 30, 2024
Merged

Conversation

aduth
Copy link
Member

@aduth aduth commented Jan 26, 2024

馃洜 Summary of changes

Consolidates openid-connect-redirect.ts and saml-post.js packs to a single click-immediate.ts which immediately clicks any elements annotated with a data-click-immediate attribute.

Why?

  • The intended behavior of these scripts is essentially the same
  • Remove legacy, non-typechecked JavaScript code
  • Smaller file size
  • Avoid announcing screen reader text for text which would not be visible for a JavaScript-enabled device

馃摐 Testing Plan

Using SAML & OIDC sample applications, verify there are no regressions in signing-in and redirecting back to the partner application.

Repeat testing instructions from #9790 to verify behavior of client-side OIDC redirect.

changelog: Internal, Code Quality, Consolidate redirect logic for SAML/OIDC
@@ -1,13 +1,16 @@
<!DOCTYPE html>
<html>
<html class="no-js">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice to have a base-ier base template that we could extend, to avoid having to bring in these individual elements.

There's probably some other features from the base template we want here too, like the lang attribute, some of the meta tags, etc.

app/views/saml_idp/shared/saml_post_binding.html.erb Outdated Show resolved Hide resolved
app/views/saml_idp/shared/saml_post_binding.html.erb Outdated Show resolved Hide resolved
Comment on lines 26 to 28
<% if params.key?(:RelayState) %>
<%= hidden_field_tag('RelayState', params[:RelayState]) %>
<% end %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we reuse saml_post_form.html.erb here and pass in :RelayState as form_params?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we reuse saml_post_form.html.erb here and pass in :RelayState as form_params?

Maybe! I can check

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was some prior discussion about this approach with a general leaning toward the duplication? Not sure I'd totally agree, but might save this for a separate effort.

https://github.com/18F/identity-idp/pull/5624/files#r753741166

@aduth
Copy link
Member Author

aduth commented Jan 29, 2024

Very strangely the spec failures have something to do with <html class="no-js"> in saml_post_binding.html.erb. The tests pass when the class attribute is removed. I'll take a closer look tomorrow.

@aduth
Copy link
Member Author

aduth commented Jan 30, 2024

Very strangely the spec failures have something to do with <html class="no-js"> in saml_post_binding.html.erb. The tests pass when the class attribute is removed. I'll take a closer look tomorrow.

This turned out to be caused by a spec helper looking specifically for an HTML opening tag without any attributes.

elsif @response.body.include?('<html>')

This was made more flexible in cf1c923, to allow for the new class attribute.

@aduth aduth merged commit da1311e into main Jan 30, 2024
2 checks passed
@aduth aduth deleted the aduth-saml-oidc-redirect branch January 30, 2024 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants