
Research
/Security News
OpenAPI React Query Codegen Compromised in Mini Shai-Hulud npm Supply Chain Attack
Ten malicious OpenAPI React Query Codegen versions were published to npm in the Mini Shai-Hulud attack, all with valid provenance.
@edirect/auth
Advanced tools
Authentication and authorization module for eDirect NestJS applications. Supports two auth providers — **Keycloak** (OIDC/JWT) and a **custom Auth Service** — with guards, middleware, decorators, and multi-tenant realm support.
Authentication and authorization module for eDirect NestJS applications. Supports two auth providers — Keycloak (OIDC/JWT) and a custom Auth Service — with guards, middleware, decorators, and multi-tenant realm support.
AuthCacheServiceAuthenticatedRequestInterface, UserInterface, TokenInterface)pnpm add @edirect/auth
# or
npm install @edirect/auth
import { Module } from '@nestjs/common';
import { KeycloakAuthModule } from '@edirect/auth';
@Module({
imports: [KeycloakAuthModule],
})
export class AppModule {}
import { Controller, Get, UseGuards } from '@nestjs/common';
import { KeycloakAuthGuard, Permissions, Roles } from '@edirect/auth';
@Controller('policies')
export class PoliciesController {
@Get()
@UseGuards(KeycloakAuthGuard)
@Roles('agent', 'admin')
@Permissions('read:policy')
findAll() {
return [];
}
}
import { Module } from '@nestjs/common';
import { AuthServiceAuthModule } from '@edirect/auth';
@Module({
imports: [AuthServiceAuthModule],
})
export class AppModule {}
import { Controller, Get, UseGuards } from '@nestjs/common';
import { AuthGuard, Roles } from '@edirect/auth';
@Controller('quotes')
export class QuotesController {
@Get()
@UseGuards(AuthGuard)
@Roles('agent')
findAll() {
return [];
}
}
| Decorator | Description |
|---|---|
@Roles(...roles) | Require one of the specified roles |
@Permissions(...perms) | Require one of the specified permissions |
@Resources(...resources) | Require access to specific resources |
For Express/NestJS middleware usage (without guards):
// Keycloak
import { KeycloakAuthMiddleware } from '@edirect/auth';
consumer
.apply(KeycloakAuthMiddleware)
.forRoutes({ path: '/**', method: RequestMethod.ALL });
// Token Exchange (for service-to-service delegation)
import { KeycloakAuthTokenExchangeMiddleware } from '@edirect/auth';
consumer
.apply(KeycloakAuthTokenExchangeMiddleware)
.forRoutes({ path: '/internal/**', method: RequestMethod.ALL });
Once authentication middleware or guard runs, req.user is populated:
import { AuthenticatedRequestInterface } from '@edirect/auth';
@Get('me')
@UseGuards(KeycloakAuthGuard)
getProfile(@Req() req: AuthenticatedRequestInterface) {
return req.user; // UserInterface
}
| Variable | Description |
|---|---|
KEYCLOAK_BASE_URL | Keycloak server base URL |
KEYCLOAK_REALM | Realm name |
KEYCLOAK_CLIENT_ID | Client ID |
KEYCLOAK_CLIENT_SECRET | Client secret |
KEYCLOAK_TIMEOUT | Request timeout (ms, optional) |
For multi-tenant deployments, override per realm using the pattern KEYCLOAK_<REALM>_<VAR>:
KEYCLOAK_TH_BROKER_CLIENT_ID=my-client-th
KEYCLOAK_TH_BROKER_CLIENT_SECRET=secret-th
KEYCLOAK_TH_BROKER_BASE_URL=https://keycloak.th.example.com
| Variable | Description |
|---|---|
AUTH_SERVICE_URL | Base URL of the auth service |
AUTH_SERVICE_TOKEN | Service token for internal auth |
// Modules
export {
AuthModule,
AuthServiceAuthModule,
KeycloakAuthModule,
} from '@edirect/auth';
// Guards
export { AuthGuard, KeycloakAuthGuard } from '@edirect/auth';
// Middleware
export {
AuthMiddleware,
KeycloakAuthMiddleware,
KeycloakAuthTokenExchangeMiddleware,
} from '@edirect/auth';
// Decorators
export { Permissions, Roles, Resources } from '@edirect/auth';
// Services
export { AuthService, ServerAuthService } from '@edirect/auth';
// Interfaces
export type {
UserInterface,
TokenInterface,
EntityInterface,
AuthenticatedRequestInterface,
AuthServiceInterface,
ServerAuthServiceInterface,
} from '@edirect/auth';
FAQs
Unknown package
The npm package @edirect/auth receives a total of 249 weekly downloads. As such, @edirect/auth popularity was classified as not popular.
We found that @edirect/auth demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 29 open source maintainers collaborating on the project.

Research
/Security News
Ten malicious OpenAPI React Query Codegen versions were published to npm in the Mini Shai-Hulud attack, all with valid provenance.

Security News
Socket joins more than 100 technology, cybersecurity, and financial organizations calling for a global surge in cyber defense.

Product
Enterprise security teams can now detect malware, credential theft, suspicious network activity, and risky updates across Microsoft Edge extensions.