Skip to content

Instantly share code, notes, and snippets.

@eballisty
Created October 30, 2017 16:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eballisty/532753bd1437723725a1d8bde6c5f930 to your computer and use it in GitHub Desktop.
Save eballisty/532753bd1437723725a1d8bde6c5f930 to your computer and use it in GitHub Desktop.
Mura SSO
function onSiteRequestStart($) {
if (external_service_gives_successful_login_message) {
userBean = $.getBean('user').loadBy(username=oAuth.prsId, $.event('siteID'));
userBean.setUsername(oAuth.prsId);
userBean.setPassword(oAuth.prsId & 'RANDOMREALLYCOMPLICATEDSTRING');
userBean.setFname(oAuth.firstName);
userBean.setLname(oAuth.lastName);
userBean.setEmail(oAuth.emailAddress);
userBean.save();
// log the user in
$.event("username", oAuth.prsId);
$.event("password", oAuth.prsId & "RANDOMREALLYCOMPLICATEDSTRING");
$.getBean('loginManager').login($.event().getAllValues(),'');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment