-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathidemeum_1.0.0.min.js
More file actions
1 lines (1 loc) · 4.45 KB
/
idemeum_1.0.0.min.js
File metadata and controls
1 lines (1 loc) · 4.45 KB
1
var clientId,clientLogin,script=document.createElement("script");script.src="https://code.jquery.com/jquery-3.4.1.min.js",script.type="text/javascript",document.getElementsByTagName("head")[0].appendChild(script);var IdemeumManager=function(){function e(e){clientId=e}return e.prototype.login=function(){return new Promise((function(e,n){screen.height,void 0!==window.screenLeft?window.screenLeft:window.screenX,void 0!==window.screenTop?window.screenTop:window.screenY;var t=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width;window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,window.screen.availWidth;window.addEventListener("message",(function(t){console.log(t);var o=JSON.parse(t.data);o.status?(localStorage.setItem("oidc_token",JSON.stringify(o.oidc)),e(o)):n(o)}),!1);window.open("https://ciam.idemeum.com/api/consumer/authorize?clientId="+clientId,"LoginScreen")}))},e.prototype.userClaims=function(){var e=localStorage.getItem("oidc_token");return new Promise((function(n,t){null!=e&&""!=e&&"{}"!=JSON.stringify(e)?$.ajax({url:"https://ciam.idemeum.com/api/consumer/token/validation",type:"POST",data:e,headers:{accept:"application/json","Content-Type":"application/json"},success:function(e){n(e),console.log(e.d)},error:function(e,n,o){t(o)}}):t("Login first and then validate token.")}))},e.prototype.logout=function(){localStorage.removeItem("oidc_token")},e.prototype.isLoggedIn=function(){var e=localStorage.getItem("oidc_token");return new Promise((function(n,t){null!=e&&""!=e&&"{}"!=JSON.stringify(e)?$.ajax({url:"https://ciam.idemeum.com/api/consumer/token/validation/accessToken",type:"POST",data:e,headers:{accept:"application/json","Content-Type":"application/json"},success:function(e){n(!0),console.log(e.d)},error:function(e,n,o){t(!1)}}):t(!1)}))},e}();$(document).ready((function(){$("#btnSignin").css({"background-color":"white","border-radius":"5px",color:"black","font-weight":"bold",width:"270px",height:"54px","font-size":"16px",border:"1.5px solid #9E9E9E"}).html("<img style='height: 16px;' src='https://asset.idemeum.com/webapp/assets/images/idemeum-logo-black.png'> Sign in with Idemeum")}));