
Security News
Suno Breached via Shai-Hulud Worm, Leaked Code Exposes AI Music Scraping
A Shai-Hulud infection exposed Suno's source code, which shows the AI music startup stream-ripped tracks to train its models.
@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
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.
The npm package @edirect/auth receives a total of 735 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.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A Shai-Hulud infection exposed Suno's source code, which shows the AI music startup stream-ripped tracks to train its models.

Security News
Vercel is formalizing a monthly release program for Next.js. The change follows React2Shell and a sharp rise in AI-assisted vulnerability discovery.

Research
/Security News
11 malicious NuGet tools pose as game cheats to deploy Windows payloads, track hosts, and use Google Sheets for telemetry and control.