1
0
mirror of https://github.com/bitwarden/web synced 2025-12-06 00:03:28 +00:00
This commit is contained in:
Kyle Spearrin
2020-09-05 22:09:38 -04:00
parent 51280c5d90
commit a73211677f
23 changed files with 14448 additions and 2211 deletions

File diff suppressed because one or more lines are too long

View File

@@ -11424,4 +11424,4 @@ img.logo {
padding-right: 40px; }
/*# sourceMappingURL=main.09f8c015ee5f3625f945.css.map*/
/*# sourceMappingURL=main.d17f7e0a75e9d35fe3ca.css.map*/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -14,4 +14,4 @@ iframe {
padding: 0; }
/*# sourceMappingURL=duo.09f8c015ee5f3625f945.css.map*/
/*# sourceMappingURL=duo.d17f7e0a75e9d35fe3ca.css.map*/

View File

@@ -1 +1 @@
{"version":3,"sources":["webpack:///./src/connectors/duo.scss"],"names":[],"mappings":"AAAA;AACA;AACA,aAAa;;AAEb;AACA,+DAA+D;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA,aAAa","file":"connectors/duo.09f8c015ee5f3625f945.css","sourcesContent":["html, body {\n margin: 0;\n padding: 0; }\n\nbody {\n background: #efeff4 url(../images/loading.svg) 0 0 no-repeat; }\n\niframe {\n display: block;\n width: 100%;\n height: 400px;\n border: none;\n margin: 0;\n padding: 0; }\n"],"sourceRoot":""}
{"version":3,"sources":["webpack:///./src/connectors/duo.scss"],"names":[],"mappings":"AAAA;AACA;AACA,aAAa;;AAEb;AACA,+DAA+D;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA,aAAa","file":"connectors/duo.d17f7e0a75e9d35fe3ca.css","sourcesContent":["html, body {\n margin: 0;\n padding: 0; }\n\nbody {\n background: #efeff4 url(../images/loading.svg) 0 0 no-repeat; }\n\niframe {\n display: block;\n width: 100%;\n height: 400px;\n border: none;\n margin: 0;\n padding: 0; }\n"],"sourceRoot":""}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
!function(e){var n={};function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:o})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var r in e)t.d(o,r,function(n){return e[n]}.bind(null,r));return o},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=1033)}({1033:function(e,n,t){function o(e){var n=window.location.href;e=e.replace(/[\[\]]/g,"\\$&");var t=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(n);return t?t[2]?decodeURIComponent(t[2].replace(/\+/g," ")):"":null}t(1034),document.addEventListener("DOMContentLoaded",function(e){var n=o("code"),t=o("state");if(null!=t&&t.endsWith(":clientId=browser"))!function(e,n){window.postMessage({command:"authResult",code:e,state:n},"*")}(n,t);else{window.location.href=window.location.origin+"/#/sso?code="+n+"&state="+t;var r=function(e,n){var t=new RegExp(n).exec(e);if(!t)return null;return t[0]}(t,"(?<=_returnUri=')(.*)(?=')");window.location.href=r?window.location.origin+"/#"+r:window.location.origin+"/#/sso?code="+n+"&state="+t}})},1034:function(e,n,t){}});

View File

