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

Use postMessage to alert window.topon framed login #1206

Merged
merged 1 commit into from
Jan 16, 2020

Conversation

plessbd
Copy link
Contributor

@plessbd plessbd commented Jan 16, 2020

Replaces #1198

detect if login is within an iframe and do not redirect to the portal, instead send a postMessage to window.top

Use the following in window.top to recieve message and react accordingly

window.addEventListener("message", receiveMessage, false);

function receiveMessage(event) {
  if (event.origin !== "{FQDN OF XDMOD INSTANCE WITH PROTOCOL AND PORT IF NEEDED}"){
    console.log('Received message from untrusted origin, discarding');
    return;
  }
  if(event.data.application == 'xdmod'){
    if(event.data.message == 'loginComplete'){
      console.log('XDMoD has logged in successfully');
    }
	if(event.data.message == 'error'){
      console.log('ERROR: ' + event.data.info);
    }
  }
}

@plessbd plessbd changed the title Uses postMessage to alert window.top Use postMessage to alert window.topon framed login Jan 16, 2020
@jpwhite4 jpwhite4 added this to the 8.7.0 milestone Jan 16, 2020
@plessbd plessbd added enhancement Enhancement of the functionality of an existing feature Open OnDemand Specific changes for Open OnDemand Integration labels Jan 16, 2020
@plessbd plessbd mentioned this pull request Jan 16, 2020
@plessbd plessbd marked this pull request as ready for review January 16, 2020 16:29
@plessbd plessbd merged commit b28197e into ubccr:xdmod8.7 Jan 16, 2020
@plessbd plessbd deleted the ood-int-iframe-login branch January 16, 2020 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of the functionality of an existing feature Open OnDemand Specific changes for Open OnDemand Integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants