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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: authorization headers on Typhos help widget redirect #457

Merged
merged 8 commits into from Oct 12, 2021

Conversation

klauer
Copy link
Contributor

@klauer klauer commented Oct 12, 2021

Description

  • Move webkit-related things to typhos.web (to isolate and also move web log messages to a different logger instance)
  • Add user-configured headers (including bearer authentication = access tokens) to accessed pages
  • Header addition is limited only to configured hosts (TYPHOS_HELP_HEADERS_HOSTS env variable)
  • Redirects javascript console log messages to Python's logger (at debug level); we almost never care about these messages

Motivation and Context

New confluence release includes a redirect, so our help system wasn't working with access tokens only being set on the first go.

How Has This Been Tested?

Interactively.

Where Has This Been Documented?

Mostly in this PR text and docstrings.

Screenshots (if appropriate):

image

@klauer klauer requested a review from ZLLentz October 12, 2021 17:56
@klauer klauer changed the title Fix auth redirect FIX: authorization headers on Typhos help widget redirect Oct 12, 2021
@@ -15,7 +15,7 @@ def _warn_unhandled(instance, metadata_key, value):
if value is None:
return

logger.warning(
logger.debug(
Copy link
Member

Choose a reason for hiding this comment

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

sneaky

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Begone, annoying log messages!

self, level, message, line_number, source_id
):
"""
This hook redirects javascript console messages to Python logging.
Copy link
Member

Choose a reason for hiding this comment

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

A++ this is something that I need to duplicate in pmps-ui

Copy link
Member

@ZLLentz ZLLentz left a comment

Choose a reason for hiding this comment

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

Everything here seems reasonable, I agree with putting the web stuff into its own submodule (I've had trouble finding it before) and I think you've gone to the correct level in making sure we don't share our credentials with arbitrary websites that we may find links to on confluence.

@ZLLentz ZLLentz merged commit 2331e1c into pcdshub:master Oct 12, 2021
@klauer klauer deleted the fix_auth_redirect branch October 12, 2021 21:42
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

2 participants