1
0
mirror of https://github.com/bitwarden/web synced 2025-12-15 15:53:18 +00:00
Files
web/connectors/duo.a3cee032b1bd0b131b53.js
github-actions[bot] 86eea14750 Staging deploy v2.22.0 (#1135)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-08-18 21:41:12 -07:00

2 lines
6.3 KiB
JavaScript

!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1249)}({1249:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(358),r=n(144);n(1250),document.addEventListener("DOMContentLoaded",(function(e){var t=document.createElement("iframe");t.setAttribute("id","duo_iframe"),a(),document.body.appendChild(t);var n=r.getQsParam("host"),i=r.getQsParam("request");function a(){t.style.height=window.innerHeight+"px"}o.init({iframe:"duo_iframe",host:n,sig_request:i,submit_callback:function(e){!function(e){try{window.invokeCSharpAction(e)}catch(t){}}(e.elements.sig_response.value)}}),window.onresize=a}))},1250:function(e,t,n){"use strict";n.r(t)},144:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.b64Decode=t.getQsParam=void 0,t.getQsParam=function(e){var t=window.location.href;e=e.replace(/[\[\]]/g,"\\$&");var n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null},t.b64Decode=function(e){return decodeURIComponent(Array.prototype.map.call(atob(e),(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))}},358:function(e,t,n){var o,r,i;r=[],void 0===(i="function"==typeof(o=function(){var e,t,n,o,r,i,a,u=/^(?:AUTH|ENROLL)+\|[A-Za-z0-9\+\/=]+\|[A-Za-z0-9\+\/=]+$/,s=/^ERR\|[\w\s\.\(\)]+$/,c=/^DUO_OPEN_WINDOW\|/,f=["duo.com","duosecurity.com","duomobile.s3-us-west-1.amazonaws.com"];function d(){e="",t="sig_response",n=void 0,o=void 0,r=void 0,i=void 0,a=void 0}function m(e,t){var n=t||"https://www.duosecurity.com/docs/duoweb#3.-show-the-iframe";throw new Error("Duo Web SDK error: "+e+(n?"\nSee "+n+" for more information":""))}function l(e){return e.replace(/([a-z])([A-Z])/,"$1-$2").toLowerCase()}function p(e,t){return"dataset"in e?e.dataset[t]:e.getAttribute("data-"+l(t))}function g(e,t,n,o){"addEventListener"in window?e.addEventListener(t,o,!1):e.attachEvent(n,o)}function h(e,t,n,o){"removeEventListener"in window?e.removeEventListener(t,o,!1):e.detachEvent(n,o)}function v(e){g(document,"DOMContentLoaded","onreadystatechange",e)}function b(e){h(document,"DOMContentLoaded","onreadystatechange",e)}function _(e){g(window,"message","onmessage",e)}function w(e){h(window,"message","onmessage",e)}function y(e){if(e){0===e.indexOf("ERR|")&&m(e.split("|")[1]),-1!==e.indexOf(":")&&2===e.split(":").length||m("Duo was given a bad token. This might indicate a configuration problem with one of Duo's client libraries.");var t=e.split(":");return o=t[0],r=t[1],{sigRequest:e,duoSig:t[0],appSig:t[1]}}}function C(e){return Boolean(e.origin==="https://"+n&&"string"==typeof e.data&&(e.data.match(u)||e.data.match(s)||e.data.match(c)))}function E(o){d(),o&&(o.host&&(n=o.host),o.sig_request&&y(o.sig_request),o.post_action&&(e=o.post_action),o.post_argument&&(t=o.post_argument),"function"==typeof o.submit_callback&&(a=o.submit_callback));var r=O(o);r?q(r,o.iframeAttributes||{}):j(o),b(E)}function O(e){var t;return e.iframe&&e.iframeContainer?m("Passing both `iframe` and `iframeContainer` arguments at the same time is not allowed."):e.iframe?A(t=D(e.iframe)):e.iframeContainer?S(t=D(e.iframeContainer)):t=document.getElementById("duo_iframe"),t}function D(e){return e.tagName?e:"string"==typeof e?document.getElementById(e):null}function P(e){return e&&e.tagName&&"iframe"===e.tagName.toLowerCase()}function A(e){e&&!P(e)&&m("`iframe` only accepts an iframe element or the id of an iframe. To use a non-iframe element, use the `iframeContainer` argument.")}function S(e){e&&P(e)&&m("`iframeContainer` only accepts a non-iframe element or the id of a non-iframe. To use a non-iframe element, use the `iframeContainer` argument on Duo.init().")}function x(){return["https://",n,"/frame/web/v1/auth?tx=",o,"&parent=",encodeURIComponent(document.location.href),"&v=2.8"].join("")}function R(e){if(C(e))if(e.data.match(c)){var t=e.data.substring("DUO_OPEN_WINDOW|".length);L(t)&&window.open(t,"_self")}else M(e.data),w(R)}function L(e){if(!e)return!1;var t=document.createElement("a");if(t.href=e,"duotrustedendpoints:"===t.protocol)return!0;if("https:"!==t.protocol)return!1;for(var n=0;n<f.length;n++)if(t.hostname.endsWith("."+f[n])||t.hostname===f[n])return!0;return!1}function j(e){var t=function(){var n=O(e);n||m('This page does not contain an iframe for Duo to use. Add an element like <iframe id="duo_iframe"></iframe> to this page.'),q(n,e.iframeAttributes||{}),b(t)};v(t)}function q(a,u){if(n||(n=p(a,"host"))||m("No API hostname is given for Duo to use. Be sure to pass a `host` parameter to Duo.init, or through the `data-host` attribute on the iframe element."),o&&r||(y(p(a,"sigRequest")),o&&r||m("No valid signed request is given. Be sure to give the `sig_request` parameter to Duo.init, or use the `data-sig-request` attribute on the iframe element.")),""===e&&(e=p(a,"postAction")||e),"sig_response"===t&&(t=p(a,"postArgument")||t),P(a))(i=a).src=x();else{for(;a.firstChild;)a.removeChild(a.firstChild);for(var s in i=document.createElement("iframe"),u.src=x(),u)i.setAttribute(s,u[s]);a.appendChild(i)}_(R)}function M(n){var o=document.createElement("input");o.type="hidden",o.name=t,o.value=n+":"+r;var u=document.getElementById("duo_form");u||(u=document.createElement("form"),i.parentElement.insertBefore(u,i.nextSibling)),u.method="POST",u.action=e,u.appendChild(o),"function"==typeof a?a.call(null,u):u.submit()}return d(),{init:E,_onReady:v,_parseSigRequest:y,_isDuoMessage:C,_doPostBack:M}})?o.apply(t,r):o)||(e.exports=i)}});
//# sourceMappingURL=duo.a3cee032b1bd0b131b53.js.map