OpenDroneMap-NodeODM/libs/auth/factory.js

15 wiersze
544 B
JavaScript
Czysty Zwykły widok Historia

2021-02-18 18:35:05 +00:00
const NoTokenRequiredAuth = require("./NoTokenRequiredAuth");
const TokenIpAuth = require("./TokenIpAuth");
const SimpleTokenAuth = require("./SimpleTokenAuth");
module.exports = {
2021-02-18 18:35:05 +00:00
fromConfig: function (config) {
if (config.token && config.authorizedIps && config.authorizedIps.length) {
return new TokenIpAuth(config.token, config.authorizedIps);
} else if (config.token) {
return new SimpleTokenAuth(config.token);
2021-02-18 18:35:05 +00:00
} else {
return new NoTokenRequiredAuth();
}
2021-02-18 18:35:05 +00:00
},
};