Spaces:
Sleeping
Sleeping
feat: Add Supabase Google OAuth authentication
Browse files- Install @supabase/supabase-js and @supabase/ssr packages
- Create Supabase client utilities for browser and server
- Implement Next.js middleware for authentication token management
- Add OAuth callback route handler and error page
- Create Google login/logout button component with user profile
- Integrate authentication UI into main page
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- securecheck-pro/frontend/package-lock.json +155 -2
- securecheck-pro/frontend/package.json +2 -0
- securecheck-pro/frontend/src/app/auth/auth-code-error/page.tsx +19 -0
- securecheck-pro/frontend/src/app/auth/callback/route.ts +29 -0
- securecheck-pro/frontend/src/app/page.tsx +5 -0
- securecheck-pro/frontend/src/components/AuthButton.tsx +114 -0
- securecheck-pro/frontend/src/lib/supabase/client.ts +8 -0
- securecheck-pro/frontend/src/lib/supabase/server.ts +29 -0
- securecheck-pro/frontend/src/middleware.ts +70 -0
securecheck-pro/frontend/package-lock.json
CHANGED
|
@@ -8,6 +8,8 @@
|
|
| 8 |
"name": "oneclick-ssl-checker",
|
| 9 |
"version": "0.1.0",
|
| 10 |
"dependencies": {
|
|
|
|
|
|
|
| 11 |
"html2pdf.js": "^0.12.0",
|
| 12 |
"next": "15.5.2",
|
| 13 |
"react": "19.1.0",
|
|
@@ -987,6 +989,92 @@
|
|
| 987 |
"dev": true,
|
| 988 |
"license": "MIT"
|
| 989 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 990 |
"node_modules/@swc/helpers": {
|
| 991 |
"version": "0.5.15",
|
| 992 |
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz",
|
|
@@ -1308,7 +1396,6 @@
|
|
| 1308 |
"version": "20.19.12",
|
| 1309 |
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.12.tgz",
|
| 1310 |
"integrity": "sha512-lSOjyS6vdO2G2g2CWrETTV3Jz2zlCXHpu1rcubLKpz9oj+z/1CceHlj+yq53W+9zgb98nSov/wjEKYDNauD+Hw==",
|
| 1311 |
-
"dev": true,
|
| 1312 |
"license": "MIT",
|
| 1313 |
"dependencies": {
|
| 1314 |
"undici-types": "~6.21.0"
|
|
@@ -1320,6 +1407,12 @@
|
|
| 1320 |
"integrity": "sha512-VWDCbrLeVXJM9fihYodcLiIv0ku+AlOa/TQ1SvYOaBuyrSKgEcro95LJyIsJ4vSo6BXIxOKxiJAat04CmST9Fw==",
|
| 1321 |
"license": "MIT"
|
| 1322 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1323 |
"node_modules/@types/raf": {
|
| 1324 |
"version": "3.4.3",
|
| 1325 |
"resolved": "https://registry.npmjs.org/@types/raf/-/raf-3.4.3.tgz",
|
|
@@ -1354,6 +1447,15 @@
|
|
| 1354 |
"license": "MIT",
|
| 1355 |
"optional": true
|
| 1356 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1357 |
"node_modules/@typescript-eslint/eslint-plugin": {
|
| 1358 |
"version": "8.42.0",
|
| 1359 |
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.42.0.tgz",
|
|
@@ -2422,6 +2524,15 @@
|
|
| 2422 |
"dev": true,
|
| 2423 |
"license": "MIT"
|
| 2424 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2425 |
"node_modules/core-js": {
|
| 2426 |
"version": "3.45.1",
|
| 2427 |
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.45.1.tgz",
|
|
@@ -6025,6 +6136,12 @@
|
|
| 6025 |
"node": ">=8.0"
|
| 6026 |
}
|
| 6027 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6028 |
"node_modules/ts-api-utils": {
|
| 6029 |
"version": "2.1.0",
|
| 6030 |
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz",
|
|
@@ -6185,7 +6302,6 @@
|
|
| 6185 |
"version": "6.21.0",
|
| 6186 |
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
|
| 6187 |
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
|
| 6188 |
-
"dev": true,
|
| 6189 |
"license": "MIT"
|
| 6190 |
},
|
| 6191 |
"node_modules/unrs-resolver": {
|
|
@@ -6242,6 +6358,22 @@
|
|
| 6242 |
"base64-arraybuffer": "^1.0.2"
|
| 6243 |
}
|
| 6244 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6245 |
"node_modules/which": {
|
| 6246 |
"version": "2.0.2",
|
| 6247 |
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
|
@@ -6357,6 +6489,27 @@
|
|
| 6357 |
"node": ">=0.10.0"
|
| 6358 |
}
|
| 6359 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6360 |
"node_modules/yallist": {
|
| 6361 |
"version": "5.0.0",
|
| 6362 |
"resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",
|
|
|
|
| 8 |
"name": "oneclick-ssl-checker",
|
| 9 |
"version": "0.1.0",
|
| 10 |
"dependencies": {
|
| 11 |
+
"@supabase/ssr": "^0.7.0",
|
| 12 |
+
"@supabase/supabase-js": "^2.57.4",
|
| 13 |
"html2pdf.js": "^0.12.0",
|
| 14 |
"next": "15.5.2",
|
| 15 |
"react": "19.1.0",
|
|
|
|
| 989 |
"dev": true,
|
| 990 |
"license": "MIT"
|
| 991 |
},
|
| 992 |
+
"node_modules/@supabase/auth-js": {
|
| 993 |
+
"version": "2.71.1",
|
| 994 |
+
"resolved": "https://registry.npmjs.org/@supabase/auth-js/-/auth-js-2.71.1.tgz",
|
| 995 |
+
"integrity": "sha512-mMIQHBRc+SKpZFRB2qtupuzulaUhFYupNyxqDj5Jp/LyPvcWvjaJzZzObv6URtL/O6lPxkanASnotGtNpS3H2Q==",
|
| 996 |
+
"license": "MIT",
|
| 997 |
+
"dependencies": {
|
| 998 |
+
"@supabase/node-fetch": "^2.6.14"
|
| 999 |
+
}
|
| 1000 |
+
},
|
| 1001 |
+
"node_modules/@supabase/functions-js": {
|
| 1002 |
+
"version": "2.4.6",
|
| 1003 |
+
"resolved": "https://registry.npmjs.org/@supabase/functions-js/-/functions-js-2.4.6.tgz",
|
| 1004 |
+
"integrity": "sha512-bhjZ7rmxAibjgmzTmQBxJU6ZIBCCJTc3Uwgvdi4FewueUTAGO5hxZT1Sj6tiD+0dSXf9XI87BDdJrg12z8Uaew==",
|
| 1005 |
+
"license": "MIT",
|
| 1006 |
+
"dependencies": {
|
| 1007 |
+
"@supabase/node-fetch": "^2.6.14"
|
| 1008 |
+
}
|
| 1009 |
+
},
|
| 1010 |
+
"node_modules/@supabase/node-fetch": {
|
| 1011 |
+
"version": "2.6.15",
|
| 1012 |
+
"resolved": "https://registry.npmjs.org/@supabase/node-fetch/-/node-fetch-2.6.15.tgz",
|
| 1013 |
+
"integrity": "sha512-1ibVeYUacxWYi9i0cf5efil6adJ9WRyZBLivgjs+AUpewx1F3xPi7gLgaASI2SmIQxPoCEjAsLAzKPgMJVgOUQ==",
|
| 1014 |
+
"license": "MIT",
|
| 1015 |
+
"dependencies": {
|
| 1016 |
+
"whatwg-url": "^5.0.0"
|
| 1017 |
+
},
|
| 1018 |
+
"engines": {
|
| 1019 |
+
"node": "4.x || >=6.0.0"
|
| 1020 |
+
}
|
| 1021 |
+
},
|
| 1022 |
+
"node_modules/@supabase/postgrest-js": {
|
| 1023 |
+
"version": "1.21.4",
|
| 1024 |
+
"resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-1.21.4.tgz",
|
| 1025 |
+
"integrity": "sha512-TxZCIjxk6/dP9abAi89VQbWWMBbybpGWyvmIzTd79OeravM13OjR/YEYeyUOPcM1C3QyvXkvPZhUfItvmhY1IQ==",
|
| 1026 |
+
"license": "MIT",
|
| 1027 |
+
"dependencies": {
|
| 1028 |
+
"@supabase/node-fetch": "^2.6.14"
|
| 1029 |
+
}
|
| 1030 |
+
},
|
| 1031 |
+
"node_modules/@supabase/realtime-js": {
|
| 1032 |
+
"version": "2.15.5",
|
| 1033 |
+
"resolved": "https://registry.npmjs.org/@supabase/realtime-js/-/realtime-js-2.15.5.tgz",
|
| 1034 |
+
"integrity": "sha512-/Rs5Vqu9jejRD8ZeuaWXebdkH+J7V6VySbCZ/zQM93Ta5y3mAmocjioa/nzlB6qvFmyylUgKVS1KpE212t30OA==",
|
| 1035 |
+
"license": "MIT",
|
| 1036 |
+
"dependencies": {
|
| 1037 |
+
"@supabase/node-fetch": "^2.6.13",
|
| 1038 |
+
"@types/phoenix": "^1.6.6",
|
| 1039 |
+
"@types/ws": "^8.18.1",
|
| 1040 |
+
"ws": "^8.18.2"
|
| 1041 |
+
}
|
| 1042 |
+
},
|
| 1043 |
+
"node_modules/@supabase/ssr": {
|
| 1044 |
+
"version": "0.7.0",
|
| 1045 |
+
"resolved": "https://registry.npmjs.org/@supabase/ssr/-/ssr-0.7.0.tgz",
|
| 1046 |
+
"integrity": "sha512-G65t5EhLSJ5c8hTCcXifSL9Q/ZRXvqgXeNo+d3P56f4U1IxwTqjB64UfmfixvmMcjuxnq2yGqEWVJqUcO+AzAg==",
|
| 1047 |
+
"license": "MIT",
|
| 1048 |
+
"dependencies": {
|
| 1049 |
+
"cookie": "^1.0.2"
|
| 1050 |
+
},
|
| 1051 |
+
"peerDependencies": {
|
| 1052 |
+
"@supabase/supabase-js": "^2.43.4"
|
| 1053 |
+
}
|
| 1054 |
+
},
|
| 1055 |
+
"node_modules/@supabase/storage-js": {
|
| 1056 |
+
"version": "2.12.1",
|
| 1057 |
+
"resolved": "https://registry.npmjs.org/@supabase/storage-js/-/storage-js-2.12.1.tgz",
|
| 1058 |
+
"integrity": "sha512-QWg3HV6Db2J81VQx0PqLq0JDBn4Q8B1FYn1kYcbla8+d5WDmTdwwMr+EJAxNOSs9W4mhKMv+EYCpCrTFlTj4VQ==",
|
| 1059 |
+
"license": "MIT",
|
| 1060 |
+
"dependencies": {
|
| 1061 |
+
"@supabase/node-fetch": "^2.6.14"
|
| 1062 |
+
}
|
| 1063 |
+
},
|
| 1064 |
+
"node_modules/@supabase/supabase-js": {
|
| 1065 |
+
"version": "2.57.4",
|
| 1066 |
+
"resolved": "https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-2.57.4.tgz",
|
| 1067 |
+
"integrity": "sha512-LcbTzFhHYdwfQ7TRPfol0z04rLEyHabpGYANME6wkQ/kLtKNmI+Vy+WEM8HxeOZAtByUFxoUTTLwhXmrh+CcVw==",
|
| 1068 |
+
"license": "MIT",
|
| 1069 |
+
"dependencies": {
|
| 1070 |
+
"@supabase/auth-js": "2.71.1",
|
| 1071 |
+
"@supabase/functions-js": "2.4.6",
|
| 1072 |
+
"@supabase/node-fetch": "2.6.15",
|
| 1073 |
+
"@supabase/postgrest-js": "1.21.4",
|
| 1074 |
+
"@supabase/realtime-js": "2.15.5",
|
| 1075 |
+
"@supabase/storage-js": "2.12.1"
|
| 1076 |
+
}
|
| 1077 |
+
},
|
| 1078 |
"node_modules/@swc/helpers": {
|
| 1079 |
"version": "0.5.15",
|
| 1080 |
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz",
|
|
|
|
| 1396 |
"version": "20.19.12",
|
| 1397 |
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.12.tgz",
|
| 1398 |
"integrity": "sha512-lSOjyS6vdO2G2g2CWrETTV3Jz2zlCXHpu1rcubLKpz9oj+z/1CceHlj+yq53W+9zgb98nSov/wjEKYDNauD+Hw==",
|
|
|
|
| 1399 |
"license": "MIT",
|
| 1400 |
"dependencies": {
|
| 1401 |
"undici-types": "~6.21.0"
|
|
|
|
| 1407 |
"integrity": "sha512-VWDCbrLeVXJM9fihYodcLiIv0ku+AlOa/TQ1SvYOaBuyrSKgEcro95LJyIsJ4vSo6BXIxOKxiJAat04CmST9Fw==",
|
| 1408 |
"license": "MIT"
|
| 1409 |
},
|
| 1410 |
+
"node_modules/@types/phoenix": {
|
| 1411 |
+
"version": "1.6.6",
|
| 1412 |
+
"resolved": "https://registry.npmjs.org/@types/phoenix/-/phoenix-1.6.6.tgz",
|
| 1413 |
+
"integrity": "sha512-PIzZZlEppgrpoT2QgbnDU+MMzuR6BbCjllj0bM70lWoejMeNJAxCchxnv7J3XFkI8MpygtRpzXrIlmWUBclP5A==",
|
| 1414 |
+
"license": "MIT"
|
| 1415 |
+
},
|
| 1416 |
"node_modules/@types/raf": {
|
| 1417 |
"version": "3.4.3",
|
| 1418 |
"resolved": "https://registry.npmjs.org/@types/raf/-/raf-3.4.3.tgz",
|
|
|
|
| 1447 |
"license": "MIT",
|
| 1448 |
"optional": true
|
| 1449 |
},
|
| 1450 |
+
"node_modules/@types/ws": {
|
| 1451 |
+
"version": "8.18.1",
|
| 1452 |
+
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz",
|
| 1453 |
+
"integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==",
|
| 1454 |
+
"license": "MIT",
|
| 1455 |
+
"dependencies": {
|
| 1456 |
+
"@types/node": "*"
|
| 1457 |
+
}
|
| 1458 |
+
},
|
| 1459 |
"node_modules/@typescript-eslint/eslint-plugin": {
|
| 1460 |
"version": "8.42.0",
|
| 1461 |
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.42.0.tgz",
|
|
|
|
| 2524 |
"dev": true,
|
| 2525 |
"license": "MIT"
|
| 2526 |
},
|
| 2527 |
+
"node_modules/cookie": {
|
| 2528 |
+
"version": "1.0.2",
|
| 2529 |
+
"resolved": "https://registry.npmjs.org/cookie/-/cookie-1.0.2.tgz",
|
| 2530 |
+
"integrity": "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==",
|
| 2531 |
+
"license": "MIT",
|
| 2532 |
+
"engines": {
|
| 2533 |
+
"node": ">=18"
|
| 2534 |
+
}
|
| 2535 |
+
},
|
| 2536 |
"node_modules/core-js": {
|
| 2537 |
"version": "3.45.1",
|
| 2538 |
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.45.1.tgz",
|
|
|
|
| 6136 |
"node": ">=8.0"
|
| 6137 |
}
|
| 6138 |
},
|
| 6139 |
+
"node_modules/tr46": {
|
| 6140 |
+
"version": "0.0.3",
|
| 6141 |
+
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
| 6142 |
+
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
|
| 6143 |
+
"license": "MIT"
|
| 6144 |
+
},
|
| 6145 |
"node_modules/ts-api-utils": {
|
| 6146 |
"version": "2.1.0",
|
| 6147 |
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz",
|
|
|
|
| 6302 |
"version": "6.21.0",
|
| 6303 |
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
|
| 6304 |
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
|
|
|
|
| 6305 |
"license": "MIT"
|
| 6306 |
},
|
| 6307 |
"node_modules/unrs-resolver": {
|
|
|
|
| 6358 |
"base64-arraybuffer": "^1.0.2"
|
| 6359 |
}
|
| 6360 |
},
|
| 6361 |
+
"node_modules/webidl-conversions": {
|
| 6362 |
+
"version": "3.0.1",
|
| 6363 |
+
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
| 6364 |
+
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
|
| 6365 |
+
"license": "BSD-2-Clause"
|
| 6366 |
+
},
|
| 6367 |
+
"node_modules/whatwg-url": {
|
| 6368 |
+
"version": "5.0.0",
|
| 6369 |
+
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
| 6370 |
+
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
| 6371 |
+
"license": "MIT",
|
| 6372 |
+
"dependencies": {
|
| 6373 |
+
"tr46": "~0.0.3",
|
| 6374 |
+
"webidl-conversions": "^3.0.0"
|
| 6375 |
+
}
|
| 6376 |
+
},
|
| 6377 |
"node_modules/which": {
|
| 6378 |
"version": "2.0.2",
|
| 6379 |
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
|
|
|
| 6489 |
"node": ">=0.10.0"
|
| 6490 |
}
|
| 6491 |
},
|
| 6492 |
+
"node_modules/ws": {
|
| 6493 |
+
"version": "8.18.3",
|
| 6494 |
+
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz",
|
| 6495 |
+
"integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==",
|
| 6496 |
+
"license": "MIT",
|
| 6497 |
+
"engines": {
|
| 6498 |
+
"node": ">=10.0.0"
|
| 6499 |
+
},
|
| 6500 |
+
"peerDependencies": {
|
| 6501 |
+
"bufferutil": "^4.0.1",
|
| 6502 |
+
"utf-8-validate": ">=5.0.2"
|
| 6503 |
+
},
|
| 6504 |
+
"peerDependenciesMeta": {
|
| 6505 |
+
"bufferutil": {
|
| 6506 |
+
"optional": true
|
| 6507 |
+
},
|
| 6508 |
+
"utf-8-validate": {
|
| 6509 |
+
"optional": true
|
| 6510 |
+
}
|
| 6511 |
+
}
|
| 6512 |
+
},
|
| 6513 |
"node_modules/yallist": {
|
| 6514 |
"version": "5.0.0",
|
| 6515 |
"resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",
|
securecheck-pro/frontend/package.json
CHANGED
|
@@ -9,6 +9,8 @@
|
|
| 9 |
"lint": "eslint"
|
| 10 |
},
|
| 11 |
"dependencies": {
|
|
|
|
|
|
|
| 12 |
"html2pdf.js": "^0.12.0",
|
| 13 |
"next": "15.5.2",
|
| 14 |
"react": "19.1.0",
|
|
|
|
| 9 |
"lint": "eslint"
|
| 10 |
},
|
| 11 |
"dependencies": {
|
| 12 |
+
"@supabase/ssr": "^0.7.0",
|
| 13 |
+
"@supabase/supabase-js": "^2.57.4",
|
| 14 |
"html2pdf.js": "^0.12.0",
|
| 15 |
"next": "15.5.2",
|
| 16 |
"react": "19.1.0",
|
securecheck-pro/frontend/src/app/auth/auth-code-error/page.tsx
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default function AuthCodeError() {
|
| 2 |
+
return (
|
| 3 |
+
<div className="min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 flex items-center justify-center">
|
| 4 |
+
<div className="max-w-md w-full bg-white rounded-lg shadow-lg p-8 text-center">
|
| 5 |
+
<div className="text-6xl mb-6">⚠️</div>
|
| 6 |
+
<h1 className="text-2xl font-bold text-gray-900 mb-4">로그인 오류</h1>
|
| 7 |
+
<p className="text-gray-600 mb-6">
|
| 8 |
+
Google 로그인 중 오류가 발생했습니다. 다시 시도해 주세요.
|
| 9 |
+
</p>
|
| 10 |
+
<a
|
| 11 |
+
href="/"
|
| 12 |
+
className="inline-block bg-blue-600 text-white px-6 py-3 rounded-lg hover:bg-blue-700 transition-colors"
|
| 13 |
+
>
|
| 14 |
+
홈으로 돌아가기
|
| 15 |
+
</a>
|
| 16 |
+
</div>
|
| 17 |
+
</div>
|
| 18 |
+
)
|
| 19 |
+
}
|
securecheck-pro/frontend/src/app/auth/callback/route.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { createClient } from '@/lib/supabase/server'
|
| 2 |
+
import { NextResponse } from 'next/server'
|
| 3 |
+
|
| 4 |
+
export async function GET(request: Request) {
|
| 5 |
+
const { searchParams, origin } = new URL(request.url)
|
| 6 |
+
const code = searchParams.get('code')
|
| 7 |
+
// if "next" is in param, use it as the redirect URL
|
| 8 |
+
const next = searchParams.get('next') ?? '/'
|
| 9 |
+
|
| 10 |
+
if (code) {
|
| 11 |
+
const supabase = await createClient()
|
| 12 |
+
const { error } = await supabase.auth.exchangeCodeForSession(code)
|
| 13 |
+
if (!error) {
|
| 14 |
+
const forwardedHost = request.headers.get('x-forwarded-host') // original origin before load balancer
|
| 15 |
+
const isLocalEnv = process.env.NODE_ENV === 'development'
|
| 16 |
+
if (isLocalEnv) {
|
| 17 |
+
// we can be sure that there is no load balancer in between, so no need to watch for X-Forwarded-Host
|
| 18 |
+
return NextResponse.redirect(`${origin}${next}`)
|
| 19 |
+
} else if (forwardedHost) {
|
| 20 |
+
return NextResponse.redirect(`https://${forwardedHost}${next}`)
|
| 21 |
+
} else {
|
| 22 |
+
return NextResponse.redirect(`${origin}${next}`)
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
// return the user to an error page with instructions
|
| 28 |
+
return NextResponse.redirect(`${origin}/auth/auth-code-error`)
|
| 29 |
+
}
|
securecheck-pro/frontend/src/app/page.tsx
CHANGED
|
@@ -1,9 +1,14 @@
|
|
| 1 |
import { SecurityAnalyzer } from '@/components/SecurityAnalyzer';
|
|
|
|
| 2 |
|
| 3 |
export default function Home() {
|
| 4 |
return (
|
| 5 |
<main className="min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100">
|
| 6 |
<div className="container mx-auto px-4 py-8">
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
<div className="text-center mb-12">
|
| 8 |
<h1 className="text-5xl font-bold text-gray-900 mb-4">
|
| 9 |
원클릭SSL
|
|
|
|
| 1 |
import { SecurityAnalyzer } from '@/components/SecurityAnalyzer';
|
| 2 |
+
import AuthButton from '@/components/AuthButton';
|
| 3 |
|
| 4 |
export default function Home() {
|
| 5 |
return (
|
| 6 |
<main className="min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100">
|
| 7 |
<div className="container mx-auto px-4 py-8">
|
| 8 |
+
<div className="flex justify-end mb-8">
|
| 9 |
+
<AuthButton />
|
| 10 |
+
</div>
|
| 11 |
+
|
| 12 |
<div className="text-center mb-12">
|
| 13 |
<h1 className="text-5xl font-bold text-gray-900 mb-4">
|
| 14 |
원클릭SSL
|
securecheck-pro/frontend/src/components/AuthButton.tsx
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use client'
|
| 2 |
+
|
| 3 |
+
import { createClient } from '@/lib/supabase/client'
|
| 4 |
+
import { type User } from '@supabase/supabase-js'
|
| 5 |
+
import { useRouter } from 'next/navigation'
|
| 6 |
+
import { useEffect, useState } from 'react'
|
| 7 |
+
|
| 8 |
+
export default function AuthButton() {
|
| 9 |
+
const [user, setUser] = useState<User | null>(null)
|
| 10 |
+
const [loading, setLoading] = useState(true)
|
| 11 |
+
const router = useRouter()
|
| 12 |
+
const supabase = createClient()
|
| 13 |
+
|
| 14 |
+
useEffect(() => {
|
| 15 |
+
const getUser = async () => {
|
| 16 |
+
const { data: { session } } = await supabase.auth.getSession()
|
| 17 |
+
setUser(session?.user ?? null)
|
| 18 |
+
setLoading(false)
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
getUser()
|
| 22 |
+
|
| 23 |
+
const {
|
| 24 |
+
data: { subscription },
|
| 25 |
+
} = supabase.auth.onAuthStateChange((_event, session) => {
|
| 26 |
+
setUser(session?.user ?? null)
|
| 27 |
+
setLoading(false)
|
| 28 |
+
})
|
| 29 |
+
|
| 30 |
+
return () => subscription.unsubscribe()
|
| 31 |
+
}, [supabase.auth])
|
| 32 |
+
|
| 33 |
+
const handleSignIn = async () => {
|
| 34 |
+
const { error } = await supabase.auth.signInWithOAuth({
|
| 35 |
+
provider: 'google',
|
| 36 |
+
options: {
|
| 37 |
+
redirectTo: `${window.location.origin}/auth/callback`,
|
| 38 |
+
},
|
| 39 |
+
})
|
| 40 |
+
if (error) {
|
| 41 |
+
console.error('Error signing in:', error.message)
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
const handleSignOut = async () => {
|
| 46 |
+
const { error } = await supabase.auth.signOut()
|
| 47 |
+
if (error) {
|
| 48 |
+
console.error('Error signing out:', error.message)
|
| 49 |
+
} else {
|
| 50 |
+
router.refresh()
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
if (loading) {
|
| 55 |
+
return (
|
| 56 |
+
<div className="flex items-center space-x-2">
|
| 57 |
+
<div className="w-8 h-8 border-2 border-blue-600 border-t-transparent rounded-full animate-spin"></div>
|
| 58 |
+
<span className="text-sm text-gray-600">로딩 중...</span>
|
| 59 |
+
</div>
|
| 60 |
+
)
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
if (user) {
|
| 64 |
+
return (
|
| 65 |
+
<div className="flex items-center space-x-4">
|
| 66 |
+
<div className="flex items-center space-x-2">
|
| 67 |
+
{user.user_metadata?.avatar_url && (
|
| 68 |
+
<img
|
| 69 |
+
src={user.user_metadata.avatar_url}
|
| 70 |
+
alt="Profile"
|
| 71 |
+
className="w-8 h-8 rounded-full"
|
| 72 |
+
/>
|
| 73 |
+
)}
|
| 74 |
+
<span className="text-sm font-medium text-gray-700">
|
| 75 |
+
{user.user_metadata?.full_name || user.email}
|
| 76 |
+
</span>
|
| 77 |
+
</div>
|
| 78 |
+
<button
|
| 79 |
+
onClick={handleSignOut}
|
| 80 |
+
className="px-4 py-2 text-sm text-gray-600 hover:text-gray-800 border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors"
|
| 81 |
+
>
|
| 82 |
+
로그아웃
|
| 83 |
+
</button>
|
| 84 |
+
</div>
|
| 85 |
+
)
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
return (
|
| 89 |
+
<button
|
| 90 |
+
onClick={handleSignIn}
|
| 91 |
+
className="flex items-center space-x-2 px-4 py-2 bg-white border border-gray-300 rounded-lg shadow-sm hover:shadow-md transition-all duration-200 text-gray-700 hover:text-gray-900"
|
| 92 |
+
>
|
| 93 |
+
<svg className="w-5 h-5" viewBox="0 0 24 24">
|
| 94 |
+
<path
|
| 95 |
+
fill="currentColor"
|
| 96 |
+
d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
| 97 |
+
/>
|
| 98 |
+
<path
|
| 99 |
+
fill="currentColor"
|
| 100 |
+
d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
| 101 |
+
/>
|
| 102 |
+
<path
|
| 103 |
+
fill="currentColor"
|
| 104 |
+
d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
|
| 105 |
+
/>
|
| 106 |
+
<path
|
| 107 |
+
fill="currentColor"
|
| 108 |
+
d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
|
| 109 |
+
/>
|
| 110 |
+
</svg>
|
| 111 |
+
<span className="text-sm font-medium">Google로 로그인</span>
|
| 112 |
+
</button>
|
| 113 |
+
)
|
| 114 |
+
}
|
securecheck-pro/frontend/src/lib/supabase/client.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { createBrowserClient } from '@supabase/ssr'
|
| 2 |
+
|
| 3 |
+
export function createClient() {
|
| 4 |
+
return createBrowserClient(
|
| 5 |
+
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
| 6 |
+
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
|
| 7 |
+
)
|
| 8 |
+
}
|
securecheck-pro/frontend/src/lib/supabase/server.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { createServerClient } from '@supabase/ssr'
|
| 2 |
+
import { cookies } from 'next/headers'
|
| 3 |
+
|
| 4 |
+
export async function createClient() {
|
| 5 |
+
const cookieStore = await cookies()
|
| 6 |
+
|
| 7 |
+
return createServerClient(
|
| 8 |
+
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
| 9 |
+
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
| 10 |
+
{
|
| 11 |
+
cookies: {
|
| 12 |
+
getAll() {
|
| 13 |
+
return cookieStore.getAll()
|
| 14 |
+
},
|
| 15 |
+
setAll(cookiesToSet) {
|
| 16 |
+
try {
|
| 17 |
+
cookiesToSet.forEach(({ name, value, options }) =>
|
| 18 |
+
cookieStore.set(name, value, options)
|
| 19 |
+
)
|
| 20 |
+
} catch {
|
| 21 |
+
// The `setAll` method was called from a Server Component.
|
| 22 |
+
// This can be ignored if you have middleware refreshing
|
| 23 |
+
// user sessions.
|
| 24 |
+
}
|
| 25 |
+
},
|
| 26 |
+
},
|
| 27 |
+
}
|
| 28 |
+
)
|
| 29 |
+
}
|
securecheck-pro/frontend/src/middleware.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { createServerClient } from '@supabase/ssr'
|
| 2 |
+
import { NextResponse, type NextRequest } from 'next/server'
|
| 3 |
+
|
| 4 |
+
export async function middleware(request: NextRequest) {
|
| 5 |
+
let supabaseResponse = NextResponse.next({
|
| 6 |
+
request,
|
| 7 |
+
})
|
| 8 |
+
|
| 9 |
+
const supabase = createServerClient(
|
| 10 |
+
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
| 11 |
+
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
| 12 |
+
{
|
| 13 |
+
cookies: {
|
| 14 |
+
getAll() {
|
| 15 |
+
return request.cookies.getAll()
|
| 16 |
+
},
|
| 17 |
+
setAll(cookiesToSet) {
|
| 18 |
+
cookiesToSet.forEach(({ name, value, options }) => request.cookies.set(name, value))
|
| 19 |
+
supabaseResponse = NextResponse.next({
|
| 20 |
+
request,
|
| 21 |
+
})
|
| 22 |
+
cookiesToSet.forEach(({ name, value, options }) =>
|
| 23 |
+
supabaseResponse.cookies.set(name, value, options)
|
| 24 |
+
)
|
| 25 |
+
},
|
| 26 |
+
},
|
| 27 |
+
}
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
// IMPORTANT: Avoid writing any logic between createServerClient and
|
| 31 |
+
// supabase.auth.getUser(). A simple mistake could make it very hard to debug
|
| 32 |
+
// issues with users being randomly logged out.
|
| 33 |
+
|
| 34 |
+
const {
|
| 35 |
+
data: { user },
|
| 36 |
+
} = await supabase.auth.getUser()
|
| 37 |
+
|
| 38 |
+
// if user is signed in and the current path is / redirect the user to /account
|
| 39 |
+
if (user && request.nextUrl.pathname === '/account') {
|
| 40 |
+
return NextResponse.redirect(new URL('/account', request.url))
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
// if user is not signed in and the current path is not / redirect the user to /
|
| 44 |
+
if (!user && request.nextUrl.pathname === '/account') {
|
| 45 |
+
return NextResponse.redirect(new URL('/', request.url))
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
// IMPORTANT: You *must* return the supabaseResponse object as it is. If you're
|
| 49 |
+
// creating a new response object with NextResponse.next() make sure to:
|
| 50 |
+
// 1. Pass the request in it, like so:
|
| 51 |
+
// const myNewResponse = NextResponse.next({ request })
|
| 52 |
+
// 2. Copy over the cookies, like so:
|
| 53 |
+
// myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())
|
| 54 |
+
// 3. Change the myNewResponse object instead of the supabaseResponse object
|
| 55 |
+
|
| 56 |
+
return supabaseResponse
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
export const config = {
|
| 60 |
+
matcher: [
|
| 61 |
+
/*
|
| 62 |
+
* Match all request paths except for the ones starting with:
|
| 63 |
+
* - _next/static (static files)
|
| 64 |
+
* - _next/image (image optimization files)
|
| 65 |
+
* - favicon.ico (favicon file)
|
| 66 |
+
* Feel free to modify this pattern to include more paths.
|
| 67 |
+
*/
|
| 68 |
+
'/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)',
|
| 69 |
+
],
|
| 70 |
+
}
|