search-client
Version:
Javascript library for executing searches in the Haive search-index via the SearchManager REST interface.
56 lines • 2.66 kB
JavaScript
import { __extends } from "tslib";
import { BaseSettings } from '../Common/BaseSettings';
import { QueryChangeSpecifications } from '../Common/QueryChangeSpecifications';
import { AuthenticationTriggers } from './AuthenticationTriggers';
/**
* These are all the settings that can affect the use of jwt authentication in the search-client.
*/
var AuthenticationSettings = /** @class */ (function (_super) {
__extends(AuthenticationSettings, _super);
/**
* Creates an AuthenticationSettings object for you, based on AuthenticationSettings defaults and the overrides provided as a param.
* @param settings - The settings defined here will override the default AuthenticationSettings.
*/
function AuthenticationSettings(settings) {
var _this = _super.call(this) // dummy (using init instead)
|| this;
// Setup settings object before calling super.init with it.
if (typeof settings === 'string') {
settings = { baseUrl: settings };
}
settings.enabled =
typeof settings.enabled !== 'undefined' ? settings.enabled : false;
settings.basePath =
typeof settings.basePath !== 'undefined' ? settings.basePath : '';
settings.servicePath =
typeof settings.servicePath !== 'undefined'
? settings.servicePath
: 'auth/login';
_super.prototype.init.call(_this, settings);
_this.type = typeof settings.type !== 'undefined' ? settings.type : 'jwt';
// Setup our own stuff (props not in the base class).
_this.token =
typeof settings.token !== 'undefined' ? settings.token : undefined;
_this.tokenPath =
typeof settings.tokenPath !== 'undefined'
? settings.tokenPath
: ['jwtToken'];
_this.triggers = new AuthenticationTriggers(settings.triggers);
// No query changes will trigger outdated warnings
_this.queryChangeSpecs = QueryChangeSpecifications.none;
_this.enableLogging =
typeof settings.enableLogging !== 'undefined'
? settings.enableLogging
: false;
_this.clientId = settings.clientId;
_this.responseType = settings.responseType;
_this.scope = settings.scope;
_this.silentRedirectUri = settings.silentRedirectUri;
_this.redirectUri = settings.redirectUri;
_this.postLogoutRedirectUri = settings.postLogoutRedirectUri;
return _this;
}
return AuthenticationSettings;
}(BaseSettings));
export { AuthenticationSettings };
//# sourceMappingURL=AuthenticationSettings.js.map