Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@amplication/plugin-auth-basic

Package Overview
Dependencies
Maintainers
8
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amplication/plugin-auth-basic - npm Package Compare versions

Comparing version 1.4.3 to 1.4.4

2

package.json
{
"name": "@amplication/plugin-auth-basic",
"version": "1.4.3",
"version": "1.4.4",
"description": "set basic auth for Amplication build",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -15,1 +15,4 @@ /**

"Authentication entity does not exist. Have you configured the authentication entity in the Resource Settings?";
export const AUTH_ENTITY_FIELD_USERNAME = "username";
export const AUTH_ENTITY_FIELD_PASSWORD = "password";

@@ -7,2 +7,3 @@ import {

CreateServerAuthParams,
CreateServerParams,
DsgContext,

@@ -16,6 +17,20 @@ EntityField,

import { createAuthModule, createBasicStrategyBase } from "./core";
import { addIdentifierToConstructorSuperCall, addImports, addInjectableDependency, awaitExpression, getClassDeclarationById, importNames, interpolate, logicalExpression, memberExpression } from "./util/ast";
import {
addIdentifierToConstructorSuperCall,
addImports,
addInjectableDependency,
awaitExpression,
getClassDeclarationById,
importNames,
interpolate,
logicalExpression,
memberExpression,
} from "./util/ast";
import { builders, namedTypes } from "ast-types";
import { relativeImportPath } from "./util/module";
import { isPasswordField } from "./util/field";
import {
AUTH_ENTITY_FIELD_PASSWORD,
AUTH_ENTITY_FIELD_USERNAME,
} from "./constants";

@@ -35,2 +50,5 @@ const ARGS_ID = builders.identifier("args");

return {
CreateServer: {
before: this.beforeCreateServer,
},
CreateAdminUI: {

@@ -52,2 +70,29 @@ before: this.beforeCreateAdminModules,

beforeCreateServer(context: DsgContext, eventParams: CreateServerParams) {
const authEntity = context.entities?.find(
(x) => x.name === context.resourceInfo?.settings.authEntityName
);
if (!authEntity) {
throw new Error(`Authentication entity does not exist`);
}
const requiredFields = [
AUTH_ENTITY_FIELD_USERNAME,
AUTH_ENTITY_FIELD_PASSWORD,
];
requiredFields.forEach((requiredField) => {
const field = authEntity.fields.find(
(field) => field.name === requiredField
);
if (!field) {
throw new Error(
`Authentication entity must have a field named ${requiredField}`
);
}
});
return eventParams;
}
beforeCreateAdminModules(

@@ -95,3 +140,2 @@ context: DsgContext,

beforeCreateEntityService(

@@ -98,0 +142,0 @@ context: DsgContext,

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc