Skip to content

Commit 3e2b678

Browse files
authored
feat: integrate SuperTokens authentication system (#440)
1 parent 9065c64 commit 3e2b678

File tree

145 files changed

+3215
-3165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+3215
-3165
lines changed

.env.sample

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@ CADDY_DATA_VOLUME=/etc/nixopus/caddy/data
2323
CADDY_CONFIG_VOLUME=/etc/nixopus/caddy/config
2424
DB_VOLUME=/etc/nixopus/db
2525
ALLOWED_ORIGIN=https://DOMAIN
26-
REDIS_URL=redis://localhost:6379
26+
SUPERTOKENS_API_KEY=NixopusSuperTokensAPIKey
27+
SUPERTOKENS_API_DOMAIN=http://localhost:3567
28+
SUPERTOKENS_WEBSITE_DOMAIN=http://localhost:3000
29+
SUPERTOKENS_CONNECTION_URI=http://localhost:3567

api/.env.sample

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ SSH_HOST=localhost
1717
SSH_PORT=22
1818
SSH_USER=<YOUR_SSH_USER_HERE>
1919

20-
# SSH Authentication - Use either SSH_PRIVATE_KEY (production/recommended) or SSH_PASSWORD (development)
20+
# SSH Authentication - Use either SSH_PRIVATE_KEY (production/recommended) or SSH_PASSWORD (development)
2121
# For production: Use SSH private key (more secure)
2222
SSH_PRIVATE_KEY=<YOUR_SSH_PRIVATE_KEY_PATH_HERE>
2323

@@ -41,3 +41,21 @@ ALLOWED_ORIGIN=http://localhost:3000
4141

4242
# Environment (development, staging, production)
4343
ENV=development
44+
45+
# SuperTokens API Key - Generate a secure random string for production
46+
SUPERTOKENS_API_KEY=NixopusSuperTokensAPIKey
47+
48+
# SuperTokens API Domain - Where your SuperTokens core is running
49+
# For development: http://localhost:3567
50+
# For production: https://your-supertokens-core-domain.com
51+
SUPERTOKENS_API_DOMAIN=http://localhost:3567
52+
53+
# SuperTokens Website Domain - Your frontend domain
54+
# For development: http://localhost:3000
55+
# For production: https://your-frontend-domain.com
56+
SUPERTOKENS_WEBSITE_DOMAIN=http://localhost:3000
57+
58+
# SuperTokens Connection URI - Same as API Domain for most setups
59+
# For development: http://localhost:3567
60+
# For production: https://your-supertokens-core-domain.com
61+
SUPERTOKENS_CONNECTION_URI=http://localhost:3567

api/doc/openapi.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

api/go.mod

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ require (
2424
github.com/slack-go/slack v0.16.0
2525
github.com/spf13/viper v1.21.0
2626
github.com/stretchr/testify v1.11.1
27+
github.com/supertokens/supertokens-golang v0.25.1
2728
github.com/uptrace/bun v1.2.14
2829
github.com/uptrace/bun/dbfixture v1.2.14
2930
github.com/uptrace/bun/dialect/pgdialect v1.2.14
@@ -52,6 +53,7 @@ require (
5253
github.com/Masterminds/goutils v1.1.1 // indirect
5354
github.com/Masterminds/semver/v3 v3.4.0 // indirect
5455
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
56+
github.com/MicahParks/keyfunc/v2 v2.1.0 // indirect
5557
github.com/Microsoft/go-winio v0.6.2 // indirect
5658
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
5759
github.com/araddon/dateparse v0.0.0-20200409225146-d820a6159ab1 // indirect
@@ -100,6 +102,7 @@ require (
100102
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
101103
github.com/gogo/protobuf v1.3.2 // indirect
102104
github.com/golang-jwt/jwt/v5 v5.2.2 // indirect
105+
github.com/golang/mock v1.6.0 // indirect
103106
github.com/golang/protobuf v1.5.4 // indirect
104107
github.com/golang/snappy v1.0.0 // indirect
105108
github.com/google/cel-go v0.26.0 // indirect
@@ -109,6 +112,7 @@ require (
109112
github.com/googleapis/gax-go/v2 v2.15.0 // indirect
110113
github.com/gookit/color v1.4.2 // indirect
111114
github.com/gorilla/schema v1.4.1 // indirect
115+
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
112116
github.com/hashicorp/golang-lru v0.5.4 // indirect
113117
github.com/huandu/xstrings v1.5.0 // indirect
114118
github.com/inconshreveable/mousetrap v1.1.0 // indirect
@@ -148,6 +152,7 @@ require (
148152
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
149153
github.com/morikuni/aec v1.0.0 // indirect
150154
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
155+
github.com/nyaruka/phonenumbers v1.0.73 // indirect
151156
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 // indirect
152157
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 // indirect
153158
github.com/onsi/gomega v1.37.0 // indirect
@@ -193,6 +198,7 @@ require (
193198
github.com/tklauser/go-sysconf v0.3.12 // indirect
194199
github.com/tklauser/numcpus v0.6.1 // indirect
195200
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
201+
github.com/twilio/twilio-go v0.26.0 // indirect
196202
github.com/urfave/cli v1.22.17 // indirect
197203
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
198204
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
@@ -230,6 +236,9 @@ require (
230236
google.golang.org/grpc v1.75.0 // indirect
231237
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 // indirect
232238
google.golang.org/protobuf v1.36.9 // indirect
239+
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
240+
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df // indirect
241+
gopkg.in/h2non/gock.v1 v1.1.2 // indirect
233242
gotest.tools/v3 v3.5.2 // indirect
234243
howett.net/plist v1.0.1 // indirect
235244
)

api/go.sum

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1
5252
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
5353
github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs=
5454
github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0=
55+
github.com/MicahParks/keyfunc/v2 v2.1.0 h1:6ZXKb9Rp6qp1bDbJefnG7cTH8yMN1IC/4nf+GVjO99k=
56+
github.com/MicahParks/keyfunc/v2 v2.1.0/go.mod h1:rW42fi+xgLJ2FRRXAfNx9ZA8WpD4OeE/yHVMteCkw9k=
5557
github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE=
5658
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
5759
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
@@ -146,13 +148,16 @@ github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwc
146148
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
147149
github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo=
148150
github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
151+
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
149152
github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
150153
github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
151154
github.com/dave/jennifer v1.4.1/go.mod h1:7jEdnm+qBcxl8PC0zyp7vxcpSRnzXSt9r39tpTVGlwA=
152155
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
153156
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
154157
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
155158
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
159+
github.com/derekstavis/go-qs v0.0.0-20180720192143-9eef69e6c4e7 h1:zmAiXR9h1TCVN/0yCMRYQNE91dNRORpSzMFiqfTTPOs=
160+
github.com/derekstavis/go-qs v0.0.0-20180720192143-9eef69e6c4e7/go.mod h1:Vgz4nKcG6+B7QcALsWZpmhyQTLSl7nwFGKSrbq2LxEo=
156161
github.com/dgraph-io/badger v1.6.2 h1:mNw0qs90GVgGGWylh0umH5iag1j6n/PeJtNvL6KY/x8=
157162
github.com/dgraph-io/badger v1.6.2/go.mod h1:JW2yswe3V058sS0kZ2h/AXeDSqFjxnZcRrVH//y2UQE=
158163
github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o=
@@ -246,8 +251,11 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfU
246251
github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E=
247252
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
248253
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
254+
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
255+
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
249256
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
250257
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
258+
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
251259
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
252260
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
253261
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
@@ -316,6 +324,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.5.0 h1:WcmKMm43DR7RdtlkEXQJyo5ws8iTp98
316324
github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
317325
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww=
318326
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90=
327+
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
328+
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
319329
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
320330
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
321331
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
@@ -444,12 +454,16 @@ github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
444454
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
445455
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
446456
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
457+
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4=
458+
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
447459
github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=
448460
github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
449461
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
450462
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
451463
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
452464
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
465+
github.com/nyaruka/phonenumbers v1.0.73 h1:bP2WN8/NUP8tQebR+WCIejFaibwYMHOaB7MQVayclUo=
466+
github.com/nyaruka/phonenumbers v1.0.73/go.mod h1:3aiS+PS3DuYwkbK3xdcmRwMiPNECZ0oENH8qUT1lY7Q=
453467
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 h1:G7ERwszslrBzRxj//JalHPu/3yz+De2J+4aLtSRlHiY=
454468
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037/go.mod h1:2bpvgLBZEtENV5scfDFEtB/5+1M4hkQhDQrccEJ/qGw=
455469
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 h1:bQx3WeLcUWy+RletIKwUIt4x3t8n2SxavmoclizMb8c=
@@ -510,8 +524,6 @@ github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
510524
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
511525
github.com/quic-go/quic-go v0.54.0 h1:6s1YB9QotYI6Ospeiguknbp2Znb/jZYjZLRXn9kMQBg=
512526
github.com/quic-go/quic-go v0.54.0/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY=
513-
github.com/raghavyuva/caddygo v0.0.0-20250820132249-3db4bc273996 h1:vtCThL1ADhVV0f35qi9K3BnWCU34DGD8AS3TaP4ovjY=
514-
github.com/raghavyuva/caddygo v0.0.0-20250820132249-3db4bc273996/go.mod h1:nXAW//4ImRs0bC/UHcqsdYpif2YCvgFdxUAHE7JqdCc=
515527
github.com/raghavyuva/caddygo v0.0.0-20250919125030-03449d9e9252 h1:PCJiDfujvCXaHlhauvRo1aNEfbgAqfkbDBUsXa/TriU=
516528
github.com/raghavyuva/caddygo v0.0.0-20250919125030-03449d9e9252/go.mod h1:nXAW//4ImRs0bC/UHcqsdYpif2YCvgFdxUAHE7JqdCc=
517529
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
@@ -629,6 +641,8 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
629641
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
630642
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
631643
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
644+
github.com/supertokens/supertokens-golang v0.25.1 h1:97srN1Ucq+ArJ9mkBl+P4n5/LBn2uly1hmeUyP6Q0S8=
645+
github.com/supertokens/supertokens-golang v0.25.1/go.mod h1:/n6zQ9461RscnnWB4Y4bWwzhPivnj8w79j/doqkLOs8=
632646
github.com/tailscale/tscert v0.0.0-20240608151842-d3f834017e53 h1:uxMgm0C+EjytfAqyfBG55ZONKQ7mvd7x4YYCWsf8QHQ=
633647
github.com/tailscale/tscert v0.0.0-20240608151842-d3f834017e53/go.mod h1:kNGUQ3VESx3VZwRwA9MSCUegIl6+saPL8Noq82ozCaU=
634648
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
@@ -644,6 +658,8 @@ github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYm
644658
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
645659
github.com/traefik/yaegi v0.9.8/go.mod h1:FAYnRlZyuVlEkvnkHq3bvJ1lW5be6XuwgLdkYgYG6Lk=
646660
github.com/traefik/yaegi v0.9.10/go.mod h1:FAYnRlZyuVlEkvnkHq3bvJ1lW5be6XuwgLdkYgYG6Lk=
661+
github.com/twilio/twilio-go v0.26.0 h1:wFW4oTe3/LKt6bvByP7eio8JsjtaLHjMQKOUEzQry7U=
662+
github.com/twilio/twilio-go v0.26.0/go.mod h1:lz62Hopu4vicpQ056H5TJ0JE4AP0rS3sQ35/ejmgOwE=
647663
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
648664
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
649665
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
@@ -896,6 +912,7 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
896912
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
897913
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
898914
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
915+
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
899916
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
900917
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
901918
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
@@ -949,13 +966,19 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
949966
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
950967
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw=
951968
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
969+
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk=
970+
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
952971
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
953972
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
954973
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
955974
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
956975
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
957976
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
958977
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
978+
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE=
979+
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw=
980+
gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY=
981+
gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0=
959982
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
960983
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
961984
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=

api/internal/config/config.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ func setupEnvVarMappings() {
185185
viper.BindEnv("app.environment", "ENV")
186186
viper.BindEnv("app.version", "APP_VERSION")
187187
viper.BindEnv("app.logs_path", "LOGS_PATH")
188+
189+
// SuperTokens
190+
viper.BindEnv("supertokens.api_key", "SUPERTOKENS_API_KEY")
191+
viper.BindEnv("supertokens.api_domain", "SUPERTOKENS_API_DOMAIN")
192+
viper.BindEnv("supertokens.website_domain", "SUPERTOKENS_WEBSITE_DOMAIN")
193+
viper.BindEnv("supertokens.connection_uri", "SUPERTOKENS_CONNECTION_URI")
188194
}
189195

190196
func validateConfig(config types.Config) error {
@@ -232,6 +238,18 @@ func validateConfig(config types.Config) error {
232238
if config.CORS.AllowedOrigin == "" {
233239
errors = append(errors, "CORS allowed origin is required")
234240
}
241+
if config.Supertokens.APIKey == "" {
242+
errors = append(errors, "SuperTokens API key is required")
243+
}
244+
if config.Supertokens.APIDomain == "" {
245+
errors = append(errors, "SuperTokens API domain is required")
246+
}
247+
if config.Supertokens.WebsiteDomain == "" {
248+
errors = append(errors, "SuperTokens website domain is required")
249+
}
250+
if config.Supertokens.ConnectionURI == "" {
251+
errors = append(errors, "SuperTokens connection URI is required")
252+
}
235253

236254
if len(errors) > 0 {
237255
return fmt.Errorf("configuration validation failed: %v", errors)

api/internal/features/auth/controller/reset_password.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -61,29 +61,3 @@ func (c *AuthController) ResetPassword(s fuego.ContextWithBody[types.ResetPasswo
6161
Data: nil,
6262
}, nil
6363
}
64-
65-
func (c *AuthController) GeneratePasswordResetLink(s fuego.ContextNoBody) (shared_types.Response, error) {
66-
w, r := s.Response(), s.Request()
67-
user := utils.GetUser(w, r)
68-
if user == nil {
69-
return shared_types.Response{}, fuego.HTTPError{
70-
Err: nil,
71-
Status: http.StatusUnauthorized,
72-
}
73-
}
74-
user, token, err := c.service.GeneratePasswordResetLink(user)
75-
if err != nil {
76-
return shared_types.Response{}, fuego.HTTPError{
77-
Err: err,
78-
Status: http.StatusInternalServerError,
79-
}
80-
}
81-
82-
c.NotifyPasswordReset(user, token, r)
83-
84-
return shared_types.Response{
85-
Status: "success",
86-
Message: "Password reset link sent",
87-
Data: nil,
88-
}, nil
89-
}

api/internal/features/auth/service/init.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,26 @@ import (
77
"github.com/raghavyuva/nixopus-api/internal/features/auth/types"
88
"github.com/raghavyuva/nixopus-api/internal/features/logger"
99
organization_service "github.com/raghavyuva/nixopus-api/internal/features/organization/service"
10-
permissions_service "github.com/raghavyuva/nixopus-api/internal/features/permission/service"
11-
role_service "github.com/raghavyuva/nixopus-api/internal/features/role/service"
1210
shared_types "github.com/raghavyuva/nixopus-api/internal/types"
1311
)
1412

1513
type AuthService struct {
1614
storage storage.AuthRepository
1715
Ctx context.Context
1816
logger logger.Logger
19-
permissions_service *permissions_service.PermissionService
20-
role_service *role_service.RoleService
2117
organization_service *organization_service.OrganizationService
2218
}
2319

2420
func NewAuthService(
2521
storage storage.AuthRepository,
2622
logger logger.Logger,
27-
permissionService *permissions_service.PermissionService,
28-
roleService *role_service.RoleService,
2923
orgService *organization_service.OrganizationService,
3024
ctx context.Context,
3125
) *AuthService {
3226
return &AuthService{
3327
storage: storage,
3428
logger: logger,
3529
Ctx: ctx,
36-
permissions_service: permissionService,
37-
role_service: roleService,
3830
organization_service: orgService,
3931
}
4032
}

0 commit comments

Comments
 (0)