@@ -1 +1 @@
!function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=1154)}({1154:function(e,r,t){"use strict";t.r(r);var n=t(554);document.addEventListener("DOMContentLoaded",function(e){var r;s(),window.addEventListener("message",function(e){e.origin&&""!==e.origin&&e.origin===a&&("stop"===e.data?i=!0:"start"===e.data&&i&&s())},!1),r="ready",parent.postMessage("info|"+r,o)});var o=null,a=null,i=!1,u=!1;function s(){if(u=!1,n.isSupported){var e=f("data");if(e)if(o=f("parent")){var r=document.createElement("a");r.href=o,a=r.origin;var t=f("v");if(t){try{parseInt(t);var s=(l=e,decodeURIComponent(Array.prototype.map.call(atob(l),function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""))),d=JSON.parse(s)}catch(p){return void c("Cannot parse data.")}var l;d.appId&&d.challenge&&d.keys&&d.keys.length?(i=!1,function e(r){if(i)return;n.sign(r.appId,r.challenge,r.keys,function(t){t.errorCode?5!==t.errorCode?(c("U2F Error: "+t.errorCode),setTimeout(function(){e(r)},1e3)):e(r):function(e){if(u)return;var r=JSON.stringify(e);parent.postMessage("success|"+r,o),u=!0}(t)},10)}(d)):c("Invalid data parameters.")}else c("No version.")}else c("No parent.");else c("No data.")}else c("U2F is not supported in this browser.")}function c(e){parent.postMessage("error|"+e,o)}function f(e){var r=window.location.href;e=e.replace(/[\[\]]/g,"\\$&");var t=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(r);return t?t[2]?decodeURIComponent(t[2].replace(/\+/g," ")):"":null}},554:function(e,r){e.exports=u2f}});
!function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=1030)}({1030:function(e,r,t){"use strict";t.r(r);var n=t(489);document.addEventListener("DOMContentLoaded",function(e){var r;s(),window.addEventListener("message",function(e){e.origin&&""!==e.origin&&e.origin===a&&("stop"===e.data?i=!0:"start"===e.data&&i&&s())},!1),r="ready",parent.postMessage("info|"+r,o)});var o=null,a=null,i=!1,u=!1;function s(){if(u=!1,n.isSupported){var e=f("data");if(e)if(o=f("parent")){var r=document.createElement("a");r.href=o,a=r.origin;var t=f("v");if(t){try{parseInt(t);var s=(l=e,decodeURIComponent(Array.prototype.map.call(atob(l),function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""))),d=JSON.parse(s)}catch(p){return void c("Cannot parse data.")}var l;d.appId&&d.challenge&&d.keys&&d.keys.length?(i=!1,function e(r){if(i)return;n.sign(r.appId,r.challenge,r.keys,function(t){t.errorCode?5!==t.errorCode?(c("U2F Error: "+t.errorCode),setTimeout(function(){e(r)},1e3)):e(r):function(e){if(u)return;var r=JSON.stringify(e);parent.postMessage("success|"+r,o),u=!0}(t)},10)}(d)):c("Invalid data parameters.")}else c("No version.")}else c("No parent.");else c("No data.")}else c("U2F is not supported in this browser.")}function c(e){parent.postMessage("error|"+e,o)}function f(e){var r=window.location.href;e=e.replace(/[\[\]]/g,"\\$&");var t=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(r);return t?t[2]?decodeURIComponent(t[2].replace(/\+/g," ")):"":null}},489:function(e,r){e.exports=u2f}});

View File

@@ -5,8 +5,8 @@
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>Bitwarden Duo Connector</title>
<link href="connectors/duo.09f8c015ee5f3625f945.css" rel="stylesheet"></head>
<link href="connectors/duo.d17f7e0a75e9d35fe3ca.css" rel="stylesheet"></head>
<body><script type="text/javascript" src="connectors/duo.09f8c015ee5f3625f945.js"></script></body>
<body><script type="text/javascript" src="connectors/duo.d17f7e0a75e9d35fe3ca.js"></script></body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -13,7 +13,7 @@
<link rel="icon" type="image/png" sizes="16x16" href="images/icons/favicon-16x16.png">
<link rel="mask-icon" href="images/icons/safari-pinned-tab.svg" color="#175DDC">
<link rel="manifest" href="manifest.json">
<link href="app/main.09f8c015ee5f3625f945.css" rel="stylesheet"></head>
<link href="app/main.d17f7e0a75e9d35fe3ca.css" rel="stylesheet"></head>
<body class="layout_frontend">
<app-root>
@@ -26,6 +26,6 @@
</div>
</div>
</app-root>
<script type="text/javascript" src="app/polyfills.09f8c015ee5f3625f945.js"></script><script type="text/javascript" src="app/vendor.09f8c015ee5f3625f945.js"></script><script type="text/javascript" src="app/main.09f8c015ee5f3625f945.js"></script></body>
<script type="text/javascript" src="app/polyfills.d17f7e0a75e9d35fe3ca.js"></script><script type="text/javascript" src="app/vendor.d17f7e0a75e9d35fe3ca.js"></script><script type="text/javascript" src="app/main.d17f7e0a75e9d35fe3ca.js"></script></body>
</html>

