Interface: Auth<T>
Alpha
The base plugin class, set of utilities for developing plugins.
Extends
Plugin<T>
Type Parameters
| Type Parameter |
|---|
T |
Properties
| Property | Modifier | Type | Description | Inherited from |
|---|---|---|---|---|
config | readonly | unknown | Alpha | Plugin.config |
options | readonly | PluginOptions | Alpha | Plugin.options |
version | readonly | number | Alpha | Plugin.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
| Parameter | Type |
|---|---|
user | string |
password | string |
cb | AuthUserCallback |
Returns
void
allow_access()?
Call Signature
ts
optional allow_access(
user,
pkg,
cb): void;Parameters
| Parameter | Type |
|---|---|
user | RemoteUser |
pkg | T & PackageAccess |
cb | AccessCallback |
Returns
void
Call Signature
ts
optional allow_access(
user,
pkg,
cb): void;Parameters
| Parameter | Type |
|---|---|
user | RemoteUser |
pkg | AllowAccess & PackageAccess |
cb | AccessCallback |
Returns
void
allow_publish()?
Call Signature
ts
optional allow_publish(
user,
pkg,
cb): void;Parameters
| Parameter | Type |
|---|---|
user | RemoteUser |
pkg | T & PackageAccess |
cb | AuthAccessCallback |
Returns
void
Call Signature
ts
optional allow_publish(
user,
pkg,
cb): void;Parameters
| Parameter | Type |
|---|---|
user | RemoteUser |
pkg | AllowAccess & PackageAccess |
cb | AuthAccessCallback |
Returns
void
allow_unpublish()?
Call Signature
ts
optional allow_unpublish(
user,
pkg,
cb): void;Parameters
| Parameter | Type |
|---|---|
user | RemoteUser |
pkg | T & PackageAccess |
cb | AuthAccessCallback |
Returns
void
Call Signature
ts
optional allow_unpublish(
user,
pkg,
cb): void;Parameters
| Parameter | Type |
|---|---|
user | RemoteUser |
pkg | AllowAccess & PackageAccess |
cb | AuthAccessCallback |
Returns
void
apiJWTmiddleware()?
ts
optional apiJWTmiddleware(helpers): RequestHandler;Parameters
| Parameter | Type |
|---|---|
helpers | any |
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
| Parameter | Type |
|---|---|
user | string |
password | string |
cb | AuthCallback |
Returns
void
changePassword()?
ts
optional changePassword(
user,
password,
newPassword,
cb): void;Parameters
| Parameter | Type |
|---|---|
user | string |
password | string |
newPassword | string |
cb | AuthChangePasswordCallback |
Returns
void
getVersion()
ts
getVersion(): number;Alpha
Returns
number