+ private buildRegisterIdAndPassAuth () {
+ return (options: RegisterServerAuthPassOptions) => {
+ if (!options.authName || typeof options.getWeight !== 'function' || typeof options.login !== 'function') {
+ logger.error('Cannot register auth plugin %s: authName of getWeight or login are not valid.', this.npmName)
+ return
+ }
+
+ this.idAndPassAuths.push(options)
+ }
+ }
+
+ private buildRegisterExternalAuth () {
+ const self = this
+
+ return (options: RegisterServerAuthExternalOptions) => {
+ this.externalAuths.push(options)
+
+ return {
+ onAuth (options: { username: string, email: string }): void {
+ onExternalAuthPlugin(self.npmName, options.username, options.email)
+ }
+ } as RegisterServerAuthExternalResult
+ }
+ }
+