import SalteAuthUtilities from '@salte-auth/salte-auth/dist/salte-auth.utilities.js'
SalteAuthUtilities
Basic utilities to support the authentication flow
Constructor Summary
Public Constructor | ||
public |
constructor(config: Config) Wraps all XHR and Fetch (if available) requests to allow promise interceptors |
Method Summary
Public Methods | ||
public |
addFetchInterceptor(interceptor: Function) Adds a fetch interceptor |
|
public |
addXHRInterceptor(interceptor: Function) Adds a XMLHttpRequest interceptor |
|
public |
Checks if the given url matches any of the test urls |
|
public |
createIframe(url: String, show: Boolean, timeout: Number): Promise Opens an iframe in the background |
|
public |
Creates a URL using a base url and a queryParams object |
|
public |
Determines if the given route is a secured route |
|
public |
openNewTab(url: String): Promise Opens a new tab |
|
public |
Opens a popup window in the middle of the viewport |
|
public |
resolveUrl(path: String): String Converts a url to an absolute url |
Public Constructors
Public Methods
public addFetchInterceptor(interceptor: Function) source
Adds a fetch interceptor
Params:
Name | Type | Attribute | Description |
interceptor | Function | the interceptor function |
public addXHRInterceptor(interceptor: Function) source
Adds a XMLHttpRequest interceptor
Params:
Name | Type | Attribute | Description |
interceptor | Function | the interceptor function |
public checkForMatchingUrl(url: String, tests: Array<String|RegExp>): Boolean source
Checks if the given url matches any of the test urls
public createIframe(url: String, show: Boolean, timeout: Number): Promise source
Opens an iframe in the background
public createUrl(baseUrl: String, queryParams: Object): String source
Creates a URL using a base url and a queryParams object
public isRouteSecure(route: String, securedRoutes: Boolean | Array<String>): Boolean source
Determines if the given route is a secured route
public openNewTab(url: String): Promise source
Opens a new tab
Params:
Name | Type | Attribute | Description |
url | String | the url to be loaded |