@next-nest-auth/nestauth 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -4
- package/dist/nestauth-facebook.strategy.d.ts +1 -1
- package/dist/nestauth-google.strategy.d.ts +1 -1
- package/dist/nestauth-jwt.guard.js +5 -0
- package/dist/nestauth-jwt.guard.js.map +1 -1
- package/dist/nestauth-jwt.strategy.d.ts +1 -1
- package/dist/nestauth.interface.d.ts +2 -2
- package/dist/nestauth.module.js +6 -0
- package/dist/nestauth.module.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -1
- package/src/nestauth-jwt.guard.ts +4 -4
- package/src/nestauth.interface.ts +2 -2
- package/src/nestauth.module.ts +4 -4
- package/dist/global-exception.filter.d.ts +0 -4
- package/dist/global-exception.filter.js +0 -30
- package/dist/global-exception.filter.js.map +0 -1
- package/dist/http.exception.filter.d.ts +0 -4
- package/dist/http.exception.filter.js +0 -29
- package/dist/http.exception.filter.js.map +0 -1
- package/dist/jwt-auth.guard.d.ts +0 -4
- package/dist/jwt-auth.guard.js +0 -18
- package/dist/jwt-auth.guard.js.map +0 -1
- package/dist/jwt.guard.d.ts +0 -4
- package/dist/jwt.guard.js +0 -18
- package/dist/jwt.guard.js.map +0 -1
- package/dist/jwt.strategy.d.ts +0 -12
- package/dist/jwt.strategy.js +0 -37
- package/dist/jwt.strategy.js.map +0 -1
- package/dist/local-auth.guard.d.ts +0 -4
- package/dist/local-auth.guard.js +0 -18
- package/dist/local-auth.guard.js.map +0 -1
- package/dist/local.srategy.d.ts +0 -9
- package/dist/local.srategy.js +0 -33
- package/dist/local.srategy.js.map +0 -1
- package/dist/local.strategy.d.ts +0 -11
- package/dist/local.strategy.js +0 -42
- package/dist/local.strategy.js.map +0 -1
- package/dist/nestauth/nestauth.controller.d.ts +0 -2
- package/dist/nestauth/nestauth.controller.js +0 -17
- package/dist/nestauth/nestauth.controller.js.map +0 -1
- package/dist/nestauth/nestauth.controller.spec.d.ts +0 -1
- package/dist/nestauth/nestauth.controller.spec.js +0 -17
- package/dist/nestauth/nestauth.controller.spec.js.map +0 -1
- package/dist/nestauth.guard.d.ts +0 -4
- package/dist/nestauth.guard.js +0 -18
- package/dist/nestauth.guard.js.map +0 -1
- package/dist/nestauth.strategy.d.ts +0 -11
- package/dist/nestauth.strategy.js +0 -38
- package/dist/nestauth.strategy.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025 Md Shafkat Hussain Tanvir
|
|
3
|
+
Copyright (c) 2025 Md Shafkat Hussain Tanvir <tanvir0604@gmail.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -59,10 +59,7 @@ Create a new file `user.service.ts` and add the following code:
|
|
|
59
59
|
|
|
60
60
|
```typescript
|
|
61
61
|
import { Injectable } from "@nestjs/common";
|
|
62
|
-
import {
|
|
63
|
-
JwtPayloadType,
|
|
64
|
-
NestAuthInterface,
|
|
65
|
-
} from "@next-nest-auth/nestauth/dist/nestauth.interface";
|
|
62
|
+
import { JwtPayloadType, NestAuthInterface } from "@next-nest-auth/nestauth";
|
|
66
63
|
|
|
67
64
|
@Injectable()
|
|
68
65
|
export class UserService implements NestAuthInterface {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Profile, Strategy } from "passport-facebook";
|
|
2
|
-
declare const NestAuthFacebookStrategy_base: new (...args: [options: import("passport-facebook").
|
|
2
|
+
declare const NestAuthFacebookStrategy_base: new (...args: [options: import("passport-facebook").StrategyOptionsWithRequest] | [options: import("passport-facebook").StrategyOptions]) => Strategy & {
|
|
3
3
|
validate(...args: any[]): unknown;
|
|
4
4
|
};
|
|
5
5
|
export declare class NestAuthFacebookStrategy extends NestAuthFacebookStrategy_base {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Strategy, Profile, VerifyCallback } from "passport-google-oauth20";
|
|
2
|
-
declare const NestAuthGoogleStrategy_base: new (...args: [options: import("passport-google-oauth20").
|
|
2
|
+
declare const NestAuthGoogleStrategy_base: new (...args: [options: import("passport-google-oauth20").StrategyOptionsWithRequest] | [options: import("passport-google-oauth20").StrategyOptions] | [options: import("passport-google-oauth20").StrategyOptions] | [options: import("passport-google-oauth20").StrategyOptionsWithRequest]) => Strategy & {
|
|
3
3
|
validate(...args: any[]): unknown;
|
|
4
4
|
};
|
|
5
5
|
export declare class NestAuthGoogleStrategy extends NestAuthGoogleStrategy_base {
|
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.NestAuthJwtGuard = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
11
|
const passport_1 = require("@nestjs/passport");
|
|
12
|
+
const macaddress = require("macaddress");
|
|
12
13
|
let NestAuthJwtGuard = class NestAuthJwtGuard extends (0, passport_1.AuthGuard)("jwt") {
|
|
13
14
|
async canActivate(context) {
|
|
14
15
|
const request = context.switchToHttp().getRequest();
|
|
@@ -17,6 +18,10 @@ let NestAuthJwtGuard = class NestAuthJwtGuard extends (0, passport_1.AuthGuard)(
|
|
|
17
18
|
if (!user) {
|
|
18
19
|
throw new common_1.UnauthorizedException("Unauthorized: Invalid token");
|
|
19
20
|
}
|
|
21
|
+
const currentMacId = await macaddress.one();
|
|
22
|
+
if (user.macId !== currentMacId) {
|
|
23
|
+
throw new common_1.UnauthorizedException("Unauthorized: Device mismatch");
|
|
24
|
+
}
|
|
20
25
|
return true;
|
|
21
26
|
}
|
|
22
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nestauth-jwt.guard.js","sourceRoot":"","sources":["../src/nestauth-jwt.guard.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAIwB;AACxB,+CAA6C;
|
|
1
|
+
{"version":3,"file":"nestauth-jwt.guard.js","sourceRoot":"","sources":["../src/nestauth-jwt.guard.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAIwB;AACxB,+CAA6C;AAC7C,yCAAyC;AAGlC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,IAAA,oBAAS,EAAC,KAAK,CAAC;IAClD,KAAK,CAAC,WAAW,CAAC,OAAyB;QACvC,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QACpD,MAAM,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACjC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAC1B,IAAI,CAAC,IAAI,EAAE,CAAC;YACR,MAAM,IAAI,8BAAqB,CAAC,6BAA6B,CAAC,CAAC;QACnE,CAAC;QACD,MAAM,YAAY,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,CAAC;QAC5C,IAAI,IAAI,CAAC,KAAK,KAAK,YAAY,EAAE,CAAC;YAC9B,MAAM,IAAI,8BAAqB,CAAC,+BAA+B,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AAdY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;GACA,gBAAgB,CAc5B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Strategy } from "passport-jwt";
|
|
2
2
|
import { JwtPayload } from "jsonwebtoken";
|
|
3
|
-
declare const NestAuthJwtStrategy_base: new (...args: [opt: import("passport-jwt").
|
|
3
|
+
declare const NestAuthJwtStrategy_base: new (...args: [opt: import("passport-jwt").StrategyOptionsWithRequest] | [opt: import("passport-jwt").StrategyOptionsWithoutRequest]) => Strategy & {
|
|
4
4
|
validate(...args: any[]): unknown;
|
|
5
5
|
};
|
|
6
6
|
export declare class NestAuthJwtStrategy extends NestAuthJwtStrategy_base {
|
|
@@ -28,6 +28,6 @@ export type FacebookProfileType = SocialProfileType;
|
|
|
28
28
|
export interface NestAuthInterface {
|
|
29
29
|
validateUser(params: any): Promise<JwtPayloadType>;
|
|
30
30
|
getUserById(id: number): Promise<JwtPayloadType>;
|
|
31
|
-
google(params: GoogleProfileType): Promise<JwtPayloadType>;
|
|
32
|
-
facebook(params: FacebookProfileType): Promise<JwtPayloadType>;
|
|
31
|
+
google?(params: GoogleProfileType): Promise<JwtPayloadType>;
|
|
32
|
+
facebook?(params: FacebookProfileType): Promise<JwtPayloadType>;
|
|
33
33
|
}
|
package/dist/nestauth.module.js
CHANGED
|
@@ -18,6 +18,8 @@ const nestauth_jwt_strategy_1 = require("./nestauth-jwt.strategy");
|
|
|
18
18
|
const nestauth_local_strategy_1 = require("./nestauth-local.strategy");
|
|
19
19
|
const nestauth_google_strategy_1 = require("./nestauth-google.strategy");
|
|
20
20
|
const nestauth_facebook_strategy_1 = require("./nestauth-facebook.strategy");
|
|
21
|
+
const core_1 = require("@nestjs/core");
|
|
22
|
+
const http_exception_filter_1 = require("./http-exception.filter");
|
|
21
23
|
let NestAuthModule = NestAuthModule_1 = class NestAuthModule {
|
|
22
24
|
static register(options) {
|
|
23
25
|
const UserServiceProvider = {
|
|
@@ -60,6 +62,10 @@ let NestAuthModule = NestAuthModule_1 = class NestAuthModule {
|
|
|
60
62
|
JwtSecretProvider,
|
|
61
63
|
JwtExpiresInProvider,
|
|
62
64
|
JwtRefreshTokenExpiresInProvider,
|
|
65
|
+
{
|
|
66
|
+
provide: core_1.APP_FILTER,
|
|
67
|
+
useClass: http_exception_filter_1.HttpExceptionFilter,
|
|
68
|
+
},
|
|
63
69
|
],
|
|
64
70
|
exports: [nestauth_service_1.NestAuthService],
|
|
65
71
|
controllers: [nestauth_controller_1.NestAuthController],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nestauth.module.js","sourceRoot":"","sources":["../src/nestauth.module.ts"],"names":[],"mapp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