-
Notifications
You must be signed in to change notification settings - Fork 15
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
Adding JWT token to Openseadragon requests #40
base: 2.x
Are you sure you want to change the base?
Conversation
Second PR I've got going getting blocked by this 🤕 |
@@ -79,6 +79,9 @@ function template_preprocess_openseadragon_formatter(&$variables) { | |||
'id' => $openseadragon_viewer_id, | |||
'prefixUrl' => 'https://cdnjs.cloudflare.com/ajax/libs/openseadragon/2.4.2/images/', | |||
'tileSources' => $tile_sources, | |||
'loadTilesWithAjax' => TRUE, | |||
'ajaxWithCredentials' => TRUE, | |||
'ajaxHeaders' => ["Authorization" => "Bearer " . \Drupal::service('jwt.authentication.jwt')->generateToken()], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cache tags/contexts would have to be added for this to avoid using the results for all users and/or living beyond their expiry... and does it make sense to be generating tokens for anonymous users, if it's going to trash the cache?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch @adam-vessey . I'll give it the caching treatment for users.
If anonymous having a token breaks caching, I can tell it not to add a token for anon and then adjust the custom delegate appropriately.
@dannylamb can you include @whikloj 's github action mysql fix to your PR: https://islandora.slack.com/archives/CM5PPAV28/p1639679529204300? More specifically, add this line https://github.com/whikloj/islandora/blob/2.x/.github/workflows/build-2.x.yml#L122 to our github workflows config? |
GitHub Issue: Islandora/documentation#2011
Release pull requests, etc.)
What does this Pull Request do?
Adds credentials to Openseadragon AJAX requests
What's new?
Jammin' in a JWT in the preprocess hooks
How should this be tested?
Once you pull in this PR, visit a page with the openseadragon viewer on it and check out the request in your developer console. You should see the AJAX request from Openseadragon with an Authorization header.
Interested parties
@Islandora/8-x-committers