Skip to content

@verdaccio/core


Interface: Auth<T>

Alpha

The base plugin class, set of utilities for developing plugins.

Extends

Type Parameters

Type Parameter
T

Properties

PropertyModifierTypeDescriptionInherited from
configreadonlyunknownAlphaPlugin.config
optionsreadonlyPluginOptionsAlphaPlugin.options
versionreadonlynumberAlphaPlugin.version

Methods

adduser()?

ts
optional adduser(
   user, 
   password, 
   cb): void;

Handles the authenticated method.

ts
 class Auth {
   public adduser(user: string, password: string, done: AuthCallback): void {
     if (!password) {
       return done(errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));
     }
     // return boolean
     return done(null, true);
 }

Parameters

ParameterType
userstring
passwordstring
cbAuthUserCallback

Returns

void


allow_access()?

Call Signature

ts
optional allow_access(
   user, 
   pkg, 
   cb): void;
Parameters
ParameterType
userRemoteUser
pkgT & PackageAccess
cbAccessCallback
Returns

void

Call Signature

ts
optional allow_access(
   user, 
   pkg, 
   cb): void;
Parameters
ParameterType
userRemoteUser
pkgAllowAccess & PackageAccess
cbAccessCallback
Returns

void


allow_publish()?

Call Signature

ts
optional allow_publish(
   user, 
   pkg, 
   cb): void;
Parameters
ParameterType
userRemoteUser
pkgT & PackageAccess
cbAuthAccessCallback
Returns

void

Call Signature

ts
optional allow_publish(
   user, 
   pkg, 
   cb): void;
Parameters
ParameterType
userRemoteUser
pkgAllowAccess & PackageAccess
cbAuthAccessCallback
Returns

void


allow_unpublish()?

Call Signature

ts
optional allow_unpublish(
   user, 
   pkg, 
   cb): void;
Parameters
ParameterType
userRemoteUser
pkgT & PackageAccess
cbAuthAccessCallback
Returns

void

Call Signature

ts
optional allow_unpublish(
   user, 
   pkg, 
   cb): void;
Parameters
ParameterType
userRemoteUser
pkgAllowAccess & PackageAccess
cbAuthAccessCallback
Returns

void


apiJWTmiddleware()?

ts
optional apiJWTmiddleware(helpers): RequestHandler;

Parameters

ParameterType
helpersany

Returns

RequestHandler


authenticate()

ts
authenticate(
   user, 
   password, 
   cb): void;

Handles the authenticated method.

ts
 class Auth {
   public authenticate(user: string, password: string, done: AuthCallback): void {
     if (!password) {
       return done(errorUtils.getUnauthorized(API_ERROR.BAD_USERNAME_PASSWORD));
     }
     // always return an array of users
     return done(null, [user]);
 }

Parameters

ParameterType
userstring
passwordstring
cbAuthCallback

Returns

void


changePassword()?

ts
optional changePassword(
   user, 
   password, 
   newPassword, 
   cb): void;

Parameters

ParameterType
userstring
passwordstring
newPasswordstring
cbAuthChangePasswordCallback

Returns

void


getVersion()

ts
getVersion(): number;

Alpha

Returns

number

Inherited from

Plugin.getVersion

Released under the MIT License.