UNPKG

scrivito

Version:

Scrivito is a professional, yet easy to use SaaS Enterprise Content Management Service, built for digital agencies and medium to large businesses. It is completely maintenance-free, cost-effective, and has unprecedented performance and security.

36 lines (28 loc) 825 B
import { AuthHandler } from 'scrivito_sdk/app_support/auth_handler'; import { getConfiguration } from 'scrivito_sdk/app_support/configure'; import { ScrivitoError } from 'scrivito_sdk/common'; import { fetchIamToken } from 'scrivito_sdk/node_support/fetch_iam_token'; export const nodeAuthHandler: AuthHandler = { getUserData(): undefined { return; }, isUserLoggedIn(): false { return false; }, ensureUserIsLoggedIn(): never { refuse(); }, iamTokenFetcher() { return async () => { const configuration = await getConfiguration(); const key = configuration.apiKey; return typeof key === 'object' ? fetchIamToken(key) : null; }; }, loginHandler(): undefined { return; }, }; function refuse(): never { throw new ScrivitoError('Only available in browser'); }