View File

@@ -1971,7 +1971,7 @@
"message": "Add and share with unlimited users"
},
"createUnlimitedCollections": {
"message": "Create unlimited collections"
"message": "Create unlimited Collections"
},
"gbEncryptedFileStorage": {
"message": "$SIZE$ encrypted file storage",
@@ -1986,13 +1986,13 @@
"message": "On-premise hosting (optional)"
},
"usersGetPremium": {
"message": "Users get access to premium membership features"
"message": "Users get access to Premium Features"
},
"controlAccessWithGroups": {
"message": "Control user access with groups"
"message": "Control user access with Groups"
},
"syncUsersFromDirectory": {
"message": "Sync your users and groups from a directory"
"message": "Sync your users and Groups from a directory"
},
"trackAuditLogs": {
"message": "Track user actions with audit logs"
@@ -3163,5 +3163,42 @@
},
"taxInfoUpdated": {
"message": "Tax information updated."
},
"setMasterPassword": {
"message": "Set Master Password"
},
"ssoCompleteRegistration": {
"message": "In order to complete logging in with SSO, please set a master password to access and protect your vault."
},
"identifier": {
"message": "Identifier"
},
"organizationIdentifier": {
"message": "Organization Identifier"
},
"ssoLogInWithOrgIdentifier": {
"message": "Log in using your organization's single sign-on portal. Please enter your organization's identifier to begin."
},
"enterpriseSingleSignOn": {
"message": "Enterprise Single Sign-On"
},
"businessPortal": {
"message": "Business Portal",
"description": "The web portal used by business organizations for configuring certain features."
},
"includeAllTeamsFeatures": {
"message": "All Teams features, plus:"
},
"includeSsoAuthentication": {
"message": "SSO Authentication via SAML2.0 and OpenID Connect"
},
"includeEnterprisePolicies": {
"message": "Enterprise Policies"
},
"ssoValidationFailed": {
"message": "SSO Validation Failed"
},
"ssoIdentifierRequired": {
"message": "Organization Identifier is required."
}
}

View File

@@ -1,12 +1,16 @@
//Copyright 2014-2015 Google Inc. All rights reserved.
//Copyright 2014-2015 Google Inc. All rights reserved.
//Use of this source code is governed by a BSD-style
//license that can be found in the LICENSE file or at
//https://developers.google.com/open-source/licenses/bsd
// ref: https://github.com/google/u2f-ref-code/blob/master/u2f-gae-demo/war/js/u2f-api.js
/**
* @fileoverview The U2F api.
*/
'use strict';
/**
* Modification:
* Wrap implementation so that we can exit if window.u2f is already supplied by the browser (see below).
@@ -18,25 +22,30 @@
*/
var isFirefox = navigator.userAgent.indexOf('Firefox') !== -1 || navigator.userAgent.indexOf('Gecko/') !== -1;
var browserImplementsU2f = !!((typeof root.u2f !== 'undefined') && root.u2f.register);
if (isFirefox && browserImplementsU2f) {
root.u2f.isSupported = true;
return;
}
/**
* Namespace for the U2F api.
* @type {Object}
*/
var u2f = root.u2f || {};
/**
* Modification:
* Check if browser supports U2F API before this wrapper was added.
*/
u2f.isSupported = !!(((typeof u2f !== 'undefined') && u2f.register) || ((typeof chrome !== 'undefined') && chrome.runtime));
/**
* FIDO U2F Javascript API Version
* @number
*/
var js_api_version;
/**
* The U2F extension id
* @const {string}
@@ -49,6 +58,8 @@
// Uncomment this if you want to deploy a server instance that uses
// the U2F Chrome extension to authenticate.
// u2f.EXTENSION_ID = 'pfboblefjcgdjicmnffhdgionmgcdmne';
/**
* Message types for messsages to/from the extension
* @const
@@ -62,6 +73,8 @@
'U2F_GET_API_VERSION_REQUEST': 'u2f_get_api_version_request',
'U2F_GET_API_VERSION_RESPONSE': 'u2f_get_api_version_response'
};
/**
* Response status codes
* @const
@@ -75,6 +88,8 @@
'DEVICE_INELIGIBLE': 4,
'TIMEOUT': 5
};
/**
* A message for registration requests
* @typedef {{
@@ -85,6 +100,8 @@
* }}
*/
u2f.U2fRequest;
/**
* A message for registration responses
* @typedef {{
@@ -94,6 +111,8 @@
* }}
*/
u2f.U2fResponse;
/**
* An error object for responses
* @typedef {{
@@ -102,16 +121,20 @@
* }}
*/
u2f.Error;
/**
* Data object for a single sign request.
* @typedef {enum {BLUETOOTH_RADIO, BLUETOOTH_LOW_ENERGY, USB, NFC}}
*/
u2f.Transport;
/**
* Data object for a single sign request.
* @typedef {Array<u2f.Transport>}
*/
u2f.Transports;
/**
* Data object for a single sign request.
* @typedef {{
@@ -122,6 +145,8 @@
* }}
*/
u2f.SignRequest;
/**
* Data object for a sign response.
* @typedef {{
@@ -131,6 +156,8 @@
* }}
*/
u2f.SignResponse;
/**
* Data object for a registration request.
* @typedef {{
@@ -139,6 +166,8 @@
* }}
*/
u2f.RegisterRequest;
/**
* Data object for a registration response.
* @typedef {{
@@ -149,6 +178,8 @@
* }}
*/
u2f.RegisterResponse;
/**
* Data object for a registered key.
* @typedef {{
@@ -159,6 +190,8 @@
* }}
*/
u2f.RegisteredKey;
/**
* Data object for a get API register response.
* @typedef {{
@@ -166,7 +199,10 @@
* }}
*/
u2f.GetJsApiVersionResponse;
//Low level MessagePort API support
/**
* Sets up a MessagePort to the U2F extension using the
* available mechanisms.
@@ -186,26 +222,23 @@
// We are on a whitelisted origin and can talk directly
// with the extension.
u2f.getChromeRuntimePort_(callback);
}
else {
} else {
// chrome.runtime was available, but we couldn't message
// the extension directly, use iframe
u2f.getIframePort_(callback);
}
});
}
else if (u2f.isAndroidChrome_()) {
} else if (u2f.isAndroidChrome_()) {
u2f.getAuthenticatorPort_(callback);
}
else if (u2f.isIosChrome_()) {
} else if (u2f.isIosChrome_()) {
u2f.getIosPort_(callback);
}
else {
} else {
// chrome.runtime was not available at all, which is normal
// when this origin doesn't have access to any extensions.
u2f.getIframePort_(callback);
}
};
/**
* Detect chrome running on android based on the browser's useragent.
* @private
@@ -215,6 +248,7 @@
return userAgent.indexOf('Chrome') != -1 &&
userAgent.indexOf('Android') != -1;
};
/**
* Detect chrome running on iOS based on the browser's platform.
* @private
@@ -222,17 +256,20 @@
u2f.isIosChrome_ = function () {
return ["iPhone", "iPad", "iPod"].indexOf(navigator.platform) > -1;
};
/**
* Connects directly to the extension via chrome.runtime.connect.
* @param {function(u2f.WrappedChromeRuntimePort_)} callback
* @private
*/
u2f.getChromeRuntimePort_ = function (callback) {
var port = chrome.runtime.connect(u2f.EXTENSION_ID, { 'includeTlsChannelId': true });
var port = chrome.runtime.connect(u2f.EXTENSION_ID,
{ 'includeTlsChannelId': true });
setTimeout(function () {
callback(new u2f.WrappedChromeRuntimePort_(port));
}, 0);
};
/**
* Return a 'port' abstraction to the Authenticator app.
* @param {function(u2f.WrappedAuthenticatorPort_)} callback
@@ -243,6 +280,7 @@
callback(new u2f.WrappedAuthenticatorPort_());
}, 0);
};
/**
* Return a 'port' abstraction to the iOS client app.
* @param {function(u2f.WrappedIosPort_)} callback
@@ -253,6 +291,7 @@
callback(new u2f.WrappedIosPort_());
}, 0);
};
/**
* A wrapper for chrome.runtime.Port that is compatible with MessagePort.
* @param {Port} port
@@ -262,6 +301,7 @@
u2f.WrappedChromeRuntimePort_ = function (port) {
this.port_ = port;
};
/**
* Format and return a sign request compliant with the JS API version supported by the extension.
* @param {Array<u2f.SignRequest>} signRequests
@@ -299,6 +339,7 @@
requestId: reqId
};
};
/**
* Format and return a register request compliant with the JS API version supported by the extension..
* @param {Array<u2f.SignRequest>} signRequests
@@ -341,6 +382,8 @@
requestId: reqId
};
};
/**
* Posts a message on the underlying channel.
* @param {Object} message
@@ -348,6 +391,8 @@
u2f.WrappedChromeRuntimePort_.prototype.postMessage = function (message) {
this.port_.postMessage(message);
};
/**
* Emulates the HTML 5 addEventListener interface. Works only for the
* onmessage event, which is hooked up to the chrome.runtime.Port.onMessage.
@@ -362,11 +407,11 @@
// Emulate a minimal MessageEvent object
handler({ 'data': message });
});
}
else {
} else {
console.error('WrappedChromeRuntimePort only supports onMessage');
}
};
/**
* Wrap the Authenticator app with a MessagePort interface.
* @constructor
@@ -375,17 +420,20 @@
u2f.WrappedAuthenticatorPort_ = function () {
this.requestId_ = -1;
this.requestObject_ = null;
};
}
/**
* Launch the Authenticator intent.
* @param {Object} message
*/
u2f.WrappedAuthenticatorPort_.prototype.postMessage = function (message) {
var intentUrl = u2f.WrappedAuthenticatorPort_.INTENT_URL_BASE_ +
var intentUrl =
u2f.WrappedAuthenticatorPort_.INTENT_URL_BASE_ +
';S.request=' + encodeURIComponent(JSON.stringify(message)) +
';end';
document.location = intentUrl;
};
/**
* Tells what type of port this is.
* @return {String} port type
@@ -393,6 +441,8 @@
u2f.WrappedAuthenticatorPort_.prototype.getPortType = function () {
return "WrappedAuthenticatorPort_";
};
/**
* Emulates the HTML 5 addEventListener interface.
* @param {string} eventName
@@ -404,12 +454,13 @@
var self = this;
/* Register a callback to that executes when
* chrome injects the response. */
window.addEventListener('message', self.onRequestUpdate_.bind(self, handler), false);
}
else {
window.addEventListener(
'message', self.onRequestUpdate_.bind(self, handler), false);
} else {
console.error('WrappedAuthenticatorPort only supports message');
}
};
/**
* Callback invoked when a response is received from the Authenticator.
* @param function({data: Object}) callback
@@ -419,13 +470,17 @@
function (callback, message) {
var messageObject = JSON.parse(message.data);
var intentUrl = messageObject['intentURL'];
var errorCode = messageObject['errorCode'];
var responseObject = null;
if (messageObject.hasOwnProperty('data')) {
responseObject = /** @type {Object} */ (JSON.parse(messageObject['data']));
responseObject = /** @type {Object} */ (
JSON.parse(messageObject['data']));
}
callback({ 'data': responseObject });
};
/**
* Base URL for intents to Authenticator.
* @const
@@ -433,12 +488,14 @@
*/
u2f.WrappedAuthenticatorPort_.INTENT_URL_BASE_ =
'intent:#Intent;action=com.google.android.apps.authenticator.AUTHENTICATE';
/**
* Wrap the iOS client app with a MessagePort interface.
* @constructor
* @private
*/
u2f.WrappedIosPort_ = function () { };
/**
* Launch the iOS client app request
* @param {Object} message
@@ -448,6 +505,7 @@
var url = "u2f://auth?" + encodeURI(str);
location.replace(url);
};
/**
* Tells what type of port this is.
* @return {String} port type
@@ -455,6 +513,7 @@
u2f.WrappedIosPort_.prototype.getPortType = function () {
return "WrappedIosPort_";
};
/**
* Emulates the HTML 5 addEventListener interface.
* @param {string} eventName
@@ -466,6 +525,7 @@
console.error('WrappedIosPort only supports message');
}
};
/**
* Sets up an embedded trampoline iframe, sourced from the extension.
* @param {function(MessagePort)} callback
@@ -478,47 +538,55 @@
iframe.src = iframeOrigin + '/u2f-comms.html';
iframe.setAttribute('style', 'display:none');
document.body.appendChild(iframe);
var channel = new MessageChannel();
var ready = function (message) {
if (message.data == 'ready') {
channel.port1.removeEventListener('message', ready);
callback(channel.port1);
}
else {
} else {
console.error('First event on iframe port was not "ready"');
}
};
channel.port1.addEventListener('message', ready);
channel.port1.start();
iframe.addEventListener('load', function () {
// Deliver the port to the iframe and initialize
iframe.contentWindow.postMessage('init', iframeOrigin, [channel.port2]);
});
};
//High-level JS API
/**
* Default extension response timeout in seconds.
* @const
*/
u2f.EXTENSION_TIMEOUT_SEC = 30;
/**
* A singleton instance for a MessagePort to the extension.
* @type {MessagePort|u2f.WrappedChromeRuntimePort_}
* @private
*/
u2f.port_ = null;
/**
* Callbacks waiting for a port
* @type {Array<function((MessagePort|u2f.WrappedChromeRuntimePort_))>}
* @private
*/
u2f.waitingForPort_ = [];
/**
* A counter for requestIds.
* @type {number}
* @private
*/
u2f.reqCounter_ = 0;
/**
* A map from requestIds to client callbacks
* @type {Object.<number,(function((u2f.Error|u2f.RegisterResponse))
@@ -526,6 +594,7 @@
* @private
*/
u2f.callbackMap_ = {};
/**
* Creates or retrieves the MessagePort singleton to use.
* @param {function((MessagePort|u2f.WrappedChromeRuntimePort_))} callback
@@ -534,13 +603,13 @@
u2f.getPortSingleton_ = function (callback) {
if (u2f.port_) {
callback(u2f.port_);
}
else {
} else {
if (u2f.waitingForPort_.length == 0) {
u2f.getMessagePort(function (port) {
u2f.port_ = port;
u2f.port_.addEventListener('message',
/** @type {function(Event)} */ (u2f.responseHandler_));
u2f.port_.addEventListener('message',
/** @type {function(Event)} */(u2f.responseHandler_));
// Careful, here be async callbacks. Maybe.
while (u2f.waitingForPort_.length)
u2f.waitingForPort_.shift()(u2f.port_);
@@ -549,6 +618,7 @@
u2f.waitingForPort_.push(callback);
}
};
/**
* Handles response messages from the extension.
* @param {MessageEvent.<u2f.Response>} message
@@ -565,6 +635,7 @@
delete u2f.callbackMap_[reqId];
cb(response['responseData']);
};
/**
* Dispatches an array of sign requests to available U2F tokens.
* If the JS API version supported by the extension is unknown, it first sends a
@@ -579,17 +650,18 @@
u2f.sign = function (appId, challenge, registeredKeys, callback, opt_timeoutSeconds) {
if (js_api_version === undefined) {
// Send a message to get the extension to JS API version, then send the actual sign request.
u2f.getApiVersion(function (response) {
js_api_version = response['js_api_version'] === undefined ? 0 : response['js_api_version'];
console.log("Extension JS API Version: ", js_api_version);
u2f.sendSignRequest(appId, challenge, registeredKeys, callback, opt_timeoutSeconds);
});
}
else {
u2f.getApiVersion(
function (response) {
js_api_version = response['js_api_version'] === undefined ? 0 : response['js_api_version'];
console.log("Extension JS API Version: ", js_api_version);
u2f.sendSignRequest(appId, challenge, registeredKeys, callback, opt_timeoutSeconds);
});
} else {
// We know the JS API version. Send the actual sign request in the supported API version.
u2f.sendSignRequest(appId, challenge, registeredKeys, callback, opt_timeoutSeconds);
}
};
/**
* Dispatches an array of sign requests to available U2F tokens.
* @param {string=} appId
@@ -608,6 +680,7 @@
port.postMessage(req);
});
};
/**
* Dispatches register requests to available U2F tokens. An array of sign
* requests identifies already registered tokens.
@@ -623,17 +696,20 @@
u2f.register = function (appId, registerRequests, registeredKeys, callback, opt_timeoutSeconds) {
if (js_api_version === undefined) {
// Send a message to get the extension to JS API version, then send the actual register request.
u2f.getApiVersion(function (response) {
js_api_version = response['js_api_version'] === undefined ? 0 : response['js_api_version'];
console.log("Extension JS API Version: ", js_api_version);
u2f.sendRegisterRequest(appId, registerRequests, registeredKeys, callback, opt_timeoutSeconds);
});
}
else {
u2f.getApiVersion(
function (response) {
js_api_version = response['js_api_version'] === undefined ? 0 : response['js_api_version'];
console.log("Extension JS API Version: ", js_api_version);
u2f.sendRegisterRequest(appId, registerRequests, registeredKeys,
callback, opt_timeoutSeconds);
});
} else {
// We know the JS API version. Send the actual register request in the supported API version.
u2f.sendRegisterRequest(appId, registerRequests, registeredKeys, callback, opt_timeoutSeconds);
u2f.sendRegisterRequest(appId, registerRequests, registeredKeys,
callback, opt_timeoutSeconds);
}
};
/**
* Dispatches register requests to available U2F tokens. An array of sign
* requests identifies already registered tokens.
@@ -649,10 +725,13 @@
u2f.callbackMap_[reqId] = callback;
var timeoutSeconds = (typeof opt_timeoutSeconds !== 'undefined' ?
opt_timeoutSeconds : u2f.EXTENSION_TIMEOUT_SEC);
var req = u2f.formatRegisterRequest_(appId, registeredKeys, registerRequests, timeoutSeconds, reqId);
var req = u2f.formatRegisterRequest_(
appId, registeredKeys, registerRequests, timeoutSeconds, reqId);
port.postMessage(req);
});
};
/**
* Dispatches a message to the extension to find out the supported
* JS API version.
@@ -672,6 +751,7 @@
case 'WrappedAuthenticatorPort_':
apiVersion = 1.1;
break;
default:
apiVersion = 0;
break;
@@ -690,10 +770,10 @@
port.postMessage(req);
});
};
/**
* Modification:
* Assign u2f back to window (root) scope.
*/
root.u2f = u2f;
}(this));
//# sourceMappingURL=u2f.js.map

