Skip to content

Commit b25c934

Browse files
committed
Simplify authentication logic.
1 parent fad2a65 commit b25c934

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

thing-url-adapter.js

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -858,32 +858,16 @@ function loadThingURLAdapter(addonManager) {
858858
for (const url of config.urls) {
859859
if ('authentication' in url) {
860860
// remove http(s) from url
861-
let urlStub = '';
862-
if (url.href.includes('http://')) {
861+
let urlStub = url.href;
862+
if (url.href.startsWith('http://')) {
863863
urlStub = url.href.substr(7);
864-
}
865-
if (url.href.includes('https://')) {
864+
} else if (url.href.startsWith('https://')) {
866865
urlStub = url.href.substr(8);
867866
}
868-
switch (url.authentication.method) {
869-
case 'jwt':
870-
adapter.authData[urlStub] = url.authentication;
871-
break;
872-
case 'basic':
873-
// adapter.authData[url_stub] = url.authentication;
874-
// break;
875-
// eslint-disable-next-line no-fallthrough
876-
case 'digest':
877-
// adapter.authData[url_stub] = url.authentication;
878-
// break;
879-
// eslint-disable-next-line no-fallthrough
880-
case 'none':
881-
break;
882-
default:
883-
console.log(`${url.authentication.method} is not implemented`);
884-
break;
885-
}
867+
868+
adapter.authData[urlStub] = url.authentication;
886869
}
870+
887871
adapter.loadThing(url.href);
888872
}
889873
startDNSDiscovery(adapter);

0 commit comments

Comments
 (0)