
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@webundsoehne/nestjs-auth0-guard
Advanced tools
This is an Auth0 guard, which covers the whole integration for you.
Module: ./module.ts
import { Module, NestModule } from '@nestjs/common'
import { Auth0Module } from '@webundsoehne/nestjs-auth0-guard'
import TestController from './controller'
@Module({
imports: [
Auth0Module.register({
domain: 'customer-domain.auth0.com',
clientId: 'auth0-client-identifier',
clientSecret: 'auth0-client-secret',
audience: 'https://customer-domain.com',
namespace: 'https://customer-domain.com'
})
],
controller: [
TestController
]
})
export class Server implements NestModule {}
Controller: ./controller.ts
import { Controller, Get, Post, UseGuards } from '@nestjs/common'
import { AuthGuard, Auth0TokenUser, Permissions, User } from '@webundsoehne/nestjs-auth0-guard'
@Controller('test')
@UseGuards(AuthGuard.withPermissions(['read:test', 'save:test', 'remove:test']))
export class TestController {
@Permissions('read:test')
@Get()
getTest () {}
@Permissions('save:test')
@Post()
getTest (@User() user: Auth0TokenUser) {}
}
The Auth0Module.register(options)
has to be imported once in your main NestModule
.
It requires the configuration for communicating with Auth0.
Options:
Name | Type | Required | Description |
---|---|---|---|
domain | String | true | The Auth0 domain of your account's tenant |
clientId | String | true | The identifier of the Auth0 client |
clientSecret | String | true | The secret key of the used Auth0 client |
audience | String | false | The configured audience you want to login (Fallback: http://localhost:3000 ) |
namespace | String | false | The namespace of the JWT property names, which should be extracted to the user's object (Fallback: audience ) |
If you want to enable the guard for a controller or method, you have to use the AutheGuard
.
You may use the jumper AuthGuard.withPermissions(permissions: string | string[])
, which allows you to tell the guard which permissions are allowed without using the decorator.
The Permissions(permissions: string | string[])
decorator restricts, the access to an method, to one of the set permission values.
The User(key?: string)
decorator allows you to fetch user specific information out of the JWT payload.
On each Git tag commit to this repo, the source-code will be automatically transpiled and published to NPM.
FAQs
NestJS Auth0 Guard
The npm package @webundsoehne/nestjs-auth0-guard receives a total of 211 weekly downloads. As such, @webundsoehne/nestjs-auth0-guard popularity was classified as not popular.
We found that @webundsoehne/nestjs-auth0-guard demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.