Socket
Socket
Sign inDemoInstall

@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-beta.pr-289.0d3954c

.eslintrc.json

3

package.json
{
"name": "@amplication/plugin-auth-basic",
"version": "1.4.3",
"version": "1.4.4-beta.pr-289.0d3954c",
"description": "set basic auth for Amplication build",
"main": "dist/index.js",
"nx": {},
"scripts": {

@@ -7,0 +8,0 @@ "dev": "webpack --watch",

# @amplication/plugin-auth-basic
[![NPM Downloads](https://img.shields.io/npm/dt/@amplication/plugin-auth-basic)](https://www.npmjs.com/package/@amplication/plugin-auth-basic)
[![NPM Downloads](https://img.shields.io/npm/dt/@amplication/plugin-auth-basic)](https://www.npmjs.com/package/@amplication/plugin-auth-basic)

@@ -9,3 +9,3 @@ Enable Basic HTTP authentication on a service

This plugin adds the required code to use Passport Basic strategy on the generated NestJS application
This plugin adds the required code to use Passport Basic strategy on the generated NestJS application

@@ -18,2 +18,2 @@ ## Configuration

This plugin is integrarted with the default behaviour of the service by changing the `defaultAuth.guard.ts` file in the `auth` folder, so all guards on REST API controllers and GraphQL API resolvers will use this authentication by default.
This plugin is integrarted with the default behaviour of the service by changing the `defaultAuth.guard.ts` file in the `auth` folder, so all guards on REST API controllers and GraphQL API resolvers will use this authentication by default.

@@ -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,

{
"extends": "../../tsconfig.base.json",
"include": [
"src/index.ts"
]
}
"include": ["src/index.ts"]
}

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