
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@tc-libs/authentication
Advanced tools
Layer di autenticazione/autorizzazione per NestJS basato su JWT, permission token e OAuth opzionale Google/Apple.
Layer di autenticazione/autorizzazione per NestJS basato su JWT, permission token e OAuth opzionale Google/Apple.
Il package esporta:
AuthModuleAuthServiceENUM_AUTH_ACCESS_FORAuthService dipende da PasswordService e TokenService di @tc-libs/helper. In pratica questo package va usato insieme a HelperModule.
AuthModule.register(
{
jwt: {
defaultSecretKey: process.env.JWT_DEFAULT_SECRET!,
defaultExpirationTime: 3600,
},
auth: {
prefixAuthorization: 'Bearer',
subject: 'access',
audience: 'my-api',
issuer: 'my-service',
payloadEncryption: true,
accessToken: {
secretKey: process.env.ACCESS_TOKEN_SECRET!,
expirationTime: 3600,
notBeforeExpirationTime: 0,
encryptKey: process.env.ACCESS_TOKEN_ENCRYPT_KEY!,
encryptIv: process.env.ACCESS_TOKEN_ENCRYPT_IV!,
},
refreshToken: {
secretKey: process.env.REFRESH_TOKEN_SECRET!,
expirationTime: 86400,
expirationTimeRememberMe: 2592000,
notBeforeExpirationTime: 0,
encryptKey: process.env.REFRESH_TOKEN_ENCRYPT_KEY!,
encryptIv: process.env.REFRESH_TOKEN_ENCRYPT_IV!,
},
permissionToken: {
headerName: 'x-permission-token',
secretKey: process.env.PERMISSION_TOKEN_SECRET!,
expirationTime: 900,
notBeforeExpirationTime: 0,
encryptKey: process.env.PERMISSION_TOKEN_ENCRYPT_KEY!,
encryptIv: process.env.PERMISSION_TOKEN_ENCRYPT_IV!,
},
},
},
true,
);
Le strategy Google e Apple vengono registrate solo se la relativa configurazione e completa.
AuthServiceMetodi principali:
getAuthToken(payload, rememberMe)getRefreshToken(payload, refreshToken, rememberMe, loginDate)validateUser(password, hash)createPassword(password)Esempio login:
const token = await this.authService.getAuthToken(
{ _id: user._id.toString(), email: user.email, role: user.role },
false,
);
AuthJwtAccessProtected()AuthJwtRefreshProtected()AuthJwtPublicAccessProtected()AuthJwtAdminAccessProtected()AuthPermissionProtected(group, ...permissions)CurrentUser()User()AuthJwtPayload()AuthJwtToken()Esempio:
@Get('me')
@AuthJwtAccessProtected()
profile(@CurrentUser() user: any) {
return user;
}
Il package definisce:
SUPER_ADMINUSERADMINEDITORLOGISTICQuesti valori vengono riusati da role, api-key e altri package.
nx build authentication
nx test authentication
FAQs
Layer di autenticazione/autorizzazione per NestJS basato su JWT, permission token e OAuth opzionale Google/Apple.
The npm package @tc-libs/authentication receives a total of 163 weekly downloads. As such, @tc-libs/authentication popularity was classified as not popular.
We found that @tc-libs/authentication demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.