UNPKG

cbp-lib

Version:

Libraries for cbp

23 lines (21 loc) 798 B
'use strict' import {httpRequest} from '../_helpers/http' import {ArgumentError} from '../_helpers/custom-error' import {Schema, validateSchema} from '../_helpers/types' import {AuthenticationManager} from './AuthenticationManager' import {AuthenticationOidc} from './AuthenticationOidc' export class AuthenticationClient { constructor(options) { if (typeof options !== 'object') { throw new ArgumentError('argument options must be type \'object\'') } this.options = options // validate options validateSchema(Schema.authClientOptions, options) .catch(error => { throw new ArgumentError(error) }) this.oauth = new AuthenticationManager(options) this.oidc = new AuthenticationOidc(options) } }