29
sso-connector.html Normal file
View File

@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=1010">
<meta name="theme-color" content="#175DDC">
<title>Bitwarden</title>
<link rel="apple-touch-icon" sizes="180x180" href="images/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="images/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="images/icons/favicon-16x16.png">
<link rel="mask-icon" href="images/icons/safari-pinned-tab.svg" color="#175DDC">
<link rel="manifest" href="manifest.json">
<link href="connectors/sso.d17f7e0a75e9d35fe3ca.css" rel="stylesheet"></head>
<body class="layout_frontend">
<div class="mt-5 d-flex justify-content-center">
<div>
<img src="images/logo-dark@2x.png" class="mb-4 logo" alt="Bitwarden">
<p class="text-center">
<i class="fa fa-spinner fa-spin fa-2x text-muted" title="Loading" aria-hidden="true"></i>
</p>
</div>
</div>
<script type="text/javascript" src="connectors/sso.d17f7e0a75e9d35fe3ca.js"></script></body>
</html>

View File

@@ -7,6 +7,6 @@
<script src="scripts/u2f.js"></script>
</head>
<body><script type="text/javascript" src="connectors/u2f.09f8c015ee5f3625f945.js"></script></body>
<body><script type="text/javascript" src="connectors/u2f.d17f7e0a75e9d35fe3ca.js"></script></body>
</html>

View File

@@ -1 +1 @@
{"version":"2.15.1"}
{"version":"2.16.0"}