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

allows SymphonyClient to operate without the guests UserID and PIN #362

Merged
merged 14 commits into from
May 19, 2021

Conversation

whereismyjetpack
Copy link
Contributor

No description provided.

@whereismyjetpack whereismyjetpack changed the title allows SymphonyClient to operate without the guests UserID and PIN [wip] allows SymphonyClient to operate without the guests UserID and PIN Mar 5, 2021
@whereismyjetpack
Copy link
Contributor Author

whereismyjetpack commented Mar 5, 2021

Instead of taking the guests userID from symphony, we get it from the REMOTE_USER variable. This will get set by Apache in qa/stage/prod. locally we can put this in with something like

https://addons.mozilla.org/en-US/firefox/addon/modheader-firefox/

SymphonyClient was modified to use it's own credentials instead of ones supplied by the symphony callback.

Instead of logging in and returning the current user, we login as "staff" and then lookup remote_user, and return that.

This PR introduces two new configuration parameters
Settings.symws.username and Settings.symws.password We'll provide test accounts for developers to use.

TODO

  • test barred accounts
  • test user logged in, but not in symphony (djb44)
  • create test accounts for developer use
  • configure non production servers with mod_openidc, and protect all paths
  • any other testing that may need to take place.

@whereismyjetpack
Copy link
Contributor Author

I return nil in the symphony service if a patron isn't in the database, or if the webservice doesn't return nil. i should probably return {} or a Hash with a useful message?

I made the request header configurable, and while I was at it allowed some settings to be configurable from the environment (this allows a much easier kubernetes config, etc) some of the other settings may want to be overridden in the same way..

This is still very much a WIP, but we've got a pretty good working config now.

@banukutlu
Copy link
Contributor

Just noting this here so to remember when testing:

image

Barred can't do anything
Delinquent can do anything
Blocked can renew and place holds only
Collection is the same as Blocked

Any of them should be able to update address

@whereismyjetpack
Copy link
Contributor Author

whereismyjetpack commented Mar 11, 2021

This code is running at https://myaccount-qa.dev.k8s.libraries.psu.edu (it's not being automatically deployed or anything, but i wanted an isolated place to test this)

This deployment is using the MYACCOUNT user that was created for myaccount, there's still some work to be done, i'd like to bubble up more friendly error messages instead of redirecting to /500, for one. I will get those credentials over to @banukutlu and @cdmo safely by next week.

@banukutlu banukutlu added this to the 1.0.x milestone Apr 6, 2021
@whereismyjetpack
Copy link
Contributor Author

Based off of our conversation in Teams yesterday, I coded up a crude "masquerade" feature.

I Introduced a new Settings value of admin_users if the remote_user is in that list, and they initially login with the query parameter of ?masquerade=abc123 they will be switched to that user. If this is a useful feature, we could potentially expose it in the UI or something, but this gets Ruth unstuck from testing

Previously, when calling logout, it would redirect to the home page, now that the web-server is enforcing authentication, it would just log you right back in. I coded up a crude logout view, so that the session doesn't get reinstated.

@banukutlu
Copy link
Contributor

Just noting this here so to remember when testing:

image

Barred can't do anything
Delinquent can do anything
Blocked can renew and place holds only
Collection is the same as Blocked

Any of them should be able to update address

@ruthtillman Have you been able to test with different accounts?

@ruthtillman
Copy link
Collaborator

Yes, I have been able to test all of these!

@@ -9,7 +9,8 @@
# Offense count: 2
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 258
# TODO change only for SymphonyClient, or refactor SymphonyClient
Max: 280
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can add an exclude for SymphonyClient to https://github.com/psu-libraries/myaccount/blob/main/.rubocop.yml

else
# if the symphony client returns no user we might want to redirect to a page that
# says that they don't have a record?
redirect_to '/500'
Copy link
Contributor

@banukutlu banukutlu May 13, 2021

Choose a reason for hiding this comment

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

yes, we can redirect to a custom error page for this case as you mentioned @whereismyjetpack, we can add that in a later PR 👍 I will add an issue for that. I think it is good for now, we all would love to see this PR deployed.

Copy link
Contributor

@banukutlu banukutlu left a comment

Choose a reason for hiding this comment

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

LGTM 👌 🎉 thanks @whereismyjetpack 🍻

@whereismyjetpack whereismyjetpack changed the title [wip] allows SymphonyClient to operate without the guests UserID and PIN allows SymphonyClient to operate without the guests UserID and PIN May 19, 2021
@banukutlu banukutlu removed the on hold label May 19, 2021
@banukutlu banukutlu merged commit 232edce into main May 19, 2021
@banukutlu banukutlu deleted the mod_openidc branch May 19, 2021 14:24
@banukutlu banukutlu mentioned this pull request May 19, 2021
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.

3 participants