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

URL-encoding access token service source url; fixes #3902 #4068

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __tests__/src/components/AccessTokenSender.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('AccessTokenSender', () => {
it('renders properly', () => {
const { container } = createWrapper({ url: 'http://example.com' });

expect(container.querySelector('iframe')).toHaveAttribute('src', 'http://example.com?origin=http://localhost&messageId=http://example.com'); // eslint-disable-line testing-library/no-node-access, testing-library/no-container
expect(container.querySelector('iframe')).toHaveAttribute('src', 'http://example.com/?origin=http%3A%2F%2Flocalhost&messageId=http%3A%2F%2Fexample.com'); // eslint-disable-line testing-library/no-node-access, testing-library/no-container
});

it('triggers an action when the iframe sends a message', () => {
Expand Down
6 changes: 5 additions & 1 deletion src/components/AccessTokenSender.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ export function AccessTokenSender({ handleAccessTokenMessage, url = undefined })

if (!url) return null;

const src = new URL(url);
src.searchParams.append('origin', window.origin);
src.searchParams.append('messageId', url);

/**
login, clickthrough/kiosk open @id, wait for close
external, no-op
*/
return (
<IIIFIFrameCommunication
src={`${url}?origin=${window.origin}&messageId=${url}`}
src={src.toString()}
title="AccessTokenSender"
handleReceiveMessage={onReceiveAccessTokenMessage}
/>
Expand Down
Loading