diff --git a/.make-lint-expect b/.make-lint-expect index 2c08312c1e..6ebe8701d0 100644 --- a/.make-lint-expect +++ b/.make-lint-expect @@ -6,8 +6,6 @@ pkg/api/apierrors/tags.go cannot import github.com/authgear/authgear-server/pkg/ pkg/api/event/blocking/util.go cannot import github.com/authgear/authgear-server/pkg/util/accesscontrol pkg/api/event/event.go cannot import github.com/authgear/authgear-server/pkg/util/accesscontrol pkg/api/event/hook_response.go cannot import github.com/authgear/authgear-server/pkg/util/validation -pkg/api/model/siwe.go cannot import github.com/authgear/authgear-server/pkg/util/web3 -pkg/api/model/web3.go cannot import github.com/authgear/authgear-server/pkg/util/web3 exit status 1 pkg/lib/deps/deps_common.go cannot import github.com/authgear/authgear-server/pkg/auth/handler/webapp/authflowv2 diff --git a/.vettedpositions b/.vettedpositions index 69329285c2..88cb827f01 100644 --- a/.vettedpositions +++ b/.vettedpositions @@ -36,7 +36,6 @@ /pkg/auth/handler/saml/login.go:296:3: requestcontext /pkg/auth/handler/saml/login_finish.go:41:9: requestcontext /pkg/auth/handler/saml/logout.go:86:9: requestcontext -/pkg/auth/handler/siwe/nonce.go:46:38: requestcontext /pkg/auth/handler/webapp/account_status.go:48:27: requestcontext /pkg/auth/handler/webapp/auth_entry_point_middleware.go:31:31: requestcontext /pkg/auth/handler/webapp/auth_entry_point_middleware.go:32:35: requestcontext @@ -172,7 +171,6 @@ /pkg/auth/handler/webapp/login.go:115:28: requestcontext /pkg/auth/handler/webapp/login_link_otp.go:121:27: requestcontext /pkg/auth/handler/webapp/logout.go:71:27: requestcontext -/pkg/auth/handler/webapp/missing_web3_wallet.go:78:27: requestcontext /pkg/auth/handler/webapp/panic_middleware.go:68:61: requestcontext /pkg/auth/handler/webapp/passkey_creation_options.go:43:28: requestcontext /pkg/auth/handler/webapp/passkey_request_options.go:52:28: requestcontext diff --git a/authui/README.md b/authui/README.md index 2e03e36e78..c975b89291 100644 --- a/authui/README.md +++ b/authui/README.md @@ -10,10 +10,7 @@ make generate-material-icons After that, commit the changes in `scripts/python/material-icons.txt`, `authui/src/authflowv2/icons/material-symbols-outlined-subset.ttf` and `authui/src/authflowv2/icons/material-symbols-outlined-subset.woff2`. -### @metamask/jazzicon +### ./tarballs/ -In oursky/authgear-server, the connection to the URL `https://codeload.github.com/MetaMask/jazzicon/tar.gz/4fe23bbbe5088e128cb24082972e28d87e76d156` fails very often. -Therefore, we download the tarball, and use it directly. -We also updated to the latest commit. -See https://github.com/MetaMask/jazzicon/compare/d923914fda6a8795f74c2e66134f73cd72070667..4fe23bbbe5088e128cb24082972e28d87e76d156 for the changes. -The changes DO NOT cover runtime behavior changes, so it is safe to upgrade. +As a workaround, we can put tarballs in ./tarballs to install dependency from a tarball. +This usage is not encouraged. diff --git a/authui/package-lock.json b/authui/package-lock.json index ffd19215d3..bae2923980 100644 --- a/authui/package-lock.json +++ b/authui/package-lock.json @@ -12,18 +12,14 @@ "@floating-ui/dom": "1.5.4", "@hotwired/stimulus": "3.2.2", "@hotwired/turbo": "7.3.0", - "@metamask/detect-provider": "2.0.0", - "@metamask/jazzicon": "file:tarballs/jazzicon-4fe23bbbe5088e128cb24082972e28d87e76d156.tar.gz", "@sentry/browser": "^8.33.1", "@tabler/icons": "1.107.0", "axios": "1.7.4", "cldr-localenames-full": "44.1.0", "cropperjs": "1.6.1", - "ethers": "6.13.2", "intl-tel-input": "18.5.3", "libphonenumber-js": "1.10.53", "luxon": "3.4.4", - "siwe": "2.3.2", "zxcvbn": "4.4.2" }, "devDependencies": { @@ -50,11 +46,6 @@ "vite": "^5.4.6" } }, - "node_modules/@adraffy/ens-normalize": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", - "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==" - }, "node_modules/@alloc/quick-lru": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", @@ -3352,26 +3343,6 @@ "integrity": "sha512-FNYbYIA8WEff/+A8iMGstZhArpgy5ZxZ9uQRsBQ+qXsiKTYn3WjxpCmJRw3CFUOqFlQSZDkC3v1y3BijRnE1Pg==", "dev": true }, - "node_modules/@metamask/detect-provider": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@metamask/detect-provider/-/detect-provider-2.0.0.tgz", - "integrity": "sha512-sFpN+TX13E9fdBDh9lvQeZdJn4qYoRb/6QF2oZZK/Pn559IhCFacPMU1rMuqyXoFQF3JSJfii2l98B87QDPeCQ==", - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@metamask/jazzicon": { - "version": "2.0.0", - "resolved": "file:tarballs/jazzicon-4fe23bbbe5088e128cb24082972e28d87e76d156.tar.gz", - "integrity": "sha512-MRAS16noz1VASRr3rwPTVXZzlnQhijR01Ty2PQtzkCr32p0vo6x4doEW/IjnjThK/l3tGuBycZS9PHqkMxVTeQ==", - "license": "ISC", - "dependencies": { - "mersenne-twister": "^1.1.0" - }, - "engines": { - "node": "^18.16 || >=20" - } - }, "node_modules/@microsoft/tsdoc": { "version": "0.15.0", "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.15.0.tgz", @@ -3460,28 +3431,6 @@ "node": ">=4.0" } }, - "node_modules/@noble/curves": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", - "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", - "dependencies": { - "@noble/hashes": "1.3.2" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@noble/hashes": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", - "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -4008,44 +3957,6 @@ "@sinonjs/commons": "^3.0.0" } }, - "node_modules/@spruceid/siwe-parser": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@spruceid/siwe-parser/-/siwe-parser-2.1.2.tgz", - "integrity": "sha512-d/r3S1LwJyMaRAKQ0awmo9whfXeE88Qt00vRj91q5uv5ATtWIQEGJ67Yr5eSZw5zp1/fZCXZYuEckt8lSkereQ==", - "dependencies": { - "@noble/hashes": "^1.1.2", - "apg-js": "^4.3.0", - "uri-js": "^4.4.1", - "valid-url": "^1.0.9" - } - }, - "node_modules/@stablelib/binary": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/binary/-/binary-1.0.1.tgz", - "integrity": "sha512-ClJWvmL6UBM/wjkvv/7m5VP3GMr9t0osr4yVgLZsLCOz4hGN9gIAFEqnJ0TsSMAN+n840nf2cHZnA5/KFqHC7Q==", - "dependencies": { - "@stablelib/int": "^1.0.1" - } - }, - "node_modules/@stablelib/int": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/int/-/int-1.0.1.tgz", - "integrity": "sha512-byr69X/sDtDiIjIV6m4roLVWnNNlRGzsvxw+agj8CIEazqWGOQp2dTYgQhtyVXV9wpO6WyXRQUzLV/JRNumT2w==" - }, - "node_modules/@stablelib/random": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@stablelib/random/-/random-1.0.2.tgz", - "integrity": "sha512-rIsE83Xpb7clHPVRlBj8qNe5L8ISQOzjghYQm/dZ7VaM2KHYwMW5adjQjrzTZCchFnNCNhkwtnOBa9HTMJCI8w==", - "dependencies": { - "@stablelib/binary": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, - "node_modules/@stablelib/wipe": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/wipe/-/wipe-1.0.1.tgz", - "integrity": "sha512-WfqfX/eXGiAd3RJe4VU2snh/ZPwtSjLG4ynQ/vYzvghTh7dHFcI1wl+nrkWG6lGhukOxOsUHfv8dUXr58D0ayg==" - }, "node_modules/@tabler/icons": { "version": "1.107.0", "resolved": "https://registry.npmjs.org/@tabler/icons/-/icons-1.107.0.tgz", @@ -4752,11 +4663,6 @@ "node": ">=0.4.0" } }, - "node_modules/aes-js": { - "version": "4.0.0-beta.5", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", - "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" - }, "node_modules/agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", @@ -4855,11 +4761,6 @@ "node": ">= 8" } }, - "node_modules/apg-js": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/apg-js/-/apg-js-4.4.0.tgz", - "integrity": "sha512-fefmXFknJmtgtNEXfPwZKYkMFX4Fyeyz+fNF6JWp87biGOPslJbCBVU158zvKRZfHBKnJDy8CMM40oLFGkXT8Q==" - }, "node_modules/arg": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", @@ -7117,38 +7018,6 @@ "node": ">=0.10.0" } }, - "node_modules/ethers": { - "version": "6.13.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.13.2.tgz", - "integrity": "sha512-9VkriTTed+/27BGuY1s0hf441kqwHJ1wtN2edksEtiRvXx+soxRX3iSXTfFqq2+YwrOqbDoTHjIhQnjJRlzKmg==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/ethers-io/" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@adraffy/ens-normalize": "1.10.1", - "@noble/curves": "1.2.0", - "@noble/hashes": "1.3.2", - "@types/node": "18.15.13", - "aes-js": "4.0.0-beta.5", - "tslib": "2.4.0", - "ws": "8.17.1" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/ethers/node_modules/@types/node": { - "version": "18.15.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", - "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==" - }, "node_modules/execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -9507,11 +9376,6 @@ "node": ">= 8" } }, - "node_modules/mersenne-twister": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mersenne-twister/-/mersenne-twister-1.1.0.tgz", - "integrity": "sha512-mUYWsMKNrm4lfygPkL3OfGzOPTR2DBlTkBNHM//F6hGp8cLThY897crAlk3/Jo17LEOOjQUrNAx6DvgO77QJkA==" - }, "node_modules/micromatch": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", @@ -10436,6 +10300,7 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, "engines": { "node": ">=6" } @@ -10988,20 +10853,6 @@ "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", "dev": true }, - "node_modules/siwe": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/siwe/-/siwe-2.3.2.tgz", - "integrity": "sha512-aSf+6+Latyttbj5nMu6GF3doMfv2UYj83hhwZgUF20ky6fTS83uVhkQABdIVnEuS8y1bBdk7p6ltb9SmlhTTlA==", - "dependencies": { - "@spruceid/siwe-parser": "^2.1.2", - "@stablelib/random": "^1.0.1", - "uri-js": "^4.4.1", - "valid-url": "^1.0.9" - }, - "peerDependencies": { - "ethers": "^5.6.8 || ^6.0.8" - } - }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -11961,11 +11812,6 @@ "node": ">=4" } }, - "node_modules/tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" - }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -12406,6 +12252,7 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, "dependencies": { "punycode": "^2.1.0" } @@ -12440,11 +12287,6 @@ "node": ">=10.12.0" } }, - "node_modules/valid-url": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/valid-url/-/valid-url-1.0.9.tgz", - "integrity": "sha512-QQDsV8OnSf5Uc30CKSwG9lnhMPe6exHtTXLRYX8uMwKENy640pU+2BgBL0LRbDh/eYRahNCS7aewCx0wf3NYVA==" - }, "node_modules/vite": { "version": "5.4.6", "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.6.tgz", @@ -12812,26 +12654,6 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, - "node_modules/ws": { - "version": "7.5.10", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", - "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/xml-name-validator": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", diff --git a/authui/package.json b/authui/package.json index fb49e65e00..4a70502d4a 100644 --- a/authui/package.json +++ b/authui/package.json @@ -25,10 +25,7 @@ "process": false }, "overrides": { - "caniuse-lite": "1.0.30001653", - "ethers": { - "ws": "^7.5.10" - } + "caniuse-lite": "1.0.30001653" }, "devDependencies": { "@jest/globals": "29.7.0", @@ -57,18 +54,14 @@ "@floating-ui/dom": "1.5.4", "@hotwired/stimulus": "3.2.2", "@hotwired/turbo": "7.3.0", - "@metamask/detect-provider": "2.0.0", - "@metamask/jazzicon": "file:tarballs/jazzicon-4fe23bbbe5088e128cb24082972e28d87e76d156.tar.gz", "@sentry/browser": "^8.33.1", "@tabler/icons": "1.107.0", "axios": "1.7.4", "cldr-localenames-full": "44.1.0", "cropperjs": "1.6.1", - "ethers": "6.13.2", "intl-tel-input": "18.5.3", "libphonenumber-js": "1.10.53", "luxon": "3.4.4", - "siwe": "2.3.2", "zxcvbn": "4.4.2" } } diff --git a/authui/src/authgear.ts b/authui/src/authgear.ts index ddcd0d1fb6..459fb172e1 100644 --- a/authui/src/authgear.ts +++ b/authui/src/authgear.ts @@ -41,7 +41,6 @@ import { PasskeyAutofillController, AuthflowPasskeyErrorController, } from "./passkey"; -import { WalletConfirmationController, WalletIconController } from "./web3"; import { init as SentryInit, browserTracingIntegration } from "@sentry/browser"; import { LockoutController } from "./lockout"; import { MirrorButtonController } from "./mirrorbutton"; @@ -118,9 +117,6 @@ Stimulus.register( ); Stimulus.register("authflow-passkey-error", AuthflowPasskeyErrorController); -Stimulus.register("web3-wallet-confirmation", WalletConfirmationController); -Stimulus.register("web3-wallet-icon", WalletIconController); - Stimulus.register("lockout", LockoutController); Stimulus.register("mirror-button", MirrorButtonController); diff --git a/authui/src/web3.ts b/authui/src/web3.ts deleted file mode 100644 index 1310062762..0000000000 --- a/authui/src/web3.ts +++ /dev/null @@ -1,279 +0,0 @@ -import { Controller } from "@hotwired/stimulus"; -import { handleAxiosError, showErrorMessage } from "./messageBar"; -import jazzicon from "@metamask/jazzicon"; -import axios from "axios"; -import { SiweMessage } from "siwe"; -import detectEthereumProvider from "@metamask/detect-provider"; -import { BrowserProvider, Eip1193Provider } from "ethers"; -import { localVisit } from "./turbo"; - -enum WalletProvider { - MetaMask = "metamask", -} - -interface SIWENonce { - nonce: string; - expireAt: Date; -} - -interface MetaMaskEthereumProvider { - isMetaMask?: boolean; - once(eventName: string | symbol, listener: (...args: any[]) => void): this; - on(eventName: string | symbol, listener: (...args: any[]) => void): this; - off(eventName: string | symbol, listener: (...args: any[]) => void): this; - addListener( - eventName: string | symbol, - listener: (...args: any[]) => void - ): this; - removeListener( - eventName: string | symbol, - listener: (...args: any[]) => void - ): this; - removeAllListeners(event?: string | symbol): this; -} - -function deserializeNonceResponse(data: any): SIWENonce { - return { - nonce: data.nonce, - expireAt: new Date(data.expire_at), - }; -} - -function createSIWEMessage( - address: string, - chainId: number, - nonce: string, - expiry: string -): string { - const message = new SiweMessage({ - domain: window.location.host, - address, - uri: window.location.origin, - version: "1", - chainId, - nonce, - expirationTime: expiry, - }); - - return message.prepareMessage(); -} - -function truncateAddress(address: string): string { - return address.slice(0, 6) + "..." + address.slice(address.length - 4); -} - -interface GetProviderResult { - browserProvider: BrowserProvider; - ethereum: MetaMaskEthereumProvider; -} - -async function getProvider(type: string): Promise { - const ethereum = await detectEthereumProvider({ - mustBeMetaMask: type === WalletProvider.MetaMask, - }); - - if (ethereum != null) { - return { - ethereum, - // @ts-expect-error - browserProvider: new BrowserProvider(ethereum as Eip1193Provider), - }; - } - - return null; -} - -interface MetaMaskError { - code: number; - message: string; -} -function isMetaMaskError(err: unknown): err is MetaMaskError { - return ( - typeof err === "object" && err !== null && "code" in err && "message" in err - ); -} -function parseWalletError(err: unknown): string | null { - if (isMetaMaskError(err)) { - switch (err.code) { - // User rejection, no need to show error message - case 4001: - return null; - // Unauthorized - case 4100: - return "error-message-metamask-unauthorized"; - // Request method not supported - case 4200: - return "error-message-metamask-unsupported-method"; - // Disconnected from chains - case 4900: - case 4901: - return "error-message-metamask-disconnected"; - default: - return "error-message-failed-to-connect-wallet"; - } - } - return "error-message-failed-to-connect-wallet"; -} - -function handleError(err: unknown) { - console.error(err); - - const parsedErrorId = parseWalletError(err); - - if (parsedErrorId) { - showErrorMessage(parsedErrorId); - } - return; -} -export class WalletIconController extends Controller { - static targets = ["iconContainer"]; - static values = { - address: String, - size: Number, - }; - - declare iconContainerTarget: HTMLDivElement; - - declare sizeValue: number; - declare addressValue: string; - - generateIcon(): SVGElement | null { - // Metamask uses 8 characters from the address as seed - const addr = this.addressValue.slice(2, 10); - const seed = parseInt(addr, 16); - - const icon = jazzicon(this.sizeValue, seed); - - const child = icon.firstChild; - if (child instanceof SVGElement) { - child.style.borderRadius = "50%"; - return child; - } - - return null; - } - - sizeValueChanged() { - this.renderIcon(); - } - - addressValueChanged() { - this.renderIcon(); - } - - onAddressUpdate({ detail: { address } }: { detail: { address: string } }) { - this.addressValue = address; - } - - renderIcon() { - const icon = this.generateIcon(); - - if (icon) { - // Clear previous icons if exists - this.iconContainerTarget.innerHTML = ""; - this.iconContainerTarget.appendChild(icon); - } - } -} - -export class WalletConfirmationController extends Controller { - static targets = ["button", "displayed", "message", "signature", "submit"]; - static values = { - provider: String, - }; - - declare buttonTarget: HTMLButtonElement; - declare displayedTarget: HTMLSpanElement; - declare messageTarget: HTMLInputElement; - declare signatureTarget: HTMLInputElement; - declare submitTarget: HTMLButtonElement; - - declare providerValue: string; - declare _provider: BrowserProvider | null; - declare _ethereum: MetaMaskEthereumProvider | null; - - connect() { - getProvider(this.providerValue) - .then((result) => { - if (result == null) { - const searchParams = new URLSearchParams(); - searchParams.set("q_provider", this.providerValue); - localVisit("/errors/missing_web3_wallet", searchParams); - return; - } - this._provider = result.browserProvider; - this._ethereum = result.ethereum; - this._ethereum.on("accountsChanged", this.onAccountChanged); - this._getAccount(); - }) - .catch((err) => { - handleError(err); - }); - } - - disconnect() { - this._ethereum?.off("accountsChanged", this.onAccountChanged); - this._ethereum = null; - this._provider = null; - } - - onAccountChanged = () => { - this._getAccount(); - }; - - async _getAccount() { - if (!this._provider) { - return; - } - this.displayedTarget.textContent = "-"; - - await this._provider.send("eth_requestAccounts", []); - - // Get account from the signer to ensure the requested account is the correct one - const signer = await this._provider.getSigner(); - const account = await signer.getAddress(); - - this.displayedTarget.textContent = truncateAddress(account); - - this.dispatch("addressUpdate", { detail: { address: account } }); - } - - async performSIWE() { - if (!this._provider) { - return; - } - - // Ensure at least one account is connected if user has rejected the initial request - await this._getAccount(); - - try { - const nonceResp = await axios("/_internals/siwe/nonce", { - method: "get", - }); - - const nonce = deserializeNonceResponse(nonceResp.data.result); - - const signer = await this._provider.getSigner(); - const network = await this._provider.getNetwork(); - - const address = await signer.getAddress(); - const chainId = Number(network.chainId); - - const siweMessage = createSIWEMessage( - address, - chainId, - nonce.nonce, - nonce.expireAt.toISOString() - ); - - const signature = await signer.signMessage(siweMessage); - - this.messageTarget.value = siweMessage; - this.signatureTarget.value = signature; - - this.submitTarget.click(); - } catch (e: unknown) { - handleAxiosError(e); - } - } -} diff --git a/authui/tarballs/.gitkeep b/authui/tarballs/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/authui/tarballs/jazzicon-4fe23bbbe5088e128cb24082972e28d87e76d156.tar.gz b/authui/tarballs/jazzicon-4fe23bbbe5088e128cb24082972e28d87e76d156.tar.gz deleted file mode 100644 index 0b44d79658..0000000000 Binary files a/authui/tarballs/jazzicon-4fe23bbbe5088e128cb24082972e28d87e76d156.tar.gz and /dev/null differ diff --git a/cmd/authgear/background/wire_gen.go b/cmd/authgear/background/wire_gen.go index 903b7cafc4..3280665a5c 100644 --- a/cmd/authgear/background/wire_gen.go +++ b/cmd/authgear/background/wire_gen.go @@ -38,10 +38,8 @@ import ( "github.com/authgear/authgear-server/pkg/lib/feature/customattrs" "github.com/authgear/authgear-server/pkg/lib/feature/forgotpassword" passkey2 "github.com/authgear/authgear-server/pkg/lib/feature/passkey" - siwe2 "github.com/authgear/authgear-server/pkg/lib/feature/siwe" stdattrs2 "github.com/authgear/authgear-server/pkg/lib/feature/stdattrs" "github.com/authgear/authgear-server/pkg/lib/feature/verification" - "github.com/authgear/authgear-server/pkg/lib/feature/web3" "github.com/authgear/authgear-server/pkg/lib/hook" "github.com/authgear/authgear-server/pkg/lib/infra/db/appdb" "github.com/authgear/authgear-server/pkg/lib/infra/db/auditdb" @@ -304,36 +302,9 @@ func newUserService(p *deps.BackgroundProvider, appID string, appContext *config SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: configAppID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: configAppID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -441,6 +412,15 @@ func newUserService(p *deps.BackgroundProvider, appID string, appContext *config Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: configAppID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: configAppID, @@ -515,13 +495,6 @@ func newUserService(p *deps.BackgroundProvider, appID string, appContext *config UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -538,7 +511,6 @@ func newUserService(p *deps.BackgroundProvider, appID string, appContext *config Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -661,7 +633,6 @@ func newUserService(p *deps.BackgroundProvider, appID string, appContext *config UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -773,8 +744,8 @@ func newUserService(p *deps.BackgroundProvider, appID string, appContext *config AppID: configAppID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -824,7 +795,7 @@ func newUserService(p *deps.BackgroundProvider, appID string, appContext *config SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: configAppID, Clock: clockClock, @@ -835,7 +806,7 @@ func newUserService(p *deps.BackgroundProvider, appID string, appContext *config cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -875,7 +846,7 @@ func newUserService(p *deps.BackgroundProvider, appID string, appContext *config UserAgentString: userAgentString, AppID: configAppID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, diff --git a/cmd/authgear/elasticsearch/wire_gen.go b/cmd/authgear/elasticsearch/wire_gen.go index 383fff13d8..67946e8c56 100644 --- a/cmd/authgear/elasticsearch/wire_gen.go +++ b/cmd/authgear/elasticsearch/wire_gen.go @@ -27,10 +27,8 @@ import ( "github.com/authgear/authgear-server/pkg/lib/deps" "github.com/authgear/authgear-server/pkg/lib/feature/customattrs" passkey2 "github.com/authgear/authgear-server/pkg/lib/feature/passkey" - siwe2 "github.com/authgear/authgear-server/pkg/lib/feature/siwe" stdattrs2 "github.com/authgear/authgear-server/pkg/lib/feature/stdattrs" "github.com/authgear/authgear-server/pkg/lib/feature/verification" - "github.com/authgear/authgear-server/pkg/lib/feature/web3" "github.com/authgear/authgear-server/pkg/lib/infra/db" "github.com/authgear/authgear-server/pkg/lib/infra/db/appdb" "github.com/authgear/authgear-server/pkg/lib/infra/db/globaldb" @@ -205,37 +203,9 @@ func NewReindexer(pool *db.Pool, databaseCredentials *CmdDBCredential, appID Cmd SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := ProvideRemoteIP() - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: configAppID, - Clock: clock, - } - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: configAppID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -272,7 +242,7 @@ func NewReindexer(pool *db.Pool, databaseCredentials *CmdDBCredential, appID Cmd } authenticatorConfig := appConfig.Authenticator authenticatorPasswordConfig := authenticatorConfig.Password - passwordLogger := password.NewLogger(factory) + logger := password.NewLogger(factory) historyStore := &password.HistoryStore{ Clock: clock, SQLBuilder: sqlBuilderApp, @@ -291,7 +261,7 @@ func NewReindexer(pool *db.Pool, databaseCredentials *CmdDBCredential, appID Cmd Store: passwordStore, Config: authenticatorPasswordConfig, Clock: clock, - Logger: passwordLogger, + Logger: logger, PasswordHistory: historyStore, PasswordChecker: passwordChecker, Expiry: expiry, @@ -327,6 +297,7 @@ func NewReindexer(pool *db.Pool, databaseCredentials *CmdDBCredential, appID Cmd } testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode + remoteIP := ProvideRemoteIP() codeStoreRedis := &otp.CodeStoreRedis{ Redis: appredisHandle, AppID: configAppID, @@ -343,6 +314,15 @@ func NewReindexer(pool *db.Pool, databaseCredentials *CmdDBCredential, appID Cmd Clock: clock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: configAppID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clock, AppID: configAppID, @@ -417,13 +397,6 @@ func NewReindexer(pool *db.Pool, databaseCredentials *CmdDBCredential, appID Cmd UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -440,7 +413,6 @@ func NewReindexer(pool *db.Pool, databaseCredentials *CmdDBCredential, appID Cmd Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } sourceProvider := &reindex.SourceProvider{ diff --git a/cmd/authgear/pgsearch/wire_gen.go b/cmd/authgear/pgsearch/wire_gen.go index b02207a3bc..7c32fe40c3 100644 --- a/cmd/authgear/pgsearch/wire_gen.go +++ b/cmd/authgear/pgsearch/wire_gen.go @@ -26,10 +26,8 @@ import ( "github.com/authgear/authgear-server/pkg/lib/deps" "github.com/authgear/authgear-server/pkg/lib/feature/customattrs" passkey2 "github.com/authgear/authgear-server/pkg/lib/feature/passkey" - siwe2 "github.com/authgear/authgear-server/pkg/lib/feature/siwe" stdattrs2 "github.com/authgear/authgear-server/pkg/lib/feature/stdattrs" "github.com/authgear/authgear-server/pkg/lib/feature/verification" - "github.com/authgear/authgear-server/pkg/lib/feature/web3" "github.com/authgear/authgear-server/pkg/lib/infra/db" "github.com/authgear/authgear-server/pkg/lib/infra/db/appdb" "github.com/authgear/authgear-server/pkg/lib/infra/db/searchdb" @@ -190,37 +188,9 @@ func NewReindexer(pool *db.Pool, databaseCredentials *CmdDBCredential, searchDat SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := ProvideRemoteIP() - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: configAppID, - Clock: clock, - } - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: configAppID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -257,7 +227,7 @@ func NewReindexer(pool *db.Pool, databaseCredentials *CmdDBCredential, searchDat } authenticatorConfig := appConfig.Authenticator authenticatorPasswordConfig := authenticatorConfig.Password - passwordLogger := password.NewLogger(factory) + logger := password.NewLogger(factory) historyStore := &password.HistoryStore{ Clock: clock, SQLBuilder: sqlBuilderApp, @@ -276,7 +246,7 @@ func NewReindexer(pool *db.Pool, databaseCredentials *CmdDBCredential, searchDat Store: passwordStore, Config: authenticatorPasswordConfig, Clock: clock, - Logger: passwordLogger, + Logger: logger, PasswordHistory: historyStore, PasswordChecker: passwordChecker, Expiry: expiry, @@ -312,6 +282,7 @@ func NewReindexer(pool *db.Pool, databaseCredentials *CmdDBCredential, searchDat } testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode + remoteIP := ProvideRemoteIP() codeStoreRedis := &otp.CodeStoreRedis{ Redis: appredisHandle, AppID: configAppID, @@ -328,6 +299,15 @@ func NewReindexer(pool *db.Pool, databaseCredentials *CmdDBCredential, searchDat Clock: clock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: configAppID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clock, AppID: configAppID, @@ -402,13 +382,6 @@ func NewReindexer(pool *db.Pool, databaseCredentials *CmdDBCredential, searchDat UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -425,7 +398,6 @@ func NewReindexer(pool *db.Pool, databaseCredentials *CmdDBCredential, searchDat Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } sourceProvider := &reindex.SourceProvider{ diff --git a/cmd/portal/cmd/cmdinternal/migrate_resources_remove_web3.go b/cmd/portal/cmd/cmdinternal/migrate_resources_remove_web3.go new file mode 100644 index 0000000000..334a4ffb66 --- /dev/null +++ b/cmd/portal/cmd/cmdinternal/migrate_resources_remove_web3.go @@ -0,0 +1,177 @@ +package cmdinternal + +import ( + "encoding/base64" + "fmt" + "log" + + "github.com/spf13/cobra" + "sigs.k8s.io/yaml" + + portalcmd "github.com/authgear/authgear-server/cmd/portal/cmd" + "github.com/authgear/authgear-server/cmd/portal/internal" +) + +var cmdInternalMigrateRemoveWeb3 = &cobra.Command{ + Use: "migrate-remove-web3", + Short: "Remove web3 related config", + RunE: func(cmd *cobra.Command, args []string) error { + binder := portalcmd.GetBinder() + + dbURL, err := binder.GetRequiredString(cmd, portalcmd.ArgDatabaseURL) + if err != nil { + return err + } + + dbSchema, err := binder.GetRequiredString(cmd, portalcmd.ArgDatabaseSchema) + if err != nil { + return err + } + + internal.MigrateResources(cmd.Context(), &internal.MigrateResourcesOptions{ + DatabaseURL: dbURL, + DatabaseSchema: dbSchema, + UpdateConfigSourceFunc: migrateRemoveWeb3, + DryRun: &MigrateResourcesDryRun, + }) + + return nil + }, +} + +func migrateRemoveWeb3(appID string, configSourceData map[string]string, dryRun bool) error { + err := migrateRemoveWeb3_authgear_yaml(appID, configSourceData, dryRun) + if err != nil { + return err + } + + err = migrateRemoveWeb3_authgear_features_yaml(appID, configSourceData, dryRun) + if err != nil { + return err + } + + return nil +} + +func migrateRemoveWeb3_authgear_yaml(appID string, configSourceData map[string]string, dryRun bool) error { + encodedAuthgearYAML, ok := configSourceData["authgear.yaml"] + if !ok { + return nil + } + + decodedAuthgearYAML, err := base64.StdEncoding.DecodeString(encodedAuthgearYAML) + if err != nil { + return fmt.Errorf("failed decode authgear.yaml: %w", err) + } + + authgearYAML := make(map[string]interface{}) + err = yaml.Unmarshal(decodedAuthgearYAML, &authgearYAML) + if err != nil { + return fmt.Errorf("failed unmarshal yaml: %w", err) + } + + changed := false + + // Delete web3 from authgear.yaml + _, ok = authgearYAML["web3"] + if ok { + changed = true + log.Printf("web3 is present in authgear.yaml: %v", appID) + delete(authgearYAML, "web3") + } + + // If authentication.identities contain siwe, then + // authentication.identities = [login_id, oauth] + // identity.login_id.keys = [{ type: "email" }] + // authentication.primary_authenticators = ["password"] + + authentication, ok := authgearYAML["authentication"].(map[string]interface{}) + if ok { + authenticationIdentitiesContainSIWE := false + + identities, ok := authentication["identities"].([]interface{}) + if ok { + for _, i := range identities { + if i, ok := i.(string); ok { + if i == "siwe" { + authenticationIdentitiesContainSIWE = true + log.Printf("authentication.identities contain siwe: %v", appID) + } + } + } + } + + if authenticationIdentitiesContainSIWE { + changed = true + + authentication["identities"] = []interface{}{ + "login_id", + "oauth", + } + authentication["primary_authenticators"] = []interface{}{ + "password", + } + authgearYAML["identity"] = map[string]interface{}{ + "login_id": map[string]interface{}{ + "keys": []interface{}{ + map[string]interface{}{ + "type": "email", + }, + }, + }, + } + } + } + + if changed { + migrated, err := yaml.Marshal(authgearYAML) + if err != nil { + return fmt.Errorf("failed marshal yaml: %w", err) + } + configSourceData["authgear.yaml"] = base64.StdEncoding.EncodeToString(migrated) + } + + return nil +} + +func migrateRemoveWeb3_authgear_features_yaml(appID string, configSourceData map[string]string, dryRun bool) error { + encodedAuthgearFeaturesYAML, ok := configSourceData["authgear.features.yaml"] + if !ok { + return nil + } + + decodedAuthgearFeaturesYAML, err := base64.StdEncoding.DecodeString(encodedAuthgearFeaturesYAML) + if err != nil { + return fmt.Errorf("failed decode authgear.features.yaml: %w", err) + } + + authgearFeaturesYAML := make(map[string]interface{}) + err = yaml.Unmarshal(decodedAuthgearFeaturesYAML, &authgearFeaturesYAML) + if err != nil { + return fmt.Errorf("failed unmarshal yaml: %w", err) + } + + changed := false + + // Delete web3 from authgear.features.yaml + _, ok = authgearFeaturesYAML["web3"] + if ok { + changed = true + log.Printf("web3 is present in authgear.features.yaml: %v", appID) + delete(authgearFeaturesYAML, "web3") + } + + if changed { + migrated, err := yaml.Marshal(authgearFeaturesYAML) + if err != nil { + return fmt.Errorf("failed marshal yaml: %w", err) + } + configSourceData["authgear.features.yaml"] = base64.StdEncoding.EncodeToString(migrated) + } + + return nil +} + +func init() { + cmdInternalBreakingChangeMigrateResources.AddCommand(cmdInternalMigrateRemoveWeb3) +} diff --git a/cmd/portal/cmd/cmdinternal/migrate_resources_remove_web3_test.go b/cmd/portal/cmd/cmdinternal/migrate_resources_remove_web3_test.go new file mode 100644 index 0000000000..1052d48e0f --- /dev/null +++ b/cmd/portal/cmd/cmdinternal/migrate_resources_remove_web3_test.go @@ -0,0 +1,150 @@ +package cmdinternal + +import ( + "encoding/base64" + "encoding/json" + "testing" + + . "github.com/smartystreets/goconvey/convey" +) + +func TestMigrateRemoveWeb3(t *testing.T) { + Convey("migrateRemoveWeb3", t, func() { + test := func(srcJSON string, expectedOutputJSON string, expectedErr error) { + src := make(map[string]string) + err := json.Unmarshal([]byte(srcJSON), &src) + if err != nil { + panic(err) + } + expectedOutput := make(map[string]string) + err = json.Unmarshal([]byte(expectedOutputJSON), &expectedOutput) + if err != nil { + panic(err) + } + err = migrateRemoveWeb3("app", src, false) + So(err, ShouldResemble, expectedErr) + So(src, ShouldResemble, expectedOutput) // src was modified in-place + } + + toJSON := func(anything interface{}) string { + b, err := json.Marshal(anything) + if err != nil { + panic(err) + } + return string(b) + } + + toB64 := func(str string) string { + return base64.StdEncoding.EncodeToString([]byte(str)) + } + + Convey("do nothing if the project is not using SIWE", func() { + test(toJSON(map[string]interface{}{ + "authgear.yaml": toB64(`http: + public_origin: http://localhost:3100 +id: app +`), + }), toJSON(map[string]interface{}{ + "authgear.yaml": toB64(`http: + public_origin: http://localhost:3100 +id: app +`), + }), nil) + }) + + Convey("migrate authgear.yaml if authentication.identities contain siwe", func() { + test(toJSON(map[string]interface{}{ + "authgear.yaml": toB64(`authentication: + identities: ["siwe"] +http: + public_origin: http://localhost:3100 +id: app +`), + }), toJSON(map[string]interface{}{ + "authgear.yaml": toB64(`authentication: + identities: + - login_id + - oauth + primary_authenticators: + - password +http: + public_origin: http://localhost:3100 +id: app +identity: + login_id: + keys: + - type: email +`), + }), nil) + }) + + Convey("remove web3 in authgear.yaml if it is present", func() { + test(toJSON(map[string]interface{}{ + "authgear.yaml": toB64(`authentication: + identities: ["siwe"] +http: + public_origin: http://localhost:3100 +id: app +web3: + siwe: + networks: + - "1" +`), + }), toJSON(map[string]interface{}{ + "authgear.yaml": toB64(`authentication: + identities: + - login_id + - oauth + primary_authenticators: + - password +http: + public_origin: http://localhost:3100 +id: app +identity: + login_id: + keys: + - type: email +`), + }), nil) + }) + + Convey("remove web3 in authgear.features.yaml if it is present", func() { + test(toJSON(map[string]interface{}{ + "authgear.yaml": toB64(`authentication: + identities: ["siwe"] +http: + public_origin: http://localhost:3100 +id: app +web3: + siwe: + networks: + - ethereum:0x0@1 +`), + "authgear.features.yaml": toB64(`rate_limits: + disabled: true +web3: + nft: + maximum: 2 +`), + }), toJSON(map[string]interface{}{ + "authgear.yaml": toB64(`authentication: + identities: + - login_id + - oauth + primary_authenticators: + - password +http: + public_origin: http://localhost:3100 +id: app +identity: + login_id: + keys: + - type: email +`), + "authgear.features.yaml": toB64(`rate_limits: + disabled: true +`), + }), nil) + }) + }) +} diff --git a/cmd/portal/server/config.go b/cmd/portal/server/config.go index d11e7728d5..f419be27ca 100644 --- a/cmd/portal/server/config.go +++ b/cmd/portal/server/config.go @@ -60,8 +60,6 @@ type Config struct { PortalFrontendSentry portalconfig.PortalFrontendSentryConfig `envconfig:"PORTAL_FRONTEND_SENTRY"` - Web3 portalconfig.Web3Config `envconfig:"WEB3"` - *config.EnvironmentConfig } diff --git a/cmd/portal/server/server.go b/cmd/portal/server/server.go index 5a93121564..0128c99347 100644 --- a/cmd/portal/server/server.go +++ b/cmd/portal/server/server.go @@ -38,7 +38,6 @@ func (c *Controller) Start(ctx context.Context) { &cfg.Kubernetes, cfg.DomainImplementation, &cfg.Search, - &cfg.Web3, &cfg.AuditLog, &cfg.Analytic, &cfg.Stripe, diff --git a/custombuild/go.mod b/custombuild/go.mod index 2d3a1768eb..7414ae90e6 100644 --- a/custombuild/go.mod +++ b/custombuild/go.mod @@ -39,7 +39,6 @@ require ( github.com/aws/aws-sdk-go v1.55.5 // indirect github.com/beevik/etree v1.4.1 // indirect github.com/boombuler/barcode v1.0.2 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect github.com/cert-manager/cert-manager v1.15.4 // indirect @@ -50,7 +49,6 @@ require ( github.com/crewjam/saml v0.4.14 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/davidbyttow/govips/v2 v2.15.0 // indirect - github.com/dchest/uniuri v1.2.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dlclark/regexp2 v1.7.0 // indirect @@ -58,7 +56,6 @@ require ( github.com/emicklei/go-restful/v3 v3.12.0 // indirect github.com/envoyproxy/go-control-plane v0.13.0 // indirect github.com/envoyproxy/protoc-gen-validate v1.1.0 // indirect - github.com/ethereum/go-ethereum v1.14.11 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fxamacker/cbor/v2 v2.6.0 // indirect @@ -97,7 +94,6 @@ require ( github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/hcl v1.0.1-vault-5 // indirect - github.com/holiman/uint256 v1.3.1 // indirect github.com/huandu/xstrings v1.4.0 // indirect github.com/iawaknahc/gomessageformat v0.0.0-20210428033148-c3f8592094b5 // indirect github.com/iawaknahc/jsonschema v0.0.0-20211026064614-d05c07b7760d // indirect @@ -138,7 +134,6 @@ require ( github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect github.com/pquerna/otp v1.4.0 // indirect github.com/redis/go-redis/v9 v9.7.0 // indirect - github.com/relvacode/iso8601 v1.1.1-0.20210511065120-b30b151cc433 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/rubenv/sql-migrate v1.7.0 // indirect github.com/russellhaering/goxmldsig v1.4.0 // indirect @@ -154,7 +149,6 @@ require ( github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.19.0 // indirect - github.com/spruceid/siwe-go v0.2.1 // indirect github.com/stripe/stripe-go/v72 v72.122.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/tdewolff/parse/v2 v2.7.19 // indirect diff --git a/custombuild/go.sum b/custombuild/go.sum index 0869e0f9da..97bc194217 100644 --- a/custombuild/go.sum +++ b/custombuild/go.sum @@ -85,10 +85,6 @@ github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= -github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= -github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -116,10 +112,6 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davidbyttow/govips/v2 v2.15.0 h1:h3lF+rQElBzGXbQSSPqmE3XGySPhcQo2x3t5l/dZ+pU= github.com/davidbyttow/govips/v2 v2.15.0/go.mod h1:3OQCHj0nf5Mnrplh5VlNvmx3IhJXyxbAoTJZPflUjmM= -github.com/dchest/uniuri v1.2.0 h1:koIcOUdrTIivZgSLhHQvKgqdWZq5d7KdMEWF1Ud6+5g= -github.com/dchest/uniuri v1.2.0/go.mod h1:fSzm4SLHzNZvWLvWJew423PhAzkpNQYq+uNLq4kxhkY= -github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= -github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= @@ -138,8 +130,6 @@ github.com/envoyproxy/go-control-plane v0.13.0/go.mod h1:GRaKG3dwvFoTg4nj7aXdZnv github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= -github.com/ethereum/go-ethereum v1.14.11 h1:8nFDCUUE67rPc6AKxFj7JKaOa2W/W1Rse3oS6LvvxEY= -github.com/ethereum/go-ethereum v1.14.11/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls= github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= @@ -284,8 +274,6 @@ github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+l github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.1-vault-5 h1:kI3hhbbyzr4dldA8UdTb7ZlVVlI2DACdCfz31RPDgJM= github.com/hashicorp/hcl v1.0.1-vault-5/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= -github.com/holiman/uint256 v1.3.1 h1:JfTzmih28bittyHM8z360dCjIA9dbPIBlcTI6lmctQs= -github.com/holiman/uint256 v1.3.1/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/iawaknahc/gomessageformat v0.0.0-20210428033148-c3f8592094b5 h1:i6r7zTbhSdHbhCVEJsM8W62F7MvxXfkpkwGrvfL+sFw= @@ -428,8 +416,6 @@ github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/redis/rueidis v1.0.19 h1:s65oWtotzlIFN8eMPhyYwxlwLR1lUdhza2KtWprKYSo= github.com/redis/rueidis v1.0.19/go.mod h1:8B+r5wdnjwK3lTFml5VtxjzGOQAC+5UmujoD12pDrEo= -github.com/relvacode/iso8601 v1.1.1-0.20210511065120-b30b151cc433 h1:mLbKGKe5gDGHE8uJLYMmA/fkp/htaXEMl2Hj0k4xfYE= -github.com/relvacode/iso8601 v1.1.1-0.20210511065120-b30b151cc433/go.mod h1:FlNp+jz+TXpyRqgmM7tnzHHzBnz776kmAH2h3sZCn0I= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= @@ -469,8 +455,6 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= -github.com/spruceid/siwe-go v0.2.1 h1:BroySys6CyUzeyNppTseEOT/w56xTdOfcmECTI7rnuc= -github.com/spruceid/siwe-go v0.2.1/go.mod h1:MHpHbptGsM3lHth2L8quhZ9ipiwST8zsJH1CjWpeO1k= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= diff --git a/e2e/cmd/e2e/pkg/wire_gen.go b/e2e/cmd/e2e/pkg/wire_gen.go index f430a4d08d..59bcfea393 100644 --- a/e2e/cmd/e2e/pkg/wire_gen.go +++ b/e2e/cmd/e2e/pkg/wire_gen.go @@ -34,10 +34,8 @@ import ( "github.com/authgear/authgear-server/pkg/lib/feature/customattrs" "github.com/authgear/authgear-server/pkg/lib/feature/forgotpassword" passkey2 "github.com/authgear/authgear-server/pkg/lib/feature/passkey" - siwe2 "github.com/authgear/authgear-server/pkg/lib/feature/siwe" stdattrs2 "github.com/authgear/authgear-server/pkg/lib/feature/stdattrs" "github.com/authgear/authgear-server/pkg/lib/feature/verification" - "github.com/authgear/authgear-server/pkg/lib/feature/web3" "github.com/authgear/authgear-server/pkg/lib/hook" "github.com/authgear/authgear-server/pkg/lib/infra/db/appdb" "github.com/authgear/authgear-server/pkg/lib/infra/db/auditdb" @@ -260,36 +258,9 @@ func newUserImport(p *deps.AppProvider) *userimport.UserImportService { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -397,6 +368,15 @@ func newUserImport(p *deps.AppProvider) *userimport.UserImportService { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -471,13 +451,6 @@ func newUserImport(p *deps.AppProvider) *userimport.UserImportService { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -494,7 +467,6 @@ func newUserImport(p *deps.AppProvider) *userimport.UserImportService { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -714,8 +686,8 @@ func newUserImport(p *deps.AppProvider) *userimport.UserImportService { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -764,7 +736,6 @@ func newUserImport(p *deps.AppProvider) *userimport.UserImportService { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -780,7 +751,7 @@ func newUserImport(p *deps.AppProvider) *userimport.UserImportService { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -791,7 +762,7 @@ func newUserImport(p *deps.AppProvider) *userimport.UserImportService { cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -830,7 +801,7 @@ func newUserImport(p *deps.AppProvider) *userimport.UserImportService { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, diff --git a/e2e/go.mod b/e2e/go.mod index 1d7c091698..96e97fb508 100644 --- a/e2e/go.mod +++ b/e2e/go.mod @@ -56,7 +56,6 @@ require ( github.com/authgear/oauthrelyingparty v1.5.0 // indirect github.com/aws/aws-sdk-go v1.55.5 // indirect github.com/boombuler/barcode v1.0.2 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect @@ -64,14 +63,12 @@ require ( github.com/cockroachdb/apd/v2 v2.0.2 // indirect github.com/coder/websocket v1.8.12 // indirect github.com/crewjam/saml v0.4.14 // indirect - github.com/dchest/uniuri v1.2.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dlclark/regexp2 v1.7.0 // indirect github.com/elastic/go-elasticsearch/v7 v7.17.10 // indirect github.com/envoyproxy/go-control-plane v0.13.0 // indirect github.com/envoyproxy/protoc-gen-validate v1.1.0 // indirect - github.com/ethereum/go-ethereum v1.14.11 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fxamacker/cbor/v2 v2.6.0 // indirect @@ -85,6 +82,7 @@ require ( github.com/go-webauthn/webauthn v0.8.6 // indirect github.com/go-webauthn/x v0.1.4 // indirect github.com/goccy/go-json v0.10.3 // indirect + github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/go-tpm v0.9.0 // indirect github.com/google/s2a-go v0.1.8 // indirect @@ -102,7 +100,6 @@ require ( github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/hcl v1.0.1-vault-5 // indirect - github.com/holiman/uint256 v1.3.1 // indirect github.com/huandu/xstrings v1.4.0 // indirect github.com/iawaknahc/gomessageformat v0.0.0-20210428033148-c3f8592094b5 // indirect github.com/iawaknahc/jsonschema v0.0.0-20211026064614-d05c07b7760d // indirect @@ -137,7 +134,6 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/pquerna/otp v1.4.0 // indirect github.com/redis/go-redis/v9 v9.7.0 // indirect - github.com/relvacode/iso8601 v1.1.1-0.20210511065120-b30b151cc433 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/russellhaering/goxmldsig v1.4.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect @@ -152,7 +148,6 @@ require ( github.com/spf13/cast v1.6.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.19.0 // indirect - github.com/spruceid/siwe-go v0.2.1 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/trustelem/zxcvbn v1.0.1 // indirect github.com/ua-parser/uap-go v0.0.0-20241012191800-bbb40edc15aa // indirect diff --git a/e2e/go.sum b/e2e/go.sum index 268fb13a28..65686bc4f2 100644 --- a/e2e/go.sum +++ b/e2e/go.sum @@ -89,10 +89,6 @@ github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= -github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= -github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -119,10 +115,6 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dchest/uniuri v1.2.0 h1:koIcOUdrTIivZgSLhHQvKgqdWZq5d7KdMEWF1Ud6+5g= -github.com/dchest/uniuri v1.2.0/go.mod h1:fSzm4SLHzNZvWLvWJew423PhAzkpNQYq+uNLq4kxhkY= -github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= -github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= @@ -139,8 +131,6 @@ github.com/envoyproxy/go-control-plane v0.13.0/go.mod h1:GRaKG3dwvFoTg4nj7aXdZnv github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= -github.com/ethereum/go-ethereum v1.14.11 h1:8nFDCUUE67rPc6AKxFj7JKaOa2W/W1Rse3oS6LvvxEY= -github.com/ethereum/go-ethereum v1.14.11/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/form3tech-oss/jwt-go v3.2.2+incompatible h1:TcekIExNqud5crz4xD2pavyTgWiPvpYe4Xau31I0PRk= @@ -276,8 +266,6 @@ github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+l github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.1-vault-5 h1:kI3hhbbyzr4dldA8UdTb7ZlVVlI2DACdCfz31RPDgJM= github.com/hashicorp/hcl v1.0.1-vault-5/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= -github.com/holiman/uint256 v1.3.1 h1:JfTzmih28bittyHM8z360dCjIA9dbPIBlcTI6lmctQs= -github.com/holiman/uint256 v1.3.1/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= @@ -420,8 +408,6 @@ github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/redis/rueidis v1.0.19 h1:s65oWtotzlIFN8eMPhyYwxlwLR1lUdhza2KtWprKYSo= github.com/redis/rueidis v1.0.19/go.mod h1:8B+r5wdnjwK3lTFml5VtxjzGOQAC+5UmujoD12pDrEo= -github.com/relvacode/iso8601 v1.1.1-0.20210511065120-b30b151cc433 h1:mLbKGKe5gDGHE8uJLYMmA/fkp/htaXEMl2Hj0k4xfYE= -github.com/relvacode/iso8601 v1.1.1-0.20210511065120-b30b151cc433/go.mod h1:FlNp+jz+TXpyRqgmM7tnzHHzBnz776kmAH2h3sZCn0I= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= @@ -459,8 +445,6 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= -github.com/spruceid/siwe-go v0.2.1 h1:BroySys6CyUzeyNppTseEOT/w56xTdOfcmECTI7rnuc= -github.com/spruceid/siwe-go v0.2.1/go.mod h1:MHpHbptGsM3lHth2L8quhZ9ipiwST8zsJH1CjWpeO1k= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= diff --git a/go.mod b/go.mod index b70485ee18..e07e9c2420 100644 --- a/go.mod +++ b/go.mod @@ -64,7 +64,6 @@ require ( github.com/Azure/azure-storage-blob-go v0.15.0 github.com/aws/aws-sdk-go v1.55.5 github.com/davidbyttow/govips/v2 v2.15.0 - github.com/ethereum/go-ethereum v1.14.11 github.com/goccy/go-json v0.10.3 // indirect github.com/stripe/stripe-go/v72 v72.122.0 github.com/tdewolff/parse/v2 v2.7.19 @@ -79,7 +78,6 @@ require ( github.com/go-webauthn/webauthn v0.8.6 github.com/lestrrat-go/jwx/v2 v2.1.2 github.com/patrickmn/go-cache v2.1.0+incompatible - github.com/spruceid/siwe-go v0.2.1 github.com/yudai/gojsondiff v1.0.0 go.uber.org/automaxprocs v1.6.0 golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c @@ -144,11 +142,9 @@ require ( github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver v1.5.0 // indirect github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/dchest/uniuri v1.2.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dlclark/regexp2 v1.7.0 // indirect @@ -180,7 +176,6 @@ require ( github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/hcl v1.0.1-vault-5 // indirect - github.com/holiman/uint256 v1.3.1 // indirect github.com/huandu/xstrings v1.4.0 // indirect github.com/imdario/mergo v0.3.16 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect @@ -208,7 +203,6 @@ require ( github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/relvacode/iso8601 v1.1.1-0.20210511065120-b30b151cc433 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/segmentio/asm v1.2.0 // indirect diff --git a/go.sum b/go.sum index 4ac45695fe..3b531d6ce1 100644 --- a/go.sum +++ b/go.sum @@ -83,10 +83,6 @@ github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= -github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= -github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -114,10 +110,6 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davidbyttow/govips/v2 v2.15.0 h1:h3lF+rQElBzGXbQSSPqmE3XGySPhcQo2x3t5l/dZ+pU= github.com/davidbyttow/govips/v2 v2.15.0/go.mod h1:3OQCHj0nf5Mnrplh5VlNvmx3IhJXyxbAoTJZPflUjmM= -github.com/dchest/uniuri v1.2.0 h1:koIcOUdrTIivZgSLhHQvKgqdWZq5d7KdMEWF1Ud6+5g= -github.com/dchest/uniuri v1.2.0/go.mod h1:fSzm4SLHzNZvWLvWJew423PhAzkpNQYq+uNLq4kxhkY= -github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= -github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= @@ -136,8 +128,6 @@ github.com/envoyproxy/go-control-plane v0.13.0/go.mod h1:GRaKG3dwvFoTg4nj7aXdZnv github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= -github.com/ethereum/go-ethereum v1.14.11 h1:8nFDCUUE67rPc6AKxFj7JKaOa2W/W1Rse3oS6LvvxEY= -github.com/ethereum/go-ethereum v1.14.11/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E= github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls= github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= @@ -285,8 +275,6 @@ github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+l github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.1-vault-5 h1:kI3hhbbyzr4dldA8UdTb7ZlVVlI2DACdCfz31RPDgJM= github.com/hashicorp/hcl v1.0.1-vault-5/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= -github.com/holiman/uint256 v1.3.1 h1:JfTzmih28bittyHM8z360dCjIA9dbPIBlcTI6lmctQs= -github.com/holiman/uint256 v1.3.1/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= @@ -438,8 +426,6 @@ github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/redis/rueidis v1.0.19 h1:s65oWtotzlIFN8eMPhyYwxlwLR1lUdhza2KtWprKYSo= github.com/redis/rueidis v1.0.19/go.mod h1:8B+r5wdnjwK3lTFml5VtxjzGOQAC+5UmujoD12pDrEo= -github.com/relvacode/iso8601 v1.1.1-0.20210511065120-b30b151cc433 h1:mLbKGKe5gDGHE8uJLYMmA/fkp/htaXEMl2Hj0k4xfYE= -github.com/relvacode/iso8601 v1.1.1-0.20210511065120-b30b151cc433/go.mod h1:FlNp+jz+TXpyRqgmM7tnzHHzBnz776kmAH2h3sZCn0I= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= @@ -479,8 +465,6 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= -github.com/spruceid/siwe-go v0.2.1 h1:BroySys6CyUzeyNppTseEOT/w56xTdOfcmECTI7rnuc= -github.com/spruceid/siwe-go v0.2.1/go.mod h1:MHpHbptGsM3lHth2L8quhZ9ipiwST8zsJH1CjWpeO1k= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= diff --git a/pkg/admin/wire_gen.go b/pkg/admin/wire_gen.go index 660b72782d..582d685199 100644 --- a/pkg/admin/wire_gen.go +++ b/pkg/admin/wire_gen.go @@ -44,10 +44,8 @@ import ( "github.com/authgear/authgear-server/pkg/lib/feature/customattrs" "github.com/authgear/authgear-server/pkg/lib/feature/forgotpassword" passkey2 "github.com/authgear/authgear-server/pkg/lib/feature/passkey" - siwe2 "github.com/authgear/authgear-server/pkg/lib/feature/siwe" stdattrs2 "github.com/authgear/authgear-server/pkg/lib/feature/stdattrs" "github.com/authgear/authgear-server/pkg/lib/feature/verification" - "github.com/authgear/authgear-server/pkg/lib/feature/web3" "github.com/authgear/authgear-server/pkg/lib/healthz" "github.com/authgear/authgear-server/pkg/lib/hook" "github.com/authgear/authgear-server/pkg/lib/infra/db/appdb" @@ -314,37 +312,9 @@ func newGraphQLHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -436,6 +406,7 @@ func newGraphQLHandler(p *deps.RequestProvider) http.Handler { } testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode + remoteIP := deps.ProvideRemoteIP(request, trustProxy) codeStoreRedis := &otp.CodeStoreRedis{ Redis: appredisHandle, AppID: appID, @@ -452,6 +423,15 @@ func newGraphQLHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -526,13 +506,6 @@ func newGraphQLHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -549,7 +522,6 @@ func newGraphQLHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userLoader := loader.NewUserLoader(userQueries) @@ -701,7 +673,6 @@ func newGraphQLHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -813,8 +784,8 @@ func newGraphQLHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -864,7 +835,7 @@ func newGraphQLHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -875,7 +846,7 @@ func newGraphQLHandler(p *deps.RequestProvider) http.Handler { cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -913,7 +884,7 @@ func newGraphQLHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -1566,37 +1537,9 @@ func newUserExportCreateHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - ratelimitLimiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: ratelimitLimiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -1688,6 +1631,7 @@ func newUserExportCreateHandler(p *deps.RequestProvider) http.Handler { } testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode + remoteIP := deps.ProvideRemoteIP(request, trustProxy) codeStoreRedis := &otp.CodeStoreRedis{ Redis: handle, AppID: appID, @@ -1704,6 +1648,15 @@ func newUserExportCreateHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + ratelimitLimiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -1777,13 +1730,6 @@ func newUserExportCreateHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -1800,18 +1746,17 @@ func newUserExportCreateHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userexportLogger := userexport.NewLogger(factory) - userexportHTTPClient := userexport.NewHTTPClient() + httpClient := userexport.NewHTTPClient() userExportService := &userexport.UserExportService{ AppDatabase: appdbHandle, Config: userProfileConfig, UserQueries: userQueries, Logger: userexportLogger, HTTPOrigin: httpOrigin, - HTTPClient: userexportHTTPClient, + HTTPClient: httpClient, CloudStorage: userExportCloudStorage, Clock: clockClock, } diff --git a/pkg/api/model/siwe.go b/pkg/api/model/siwe.go index 348be45bae..49f24d711f 100644 --- a/pkg/api/model/siwe.go +++ b/pkg/api/model/siwe.go @@ -1,51 +1,9 @@ package model -import ( - "crypto/ecdsa" - "encoding/hex" - "fmt" - - "github.com/ethereum/go-ethereum/crypto" - - "github.com/authgear/authgear-server/pkg/util/web3" -) - type SIWEPublicKey string -type SIWEVerificationRequest struct { - Message string `json:"message"` - Signature string `json:"signature"` -} - -type SIWEWallet struct { - Address web3.EIP55 `json:"address"` - ChainID int `json:"chain_id"` -} type SIWEVerifiedData struct { Message string `json:"message"` Signature string `json:"signature"` EncodedPublicKey SIWEPublicKey `json:"encoded_public_key"` } - -func NewSIWEPublicKey(k *ecdsa.PublicKey) (SIWEPublicKey, error) { - if k.Curve != crypto.S256() { - return "", fmt.Errorf("Invalid curve: %s", k.Curve) - } - return SIWEPublicKey(hex.EncodeToString(crypto.CompressPubkey(k))), nil -} - -func (k SIWEPublicKey) ECDSA() (*ecdsa.PublicKey, error) { - hexKey := string(k) - - bytes, err := hex.DecodeString(hexKey) - if err != nil { - return nil, err - } - - key, err := crypto.DecompressPubkey(bytes) - if err != nil { - return nil, err - } - - return key, nil -} diff --git a/pkg/api/model/siwe_test.go b/pkg/api/model/siwe_test.go deleted file mode 100644 index e9d2816734..0000000000 --- a/pkg/api/model/siwe_test.go +++ /dev/null @@ -1,47 +0,0 @@ -package model_test - -import ( - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - "testing" - - . "github.com/smartystreets/goconvey/convey" - - "github.com/authgear/authgear-server/pkg/api/model" - - "github.com/ethereum/go-ethereum/crypto" -) - -func TestSIWEPubKey(t *testing.T) { - Convey("SIWEPublicKey", t, func() { - Convey("should encode and decode key", func() { - - Convey("valid curve", func() { - key, err := ecdsa.GenerateKey(crypto.S256(), rand.Reader) - So(err, ShouldBeNil) - So(key, ShouldNotBeNil) - - hex, err := model.NewSIWEPublicKey(&key.PublicKey) - So(err, ShouldBeNil) - So(hex, ShouldNotBeEmpty) - - decodedKey, err := hex.ECDSA() - So(err, ShouldBeNil) - - So(key.PublicKey, ShouldResemble, *decodedKey) - }) - - Convey("invalid curve", func() { - key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - So(err, ShouldBeNil) - So(key, ShouldNotBeNil) - - hex, err := model.NewSIWEPublicKey(&key.PublicKey) - So(err, ShouldBeError) - So(hex, ShouldBeEmpty) - }) - }) - - }) -} diff --git a/pkg/api/model/user.go b/pkg/api/model/user.go index aaa65bc64f..e7cc5c9dc9 100644 --- a/pkg/api/model/user.go +++ b/pkg/api/model/user.go @@ -18,7 +18,6 @@ type User struct { CanReauthenticate bool `json:"can_reauthenticate"` StandardAttributes map[string]interface{} `json:"standard_attributes,omitempty"` CustomAttributes map[string]interface{} `json:"custom_attributes,omitempty"` - Web3 *UserWeb3Info `json:"x_web3,omitempty"` Roles []string `json:"roles,omitempty"` Groups []string `json:"groups,omitempty"` MFAGracePeriodtEndAt *time.Time `json:"mfa_grace_period_end_at,omitempty"` diff --git a/pkg/api/model/web3.go b/pkg/api/model/web3.go index 8b616af130..ff74ae5ad4 100644 --- a/pkg/api/model/web3.go +++ b/pkg/api/model/web3.go @@ -1,107 +1,5 @@ package model -import ( - "math/big" - "net/url" - "strconv" - "time" - - web3util "github.com/authgear/authgear-server/pkg/util/web3" -) - -type AccountIdentifier struct { - Address string `json:"address"` -} - -type NetworkIdentifier struct { - Blockchain string `json:"blockchain"` - Network string `json:"network"` -} - -type Contract struct { - Name string `json:"name"` - Address string `json:"address"` -} - -type TransactionIdentifier struct { - Hash string `json:"hash"` -} - -type BlockIdentifier struct { - Index big.Int `json:"index"` - Timestamp time.Time `json:"timestamp"` -} - -type Token struct { - TokenID string `json:"token_id"` - TransactionIdentifier TransactionIdentifier `json:"transaction_identifier"` - BlockIdentifier BlockIdentifier `json:"block_identifier"` - Balance string `json:"balance"` -} - -type NFT struct { - Contract Contract `json:"contract"` - Tokens []Token `json:"tokens"` -} - -type NFTOwnership struct { - AccountIdentifier AccountIdentifier `json:"account_identifier"` - NetworkIdentifier NetworkIdentifier `json:"network_identifier"` - NFTs []NFT `json:"nfts"` -} - -func (s *NFTOwnership) EndUserAccountID() string { - if s.NetworkIdentifier.Blockchain == "ethereum" { - chainID, err := strconv.ParseInt(s.NetworkIdentifier.Network, 10, 0) - if err != nil { - return "" - } - eip681, err := web3util.NewEIP681(int(chainID), s.AccountIdentifier.Address, url.Values{}) - if err != nil { - return "" - } - return eip681.URL().String() - } - - return "" -} - -type NFTCollection struct { - ID string `json:"id"` - Blockchain string `json:"blockchain"` - Network string `json:"network"` - Name string `json:"name"` - ContractAddress string `json:"contract_address"` - TotalSupply *big.Int `json:"total_supply"` - TokenType string `json:"type"` - CreatedAt time.Time `json:"created_at"` -} - -type ProbeCollectionRequest struct { - ContractID string `json:"contract_id"` -} - -type ProbeCollectionResult struct { - IsLargeCollection bool `json:"is_large_collection"` -} - -type GetContractMetadataRequest struct { - ContractIDs []string `json:"contract_ids"` -} - -type GetContractMetadataResult struct { - Collections []NFTCollection `json:"collections"` -} - -type ListOwnerNFTsRequest struct { - OwnerAddress string `json:"owner_address"` - ContractIDs []string `json:"contract_ids"` -} - -type UserWeb3Info struct { - Accounts []NFTOwnership `json:"accounts"` -} - type EthereumNetwork string const ( diff --git a/pkg/auth/deps.go b/pkg/auth/deps.go index 38116d546d..e2fd798bda 100644 --- a/pkg/auth/deps.go +++ b/pkg/auth/deps.go @@ -10,7 +10,6 @@ import ( handlerapi "github.com/authgear/authgear-server/pkg/auth/handler/api" handleroauth "github.com/authgear/authgear-server/pkg/auth/handler/oauth" handlersaml "github.com/authgear/authgear-server/pkg/auth/handler/saml" - handlersiwe "github.com/authgear/authgear-server/pkg/auth/handler/siwe" handlerwebapp "github.com/authgear/authgear-server/pkg/auth/handler/webapp" handlerwebappauthflowv2 "github.com/authgear/authgear-server/pkg/auth/handler/webapp/authflowv2" viewmodelswebapp "github.com/authgear/authgear-server/pkg/auth/handler/webapp/viewmodels" @@ -33,7 +32,6 @@ import ( featurecustomattrs "github.com/authgear/authgear-server/pkg/lib/feature/customattrs" "github.com/authgear/authgear-server/pkg/lib/feature/forgotpassword" featurepasskey "github.com/authgear/authgear-server/pkg/lib/feature/passkey" - featuresiwe "github.com/authgear/authgear-server/pkg/lib/feature/siwe" featurestdattrs "github.com/authgear/authgear-server/pkg/lib/feature/stdattrs" "github.com/authgear/authgear-server/pkg/lib/feature/verification" "github.com/authgear/authgear-server/pkg/lib/infra/db/appdb" @@ -245,10 +243,6 @@ var DependencySet = wire.NewSet( handlerwebappauthflowv2.DependencySet, wire.Bind(new(handlerwebapp.ErrorRendererAuthflowV2Navigator), new(*handlerwebappauthflowv2.AuthflowV2Navigator)), - handlersiwe.DependencySet, - wire.Bind(new(handlersiwe.NonceHandlerJSONResponseWriter), new(*httputil.JSONResponseWriter)), - wire.Bind(new(handlersiwe.NonceHandlerSIWEService), new(*featuresiwe.Service)), - api.DependencySet, wire.Bind(new(api.JSONResponseWriter), new(*httputil.JSONResponseWriter)), wire.Bind(new(authenticationflow.JSONResponseWriter), new(*httputil.JSONResponseWriter)), diff --git a/pkg/auth/handler/siwe/deps.go b/pkg/auth/handler/siwe/deps.go deleted file mode 100644 index 870babb6fa..0000000000 --- a/pkg/auth/handler/siwe/deps.go +++ /dev/null @@ -1,10 +0,0 @@ -package siwe - -import ( - "github.com/google/wire" -) - -var DependencySet = wire.NewSet( - NewNonceHandlerLogger, - wire.Struct(new(NonceHandler), "*"), -) diff --git a/pkg/auth/handler/siwe/nonce.go b/pkg/auth/handler/siwe/nonce.go deleted file mode 100644 index 7ab474be2a..0000000000 --- a/pkg/auth/handler/siwe/nonce.go +++ /dev/null @@ -1,59 +0,0 @@ -package siwe - -import ( - "context" - "net/http" - "time" - - "github.com/authgear/authgear-server/pkg/api" - featuresiwe "github.com/authgear/authgear-server/pkg/lib/feature/siwe" - "github.com/authgear/authgear-server/pkg/util/httproute" - "github.com/authgear/authgear-server/pkg/util/log" -) - -func ConfigureNonceRoute(route httproute.Route) httproute.Route { - return route. - WithMethods("OPTIONS", "GET"). - WithPathPattern("/_internals/siwe/nonce") -} - -type NonceHandlerSIWEService interface { - CreateNewNonce(ctx context.Context) (*featuresiwe.Nonce, error) -} - -type NonceHandlerLogger struct{ *log.Logger } - -func NewNonceHandlerLogger(lf *log.Factory) NonceHandlerLogger { - return NonceHandlerLogger{lf.New("handler-nonce")} -} - -type NonceResponse struct { - Nonce string `json:"nonce"` - ExpireAt time.Time `json:"expire_at"` -} - -type NonceHandlerJSONResponseWriter interface { - WriteResponse(rw http.ResponseWriter, resp *api.Response) -} - -type NonceHandler struct { - Logger NonceHandlerLogger - SIWE NonceHandlerSIWEService - JSON NonceHandlerJSONResponseWriter -} - -func (h *NonceHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - nonce, err := h.SIWE.CreateNewNonce(r.Context()) - if err != nil { - h.Logger.WithError(err).Error("failed to create siwe nonce") - http.Error(rw, "internal server error", 500) - return - } - - h.JSON.WriteResponse(rw, &api.Response{ - Result: &NonceResponse{ - Nonce: nonce.Nonce, - ExpireAt: nonce.ExpireAt, - }, - }) -} diff --git a/pkg/auth/handler/webapp/deps.go b/pkg/auth/handler/webapp/deps.go index c7afe48e24..52c3ae208c 100644 --- a/pkg/auth/handler/webapp/deps.go +++ b/pkg/auth/handler/webapp/deps.go @@ -93,7 +93,6 @@ var DependencySet = wire.NewSet( wire.Struct(new(PasskeyCreationOptionsHandler), "*"), wire.Struct(new(PasskeyRequestOptionsHandler), "*"), wire.Struct(new(ConnectWeb3AccountHandler), "*"), - wire.Struct(new(MissingWeb3WalletHandler), "*"), wire.Struct(new(FeatureDisabledHandler), "*"), wire.Struct(new(AuthflowLoginHandler), "*"), diff --git a/pkg/auth/handler/webapp/missing_web3_wallet.go b/pkg/auth/handler/webapp/missing_web3_wallet.go deleted file mode 100644 index cdfe6b7b07..0000000000 --- a/pkg/auth/handler/webapp/missing_web3_wallet.go +++ /dev/null @@ -1,89 +0,0 @@ -package webapp - -import ( - "context" - "net/http" - - "github.com/authgear/authgear-server/pkg/api/model" - "github.com/authgear/authgear-server/pkg/auth/handler/webapp/viewmodels" - "github.com/authgear/authgear-server/pkg/lib/config" - "github.com/authgear/authgear-server/pkg/util/httproute" - "github.com/authgear/authgear-server/pkg/util/template" -) - -var TemplateWebMissingWeb3WalletHTML = template.RegisterHTML( - "web/missing_web3_wallet.html", - Components..., -) - -func ConfigureMissingWeb3WalletRoute(route httproute.Route) httproute.Route { - return route. - WithMethods("OPTIONS", "GET"). - WithPathPattern("/errors/missing_web3_wallet") -} - -type MissingWeb3WalletViewModel struct { - Provider string -} - -type MissingWeb3WalletHandler struct { - ControllerFactory ControllerFactory - BaseViewModel *viewmodels.BaseViewModeler - Renderer Renderer - AuthenticationConfig *config.AuthenticationConfig -} - -func (h *MissingWeb3WalletHandler) GetData(r *http.Request, rw http.ResponseWriter) (map[string]interface{}, error) { - data := map[string]interface{}{} - - baseViewModel := h.BaseViewModel.ViewModel(r, rw) - - provider := "" - if p := r.Form.Get("provider"); p == "" { - provider = "metamask" - } else { - provider = p - } - - missingWeb3WalletViewModel := MissingWeb3WalletViewModel{ - Provider: provider, - } - - viewmodels.Embed(data, missingWeb3WalletViewModel) - viewmodels.Embed(data, baseViewModel) - - return data, nil -} - -func (h *MissingWeb3WalletHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { - ctrl, err := h.ControllerFactory.New(r, w) - if err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return - } - - identities := h.AuthenticationConfig.Identities - isSIWEEnabled := false - for _, i := range identities { - if i == model.IdentityTypeSIWE { - isSIWEEnabled = true - break - } - } - - if !isSIWEEnabled { - http.Redirect(w, r, "/", http.StatusFound) - return - } - defer ctrl.ServeWithDBTx(r.Context()) - - ctrl.Get(func(ctx context.Context) error { - data, err := h.GetData(r, w) - if err != nil { - return err - } - - h.Renderer.RenderHTML(w, r, TemplateWebMissingWeb3WalletHTML, data) - return nil - }) -} diff --git a/pkg/auth/routes.go b/pkg/auth/routes.go index 23cfe7116a..6b910b8b85 100644 --- a/pkg/auth/routes.go +++ b/pkg/auth/routes.go @@ -6,7 +6,6 @@ import ( apihandler "github.com/authgear/authgear-server/pkg/auth/handler/api" oauthhandler "github.com/authgear/authgear-server/pkg/auth/handler/oauth" samlhandler "github.com/authgear/authgear-server/pkg/auth/handler/saml" - siwehandler "github.com/authgear/authgear-server/pkg/auth/handler/siwe" webapphandler "github.com/authgear/authgear-server/pkg/auth/handler/webapp" webapphandlerauthflowv2 "github.com/authgear/authgear-server/pkg/auth/handler/webapp/authflowv2" "github.com/authgear/authgear-server/pkg/auth/webapp" @@ -113,12 +112,6 @@ func NewRouter(p *deps.RootProvider, configSource *configsource.ConfigSource) ht p.Middleware(newDPoPMiddleware), ) oauthAuthzAPIChain := newOAuthAPIChain() - siweAPIChain := httproute.Chain( - rootChain, - p.Middleware(newCORSMiddleware), - p.Middleware(newPublicOriginMiddleware), - httproute.MiddlewareFunc(httputil.NoCache), - ) apiChain := httproute.Chain( rootChain, @@ -293,7 +286,6 @@ func NewRouter(p *deps.RootProvider, configSource *configsource.ConfigSource) ht oauthAPIRoute := httproute.Route{Middleware: oauthAPIChain} dpopOauthAPIRoute := httproute.Route{Middleware: dpopOAuthAPIChain} oauthAuthzAPIRoute := httproute.Route{Middleware: oauthAuthzAPIChain} - siweAPIRoute := httproute.Route{Middleware: siweAPIChain} apiRoute := httproute.Route{Middleware: apiChain} dpopApiRoute := httproute.Route{Middleware: dpopApiChain} workflowRoute := httproute.Route{Middleware: workflowChain} @@ -445,7 +437,6 @@ func NewRouter(p *deps.RootProvider, configSource *configsource.ConfigSource) ht router.Add(webapphandler.ConfigureForceChangePasswordRoute(webappPageRoute), p.Handler(newWebAppForceChangePasswordHandler)) router.Add(webapphandler.ConfigureForceChangeSecondaryPasswordRoute(webappPageRoute), p.Handler(newWebAppForceChangeSecondaryPasswordHandler)) router.Add(webapphandler.ConfigureConnectWeb3AccountRoute(webappSIWERoute), p.Handler(newWebAppConnectWeb3AccountHandler)) - router.Add(webapphandler.ConfigureMissingWeb3WalletRoute(webappPageRoute), p.Handler(newWebAppMissingWeb3WalletHandler)) router.Add(webapphandler.ConfigureFeatureDisabledRoute(webappPageRoute), p.Handler(newWebAppFeatureDisabledHandler)) router.Add(webapphandler.ConfigureForgotPasswordSuccessRoute(webappSuccessPageRoute), p.Handler(newWebAppForgotPasswordSuccessHandler)) @@ -565,8 +556,6 @@ func NewRouter(p *deps.RootProvider, configSource *configsource.ConfigSource) ht router.Add(samlhandler.ConfigureLoginFinishRoute(samlAPIRoute), p.Handler(newSAMLLoginFinishHandler)) router.Add(samlhandler.ConfigureLogoutRoute(samlAPIRoute), p.Handler(newSAMLLogoutHandler)) - router.Add(siwehandler.ConfigureNonceRoute(siweAPIRoute), p.Handler(newSIWENonceHandler)) - router.Add(apihandler.ConfigureAnonymousUserSignupRoute(apiRoute), p.Handler(newAPIAnonymousUserSignupHandler)) router.Add(apihandler.ConfigureAnonymousUserPromotionCodeRoute(apiRoute), p.Handler(newAPIAnonymousUserPromotionCodeHandler)) router.Add(apihandler.ConfigurePresignImagesUploadRoute(apiAuthenticatedRoute), p.Handler(newAPIPresignImagesUploadHandler)) diff --git a/pkg/auth/wire_gen.go b/pkg/auth/wire_gen.go index bc01fefe7a..b2c7bb34fe 100644 --- a/pkg/auth/wire_gen.go +++ b/pkg/auth/wire_gen.go @@ -12,7 +12,6 @@ import ( "github.com/authgear/authgear-server/pkg/auth/handler/api" "github.com/authgear/authgear-server/pkg/auth/handler/oauth" saml2 "github.com/authgear/authgear-server/pkg/auth/handler/saml" - siwe3 "github.com/authgear/authgear-server/pkg/auth/handler/siwe" "github.com/authgear/authgear-server/pkg/auth/handler/webapp" "github.com/authgear/authgear-server/pkg/auth/handler/webapp/authflowv2" "github.com/authgear/authgear-server/pkg/auth/handler/webapp/viewmodels" @@ -54,10 +53,8 @@ import ( "github.com/authgear/authgear-server/pkg/lib/feature/customattrs" "github.com/authgear/authgear-server/pkg/lib/feature/forgotpassword" passkey2 "github.com/authgear/authgear-server/pkg/lib/feature/passkey" - siwe2 "github.com/authgear/authgear-server/pkg/lib/feature/siwe" stdattrs2 "github.com/authgear/authgear-server/pkg/lib/feature/stdattrs" "github.com/authgear/authgear-server/pkg/lib/feature/verification" - "github.com/authgear/authgear-server/pkg/lib/feature/web3" "github.com/authgear/authgear-server/pkg/lib/healthz" "github.com/authgear/authgear-server/pkg/lib/hook" captcha2 "github.com/authgear/authgear-server/pkg/lib/infra/captcha" @@ -306,37 +303,9 @@ func newOAuthAuthorizeHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clock, - } - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -373,7 +342,7 @@ func newOAuthAuthorizeHandler(p *deps.RequestProvider) http.Handler { } authenticatorConfig := appConfig.Authenticator authenticatorPasswordConfig := authenticatorConfig.Password - passwordLogger := password.NewLogger(factory) + logger := password.NewLogger(factory) historyStore := &password.HistoryStore{ Clock: clock, SQLBuilder: sqlBuilderApp, @@ -392,7 +361,7 @@ func newOAuthAuthorizeHandler(p *deps.RequestProvider) http.Handler { Store: passwordStore, Config: authenticatorPasswordConfig, Clock: clock, - Logger: passwordLogger, + Logger: logger, PasswordHistory: historyStore, PasswordChecker: passwordChecker, Expiry: expiry, @@ -428,6 +397,7 @@ func newOAuthAuthorizeHandler(p *deps.RequestProvider) http.Handler { } testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode + remoteIP := deps.ProvideRemoteIP(request, trustProxy) codeStoreRedis := &otp.CodeStoreRedis{ Redis: appredisHandle, AppID: appID, @@ -444,6 +414,15 @@ func newOAuthAuthorizeHandler(p *deps.RequestProvider) http.Handler { Clock: clock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clock, AppID: appID, @@ -518,13 +497,6 @@ func newOAuthAuthorizeHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -541,7 +513,6 @@ func newOAuthAuthorizeHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } idTokenIssuer := &oidc.IDTokenIssuer{ @@ -553,7 +524,7 @@ func newOAuthAuthorizeHandler(p *deps.RequestProvider) http.Handler { } userAgentString := deps.ProvideUserAgentString(request) storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clock, @@ -584,7 +555,7 @@ func newOAuthAuthorizeHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -907,8 +878,8 @@ func newOAuthAuthorizeHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -957,7 +928,6 @@ func newOAuthAuthorizeHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -970,7 +940,7 @@ func newOAuthAuthorizeHandler(p *deps.RequestProvider) http.Handler { } cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -1236,37 +1206,9 @@ func newOAuthConsentHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -1303,7 +1245,7 @@ func newOAuthConsentHandler(p *deps.RequestProvider) http.Handler { } authenticatorConfig := appConfig.Authenticator authenticatorPasswordConfig := authenticatorConfig.Password - passwordLogger := password.NewLogger(factory) + logger := password.NewLogger(factory) historyStore := &password.HistoryStore{ Clock: clockClock, SQLBuilder: sqlBuilderApp, @@ -1322,7 +1264,7 @@ func newOAuthConsentHandler(p *deps.RequestProvider) http.Handler { Store: passwordStore, Config: authenticatorPasswordConfig, Clock: clockClock, - Logger: passwordLogger, + Logger: logger, PasswordHistory: historyStore, PasswordChecker: passwordChecker, Expiry: expiry, @@ -1358,6 +1300,7 @@ func newOAuthConsentHandler(p *deps.RequestProvider) http.Handler { } testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode + remoteIP := deps.ProvideRemoteIP(request, trustProxy) codeStoreRedis := &otp.CodeStoreRedis{ Redis: appredisHandle, AppID: appID, @@ -1374,6 +1317,15 @@ func newOAuthConsentHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -1448,13 +1400,6 @@ func newOAuthConsentHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -1471,7 +1416,6 @@ func newOAuthConsentHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } idTokenIssuer := &oidc.IDTokenIssuer{ @@ -1483,7 +1427,7 @@ func newOAuthConsentHandler(p *deps.RequestProvider) http.Handler { } userAgentString := deps.ProvideUserAgentString(request) storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -1514,7 +1458,7 @@ func newOAuthConsentHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -1837,8 +1781,8 @@ func newOAuthConsentHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -1887,7 +1831,6 @@ func newOAuthConsentHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -1900,7 +1843,7 @@ func newOAuthConsentHandler(p *deps.RequestProvider) http.Handler { } cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -2287,36 +2230,9 @@ func newOAuthTokenHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - siweStoreRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: siweStoreRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -2424,6 +2340,15 @@ func newOAuthTokenHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -2498,13 +2423,6 @@ func newOAuthTokenHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -2521,7 +2439,6 @@ func newOAuthTokenHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } idTokenIssuer := &oidc.IDTokenIssuer{ @@ -2751,8 +2668,8 @@ func newOAuthTokenHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -2801,7 +2718,6 @@ func newOAuthTokenHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -3344,36 +3260,9 @@ func newOAuthRevokeHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - siweStoreRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: siweStoreRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -3481,6 +3370,15 @@ func newOAuthRevokeHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -3555,13 +3453,6 @@ func newOAuthRevokeHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -3578,7 +3469,6 @@ func newOAuthRevokeHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -3912,37 +3802,9 @@ func newOAuthJWKSHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -3979,7 +3841,7 @@ func newOAuthJWKSHandler(p *deps.RequestProvider) http.Handler { } authenticatorConfig := appConfig.Authenticator authenticatorPasswordConfig := authenticatorConfig.Password - passwordLogger := password.NewLogger(factory) + logger := password.NewLogger(factory) historyStore := &password.HistoryStore{ Clock: clockClock, SQLBuilder: sqlBuilderApp, @@ -3998,7 +3860,7 @@ func newOAuthJWKSHandler(p *deps.RequestProvider) http.Handler { Store: passwordStore, Config: authenticatorPasswordConfig, Clock: clockClock, - Logger: passwordLogger, + Logger: logger, PasswordHistory: historyStore, PasswordChecker: passwordChecker, Expiry: expiry, @@ -4034,6 +3896,7 @@ func newOAuthJWKSHandler(p *deps.RequestProvider) http.Handler { } testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode + remoteIP := deps.ProvideRemoteIP(request, trustProxy) codeStoreRedis := &otp.CodeStoreRedis{ Redis: appredisHandle, AppID: appID, @@ -4050,6 +3913,15 @@ func newOAuthJWKSHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -4124,13 +3996,6 @@ func newOAuthJWKSHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -4147,7 +4012,6 @@ func newOAuthJWKSHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } idTokenIssuer := &oidc.IDTokenIssuer{ @@ -4319,37 +4183,9 @@ func newOAuthUserInfoHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -4386,7 +4222,7 @@ func newOAuthUserInfoHandler(p *deps.RequestProvider) http.Handler { } authenticatorConfig := appConfig.Authenticator authenticatorPasswordConfig := authenticatorConfig.Password - passwordLogger := password.NewLogger(factory) + logger := password.NewLogger(factory) historyStore := &password.HistoryStore{ Clock: clockClock, SQLBuilder: sqlBuilderApp, @@ -4405,7 +4241,7 @@ func newOAuthUserInfoHandler(p *deps.RequestProvider) http.Handler { Store: passwordStore, Config: authenticatorPasswordConfig, Clock: clockClock, - Logger: passwordLogger, + Logger: logger, PasswordHistory: historyStore, PasswordChecker: passwordChecker, Expiry: expiry, @@ -4441,6 +4277,7 @@ func newOAuthUserInfoHandler(p *deps.RequestProvider) http.Handler { } testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode + remoteIP := deps.ProvideRemoteIP(request, trustProxy) codeStoreRedis := &otp.CodeStoreRedis{ Redis: appredisHandle, AppID: appID, @@ -4457,6 +4294,15 @@ func newOAuthUserInfoHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -4531,13 +4377,6 @@ func newOAuthUserInfoHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -4554,7 +4393,6 @@ func newOAuthUserInfoHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } idTokenIssuer := &oidc.IDTokenIssuer{ @@ -4815,36 +4653,9 @@ func newOAuthEndSessionHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - siweStoreRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: siweStoreRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -4952,6 +4763,15 @@ func newOAuthEndSessionHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -5026,13 +4846,6 @@ func newOAuthEndSessionHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -5049,7 +4862,6 @@ func newOAuthEndSessionHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -5465,36 +5277,9 @@ func newOAuthAppSessionTokenHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - siweStoreRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: siweStoreRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -5602,6 +5387,15 @@ func newOAuthAppSessionTokenHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -5676,13 +5470,6 @@ func newOAuthAppSessionTokenHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -5699,7 +5486,6 @@ func newOAuthAppSessionTokenHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } idTokenIssuer := &oidc.IDTokenIssuer{ @@ -5929,8 +5715,8 @@ func newOAuthAppSessionTokenHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -5979,7 +5765,6 @@ func newOAuthAppSessionTokenHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -6312,64 +6097,6 @@ func newOAuthProxyRedirectHandler(p *deps.RequestProvider) http.Handler { return oauthProxyRedirectHandler } -func newSIWENonceHandler(p *deps.RequestProvider) http.Handler { - appProvider := p.AppProvider - factory := appProvider.LoggerFactory - nonceHandlerLogger := siwe3.NewNonceHandlerLogger(factory) - request := p.Request - rootProvider := appProvider.RootProvider - environmentConfig := rootProvider.EnvironmentConfig - trustProxy := environmentConfig.TrustProxy - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - httpProto := deps.ProvideHTTPProto(request, trustProxy) - httpHost := deps.ProvideHTTPHost(request, trustProxy) - httpOrigin := httputil.MakeHTTPOrigin(httpProto, httpHost) - appContext := appProvider.AppContext - config := appContext.Config - appConfig := config.AppConfig - web3Config := appConfig.Web3 - authenticationConfig := appConfig.Authentication - clockClock := _wireSystemClockValue - handle := appProvider.Redis - appID := appConfig.ID - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - featureConfig := config.FeatureConfig - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } - jsonResponseWriterLogger := httputil.NewJSONResponseWriterLogger(factory) - jsonResponseWriter := &httputil.JSONResponseWriter{ - Logger: jsonResponseWriterLogger, - } - nonceHandler := &siwe3.NonceHandler{ - Logger: nonceHandlerLogger, - SIWE: siweService, - JSON: jsonResponseWriter, - } - return nonceHandler -} - func newAPIAnonymousUserSignupHandler(p *deps.RequestProvider) http.Handler { appProvider := p.AppProvider factory := appProvider.LoggerFactory @@ -6549,36 +6276,9 @@ func newAPIAnonymousUserSignupHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -6686,6 +6386,15 @@ func newAPIAnonymousUserSignupHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -6760,13 +6469,6 @@ func newAPIAnonymousUserSignupHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -6783,7 +6485,6 @@ func newAPIAnonymousUserSignupHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -7003,8 +6704,8 @@ func newAPIAnonymousUserSignupHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -7053,7 +6754,6 @@ func newAPIAnonymousUserSignupHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -7069,7 +6769,7 @@ func newAPIAnonymousUserSignupHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -7080,7 +6780,7 @@ func newAPIAnonymousUserSignupHandler(p *deps.RequestProvider) http.Handler { cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -7109,7 +6809,7 @@ func newAPIAnonymousUserSignupHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -7564,36 +7264,9 @@ func newAPIAnonymousUserPromotionCodeHandler(p *deps.RequestProvider) http.Handl SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -7701,6 +7374,15 @@ func newAPIAnonymousUserPromotionCodeHandler(p *deps.RequestProvider) http.Handl Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -7775,13 +7457,6 @@ func newAPIAnonymousUserPromotionCodeHandler(p *deps.RequestProvider) http.Handl UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -7798,7 +7473,6 @@ func newAPIAnonymousUserPromotionCodeHandler(p *deps.RequestProvider) http.Handl Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -8018,8 +7692,8 @@ func newAPIAnonymousUserPromotionCodeHandler(p *deps.RequestProvider) http.Handl AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -8068,7 +7742,6 @@ func newAPIAnonymousUserPromotionCodeHandler(p *deps.RequestProvider) http.Handl UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -8084,7 +7757,7 @@ func newAPIAnonymousUserPromotionCodeHandler(p *deps.RequestProvider) http.Handl SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -8095,7 +7768,7 @@ func newAPIAnonymousUserPromotionCodeHandler(p *deps.RequestProvider) http.Handl cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -8124,7 +7797,7 @@ func newAPIAnonymousUserPromotionCodeHandler(p *deps.RequestProvider) http.Handl UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -8711,36 +8384,9 @@ func newWebAppLoginHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -8848,6 +8494,15 @@ func newWebAppLoginHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -8922,13 +8577,6 @@ func newWebAppLoginHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -8945,7 +8593,6 @@ func newWebAppLoginHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -9165,8 +8812,8 @@ func newWebAppLoginHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -9215,7 +8862,6 @@ func newWebAppLoginHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -9231,7 +8877,7 @@ func newWebAppLoginHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -9240,7 +8886,7 @@ func newWebAppLoginHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -9269,7 +8915,7 @@ func newWebAppLoginHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -9754,36 +9400,9 @@ func newWebAppSignupHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -9891,6 +9510,15 @@ func newWebAppSignupHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -9965,13 +9593,6 @@ func newWebAppSignupHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -9988,7 +9609,6 @@ func newWebAppSignupHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -10208,8 +9828,8 @@ func newWebAppSignupHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -10258,7 +9878,6 @@ func newWebAppSignupHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -10274,7 +9893,7 @@ func newWebAppSignupHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -10283,7 +9902,7 @@ func newWebAppSignupHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -10312,7 +9931,7 @@ func newWebAppSignupHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -10796,36 +10415,9 @@ func newWebAppPromoteHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -10933,6 +10525,15 @@ func newWebAppPromoteHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -11007,13 +10608,6 @@ func newWebAppPromoteHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -11030,7 +10624,6 @@ func newWebAppPromoteHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -11250,8 +10843,8 @@ func newWebAppPromoteHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -11300,7 +10893,6 @@ func newWebAppPromoteHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -11316,7 +10908,7 @@ func newWebAppPromoteHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -11325,7 +10917,7 @@ func newWebAppPromoteHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -11354,7 +10946,7 @@ func newWebAppPromoteHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -11838,36 +11430,9 @@ func newWebAppSelectAccountHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -11975,6 +11540,15 @@ func newWebAppSelectAccountHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -12049,13 +11623,6 @@ func newWebAppSelectAccountHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -12072,7 +11639,6 @@ func newWebAppSelectAccountHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -12292,8 +11858,8 @@ func newWebAppSelectAccountHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -12342,7 +11908,6 @@ func newWebAppSelectAccountHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -12358,7 +11923,7 @@ func newWebAppSelectAccountHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -12367,7 +11932,7 @@ func newWebAppSelectAccountHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -12396,7 +11961,7 @@ func newWebAppSelectAccountHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -12858,36 +12423,9 @@ func newWebAppAuthflowV2VerifyBotProtectionHandler(p *deps.RequestProvider) http SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -12995,6 +12533,15 @@ func newWebAppAuthflowV2VerifyBotProtectionHandler(p *deps.RequestProvider) http Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -13069,13 +12616,6 @@ func newWebAppAuthflowV2VerifyBotProtectionHandler(p *deps.RequestProvider) http UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -13092,7 +12632,6 @@ func newWebAppAuthflowV2VerifyBotProtectionHandler(p *deps.RequestProvider) http Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -13215,7 +12754,6 @@ func newWebAppAuthflowV2VerifyBotProtectionHandler(p *deps.RequestProvider) http UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -13327,8 +12865,8 @@ func newWebAppAuthflowV2VerifyBotProtectionHandler(p *deps.RequestProvider) http AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -13378,7 +12916,7 @@ func newWebAppAuthflowV2VerifyBotProtectionHandler(p *deps.RequestProvider) http SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -13387,7 +12925,7 @@ func newWebAppAuthflowV2VerifyBotProtectionHandler(p *deps.RequestProvider) http sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -13426,7 +12964,7 @@ func newWebAppAuthflowV2VerifyBotProtectionHandler(p *deps.RequestProvider) http UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -14004,36 +13542,9 @@ func newWebAppAuthflowV2SelectAccountHandler(p *deps.RequestProvider) http.Handl SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -14141,6 +13652,15 @@ func newWebAppAuthflowV2SelectAccountHandler(p *deps.RequestProvider) http.Handl Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -14215,13 +13735,6 @@ func newWebAppAuthflowV2SelectAccountHandler(p *deps.RequestProvider) http.Handl UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -14238,7 +13751,6 @@ func newWebAppAuthflowV2SelectAccountHandler(p *deps.RequestProvider) http.Handl Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -14458,8 +13970,8 @@ func newWebAppAuthflowV2SelectAccountHandler(p *deps.RequestProvider) http.Handl AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -14508,7 +14020,6 @@ func newWebAppAuthflowV2SelectAccountHandler(p *deps.RequestProvider) http.Handl UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -14524,7 +14035,7 @@ func newWebAppAuthflowV2SelectAccountHandler(p *deps.RequestProvider) http.Handl SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -14533,7 +14044,7 @@ func newWebAppAuthflowV2SelectAccountHandler(p *deps.RequestProvider) http.Handl sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -14562,7 +14073,7 @@ func newWebAppAuthflowV2SelectAccountHandler(p *deps.RequestProvider) http.Handl UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -15024,36 +14535,9 @@ func newWebAppSSOCallbackHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -15161,6 +14645,15 @@ func newWebAppSSOCallbackHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -15235,13 +14728,6 @@ func newWebAppSSOCallbackHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -15258,7 +14744,6 @@ func newWebAppSSOCallbackHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -15381,7 +14866,6 @@ func newWebAppSSOCallbackHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -15493,8 +14977,8 @@ func newWebAppSSOCallbackHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -15544,7 +15028,7 @@ func newWebAppSSOCallbackHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -15553,7 +15037,7 @@ func newWebAppSSOCallbackHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -15592,7 +15076,7 @@ func newWebAppSSOCallbackHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -16266,36 +15750,9 @@ func newWebAppAuthflowSSOCallbackHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -16403,6 +15860,15 @@ func newWebAppAuthflowSSOCallbackHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -16477,13 +15943,6 @@ func newWebAppAuthflowSSOCallbackHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -16500,7 +15959,6 @@ func newWebAppAuthflowSSOCallbackHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -16623,7 +16081,6 @@ func newWebAppAuthflowSSOCallbackHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -16735,8 +16192,8 @@ func newWebAppAuthflowSSOCallbackHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -16786,7 +16243,7 @@ func newWebAppAuthflowSSOCallbackHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -16795,7 +16252,7 @@ func newWebAppAuthflowSSOCallbackHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -16834,7 +16291,7 @@ func newWebAppAuthflowSSOCallbackHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -17508,36 +16965,9 @@ func newWebAppAuthflowV2SSOCallbackHandler(p *deps.RequestProvider) http.Handler SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -17645,6 +17075,15 @@ func newWebAppAuthflowV2SSOCallbackHandler(p *deps.RequestProvider) http.Handler Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -17719,13 +17158,6 @@ func newWebAppAuthflowV2SSOCallbackHandler(p *deps.RequestProvider) http.Handler UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -17742,7 +17174,6 @@ func newWebAppAuthflowV2SSOCallbackHandler(p *deps.RequestProvider) http.Handler Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -17865,7 +17296,6 @@ func newWebAppAuthflowV2SSOCallbackHandler(p *deps.RequestProvider) http.Handler UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -17977,8 +17407,8 @@ func newWebAppAuthflowV2SSOCallbackHandler(p *deps.RequestProvider) http.Handler AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -18028,7 +17458,7 @@ func newWebAppAuthflowV2SSOCallbackHandler(p *deps.RequestProvider) http.Handler SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -18037,7 +17467,7 @@ func newWebAppAuthflowV2SSOCallbackHandler(p *deps.RequestProvider) http.Handler sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -18076,7 +17506,7 @@ func newWebAppAuthflowV2SSOCallbackHandler(p *deps.RequestProvider) http.Handler UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -18772,36 +18202,9 @@ func newWechatAuthHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -18909,6 +18312,15 @@ func newWechatAuthHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -18983,13 +18395,6 @@ func newWechatAuthHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -19006,7 +18411,6 @@ func newWechatAuthHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -19226,8 +18630,8 @@ func newWechatAuthHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -19276,7 +18680,6 @@ func newWechatAuthHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -19292,7 +18695,7 @@ func newWechatAuthHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -19301,7 +18704,7 @@ func newWechatAuthHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -19330,7 +18733,7 @@ func newWechatAuthHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -19799,36 +19202,9 @@ func newWechatCallbackHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -19936,6 +19312,15 @@ func newWechatCallbackHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -20010,13 +19395,6 @@ func newWechatCallbackHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -20033,7 +19411,6 @@ func newWechatCallbackHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -20253,8 +19630,8 @@ func newWechatCallbackHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -20303,7 +19680,6 @@ func newWechatCallbackHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -20319,7 +19695,7 @@ func newWechatCallbackHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -20328,7 +19704,7 @@ func newWechatCallbackHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -20357,7 +19733,7 @@ func newWechatCallbackHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -20831,36 +20207,9 @@ func newWebAppEnterLoginIDHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -20968,6 +20317,15 @@ func newWebAppEnterLoginIDHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -21042,13 +20400,6 @@ func newWebAppEnterLoginIDHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -21065,7 +20416,6 @@ func newWebAppEnterLoginIDHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -21285,8 +20635,8 @@ func newWebAppEnterLoginIDHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -21335,7 +20685,6 @@ func newWebAppEnterLoginIDHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -21351,7 +20700,7 @@ func newWebAppEnterLoginIDHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -21360,7 +20709,7 @@ func newWebAppEnterLoginIDHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -21389,7 +20738,7 @@ func newWebAppEnterLoginIDHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -21865,36 +21214,9 @@ func newWebAppEnterPasswordHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -22002,6 +21324,15 @@ func newWebAppEnterPasswordHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -22076,13 +21407,6 @@ func newWebAppEnterPasswordHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -22099,7 +21423,6 @@ func newWebAppEnterPasswordHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -22319,8 +21642,8 @@ func newWebAppEnterPasswordHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -22369,7 +21692,6 @@ func newWebAppEnterPasswordHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -22385,7 +21707,7 @@ func newWebAppEnterPasswordHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -22394,7 +21716,7 @@ func newWebAppEnterPasswordHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -22423,7 +21745,7 @@ func newWebAppEnterPasswordHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -22896,36 +22218,9 @@ func newWebConfirmTerminateOtherSessionsHandler(p *deps.RequestProvider) http.Ha SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -23033,6 +22328,15 @@ func newWebConfirmTerminateOtherSessionsHandler(p *deps.RequestProvider) http.Ha Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -23107,13 +22411,6 @@ func newWebConfirmTerminateOtherSessionsHandler(p *deps.RequestProvider) http.Ha UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -23130,7 +22427,6 @@ func newWebConfirmTerminateOtherSessionsHandler(p *deps.RequestProvider) http.Ha Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -23350,8 +22646,8 @@ func newWebConfirmTerminateOtherSessionsHandler(p *deps.RequestProvider) http.Ha AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -23400,7 +22696,6 @@ func newWebConfirmTerminateOtherSessionsHandler(p *deps.RequestProvider) http.Ha UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -23416,7 +22711,7 @@ func newWebConfirmTerminateOtherSessionsHandler(p *deps.RequestProvider) http.Ha SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -23425,7 +22720,7 @@ func newWebConfirmTerminateOtherSessionsHandler(p *deps.RequestProvider) http.Ha sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -23454,7 +22749,7 @@ func newWebConfirmTerminateOtherSessionsHandler(p *deps.RequestProvider) http.Ha UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -23924,36 +23219,9 @@ func newWebAppUsePasskeyHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -24061,6 +23329,15 @@ func newWebAppUsePasskeyHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -24135,13 +23412,6 @@ func newWebAppUsePasskeyHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -24158,7 +23428,6 @@ func newWebAppUsePasskeyHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -24378,8 +23647,8 @@ func newWebAppUsePasskeyHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -24428,7 +23697,6 @@ func newWebAppUsePasskeyHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -24444,7 +23712,7 @@ func newWebAppUsePasskeyHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -24453,7 +23721,7 @@ func newWebAppUsePasskeyHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -24482,7 +23750,7 @@ func newWebAppUsePasskeyHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -24955,36 +24223,9 @@ func newWebAppCreatePasswordHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -25092,6 +24333,15 @@ func newWebAppCreatePasswordHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -25166,13 +24416,6 @@ func newWebAppCreatePasswordHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -25189,7 +24432,6 @@ func newWebAppCreatePasswordHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -25409,8 +24651,8 @@ func newWebAppCreatePasswordHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -25459,7 +24701,6 @@ func newWebAppCreatePasswordHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -25475,7 +24716,7 @@ func newWebAppCreatePasswordHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -25484,7 +24725,7 @@ func newWebAppCreatePasswordHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -25513,7 +24754,7 @@ func newWebAppCreatePasswordHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -25987,36 +25228,9 @@ func newWebAppCreatePasskeyHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -26124,6 +25338,15 @@ func newWebAppCreatePasskeyHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -26198,13 +25421,6 @@ func newWebAppCreatePasskeyHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -26221,7 +25437,6 @@ func newWebAppCreatePasskeyHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -26441,8 +25656,8 @@ func newWebAppCreatePasskeyHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -26491,7 +25706,6 @@ func newWebAppCreatePasskeyHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -26507,7 +25721,7 @@ func newWebAppCreatePasskeyHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -26516,7 +25730,7 @@ func newWebAppCreatePasskeyHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -26545,7 +25759,7 @@ func newWebAppCreatePasskeyHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -27018,36 +26232,9 @@ func newWebAppPromptCreatePasskeyHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -27155,6 +26342,15 @@ func newWebAppPromptCreatePasskeyHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -27229,13 +26425,6 @@ func newWebAppPromptCreatePasskeyHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -27252,7 +26441,6 @@ func newWebAppPromptCreatePasskeyHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -27472,8 +26660,8 @@ func newWebAppPromptCreatePasskeyHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -27522,7 +26710,6 @@ func newWebAppPromptCreatePasskeyHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -27538,7 +26725,7 @@ func newWebAppPromptCreatePasskeyHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -27547,7 +26734,7 @@ func newWebAppPromptCreatePasskeyHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -27576,7 +26763,7 @@ func newWebAppPromptCreatePasskeyHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -28049,36 +27236,9 @@ func newWebAppSetupTOTPHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -28186,6 +27346,15 @@ func newWebAppSetupTOTPHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -28260,13 +27429,6 @@ func newWebAppSetupTOTPHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -28283,7 +27445,6 @@ func newWebAppSetupTOTPHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -28503,8 +27664,8 @@ func newWebAppSetupTOTPHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -28553,7 +27714,6 @@ func newWebAppSetupTOTPHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -28569,7 +27729,7 @@ func newWebAppSetupTOTPHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -28578,7 +27738,7 @@ func newWebAppSetupTOTPHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -28607,7 +27767,7 @@ func newWebAppSetupTOTPHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -29082,36 +28242,9 @@ func newWebAppEnterTOTPHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -29219,6 +28352,15 @@ func newWebAppEnterTOTPHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -29293,13 +28435,6 @@ func newWebAppEnterTOTPHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -29316,7 +28451,6 @@ func newWebAppEnterTOTPHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -29536,8 +28670,8 @@ func newWebAppEnterTOTPHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -29586,7 +28720,6 @@ func newWebAppEnterTOTPHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -29602,7 +28735,7 @@ func newWebAppEnterTOTPHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -29611,7 +28744,7 @@ func newWebAppEnterTOTPHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -29640,7 +28773,7 @@ func newWebAppEnterTOTPHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -30113,36 +29246,9 @@ func newWebAppSetupOOBOTPHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -30250,6 +29356,15 @@ func newWebAppSetupOOBOTPHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -30324,13 +29439,6 @@ func newWebAppSetupOOBOTPHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -30347,7 +29455,6 @@ func newWebAppSetupOOBOTPHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -30567,8 +29674,8 @@ func newWebAppSetupOOBOTPHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -30617,7 +29724,6 @@ func newWebAppSetupOOBOTPHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -30633,7 +29739,7 @@ func newWebAppSetupOOBOTPHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -30642,7 +29748,7 @@ func newWebAppSetupOOBOTPHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -30671,7 +29777,7 @@ func newWebAppSetupOOBOTPHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -31144,36 +30250,9 @@ func newWebAppEnterOOBOTPHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -31281,6 +30360,15 @@ func newWebAppEnterOOBOTPHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -31355,13 +30443,6 @@ func newWebAppEnterOOBOTPHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -31378,7 +30459,6 @@ func newWebAppEnterOOBOTPHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -31598,8 +30678,8 @@ func newWebAppEnterOOBOTPHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -31648,7 +30728,6 @@ func newWebAppEnterOOBOTPHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -31664,7 +30743,7 @@ func newWebAppEnterOOBOTPHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -31673,7 +30752,7 @@ func newWebAppEnterOOBOTPHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -31702,7 +30781,7 @@ func newWebAppEnterOOBOTPHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -32179,36 +31258,9 @@ func newWebAppSetupWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -32316,6 +31368,15 @@ func newWebAppSetupWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -32390,13 +31451,6 @@ func newWebAppSetupWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -32413,7 +31467,6 @@ func newWebAppSetupWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -32633,8 +31686,8 @@ func newWebAppSetupWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -32683,7 +31736,6 @@ func newWebAppSetupWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -32699,7 +31751,7 @@ func newWebAppSetupWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -32708,7 +31760,7 @@ func newWebAppSetupWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -32737,7 +31789,7 @@ func newWebAppSetupWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -33210,36 +32262,9 @@ func newWebAppWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -33347,6 +32372,15 @@ func newWebAppWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -33421,13 +32455,6 @@ func newWebAppWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -33444,7 +32471,6 @@ func newWebAppWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -33664,8 +32690,8 @@ func newWebAppWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -33714,7 +32740,6 @@ func newWebAppWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -33730,7 +32755,7 @@ func newWebAppWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -33739,7 +32764,7 @@ func newWebAppWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -33768,7 +32793,7 @@ func newWebAppWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -34245,36 +33270,9 @@ func newWebAppSetupLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -34382,6 +33380,15 @@ func newWebAppSetupLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -34456,13 +33463,6 @@ func newWebAppSetupLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -34479,7 +33479,6 @@ func newWebAppSetupLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -34699,8 +33698,8 @@ func newWebAppSetupLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -34749,7 +33748,6 @@ func newWebAppSetupLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -34765,7 +33763,7 @@ func newWebAppSetupLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -34774,7 +33772,7 @@ func newWebAppSetupLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -34803,7 +33801,7 @@ func newWebAppSetupLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -35315,27 +34313,9 @@ func newWebAppLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -35487,13 +34467,6 @@ func newWebAppLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -35510,7 +34483,6 @@ func newWebAppLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -35730,8 +34702,8 @@ func newWebAppLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -35780,7 +34752,6 @@ func newWebAppLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -35796,7 +34767,7 @@ func newWebAppLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -35805,7 +34776,7 @@ func newWebAppLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -35834,7 +34805,7 @@ func newWebAppLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -36354,27 +35325,9 @@ func newWebAppVerifyLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -36526,13 +35479,6 @@ func newWebAppVerifyLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -36549,7 +35495,6 @@ func newWebAppVerifyLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -36769,8 +35714,8 @@ func newWebAppVerifyLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -36819,7 +35764,6 @@ func newWebAppVerifyLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -36835,7 +35779,7 @@ func newWebAppVerifyLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -36844,7 +35788,7 @@ func newWebAppVerifyLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -36873,7 +35817,7 @@ func newWebAppVerifyLoginLinkOTPHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -37405,27 +36349,9 @@ func newWebAppAuthflowV2VerifyLoginLinkOTPHandler(p *deps.RequestProvider) http. SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -37577,13 +36503,6 @@ func newWebAppAuthflowV2VerifyLoginLinkOTPHandler(p *deps.RequestProvider) http. UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -37600,7 +36519,6 @@ func newWebAppAuthflowV2VerifyLoginLinkOTPHandler(p *deps.RequestProvider) http. Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -37820,8 +36738,8 @@ func newWebAppAuthflowV2VerifyLoginLinkOTPHandler(p *deps.RequestProvider) http. AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -37870,7 +36788,6 @@ func newWebAppAuthflowV2VerifyLoginLinkOTPHandler(p *deps.RequestProvider) http. UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -37886,7 +36803,7 @@ func newWebAppAuthflowV2VerifyLoginLinkOTPHandler(p *deps.RequestProvider) http. SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -37895,7 +36812,7 @@ func newWebAppAuthflowV2VerifyLoginLinkOTPHandler(p *deps.RequestProvider) http. sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -37924,7 +36841,7 @@ func newWebAppAuthflowV2VerifyLoginLinkOTPHandler(p *deps.RequestProvider) http. UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -38407,36 +37324,9 @@ func newWebAppEnterRecoveryCodeHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -38544,6 +37434,15 @@ func newWebAppEnterRecoveryCodeHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -38618,13 +37517,6 @@ func newWebAppEnterRecoveryCodeHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -38641,7 +37533,6 @@ func newWebAppEnterRecoveryCodeHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -38861,8 +37752,8 @@ func newWebAppEnterRecoveryCodeHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -38911,7 +37802,6 @@ func newWebAppEnterRecoveryCodeHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -38927,7 +37817,7 @@ func newWebAppEnterRecoveryCodeHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -38936,7 +37826,7 @@ func newWebAppEnterRecoveryCodeHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -38965,7 +37855,7 @@ func newWebAppEnterRecoveryCodeHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -39438,36 +38328,9 @@ func newWebAppSetupRecoveryCodeHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -39575,6 +38438,15 @@ func newWebAppSetupRecoveryCodeHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -39649,13 +38521,6 @@ func newWebAppSetupRecoveryCodeHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -39672,7 +38537,6 @@ func newWebAppSetupRecoveryCodeHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -39892,8 +38756,8 @@ func newWebAppSetupRecoveryCodeHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -39942,7 +38806,6 @@ func newWebAppSetupRecoveryCodeHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -39958,7 +38821,7 @@ func newWebAppSetupRecoveryCodeHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -39967,7 +38830,7 @@ func newWebAppSetupRecoveryCodeHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -39996,7 +38859,7 @@ func newWebAppSetupRecoveryCodeHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -40465,36 +39328,9 @@ func newWebAppVerifyIdentityHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -40602,6 +39438,15 @@ func newWebAppVerifyIdentityHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -40676,13 +39521,6 @@ func newWebAppVerifyIdentityHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -40699,7 +39537,6 @@ func newWebAppVerifyIdentityHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -40919,8 +39756,8 @@ func newWebAppVerifyIdentityHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -40969,7 +39806,6 @@ func newWebAppVerifyIdentityHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -40985,7 +39821,7 @@ func newWebAppVerifyIdentityHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -40994,7 +39830,7 @@ func newWebAppVerifyIdentityHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -41023,7 +39859,7 @@ func newWebAppVerifyIdentityHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -41496,36 +40332,9 @@ func newWebAppVerifyIdentitySuccessHandler(p *deps.RequestProvider) http.Handler SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -41633,6 +40442,15 @@ func newWebAppVerifyIdentitySuccessHandler(p *deps.RequestProvider) http.Handler Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -41707,13 +40525,6 @@ func newWebAppVerifyIdentitySuccessHandler(p *deps.RequestProvider) http.Handler UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -41730,7 +40541,6 @@ func newWebAppVerifyIdentitySuccessHandler(p *deps.RequestProvider) http.Handler Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -41950,8 +40760,8 @@ func newWebAppVerifyIdentitySuccessHandler(p *deps.RequestProvider) http.Handler AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -42000,7 +40810,6 @@ func newWebAppVerifyIdentitySuccessHandler(p *deps.RequestProvider) http.Handler UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -42016,7 +40825,7 @@ func newWebAppVerifyIdentitySuccessHandler(p *deps.RequestProvider) http.Handler SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -42025,7 +40834,7 @@ func newWebAppVerifyIdentitySuccessHandler(p *deps.RequestProvider) http.Handler sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -42054,7 +40863,7 @@ func newWebAppVerifyIdentitySuccessHandler(p *deps.RequestProvider) http.Handler UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -42523,36 +41332,9 @@ func newWebAppForgotPasswordHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -42660,6 +41442,15 @@ func newWebAppForgotPasswordHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -42734,13 +41525,6 @@ func newWebAppForgotPasswordHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -42757,7 +41541,6 @@ func newWebAppForgotPasswordHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -42977,8 +41760,8 @@ func newWebAppForgotPasswordHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -43027,7 +41810,6 @@ func newWebAppForgotPasswordHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -43043,7 +41825,7 @@ func newWebAppForgotPasswordHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -43052,7 +41834,7 @@ func newWebAppForgotPasswordHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -43081,7 +41863,7 @@ func newWebAppForgotPasswordHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -43560,36 +42342,9 @@ func newWebAppForgotPasswordSuccessHandler(p *deps.RequestProvider) http.Handler SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -43697,6 +42452,15 @@ func newWebAppForgotPasswordSuccessHandler(p *deps.RequestProvider) http.Handler Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -43771,13 +42535,6 @@ func newWebAppForgotPasswordSuccessHandler(p *deps.RequestProvider) http.Handler UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -43794,7 +42551,6 @@ func newWebAppForgotPasswordSuccessHandler(p *deps.RequestProvider) http.Handler Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -44014,8 +42770,8 @@ func newWebAppForgotPasswordSuccessHandler(p *deps.RequestProvider) http.Handler AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -44064,7 +42820,6 @@ func newWebAppForgotPasswordSuccessHandler(p *deps.RequestProvider) http.Handler UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -44080,7 +42835,7 @@ func newWebAppForgotPasswordSuccessHandler(p *deps.RequestProvider) http.Handler SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -44089,7 +42844,7 @@ func newWebAppForgotPasswordSuccessHandler(p *deps.RequestProvider) http.Handler sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -44118,7 +42873,7 @@ func newWebAppForgotPasswordSuccessHandler(p *deps.RequestProvider) http.Handler UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -44587,36 +43342,9 @@ func newWebAppResetPasswordHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -44724,6 +43452,15 @@ func newWebAppResetPasswordHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -44798,13 +43535,6 @@ func newWebAppResetPasswordHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -44821,7 +43551,6 @@ func newWebAppResetPasswordHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -45041,8 +43770,8 @@ func newWebAppResetPasswordHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -45091,7 +43820,6 @@ func newWebAppResetPasswordHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -45107,7 +43835,7 @@ func newWebAppResetPasswordHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -45116,7 +43844,7 @@ func newWebAppResetPasswordHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -45145,7 +43873,7 @@ func newWebAppResetPasswordHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -45616,36 +44344,9 @@ func newWebAppResetPasswordSuccessHandler(p *deps.RequestProvider) http.Handler SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -45753,6 +44454,15 @@ func newWebAppResetPasswordSuccessHandler(p *deps.RequestProvider) http.Handler Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -45827,13 +44537,6 @@ func newWebAppResetPasswordSuccessHandler(p *deps.RequestProvider) http.Handler UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -45850,7 +44553,6 @@ func newWebAppResetPasswordSuccessHandler(p *deps.RequestProvider) http.Handler Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -46070,8 +44772,8 @@ func newWebAppResetPasswordSuccessHandler(p *deps.RequestProvider) http.Handler AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -46120,7 +44822,6 @@ func newWebAppResetPasswordSuccessHandler(p *deps.RequestProvider) http.Handler UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -46136,7 +44837,7 @@ func newWebAppResetPasswordSuccessHandler(p *deps.RequestProvider) http.Handler SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -46145,7 +44846,7 @@ func newWebAppResetPasswordSuccessHandler(p *deps.RequestProvider) http.Handler sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -46174,7 +44875,7 @@ func newWebAppResetPasswordSuccessHandler(p *deps.RequestProvider) http.Handler UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -46643,36 +45344,9 @@ func newWebAppSettingsHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -46780,6 +45454,15 @@ func newWebAppSettingsHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -46854,13 +45537,6 @@ func newWebAppSettingsHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -46877,7 +45553,6 @@ func newWebAppSettingsHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -47097,8 +45772,8 @@ func newWebAppSettingsHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -47147,7 +45822,6 @@ func newWebAppSettingsHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -47163,7 +45837,7 @@ func newWebAppSettingsHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -47172,7 +45846,7 @@ func newWebAppSettingsHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -47201,7 +45875,7 @@ func newWebAppSettingsHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -47705,36 +46379,9 @@ func newWebAppAuthflowV2SettingsHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -47842,6 +46489,15 @@ func newWebAppAuthflowV2SettingsHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -47916,13 +46572,6 @@ func newWebAppAuthflowV2SettingsHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -47939,7 +46588,6 @@ func newWebAppAuthflowV2SettingsHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -48159,8 +46807,8 @@ func newWebAppAuthflowV2SettingsHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -48209,7 +46857,6 @@ func newWebAppAuthflowV2SettingsHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -48225,7 +46872,7 @@ func newWebAppAuthflowV2SettingsHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -48234,7 +46881,7 @@ func newWebAppAuthflowV2SettingsHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -48263,7 +46910,7 @@ func newWebAppAuthflowV2SettingsHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -48762,36 +47409,9 @@ func newWebAppSettingsProfileHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -48899,6 +47519,15 @@ func newWebAppSettingsProfileHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -48973,13 +47602,6 @@ func newWebAppSettingsProfileHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -48996,7 +47618,6 @@ func newWebAppSettingsProfileHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -49216,8 +47837,8 @@ func newWebAppSettingsProfileHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -49266,7 +47887,6 @@ func newWebAppSettingsProfileHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -49282,7 +47902,7 @@ func newWebAppSettingsProfileHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -49291,7 +47911,7 @@ func newWebAppSettingsProfileHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -49320,7 +47940,7 @@ func newWebAppSettingsProfileHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -49800,36 +48420,9 @@ func newWebAppSettingsProfileEditHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -49937,6 +48530,15 @@ func newWebAppSettingsProfileEditHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -50011,13 +48613,6 @@ func newWebAppSettingsProfileEditHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -50034,7 +48629,6 @@ func newWebAppSettingsProfileEditHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -50254,8 +48848,8 @@ func newWebAppSettingsProfileEditHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -50304,7 +48898,6 @@ func newWebAppSettingsProfileEditHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -50320,7 +48913,7 @@ func newWebAppSettingsProfileEditHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -50329,7 +48922,7 @@ func newWebAppSettingsProfileEditHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -50358,7 +48951,7 @@ func newWebAppSettingsProfileEditHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -50850,36 +49443,9 @@ func newWebAppAuthflowV2SettingsProfileEditHandler(p *deps.RequestProvider) http SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -50987,6 +49553,15 @@ func newWebAppAuthflowV2SettingsProfileEditHandler(p *deps.RequestProvider) http Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -51061,13 +49636,6 @@ func newWebAppAuthflowV2SettingsProfileEditHandler(p *deps.RequestProvider) http UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -51084,7 +49652,6 @@ func newWebAppAuthflowV2SettingsProfileEditHandler(p *deps.RequestProvider) http Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -51304,8 +49871,8 @@ func newWebAppAuthflowV2SettingsProfileEditHandler(p *deps.RequestProvider) http AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -51354,7 +49921,6 @@ func newWebAppAuthflowV2SettingsProfileEditHandler(p *deps.RequestProvider) http UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -51370,7 +49936,7 @@ func newWebAppAuthflowV2SettingsProfileEditHandler(p *deps.RequestProvider) http SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -51379,7 +49945,7 @@ func newWebAppAuthflowV2SettingsProfileEditHandler(p *deps.RequestProvider) http sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -51408,7 +49974,7 @@ func newWebAppAuthflowV2SettingsProfileEditHandler(p *deps.RequestProvider) http UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -51902,36 +50468,9 @@ func newWebAppSettingsIdentityHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -52039,6 +50578,15 @@ func newWebAppSettingsIdentityHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -52113,13 +50661,6 @@ func newWebAppSettingsIdentityHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -52136,7 +50677,6 @@ func newWebAppSettingsIdentityHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -52356,8 +50896,8 @@ func newWebAppSettingsIdentityHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -52406,7 +50946,6 @@ func newWebAppSettingsIdentityHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -52422,7 +50961,7 @@ func newWebAppSettingsIdentityHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -52431,7 +50970,7 @@ func newWebAppSettingsIdentityHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -52460,7 +50999,7 @@ func newWebAppSettingsIdentityHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -52937,36 +51476,9 @@ func newWebAppSettingsBiometricHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -53074,6 +51586,15 @@ func newWebAppSettingsBiometricHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -53148,13 +51669,6 @@ func newWebAppSettingsBiometricHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -53171,7 +51685,6 @@ func newWebAppSettingsBiometricHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -53391,8 +51904,8 @@ func newWebAppSettingsBiometricHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -53441,7 +51954,6 @@ func newWebAppSettingsBiometricHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -53457,7 +51969,7 @@ func newWebAppSettingsBiometricHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -53466,7 +51978,7 @@ func newWebAppSettingsBiometricHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -53495,7 +52007,7 @@ func newWebAppSettingsBiometricHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -53965,36 +52477,9 @@ func newWebAppAuthflowV2SettingsBiometricHandler(p *deps.RequestProvider) http.H SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -54102,6 +52587,15 @@ func newWebAppAuthflowV2SettingsBiometricHandler(p *deps.RequestProvider) http.H Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -54176,13 +52670,6 @@ func newWebAppAuthflowV2SettingsBiometricHandler(p *deps.RequestProvider) http.H UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -54199,7 +52686,6 @@ func newWebAppAuthflowV2SettingsBiometricHandler(p *deps.RequestProvider) http.H Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -54419,8 +52905,8 @@ func newWebAppAuthflowV2SettingsBiometricHandler(p *deps.RequestProvider) http.H AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -54469,7 +52955,6 @@ func newWebAppAuthflowV2SettingsBiometricHandler(p *deps.RequestProvider) http.H UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -54485,7 +52970,7 @@ func newWebAppAuthflowV2SettingsBiometricHandler(p *deps.RequestProvider) http.H SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -54494,7 +52979,7 @@ func newWebAppAuthflowV2SettingsBiometricHandler(p *deps.RequestProvider) http.H sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -54523,7 +53008,7 @@ func newWebAppAuthflowV2SettingsBiometricHandler(p *deps.RequestProvider) http.H UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -55033,36 +53518,9 @@ func newWebAppSettingsMFAHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -55170,6 +53628,15 @@ func newWebAppSettingsMFAHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -55244,13 +53711,6 @@ func newWebAppSettingsMFAHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -55267,7 +53727,6 @@ func newWebAppSettingsMFAHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -55487,8 +53946,8 @@ func newWebAppSettingsMFAHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -55537,7 +53996,6 @@ func newWebAppSettingsMFAHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -55553,7 +54011,7 @@ func newWebAppSettingsMFAHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -55562,7 +54020,7 @@ func newWebAppSettingsMFAHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -55591,7 +54049,7 @@ func newWebAppSettingsMFAHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -56072,36 +54530,9 @@ func newWebAppAuthflowV2SettingsMFAHandler(p *deps.RequestProvider) http.Handler SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -56209,6 +54640,15 @@ func newWebAppAuthflowV2SettingsMFAHandler(p *deps.RequestProvider) http.Handler Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -56283,13 +54723,6 @@ func newWebAppAuthflowV2SettingsMFAHandler(p *deps.RequestProvider) http.Handler UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -56306,7 +54739,6 @@ func newWebAppAuthflowV2SettingsMFAHandler(p *deps.RequestProvider) http.Handler Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -56526,8 +54958,8 @@ func newWebAppAuthflowV2SettingsMFAHandler(p *deps.RequestProvider) http.Handler AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -56576,7 +55008,6 @@ func newWebAppAuthflowV2SettingsMFAHandler(p *deps.RequestProvider) http.Handler UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -56592,7 +55023,7 @@ func newWebAppAuthflowV2SettingsMFAHandler(p *deps.RequestProvider) http.Handler SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -56601,7 +55032,7 @@ func newWebAppAuthflowV2SettingsMFAHandler(p *deps.RequestProvider) http.Handler sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -56630,7 +55061,7 @@ func newWebAppAuthflowV2SettingsMFAHandler(p *deps.RequestProvider) http.Handler UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -57112,36 +55543,9 @@ func newWebAppAuthflowV2SettingsMFAViewRecoveryCodeHandler(p *deps.RequestProvid SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -57249,6 +55653,15 @@ func newWebAppAuthflowV2SettingsMFAViewRecoveryCodeHandler(p *deps.RequestProvid Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -57323,13 +55736,6 @@ func newWebAppAuthflowV2SettingsMFAViewRecoveryCodeHandler(p *deps.RequestProvid UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -57346,7 +55752,6 @@ func newWebAppAuthflowV2SettingsMFAViewRecoveryCodeHandler(p *deps.RequestProvid Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -57566,8 +55971,8 @@ func newWebAppAuthflowV2SettingsMFAViewRecoveryCodeHandler(p *deps.RequestProvid AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -57616,7 +56021,6 @@ func newWebAppAuthflowV2SettingsMFAViewRecoveryCodeHandler(p *deps.RequestProvid UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -57632,7 +56036,7 @@ func newWebAppAuthflowV2SettingsMFAViewRecoveryCodeHandler(p *deps.RequestProvid SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -57641,7 +56045,7 @@ func newWebAppAuthflowV2SettingsMFAViewRecoveryCodeHandler(p *deps.RequestProvid sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -57670,7 +56074,7 @@ func newWebAppAuthflowV2SettingsMFAViewRecoveryCodeHandler(p *deps.RequestProvid UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -58168,36 +56572,9 @@ func newWebAppAuthflowV2SettingsMFACreatePasswordHandler(p *deps.RequestProvider SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -58305,6 +56682,15 @@ func newWebAppAuthflowV2SettingsMFACreatePasswordHandler(p *deps.RequestProvider Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -58379,13 +56765,6 @@ func newWebAppAuthflowV2SettingsMFACreatePasswordHandler(p *deps.RequestProvider UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -58402,7 +56781,6 @@ func newWebAppAuthflowV2SettingsMFACreatePasswordHandler(p *deps.RequestProvider Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -58622,8 +57000,8 @@ func newWebAppAuthflowV2SettingsMFACreatePasswordHandler(p *deps.RequestProvider AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -58672,7 +57050,6 @@ func newWebAppAuthflowV2SettingsMFACreatePasswordHandler(p *deps.RequestProvider UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -58688,7 +57065,7 @@ func newWebAppAuthflowV2SettingsMFACreatePasswordHandler(p *deps.RequestProvider SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -58697,7 +57074,7 @@ func newWebAppAuthflowV2SettingsMFACreatePasswordHandler(p *deps.RequestProvider sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -58726,7 +57103,7 @@ func newWebAppAuthflowV2SettingsMFACreatePasswordHandler(p *deps.RequestProvider UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -59234,36 +57611,9 @@ func newWebAppAuthflowV2SettingsMFAPasswordHandler(p *deps.RequestProvider) http SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -59371,6 +57721,15 @@ func newWebAppAuthflowV2SettingsMFAPasswordHandler(p *deps.RequestProvider) http Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -59445,13 +57804,6 @@ func newWebAppAuthflowV2SettingsMFAPasswordHandler(p *deps.RequestProvider) http UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -59468,7 +57820,6 @@ func newWebAppAuthflowV2SettingsMFAPasswordHandler(p *deps.RequestProvider) http Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -59688,8 +58039,8 @@ func newWebAppAuthflowV2SettingsMFAPasswordHandler(p *deps.RequestProvider) http AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -59738,7 +58089,6 @@ func newWebAppAuthflowV2SettingsMFAPasswordHandler(p *deps.RequestProvider) http UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -59754,7 +58104,7 @@ func newWebAppAuthflowV2SettingsMFAPasswordHandler(p *deps.RequestProvider) http SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -59763,7 +58113,7 @@ func newWebAppAuthflowV2SettingsMFAPasswordHandler(p *deps.RequestProvider) http sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -59792,7 +58142,7 @@ func newWebAppAuthflowV2SettingsMFAPasswordHandler(p *deps.RequestProvider) http UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -60300,36 +58650,9 @@ func newWebAppAuthflowV2SettingsMFAChangePasswordHandler(p *deps.RequestProvider SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -60437,6 +58760,15 @@ func newWebAppAuthflowV2SettingsMFAChangePasswordHandler(p *deps.RequestProvider Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -60511,13 +58843,6 @@ func newWebAppAuthflowV2SettingsMFAChangePasswordHandler(p *deps.RequestProvider UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -60534,7 +58859,6 @@ func newWebAppAuthflowV2SettingsMFAChangePasswordHandler(p *deps.RequestProvider Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -60754,8 +59078,8 @@ func newWebAppAuthflowV2SettingsMFAChangePasswordHandler(p *deps.RequestProvider AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -60804,7 +59128,6 @@ func newWebAppAuthflowV2SettingsMFAChangePasswordHandler(p *deps.RequestProvider UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -60820,7 +59143,7 @@ func newWebAppAuthflowV2SettingsMFAChangePasswordHandler(p *deps.RequestProvider SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -60829,7 +59152,7 @@ func newWebAppAuthflowV2SettingsMFAChangePasswordHandler(p *deps.RequestProvider sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -60858,7 +59181,7 @@ func newWebAppAuthflowV2SettingsMFAChangePasswordHandler(p *deps.RequestProvider UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -61355,36 +59678,9 @@ func newWebAppSettingsTOTPHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -61492,6 +59788,15 @@ func newWebAppSettingsTOTPHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -61566,13 +59871,6 @@ func newWebAppSettingsTOTPHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -61589,7 +59887,6 @@ func newWebAppSettingsTOTPHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -61809,8 +60106,8 @@ func newWebAppSettingsTOTPHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -61859,7 +60156,6 @@ func newWebAppSettingsTOTPHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -61875,7 +60171,7 @@ func newWebAppSettingsTOTPHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -61884,7 +60180,7 @@ func newWebAppSettingsTOTPHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -61913,7 +60209,7 @@ func newWebAppSettingsTOTPHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -62383,36 +60679,9 @@ func newWebAppAuthflowV2SettingsTOTPHandler(p *deps.RequestProvider) http.Handle SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -62520,6 +60789,15 @@ func newWebAppAuthflowV2SettingsTOTPHandler(p *deps.RequestProvider) http.Handle Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -62594,13 +60872,6 @@ func newWebAppAuthflowV2SettingsTOTPHandler(p *deps.RequestProvider) http.Handle UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -62617,7 +60888,6 @@ func newWebAppAuthflowV2SettingsTOTPHandler(p *deps.RequestProvider) http.Handle Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -62837,8 +61107,8 @@ func newWebAppAuthflowV2SettingsTOTPHandler(p *deps.RequestProvider) http.Handle AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -62887,7 +61157,6 @@ func newWebAppAuthflowV2SettingsTOTPHandler(p *deps.RequestProvider) http.Handle UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -62903,7 +61172,7 @@ func newWebAppAuthflowV2SettingsTOTPHandler(p *deps.RequestProvider) http.Handle SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -62912,7 +61181,7 @@ func newWebAppAuthflowV2SettingsTOTPHandler(p *deps.RequestProvider) http.Handle sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -62941,7 +61210,7 @@ func newWebAppAuthflowV2SettingsTOTPHandler(p *deps.RequestProvider) http.Handle UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -63461,36 +61730,9 @@ func newWebAppAuthflowV2SettingsMFACreateTOTPHandler(p *deps.RequestProvider) ht SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -63598,6 +61840,15 @@ func newWebAppAuthflowV2SettingsMFACreateTOTPHandler(p *deps.RequestProvider) ht Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -63672,13 +61923,6 @@ func newWebAppAuthflowV2SettingsMFACreateTOTPHandler(p *deps.RequestProvider) ht UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -63695,7 +61939,6 @@ func newWebAppAuthflowV2SettingsMFACreateTOTPHandler(p *deps.RequestProvider) ht Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -63915,8 +62158,8 @@ func newWebAppAuthflowV2SettingsMFACreateTOTPHandler(p *deps.RequestProvider) ht AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -63965,7 +62208,6 @@ func newWebAppAuthflowV2SettingsMFACreateTOTPHandler(p *deps.RequestProvider) ht UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -63981,7 +62223,7 @@ func newWebAppAuthflowV2SettingsMFACreateTOTPHandler(p *deps.RequestProvider) ht SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -63990,7 +62232,7 @@ func newWebAppAuthflowV2SettingsMFACreateTOTPHandler(p *deps.RequestProvider) ht sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -64019,7 +62261,7 @@ func newWebAppAuthflowV2SettingsMFACreateTOTPHandler(p *deps.RequestProvider) ht UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -64527,36 +62769,9 @@ func newWebAppAuthflowV2SettingsMFAEnterTOTPHandler(p *deps.RequestProvider) htt SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -64664,6 +62879,15 @@ func newWebAppAuthflowV2SettingsMFAEnterTOTPHandler(p *deps.RequestProvider) htt Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -64738,13 +62962,6 @@ func newWebAppAuthflowV2SettingsMFAEnterTOTPHandler(p *deps.RequestProvider) htt UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -64761,7 +62978,6 @@ func newWebAppAuthflowV2SettingsMFAEnterTOTPHandler(p *deps.RequestProvider) htt Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -64981,8 +63197,8 @@ func newWebAppAuthflowV2SettingsMFAEnterTOTPHandler(p *deps.RequestProvider) htt AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -65031,7 +63247,6 @@ func newWebAppAuthflowV2SettingsMFAEnterTOTPHandler(p *deps.RequestProvider) htt UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -65047,7 +63262,7 @@ func newWebAppAuthflowV2SettingsMFAEnterTOTPHandler(p *deps.RequestProvider) htt SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -65056,7 +63271,7 @@ func newWebAppAuthflowV2SettingsMFAEnterTOTPHandler(p *deps.RequestProvider) htt sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -65085,7 +63300,7 @@ func newWebAppAuthflowV2SettingsMFAEnterTOTPHandler(p *deps.RequestProvider) htt UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -65594,36 +63809,9 @@ func newWebAppAuthflowV2SettingsOOBOTPHandler(p *deps.RequestProvider) http.Hand SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -65731,6 +63919,15 @@ func newWebAppAuthflowV2SettingsOOBOTPHandler(p *deps.RequestProvider) http.Hand Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -65805,13 +64002,6 @@ func newWebAppAuthflowV2SettingsOOBOTPHandler(p *deps.RequestProvider) http.Hand UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -65828,7 +64018,6 @@ func newWebAppAuthflowV2SettingsOOBOTPHandler(p *deps.RequestProvider) http.Hand Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -66048,8 +64237,8 @@ func newWebAppAuthflowV2SettingsOOBOTPHandler(p *deps.RequestProvider) http.Hand AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -66098,7 +64287,6 @@ func newWebAppAuthflowV2SettingsOOBOTPHandler(p *deps.RequestProvider) http.Hand UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -66114,7 +64302,7 @@ func newWebAppAuthflowV2SettingsOOBOTPHandler(p *deps.RequestProvider) http.Hand SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -66123,7 +64311,7 @@ func newWebAppAuthflowV2SettingsOOBOTPHandler(p *deps.RequestProvider) http.Hand sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -66152,7 +64340,7 @@ func newWebAppAuthflowV2SettingsOOBOTPHandler(p *deps.RequestProvider) http.Hand UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -66673,36 +64861,9 @@ func newWebAppAuthflowV2SettingsMFACreateOOBOTPHandler(p *deps.RequestProvider) SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -66810,6 +64971,15 @@ func newWebAppAuthflowV2SettingsMFACreateOOBOTPHandler(p *deps.RequestProvider) Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -66884,13 +65054,6 @@ func newWebAppAuthflowV2SettingsMFACreateOOBOTPHandler(p *deps.RequestProvider) UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -66907,7 +65070,6 @@ func newWebAppAuthflowV2SettingsMFACreateOOBOTPHandler(p *deps.RequestProvider) Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -67127,8 +65289,8 @@ func newWebAppAuthflowV2SettingsMFACreateOOBOTPHandler(p *deps.RequestProvider) AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -67177,7 +65339,6 @@ func newWebAppAuthflowV2SettingsMFACreateOOBOTPHandler(p *deps.RequestProvider) UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -67193,7 +65354,7 @@ func newWebAppAuthflowV2SettingsMFACreateOOBOTPHandler(p *deps.RequestProvider) SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -67202,7 +65363,7 @@ func newWebAppAuthflowV2SettingsMFACreateOOBOTPHandler(p *deps.RequestProvider) sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -67231,7 +65392,7 @@ func newWebAppAuthflowV2SettingsMFACreateOOBOTPHandler(p *deps.RequestProvider) UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -67739,36 +65900,9 @@ func newWebAppAuthflowV2SettingsMFAEnterOOBOTPHandler(p *deps.RequestProvider) h SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -67876,6 +66010,15 @@ func newWebAppAuthflowV2SettingsMFAEnterOOBOTPHandler(p *deps.RequestProvider) h Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -67950,13 +66093,6 @@ func newWebAppAuthflowV2SettingsMFAEnterOOBOTPHandler(p *deps.RequestProvider) h UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -67973,7 +66109,6 @@ func newWebAppAuthflowV2SettingsMFAEnterOOBOTPHandler(p *deps.RequestProvider) h Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -68193,8 +66328,8 @@ func newWebAppAuthflowV2SettingsMFAEnterOOBOTPHandler(p *deps.RequestProvider) h AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -68243,7 +66378,6 @@ func newWebAppAuthflowV2SettingsMFAEnterOOBOTPHandler(p *deps.RequestProvider) h UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -68259,7 +66393,7 @@ func newWebAppAuthflowV2SettingsMFAEnterOOBOTPHandler(p *deps.RequestProvider) h SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -68268,7 +66402,7 @@ func newWebAppAuthflowV2SettingsMFAEnterOOBOTPHandler(p *deps.RequestProvider) h sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -68297,7 +66431,7 @@ func newWebAppAuthflowV2SettingsMFAEnterOOBOTPHandler(p *deps.RequestProvider) h UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -68797,36 +66931,9 @@ func newWebAppSettingsPasskeyHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -68934,6 +67041,15 @@ func newWebAppSettingsPasskeyHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -69008,13 +67124,6 @@ func newWebAppSettingsPasskeyHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -69031,7 +67140,6 @@ func newWebAppSettingsPasskeyHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -69251,8 +67359,8 @@ func newWebAppSettingsPasskeyHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -69301,7 +67409,6 @@ func newWebAppSettingsPasskeyHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -69317,7 +67424,7 @@ func newWebAppSettingsPasskeyHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -69326,7 +67433,7 @@ func newWebAppSettingsPasskeyHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -69355,7 +67462,7 @@ func newWebAppSettingsPasskeyHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -69825,36 +67932,9 @@ func newWebAppAuthflowV2SettingsChangePasskeyHandler(p *deps.RequestProvider) ht SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -69962,6 +68042,15 @@ func newWebAppAuthflowV2SettingsChangePasskeyHandler(p *deps.RequestProvider) ht Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -70036,13 +68125,6 @@ func newWebAppAuthflowV2SettingsChangePasskeyHandler(p *deps.RequestProvider) ht UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -70059,7 +68141,6 @@ func newWebAppAuthflowV2SettingsChangePasskeyHandler(p *deps.RequestProvider) ht Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -70279,8 +68360,8 @@ func newWebAppAuthflowV2SettingsChangePasskeyHandler(p *deps.RequestProvider) ht AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -70329,7 +68410,6 @@ func newWebAppAuthflowV2SettingsChangePasskeyHandler(p *deps.RequestProvider) ht UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -70345,7 +68425,7 @@ func newWebAppAuthflowV2SettingsChangePasskeyHandler(p *deps.RequestProvider) ht SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -70354,7 +68434,7 @@ func newWebAppAuthflowV2SettingsChangePasskeyHandler(p *deps.RequestProvider) ht sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -70383,7 +68463,7 @@ func newWebAppAuthflowV2SettingsChangePasskeyHandler(p *deps.RequestProvider) ht UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -70912,36 +68992,9 @@ func newWebAppSettingsOOBOTPHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -71049,6 +69102,15 @@ func newWebAppSettingsOOBOTPHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -71123,13 +69185,6 @@ func newWebAppSettingsOOBOTPHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -71146,7 +69201,6 @@ func newWebAppSettingsOOBOTPHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -71366,8 +69420,8 @@ func newWebAppSettingsOOBOTPHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -71416,7 +69470,6 @@ func newWebAppSettingsOOBOTPHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -71432,7 +69485,7 @@ func newWebAppSettingsOOBOTPHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -71441,7 +69494,7 @@ func newWebAppSettingsOOBOTPHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -71470,7 +69523,7 @@ func newWebAppSettingsOOBOTPHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -71940,36 +69993,9 @@ func newWebAppSettingsRecoveryCodeHandler(p *deps.RequestProvider) http.Handler SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -72077,6 +70103,15 @@ func newWebAppSettingsRecoveryCodeHandler(p *deps.RequestProvider) http.Handler Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -72151,13 +70186,6 @@ func newWebAppSettingsRecoveryCodeHandler(p *deps.RequestProvider) http.Handler UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -72174,7 +70202,6 @@ func newWebAppSettingsRecoveryCodeHandler(p *deps.RequestProvider) http.Handler Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -72394,8 +70421,8 @@ func newWebAppSettingsRecoveryCodeHandler(p *deps.RequestProvider) http.Handler AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -72444,7 +70471,6 @@ func newWebAppSettingsRecoveryCodeHandler(p *deps.RequestProvider) http.Handler UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -72460,7 +70486,7 @@ func newWebAppSettingsRecoveryCodeHandler(p *deps.RequestProvider) http.Handler SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -72469,7 +70495,7 @@ func newWebAppSettingsRecoveryCodeHandler(p *deps.RequestProvider) http.Handler sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -72498,7 +70524,7 @@ func newWebAppSettingsRecoveryCodeHandler(p *deps.RequestProvider) http.Handler UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -72969,36 +70995,9 @@ func newWebAppSettingsSessionsHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -73106,6 +71105,15 @@ func newWebAppSettingsSessionsHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -73180,13 +71188,6 @@ func newWebAppSettingsSessionsHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -73203,7 +71204,6 @@ func newWebAppSettingsSessionsHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -73423,8 +71423,8 @@ func newWebAppSettingsSessionsHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -73473,7 +71473,6 @@ func newWebAppSettingsSessionsHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -73489,7 +71488,7 @@ func newWebAppSettingsSessionsHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -73498,7 +71497,7 @@ func newWebAppSettingsSessionsHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -73527,7 +71526,7 @@ func newWebAppSettingsSessionsHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -74022,36 +72021,9 @@ func newWebAppAuthflowV2SettingsSessionsHandler(p *deps.RequestProvider) http.Ha SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -74159,6 +72131,15 @@ func newWebAppAuthflowV2SettingsSessionsHandler(p *deps.RequestProvider) http.Ha Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -74233,13 +72214,6 @@ func newWebAppAuthflowV2SettingsSessionsHandler(p *deps.RequestProvider) http.Ha UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -74256,7 +72230,6 @@ func newWebAppAuthflowV2SettingsSessionsHandler(p *deps.RequestProvider) http.Ha Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -74476,8 +72449,8 @@ func newWebAppAuthflowV2SettingsSessionsHandler(p *deps.RequestProvider) http.Ha AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -74526,7 +72499,6 @@ func newWebAppAuthflowV2SettingsSessionsHandler(p *deps.RequestProvider) http.Ha UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -74542,7 +72514,7 @@ func newWebAppAuthflowV2SettingsSessionsHandler(p *deps.RequestProvider) http.Ha SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -74551,7 +72523,7 @@ func newWebAppAuthflowV2SettingsSessionsHandler(p *deps.RequestProvider) http.Ha sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -74580,7 +72552,7 @@ func newWebAppAuthflowV2SettingsSessionsHandler(p *deps.RequestProvider) http.Ha UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -75087,36 +73059,9 @@ func newWebAppForceChangePasswordHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -75224,6 +73169,15 @@ func newWebAppForceChangePasswordHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -75298,13 +73252,6 @@ func newWebAppForceChangePasswordHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -75321,7 +73268,6 @@ func newWebAppForceChangePasswordHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -75541,8 +73487,8 @@ func newWebAppForceChangePasswordHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -75591,7 +73537,6 @@ func newWebAppForceChangePasswordHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -75607,7 +73552,7 @@ func newWebAppForceChangePasswordHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -75616,7 +73561,7 @@ func newWebAppForceChangePasswordHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -75645,7 +73590,7 @@ func newWebAppForceChangePasswordHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -76120,36 +74065,9 @@ func newWebAppSettingsChangePasswordHandler(p *deps.RequestProvider) http.Handle SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -76257,6 +74175,15 @@ func newWebAppSettingsChangePasswordHandler(p *deps.RequestProvider) http.Handle Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -76331,13 +74258,6 @@ func newWebAppSettingsChangePasswordHandler(p *deps.RequestProvider) http.Handle UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -76354,7 +74274,6 @@ func newWebAppSettingsChangePasswordHandler(p *deps.RequestProvider) http.Handle Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -76574,8 +74493,8 @@ func newWebAppSettingsChangePasswordHandler(p *deps.RequestProvider) http.Handle AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -76624,7 +74543,6 @@ func newWebAppSettingsChangePasswordHandler(p *deps.RequestProvider) http.Handle UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -76640,7 +74558,7 @@ func newWebAppSettingsChangePasswordHandler(p *deps.RequestProvider) http.Handle SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -76649,7 +74567,7 @@ func newWebAppSettingsChangePasswordHandler(p *deps.RequestProvider) http.Handle sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -76678,7 +74596,7 @@ func newWebAppSettingsChangePasswordHandler(p *deps.RequestProvider) http.Handle UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -77148,36 +75066,9 @@ func newWebAppAuthflowV2SettingsChangePasswordHandler(p *deps.RequestProvider) h SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -77285,6 +75176,15 @@ func newWebAppAuthflowV2SettingsChangePasswordHandler(p *deps.RequestProvider) h Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -77359,13 +75259,6 @@ func newWebAppAuthflowV2SettingsChangePasswordHandler(p *deps.RequestProvider) h UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -77382,7 +75275,6 @@ func newWebAppAuthflowV2SettingsChangePasswordHandler(p *deps.RequestProvider) h Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -77602,8 +75494,8 @@ func newWebAppAuthflowV2SettingsChangePasswordHandler(p *deps.RequestProvider) h AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -77652,7 +75544,6 @@ func newWebAppAuthflowV2SettingsChangePasswordHandler(p *deps.RequestProvider) h UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -77668,7 +75559,7 @@ func newWebAppAuthflowV2SettingsChangePasswordHandler(p *deps.RequestProvider) h SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -77677,7 +75568,7 @@ func newWebAppAuthflowV2SettingsChangePasswordHandler(p *deps.RequestProvider) h sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -77706,7 +75597,7 @@ func newWebAppAuthflowV2SettingsChangePasswordHandler(p *deps.RequestProvider) h UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -78203,36 +76094,9 @@ func newWebAppForceChangeSecondaryPasswordHandler(p *deps.RequestProvider) http. SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -78340,6 +76204,15 @@ func newWebAppForceChangeSecondaryPasswordHandler(p *deps.RequestProvider) http. Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -78414,13 +76287,6 @@ func newWebAppForceChangeSecondaryPasswordHandler(p *deps.RequestProvider) http. UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -78437,7 +76303,6 @@ func newWebAppForceChangeSecondaryPasswordHandler(p *deps.RequestProvider) http. Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -78657,8 +76522,8 @@ func newWebAppForceChangeSecondaryPasswordHandler(p *deps.RequestProvider) http. AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -78707,7 +76572,6 @@ func newWebAppForceChangeSecondaryPasswordHandler(p *deps.RequestProvider) http. UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -78723,7 +76587,7 @@ func newWebAppForceChangeSecondaryPasswordHandler(p *deps.RequestProvider) http. SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -78732,7 +76596,7 @@ func newWebAppForceChangeSecondaryPasswordHandler(p *deps.RequestProvider) http. sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -78761,7 +76625,7 @@ func newWebAppForceChangeSecondaryPasswordHandler(p *deps.RequestProvider) http. UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -79236,36 +77100,9 @@ func newWebAppSettingsChangeSecondaryPasswordHandler(p *deps.RequestProvider) ht SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -79373,6 +77210,15 @@ func newWebAppSettingsChangeSecondaryPasswordHandler(p *deps.RequestProvider) ht Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -79447,13 +77293,6 @@ func newWebAppSettingsChangeSecondaryPasswordHandler(p *deps.RequestProvider) ht UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -79470,7 +77309,6 @@ func newWebAppSettingsChangeSecondaryPasswordHandler(p *deps.RequestProvider) ht Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -79690,8 +77528,8 @@ func newWebAppSettingsChangeSecondaryPasswordHandler(p *deps.RequestProvider) ht AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -79740,7 +77578,6 @@ func newWebAppSettingsChangeSecondaryPasswordHandler(p *deps.RequestProvider) ht UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -79756,7 +77593,7 @@ func newWebAppSettingsChangeSecondaryPasswordHandler(p *deps.RequestProvider) ht SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -79765,7 +77602,7 @@ func newWebAppSettingsChangeSecondaryPasswordHandler(p *deps.RequestProvider) ht sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -79794,7 +77631,7 @@ func newWebAppSettingsChangeSecondaryPasswordHandler(p *deps.RequestProvider) ht UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -80264,36 +78101,9 @@ func newWebAppSettingsDeleteAccountHandler(p *deps.RequestProvider) http.Handler SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -80401,6 +78211,15 @@ func newWebAppSettingsDeleteAccountHandler(p *deps.RequestProvider) http.Handler Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -80475,13 +78294,6 @@ func newWebAppSettingsDeleteAccountHandler(p *deps.RequestProvider) http.Handler UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -80498,7 +78310,6 @@ func newWebAppSettingsDeleteAccountHandler(p *deps.RequestProvider) http.Handler Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -80718,8 +78529,8 @@ func newWebAppSettingsDeleteAccountHandler(p *deps.RequestProvider) http.Handler AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -80768,7 +78579,6 @@ func newWebAppSettingsDeleteAccountHandler(p *deps.RequestProvider) http.Handler UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -80784,7 +78594,7 @@ func newWebAppSettingsDeleteAccountHandler(p *deps.RequestProvider) http.Handler SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -80793,7 +78603,7 @@ func newWebAppSettingsDeleteAccountHandler(p *deps.RequestProvider) http.Handler sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -80822,7 +78632,7 @@ func newWebAppSettingsDeleteAccountHandler(p *deps.RequestProvider) http.Handler UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -81303,36 +79113,9 @@ func newWebAppAuthflowV2SettingsDeleteAccountHandler(p *deps.RequestProvider) ht SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -81440,6 +79223,15 @@ func newWebAppAuthflowV2SettingsDeleteAccountHandler(p *deps.RequestProvider) ht Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -81514,13 +79306,6 @@ func newWebAppAuthflowV2SettingsDeleteAccountHandler(p *deps.RequestProvider) ht UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -81537,7 +79322,6 @@ func newWebAppAuthflowV2SettingsDeleteAccountHandler(p *deps.RequestProvider) ht Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -81757,8 +79541,8 @@ func newWebAppAuthflowV2SettingsDeleteAccountHandler(p *deps.RequestProvider) ht AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -81807,7 +79591,6 @@ func newWebAppAuthflowV2SettingsDeleteAccountHandler(p *deps.RequestProvider) ht UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -81823,7 +79606,7 @@ func newWebAppAuthflowV2SettingsDeleteAccountHandler(p *deps.RequestProvider) ht SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -81832,7 +79615,7 @@ func newWebAppAuthflowV2SettingsDeleteAccountHandler(p *deps.RequestProvider) ht sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -81861,7 +79644,7 @@ func newWebAppAuthflowV2SettingsDeleteAccountHandler(p *deps.RequestProvider) ht UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -82353,36 +80136,9 @@ func newWebAppSettingsDeleteAccountSuccessHandler(p *deps.RequestProvider) http. SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -82490,6 +80246,15 @@ func newWebAppSettingsDeleteAccountSuccessHandler(p *deps.RequestProvider) http. Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -82564,13 +80329,6 @@ func newWebAppSettingsDeleteAccountSuccessHandler(p *deps.RequestProvider) http. UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -82587,7 +80345,6 @@ func newWebAppSettingsDeleteAccountSuccessHandler(p *deps.RequestProvider) http. Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -82807,8 +80564,8 @@ func newWebAppSettingsDeleteAccountSuccessHandler(p *deps.RequestProvider) http. AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -82857,7 +80614,6 @@ func newWebAppSettingsDeleteAccountSuccessHandler(p *deps.RequestProvider) http. UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -82873,7 +80629,7 @@ func newWebAppSettingsDeleteAccountSuccessHandler(p *deps.RequestProvider) http. SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -82882,7 +80638,7 @@ func newWebAppSettingsDeleteAccountSuccessHandler(p *deps.RequestProvider) http. sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -82911,7 +80667,7 @@ func newWebAppSettingsDeleteAccountSuccessHandler(p *deps.RequestProvider) http. UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -83384,36 +81140,9 @@ func newWebAppAuthflowV2SettingsDeleteAccountSuccessHandler(p *deps.RequestProvi SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -83521,6 +81250,15 @@ func newWebAppAuthflowV2SettingsDeleteAccountSuccessHandler(p *deps.RequestProvi Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -83595,13 +81333,6 @@ func newWebAppAuthflowV2SettingsDeleteAccountSuccessHandler(p *deps.RequestProvi UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -83618,7 +81349,6 @@ func newWebAppAuthflowV2SettingsDeleteAccountSuccessHandler(p *deps.RequestProvi Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -83838,8 +81568,8 @@ func newWebAppAuthflowV2SettingsDeleteAccountSuccessHandler(p *deps.RequestProvi AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -83888,7 +81618,6 @@ func newWebAppAuthflowV2SettingsDeleteAccountSuccessHandler(p *deps.RequestProvi UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -83904,7 +81633,7 @@ func newWebAppAuthflowV2SettingsDeleteAccountSuccessHandler(p *deps.RequestProvi SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -83913,7 +81642,7 @@ func newWebAppAuthflowV2SettingsDeleteAccountSuccessHandler(p *deps.RequestProvi sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -83942,7 +81671,7 @@ func newWebAppAuthflowV2SettingsDeleteAccountSuccessHandler(p *deps.RequestProvi UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -84415,36 +82144,9 @@ func newWebAppAuthflowV2SettingsAdvancedSettingsHandler(p *deps.RequestProvider) SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -84552,6 +82254,15 @@ func newWebAppAuthflowV2SettingsAdvancedSettingsHandler(p *deps.RequestProvider) Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -84626,13 +82337,6 @@ func newWebAppAuthflowV2SettingsAdvancedSettingsHandler(p *deps.RequestProvider) UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -84649,7 +82353,6 @@ func newWebAppAuthflowV2SettingsAdvancedSettingsHandler(p *deps.RequestProvider) Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -84869,8 +82572,8 @@ func newWebAppAuthflowV2SettingsAdvancedSettingsHandler(p *deps.RequestProvider) AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -84919,7 +82622,6 @@ func newWebAppAuthflowV2SettingsAdvancedSettingsHandler(p *deps.RequestProvider) UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -84935,7 +82637,7 @@ func newWebAppAuthflowV2SettingsAdvancedSettingsHandler(p *deps.RequestProvider) SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -84944,7 +82646,7 @@ func newWebAppAuthflowV2SettingsAdvancedSettingsHandler(p *deps.RequestProvider) sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -84973,7 +82675,7 @@ func newWebAppAuthflowV2SettingsAdvancedSettingsHandler(p *deps.RequestProvider) UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -85442,36 +83144,9 @@ func newWebAppAccountStatusHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -85579,6 +83254,15 @@ func newWebAppAccountStatusHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -85653,13 +83337,6 @@ func newWebAppAccountStatusHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -85676,7 +83353,6 @@ func newWebAppAccountStatusHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -85896,8 +83572,8 @@ func newWebAppAccountStatusHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -85946,7 +83622,6 @@ func newWebAppAccountStatusHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -85962,7 +83637,7 @@ func newWebAppAccountStatusHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -85971,7 +83646,7 @@ func newWebAppAccountStatusHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -86000,7 +83675,7 @@ func newWebAppAccountStatusHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -86469,36 +84144,9 @@ func newWebAppLogoutHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -86606,6 +84254,15 @@ func newWebAppLogoutHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -86680,13 +84337,6 @@ func newWebAppLogoutHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -86703,7 +84353,6 @@ func newWebAppLogoutHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -86923,8 +84572,8 @@ func newWebAppLogoutHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -86973,7 +84622,6 @@ func newWebAppLogoutHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -86989,7 +84637,7 @@ func newWebAppLogoutHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -86998,7 +84646,7 @@ func newWebAppLogoutHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -87027,7 +84675,7 @@ func newWebAppLogoutHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -87561,36 +85209,9 @@ func newWebAppReturnHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -87698,6 +85319,15 @@ func newWebAppReturnHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -87772,13 +85402,6 @@ func newWebAppReturnHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -87795,7 +85418,6 @@ func newWebAppReturnHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -88015,8 +85637,8 @@ func newWebAppReturnHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -88065,7 +85687,6 @@ func newWebAppReturnHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -88081,7 +85702,7 @@ func newWebAppReturnHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -88090,7 +85711,7 @@ func newWebAppReturnHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -88119,7 +85740,7 @@ func newWebAppReturnHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -88588,36 +86209,9 @@ func newWebAppErrorHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -88725,6 +86319,15 @@ func newWebAppErrorHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -88799,13 +86402,6 @@ func newWebAppErrorHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -88822,7 +86418,6 @@ func newWebAppErrorHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -89042,8 +86637,8 @@ func newWebAppErrorHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -89092,7 +86687,6 @@ func newWebAppErrorHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -89108,7 +86702,7 @@ func newWebAppErrorHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -89117,7 +86711,7 @@ func newWebAppErrorHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -89146,7 +86740,7 @@ func newWebAppErrorHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -89593,1160 +87187,9 @@ func newWebAppAuthflowV2ErrorHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } - siweProvider := &siwe.Provider{ - Store: siweStore, - Clock: clockClock, - SIWE: siweService, - } - ldapStore := &ldap.Store{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - } - normalizer := &stdattrs.Normalizer{ - LoginIDNormalizerFactory: normalizerFactory, - } - ldapProvider := &ldap.Provider{ - Store: ldapStore, - Clock: clockClock, - StandardAttributesNormalizer: normalizer, - } - serviceService := &service.Service{ - Authentication: authenticationConfig, - Identity: identityConfig, - IdentityFeatureConfig: identityFeatureConfig, - Store: serviceStore, - LoginID: provider, - OAuth: oauthProvider, - Anonymous: anonymousProvider, - Biometric: biometricProvider, - Passkey: passkeyProvider, - SIWE: siweProvider, - LDAP: ldapProvider, - } - store3 := &service2.Store{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - } - passwordStore := &password.Store{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - } - authenticatorConfig := appConfig.Authenticator - authenticatorPasswordConfig := authenticatorConfig.Password - passwordLogger := password.NewLogger(factory) - historyStore := &password.HistoryStore{ - Clock: clockClock, - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - } - authenticatorFeatureConfig := featureConfig.Authenticator - passwordChecker := password.ProvideChecker(authenticatorPasswordConfig, authenticatorFeatureConfig, historyStore) - expiry := password.ProvideExpiry(authenticatorPasswordConfig, clockClock) - housekeeperLogger := password.NewHousekeeperLogger(factory) - housekeeper := &password.Housekeeper{ - Store: historyStore, - Logger: housekeeperLogger, - Config: authenticatorPasswordConfig, - } - passwordProvider := &password.Provider{ - Store: passwordStore, - Config: authenticatorPasswordConfig, - Clock: clockClock, - Logger: passwordLogger, - PasswordHistory: historyStore, - PasswordChecker: passwordChecker, - Expiry: expiry, - Housekeeper: housekeeper, - } - store4 := &passkey3.Store{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - } - provider2 := &passkey3.Provider{ - Store: store4, - Clock: clockClock, - Passkey: passkeyService, - } - totpStore := &totp.Store{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - } - authenticatorTOTPConfig := authenticatorConfig.TOTP - totpProvider := &totp.Provider{ - Store: totpStore, - Config: authenticatorTOTPConfig, - Clock: clockClock, - } - oobStore := &oob.Store{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - } - oobProvider := &oob.Provider{ - Store: oobStore, - LoginIDNormalizerFactory: normalizerFactory, - Clock: clockClock, - } - testModeConfig := appConfig.TestMode - testModeFeatureConfig := featureConfig.TestMode - codeStoreRedis := &otp.CodeStoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - lookupStoreRedis := &otp.LookupStoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - attemptTrackerRedis := &otp.AttemptTrackerRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - otpLogger := otp.NewLogger(factory) - otpService := &otp.Service{ - Clock: clockClock, - AppID: appID, - TestModeConfig: testModeConfig, - TestModeFeatureConfig: testModeFeatureConfig, - RemoteIP: remoteIP, - CodeStore: codeStoreRedis, - LookupStore: lookupStoreRedis, - AttemptTracker: attemptTrackerRedis, - Logger: otpLogger, - RateLimiter: limiter, - } - rateLimits := service2.RateLimits{ - IP: remoteIP, - Config: authenticationConfig, - RateLimiter: limiter, - } - authenticationLockoutConfig := authenticationConfig.Lockout - lockoutLogger := lockout.NewLogger(factory) - lockoutStorageRedis := &lockout.StorageRedis{ - AppID: appID, - Redis: handle, - } - lockoutService := &lockout.Service{ - Logger: lockoutLogger, - Storage: lockoutStorageRedis, - } - serviceLockout := service2.Lockout{ - Config: authenticationLockoutConfig, - RemoteIP: remoteIP, - Provider: lockoutService, - } - service3 := &service2.Service{ - Store: store3, - Config: appConfig, - Password: passwordProvider, - Passkey: provider2, - TOTP: totpProvider, - OOBOTP: oobProvider, - OTPCodeService: otpService, - RateLimits: rateLimits, - Lockout: serviceLockout, - } - verificationConfig := appConfig.Verification - userProfileConfig := appConfig.UserProfile - storePQ := &verification.StorePQ{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - } - verificationService := &verification.Service{ - Config: verificationConfig, - UserProfileConfig: userProfileConfig, - Clock: clockClock, - ClaimStore: storePQ, - } - imagesCDNHost := environmentConfig.ImagesCDNHost - pictureTransformer := &stdattrs2.PictureTransformer{ - HTTPProto: httpProto, - HTTPHost: httpHost, - ImagesCDNHost: imagesCDNHost, - } - serviceNoEvent := &stdattrs2.ServiceNoEvent{ - UserProfileConfig: userProfileConfig, - Identities: serviceService, - UserQueries: rawQueries, - UserStore: store, - ClaimStore: storePQ, - Transformer: pictureTransformer, - } - customattrsServiceNoEvent := &customattrs.ServiceNoEvent{ - Config: userProfileConfig, - UserQueries: rawQueries, - UserStore: store, - } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } - rolesgroupsStore := &rolesgroups.Store{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - Clock: clockClock, - } - queries := &rolesgroups.Queries{ - Store: rolesgroupsStore, - } - userQueries := &user.Queries{ - RawQueries: rawQueries, - Store: store, - Identities: serviceService, - Authenticators: service3, - Verification: verificationService, - StandardAttributes: serviceNoEvent, - CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, - RolesAndGroups: queries, - } - resolverImpl := &event.ResolverImpl{ - Users: userQueries, - } - hookLogger := hook.NewLogger(factory) - hookConfig := appConfig.Hook - webHookLogger := hook.NewWebHookLogger(factory) - webhookKeyMaterials := deps.ProvideWebhookKeyMaterials(secretConfig) - webHookImpl := hook.WebHookImpl{ - Logger: webHookLogger, - Secret: webhookKeyMaterials, - } - syncHTTPClient := hook.NewSyncHTTPClient(hookConfig) - asyncHTTPClient := hook.NewAsyncHTTPClient() - eventWebHookImpl := &hook.EventWebHookImpl{ - WebHookImpl: webHookImpl, - SyncHTTP: syncHTTPClient, - AsyncHTTP: asyncHTTPClient, - } - denoHookLogger := hook.NewDenoHookLogger(factory) - denoHook := hook.DenoHook{ - ResourceManager: manager, - Logger: denoHookLogger, - } - denoEndpoint := environmentConfig.DenoEndpoint - syncDenoClient := hook.NewSyncDenoClient(denoEndpoint, hookConfig, hookLogger) - asyncDenoClient := hook.NewAsyncDenoClient(denoEndpoint, hookLogger) - eventDenoHookImpl := &hook.EventDenoHookImpl{ - DenoHook: denoHook, - SyncDenoClient: syncDenoClient, - AsyncDenoClient: asyncDenoClient, - } - commands := &rolesgroups.Commands{ - Store: rolesgroupsStore, - } - sink := &hook.Sink{ - Logger: hookLogger, - Config: hookConfig, - Clock: clockClock, - EventWebHook: eventWebHookImpl, - EventDenoHook: eventDenoHookImpl, - StandardAttributes: serviceNoEvent, - CustomAttributes: customattrsServiceNoEvent, - RolesAndGroups: commands, - } - auditLogger := audit.NewLogger(factory) - writeHandle := appProvider.AuditWriteDatabase - auditDatabaseCredentials := deps.ProvideAuditDatabaseCredentials(secretConfig) - auditdbSQLBuilderApp := auditdb.NewSQLBuilderApp(auditDatabaseCredentials, appID) - writeSQLExecutor := auditdb.NewWriteSQLExecutor(writeHandle) - writeStore := &audit.WriteStore{ - SQLBuilder: auditdbSQLBuilderApp, - SQLExecutor: writeSQLExecutor, - } - auditSink := &audit.Sink{ - Logger: auditLogger, - Database: writeHandle, - Store: writeStore, - } - sinkLogger := reindex.NewSinkLogger(factory) - searchConfig := appConfig.Search - reindexerLogger := reindex.NewReindexerLogger(factory) - userReindexProducer := redisqueue.NewUserReindexProducer(handle, clockClock) - sourceProvider := &reindex.SourceProvider{ - AppID: appID, - Users: userQueries, - UserStore: store, - IdentityService: serviceService, - RolesGroups: rolesgroupsStore, - } - elasticsearchServiceLogger := elasticsearch.NewElasticsearchServiceLogger(factory) - elasticsearchCredentials := deps.ProvideElasticsearchCredentials(secretConfig) - client := elasticsearch.NewClient(elasticsearchCredentials) - elasticsearchService := &elasticsearch.Service{ - Clock: clockClock, - Database: appdbHandle, - Logger: elasticsearchServiceLogger, - AppID: appID, - Client: client, - Users: userQueries, - UserStore: store, - IdentityService: serviceService, - RolesGroups: rolesgroupsStore, - } - configAppID := &appConfig.ID - searchDatabaseCredentials := deps.ProvideSearchDatabaseCredentials(secretConfig) - searchdbSQLBuilder := searchdb.NewSQLBuilder(searchDatabaseCredentials) - searchdbHandle := appProvider.SearchDatabase - searchdbSQLExecutor := searchdb.NewSQLExecutor(searchdbHandle) - pgsearchStore := pgsearch.NewStore(appID, searchdbSQLBuilder, searchdbSQLExecutor) - pgsearchService := &pgsearch.Service{ - AppID: configAppID, - Store: pgsearchStore, - Database: searchdbHandle, - } - reindexer := &reindex.Reindexer{ - AppID: appID, - SearchConfig: searchConfig, - Clock: clockClock, - Database: appdbHandle, - Logger: reindexerLogger, - UserStore: store, - Producer: userReindexProducer, - SourceProvider: sourceProvider, - ElasticsearchReindexer: elasticsearchService, - PostgresqlReindexer: pgsearchService, - } - reindexSink := &reindex.Sink{ - Logger: sinkLogger, - Reindexer: reindexer, - Database: appdbHandle, - } - eventService := event.NewService(appID, remoteIP, userAgentString, logger, appdbHandle, clockClock, localizationConfig, storeImpl, resolverImpl, sink, auditSink, reindexSink) - userCommands := &user.Commands{ - RawCommands: rawCommands, - RawQueries: rawQueries, - Events: eventService, - Verification: verificationService, - UserProfileConfig: userProfileConfig, - StandardAttributes: serviceNoEvent, - CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, - RolesAndGroups: queries, - } - userProvider := &user.Provider{ - Commands: userCommands, - Queries: userQueries, - } - storeDeviceTokenRedis := &mfa.StoreDeviceTokenRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - storeRecoveryCodePQ := &mfa.StoreRecoveryCodePQ{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - } - mfaLockout := mfa.Lockout{ - Config: authenticationLockoutConfig, - RemoteIP: remoteIP, - Provider: lockoutService, - } - mfaService := &mfa.Service{ - IP: remoteIP, - DeviceTokens: storeDeviceTokenRedis, - RecoveryCodes: storeRecoveryCodePQ, - Clock: clockClock, - Config: authenticationConfig, - RateLimiter: limiter, - Lockout: mfaLockout, - } - messagingLogger := messaging.NewLogger(factory) - usageLogger := usage.NewLogger(factory) - usageLimiter := &usage.Limiter{ - Logger: usageLogger, - Clock: clockClock, - AppID: appID, - Redis: handle, - } - messagingConfig := appConfig.Messaging - messagingRateLimitsConfig := messagingConfig.RateLimits - messagingFeatureConfig := featureConfig.Messaging - rateLimitsEnvironmentConfig := &environmentConfig.RateLimits - limits := messaging.Limits{ - Logger: messagingLogger, - RateLimiter: limiter, - UsageLimiter: usageLimiter, - RemoteIP: remoteIP, - Config: messagingRateLimitsConfig, - FeatureConfig: messagingFeatureConfig, - EnvConfig: rateLimitsEnvironmentConfig, - } - mailLogger := mail.NewLogger(factory) - smtpServerCredentials := deps.ProvideSMTPServerCredentials(secretConfig) - dialer := mail.NewGomailDialer(smtpServerCredentials) - sender := &mail.Sender{ - Logger: mailLogger, - GomailDialer: dialer, - } - smsLogger := sms.NewLogger(factory) - smsProvider := messagingConfig.SMSProvider - smsGatewayConfig := messagingConfig.SMSGateway - nexmoCredentials := deps.ProvideNexmoCredentials(secretConfig) - twilioCredentials := deps.ProvideTwilioCredentials(secretConfig) - customSMSProviderConfig := deps.ProvideCustomSMSProviderConfig(secretConfig) - smsGatewayEnvironmentConfig := &environmentConfig.SMSGatewayConfig - smsGatewayEnvironmentDefaultConfig := &smsGatewayEnvironmentConfig.Default - smsGatewayEnvironmentDefaultProvider := smsGatewayEnvironmentDefaultConfig.Provider - smsGatewayEnvironmentDefaultUseConfigFrom := smsGatewayEnvironmentDefaultConfig.UseConfigFrom - smsGatewayEnvironmentNexmoCredentials := smsGatewayEnvironmentConfig.Nexmo - smsGatewayEnvironmentTwilioCredentials := smsGatewayEnvironmentConfig.Twilio - smsGatewayEnvironmentCustomSMSProviderConfig := smsGatewayEnvironmentConfig.Custom - smsHookTimeout := custom.NewSMSHookTimeout(customSMSProviderConfig) - hookDenoClient := custom.NewHookDenoClient(denoEndpoint, hookLogger, smsHookTimeout) - smsDenoHook := custom.SMSDenoHook{ - DenoHook: denoHook, - Client: hookDenoClient, - } - hookWebHookImpl := &hook.WebHookImpl{ - Logger: webHookLogger, - Secret: webhookKeyMaterials, - } - hookHTTPClient := custom.NewHookHTTPClient(smsHookTimeout) - smsWebHook := custom.SMSWebHook{ - WebHook: hookWebHookImpl, - Client: hookHTTPClient, - } - clientResolver := &sms.ClientResolver{ - AuthgearYAMLSMSProvider: smsProvider, - AuthgearYAMLSMSGateway: smsGatewayConfig, - AuthgearSecretsYAMLNexmoCredentials: nexmoCredentials, - AuthgearSecretsYAMLTwilioCredentials: twilioCredentials, - AuthgearSecretsYAMLCustomSMSProviderConfig: customSMSProviderConfig, - EnvironmentDefaultProvider: smsGatewayEnvironmentDefaultProvider, - EnvironmentDefaultUseConfigFrom: smsGatewayEnvironmentDefaultUseConfigFrom, - EnvironmentNexmoCredentials: smsGatewayEnvironmentNexmoCredentials, - EnvironmentTwilioCredentials: smsGatewayEnvironmentTwilioCredentials, - EnvironmentCustomSMSProviderConfig: smsGatewayEnvironmentCustomSMSProviderConfig, - SMSDenoHook: smsDenoHook, - SMSWebHook: smsWebHook, - } - smsClient := &sms.Client{ - Logger: smsLogger, - ClientResolver: clientResolver, - } - serviceLogger := whatsapp.NewServiceLogger(factory) - whatsappConfig := messagingConfig.Whatsapp - whatsappOnPremisesCredentials := deps.ProvideWhatsappOnPremisesCredentials(secretConfig) - tokenStore := &whatsapp.TokenStore{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) - whatsappService := &whatsapp.Service{ - Logger: serviceLogger, - WhatsappConfig: whatsappConfig, - LocalizationConfig: localizationConfig, - OnPremisesClient: onPremisesClient, - } - devMode := environmentConfig.DevMode - featureTestModeEmailSuppressed := deps.ProvideTestModeEmailSuppressed(testModeFeatureConfig) - testModeEmailConfig := testModeConfig.Email - featureTestModeSMSSuppressed := deps.ProvideTestModeSMSSuppressed(testModeFeatureConfig) - testModeSMSConfig := testModeConfig.SMS - featureTestModeWhatsappSuppressed := deps.ProvideTestModeWhatsappSuppressed(testModeFeatureConfig) - testModeWhatsappConfig := testModeConfig.Whatsapp - messagingSender := &messaging.Sender{ - Logger: messagingLogger, - Limits: limits, - Events: eventService, - MailSender: sender, - SMSSender: smsClient, - WhatsappSender: whatsappService, - Database: appdbHandle, - DevMode: devMode, - MessagingFeatureConfig: messagingFeatureConfig, - FeatureTestModeEmailSuppressed: featureTestModeEmailSuppressed, - TestModeEmailConfig: testModeEmailConfig, - FeatureTestModeSMSSuppressed: featureTestModeSMSSuppressed, - TestModeSMSConfig: testModeSMSConfig, - FeatureTestModeWhatsappSuppressed: featureTestModeWhatsappSuppressed, - TestModeWhatsappConfig: testModeWhatsappConfig, - } - forgotpasswordSender := &forgotpassword.Sender{ - AppConfg: appConfig, - Identities: serviceService, - Sender: messagingSender, - Translation: translationService, - } - stdattrsService := &stdattrs2.Service{ - UserProfileConfig: userProfileConfig, - ServiceNoEvent: serviceNoEvent, - Identities: serviceService, - UserQueries: rawQueries, - UserStore: store, - Events: eventService, - } - authorizationStore := &pq.AuthorizationStore{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - } - storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - Logger: storeRedisLogger, - } - sessionConfig := appConfig.Session - cookieDef := session.NewSessionCookieDef(sessionConfig) - idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, - Config: sessionConfig, - Cookies: cookieManager, - CookieDef: cookieDef, - } - redisLogger := redis.NewLogger(factory) - redisStore := &redis.Store{ - Redis: handle, - AppID: appID, - Logger: redisLogger, - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - Clock: clockClock, - } - oAuthConfig := appConfig.OAuth - eventStoreRedis := &access.EventStoreRedis{ - Redis: handle, - AppID: appID, - } - eventProvider := &access.EventProvider{ - Store: eventStoreRedis, - } - analyticredisHandle := appProvider.AnalyticRedis - meterStoreRedisLogger := meter.NewStoreRedisLogger(factory) - writeStoreRedis := &meter.WriteStoreRedis{ - Redis: analyticredisHandle, - AppID: appID, - Clock: clockClock, - Logger: meterStoreRedisLogger, - } - meterService := &meter.Service{ - Counter: writeStoreRedis, - } - idpsessionRand := _wireRandValue - idpsessionProvider := &idpsession.Provider{ - RemoteIP: remoteIP, - UserAgentString: userAgentString, - AppID: appID, - Redis: handle, - Store: idpsessionStoreRedis, - AccessEvents: eventProvider, - MeterService: meterService, - TrustProxy: trustProxy, - Config: sessionConfig, - Clock: clockClock, - Random: idpsessionRand, - } - oauthclientResolver := &oauthclient.Resolver{ - OAuthConfig: oAuthConfig, - TesterEndpoints: endpointsEndpoints, - } - offlineGrantService := oauth2.OfflineGrantService{ - OAuthConfig: oAuthConfig, - Clock: clockClock, - IDPSessions: idpsessionProvider, - ClientResolver: oauthclientResolver, - AccessEvents: eventProvider, - MeterService: meterService, - OfflineGrants: redisStore, - } - sessionManager := &oauth2.SessionManager{ - Store: redisStore, - Config: oAuthConfig, - Service: offlineGrantService, - } - accountDeletionConfig := appConfig.AccountDeletion - accountAnonymizationConfig := appConfig.AccountAnonymization - maxTrials := _wireMaxTrialsValue - passwordRand := password.NewRandSource() - generator := &password.Generator{ - MaxTrials: maxTrials, - Checker: passwordChecker, - Rand: passwordRand, - PasswordConfig: authenticatorPasswordConfig, - } - coordinator := &facade.Coordinator{ - Events: eventService, - Identities: serviceService, - Authenticators: service3, - Verification: verificationService, - MFA: mfaService, - SendPassword: forgotpasswordSender, - UserCommands: userCommands, - UserQueries: userQueries, - RolesGroupsCommands: commands, - StdAttrsService: stdattrsService, - PasswordHistory: historyStore, - OAuth: authorizationStore, - IDPSessions: idpsessionManager, - OAuthSessions: sessionManager, - IdentityConfig: identityConfig, - AccountDeletionConfig: accountDeletionConfig, - AccountAnonymizationConfig: accountAnonymizationConfig, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - PasswordGenerator: generator, - } - identityFacade := facade.IdentityFacade{ - Coordinator: coordinator, - } - anonymousStoreRedis := &anonymous.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - authenticatorFacade := facade.AuthenticatorFacade{ - Coordinator: coordinator, - } - mfaFacade := &facade.MFAFacade{ - Coordinator: coordinator, - } - customattrsService := &customattrs.Service{ - Config: userProfileConfig, - ServiceNoEvent: customattrsServiceNoEvent, - Events: eventService, - } - messageSender := &otp.MessageSender{ - AppID: appID, - Translation: translationService, - Endpoints: endpointsEndpoints, - Sender: messagingSender, - } - workflowVerificationFacade := facade.WorkflowVerificationFacade{ - Verification: verificationService, - } - forgotpasswordLogger := forgotpassword.NewLogger(factory) - sender2 := forgotpassword.Sender{ - AppConfg: appConfig, - Identities: serviceService, - Sender: messagingSender, - Translation: translationService, - } - forgotpasswordService := &forgotpassword.Service{ - Logger: forgotpasswordLogger, - Config: appConfig, - FeatureConfig: featureConfig, - Identities: serviceService, - Authenticators: authenticatorFacade, - OTPCodes: otpService, - OTPSender: messageSender, - PasswordSender: sender2, - Events: eventService, - } - accountMigrationConfig := appConfig.AccountMigration - accountMigrationHookConfig := accountMigrationConfig.Hook - accountmigrationHookDenoClient := accountmigration.NewHookDenoClient(denoEndpoint, hookLogger, accountMigrationHookConfig) - denoMiddlewareLogger := accountmigration.NewDenoMiddlewareLogger(factory) - accountMigrationDenoHook := &accountmigration.AccountMigrationDenoHook{ - DenoHook: denoHook, - Client: accountmigrationHookDenoClient, - Logger: denoMiddlewareLogger, - } - accountmigrationHookHTTPClient := accountmigration.NewHookHTTPClient(accountMigrationHookConfig) - webhookMiddlewareLogger := accountmigration.NewWebhookMiddlewareLogger(factory) - accountMigrationWebHook := &accountmigration.AccountMigrationWebHook{ - WebHook: hookWebHookImpl, - Client: accountmigrationHookHTTPClient, - Logger: webhookMiddlewareLogger, - } - accountmigrationService := &accountmigration.Service{ - Config: accountMigrationHookConfig, - DenoHook: accountMigrationDenoHook, - WebHook: accountMigrationWebHook, - } - challengeProvider := &challenge.Provider{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - captchaConfig := appConfig.Captcha - providerLogger := captcha.NewProviderLogger(factory) - deprecated_CaptchaCloudflareCredentials := deps.ProvideCaptchaCloudflareCredentials(secretConfig) - captchaHTTPClient := captcha2.NewHTTPClient() - cloudflareClient := captcha2.NewCloudflareClient(deprecated_CaptchaCloudflareCredentials, captchaHTTPClient) - captchaProvider := &captcha.Provider{ - RemoteIP: remoteIP, - Config: captchaConfig, - Logger: providerLogger, - CloudflareClient: cloudflareClient, - } - botProtectionConfig := appConfig.BotProtection - botprotectionProviderLogger := botprotection.NewProviderLogger(factory) - botProtectionProviderCredentials := deps.ProvideBotProtectionProvidersCredentials(secretConfig) - botprotectionCloudflareClient := botprotection.NewCloudflareClient(botProtectionProviderCredentials, environmentConfig) - recaptchaV2Client := botprotection.NewRecaptchaV2Client(botProtectionProviderCredentials, environmentConfig) - botprotectionProvider := &botprotection.Provider{ - RemoteIP: remoteIP, - Config: botProtectionConfig, - Logger: botprotectionProviderLogger, - CloudflareClient: botprotectionCloudflareClient, - RecaptchaV2Client: recaptchaV2Client, - Events: eventService, - } - oAuthSSOProviderCredentials := deps.ProvideOAuthSSOProviderCredentials(secretConfig) - oAuthHTTPClient := sso.ProvideOAuthHTTPClient(environmentConfig) - simpleStoreRedisFactory := &sso.SimpleStoreRedisFactory{ - AppID: appID, - Redis: handle, - } - oAuthProviderFactory := &sso.OAuthProviderFactory{ - IdentityConfig: identityConfig, - Credentials: oAuthSSOProviderCredentials, - Clock: clockClock, - StandardAttributesNormalizer: normalizer, - HTTPClient: oAuthHTTPClient, - SimpleStoreRedisFactory: simpleStoreRedisFactory, - } - requestOptionsService := &passkey2.RequestOptionsService{ - ConfigService: configService, - IdentityService: serviceService, - Store: store2, - } - creationOptionsService := &passkey2.CreationOptionsService{ - ConfigService: configService, - UserService: userQueries, - IdentityService: serviceService, - Store: store2, - } - ldapConfig := identityConfig.LDAP - ldapServerUserCredentials := deps.ProvideLDAPServerUserCredentials(secretConfig) - clientFactory := &ldap2.ClientFactory{ - Config: ldapConfig, - SecretConfig: ldapServerUserCredentials, - } - manager2 := &session.Manager{ - IDPSessions: idpsessionManager, - AccessTokenSessions: sessionManager, - Events: eventService, - } - authenticationinfoStoreRedis := &authenticationinfo.StoreRedis{ - Redis: handle, - AppID: appID, - } - mfaCookieDef := mfa.NewDeviceTokenCookieDef(authenticationConfig) - userFacade := &facade.UserFacade{ - UserProvider: userProvider, - Coordinator: coordinator, - } - oAuthKeyMaterials := deps.ProvideOAuthKeyMaterials(secretConfig) - idTokenIssuer := &oidc.IDTokenIssuer{ - Secrets: oAuthKeyMaterials, - BaseURL: endpointsEndpoints, - Users: userQueries, - RolesAndGroups: queries, - Clock: clockClock, - } - dependencies := &authenticationflow.Dependencies{ - Config: appConfig, - FeatureConfig: featureConfig, - Clock: clockClock, - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - HTTPRequest: request, - Users: userProvider, - Identities: identityFacade, - AnonymousIdentities: anonymousProvider, - AnonymousUserPromotionCodeStore: anonymousStoreRedis, - Authenticators: authenticatorFacade, - MFA: mfaFacade, - StdAttrsService: stdattrsService, - CustomAttrsService: customattrsService, - OTPCodes: otpService, - OTPSender: messageSender, - Verification: workflowVerificationFacade, - ForgotPassword: forgotpasswordService, - ResetPassword: forgotpasswordService, - AccountMigrations: accountmigrationService, - Challenges: challengeProvider, - Captcha: captchaProvider, - BotProtection: botprotectionProvider, - OAuthProviderFactory: oAuthProviderFactory, - PasskeyRequestOptionsService: requestOptionsService, - PasskeyCreationOptionsService: creationOptionsService, - PasskeyService: passkeyService, - LoginIDs: provider, - LDAP: ldapProvider, - LDAPClientFactory: clientFactory, - IDPSessions: idpsessionProvider, - Sessions: manager2, - AuthenticationInfos: authenticationinfoStoreRedis, - SessionCookie: cookieDef, - MFADeviceTokenCookie: mfaCookieDef, - UserFacade: userFacade, - Cookies: cookieManager, - Events: eventService, - RateLimiter: limiter, - OfflineGrants: redisStore, - IDTokens: idTokenIssuer, - } - authenticationflowServiceLogger := authenticationflow.NewServiceLogger(factory) - authenticationflowStoreImpl := &authenticationflow.StoreImpl{ - Redis: handle, - AppID: appID, - } - uiService := &authenticationinfo.UIService{ - EndpointsProvider: endpointsEndpoints, - } - authenticationflowService := &authenticationflow.Service{ - Deps: dependencies, - Logger: authenticationflowServiceLogger, - Store: authenticationflowStoreImpl, - Database: appdbHandle, - UIConfig: uiConfig, - UIInfoResolver: uiService, - OAuthClientResolver: oauthclientResolver, - } - oauthsessionStoreRedis := &oauthsession.StoreRedis{ - Redis: handle, - AppID: appID, - } - samlsessionStoreRedis := &samlsession.StoreRedis{ - Redis: handle, - AppID: appID, - } - promptResolver := &oauth2.PromptResolver{ - Clock: clockClock, - } - oauthOfflineGrantService := &oauth2.OfflineGrantService{ - OAuthConfig: oAuthConfig, - Clock: clockClock, - IDPSessions: idpsessionProvider, - ClientResolver: oauthclientResolver, - AccessEvents: eventProvider, - MeterService: meterService, - OfflineGrants: redisStore, - } - idTokenHintResolver := &oidc.IDTokenHintResolver{ - Issuer: idTokenIssuer, - Sessions: idpsessionProvider, - OfflineGrantService: oauthOfflineGrantService, - } - uiInfoResolver := &oidc.UIInfoResolver{ - Config: oAuthConfig, - EndpointsProvider: endpointsEndpoints, - PromptResolver: promptResolver, - IDTokenHintResolver: idTokenHintResolver, - Clock: clockClock, - Cookies: cookieManager, - ClientResolver: oauthclientResolver, - } - webappoauthStore := &webappoauth.Store{ - Redis: handle, - AppID: appID, - } - authflowV2Navigator := &authflowv2.AuthflowV2Navigator{ - Endpoints: endpointsEndpoints, - OAuthStateStore: webappoauthStore, - } - errorTokenCookieDef := webapp2.NewErrorTokenCookieDef() - errorService := &webapp2.ErrorService{ - AppID: appID, - Cookie: errorTokenCookieDef, - RedisHandle: handle, - Cookies: cookieManager, - } - authflowNavigator := &webapp2.AuthflowNavigator{ - Endpoints: endpointsEndpoints, - OAuthStateStore: webappoauthStore, - } - errorRenderer := &webapp.ErrorRenderer{ - ErrorService: errorService, - UIImplementationService: uiImplementationService, - AuthflowV1Navigator: authflowNavigator, - AuthflowV2Navigator: authflowV2Navigator, - } - authflowController := &webapp.AuthflowController{ - Logger: authflowControllerLogger, - TesterEndpointsProvider: endpointsEndpoints, - TrustProxy: trustProxy, - Clock: clockClock, - Cookies: cookieManager, - Sessions: sessionStoreRedis, - SessionCookie: sessionCookieDef, - SignedUpCookie: signedUpCookieDef, - Authflows: authenticationflowService, - OAuthSessions: oauthsessionStoreRedis, - SAMLSessions: samlsessionStoreRedis, - UIInfoResolver: uiInfoResolver, - UIConfig: uiConfig, - OAuthClientResolver: oauthclientResolver, - Navigator: authflowV2Navigator, - ErrorRenderer: errorRenderer, - } - uiFeatureConfig := featureConfig.UI - forgotPasswordConfig := appConfig.ForgotPassword - googleTagManagerConfig := appConfig.GoogleTagManager - flashMessage := &httputil.FlashMessage{ - Cookies: cookieManager, - } - authUISentryDSN := environmentConfig.AuthUISentryDSN - authUIWindowMessageAllowedOrigins := environmentConfig.AuthUIWindowMessageAllowedOrigins - baseLogger := viewmodels.NewBaseLogger(factory) - baseViewModeler := &viewmodels.BaseViewModeler{ - TrustProxy: trustProxy, - OAuth: oAuthConfig, - AuthUI: uiConfig, - AuthUIFeatureConfig: uiFeatureConfig, - StaticAssets: staticAssetResolver, - ForgotPassword: forgotPasswordConfig, - Authentication: authenticationConfig, - GoogleTagManager: googleTagManagerConfig, - BotProtection: botProtectionConfig, - ErrorService: errorService, - Translations: translationService, - Clock: clockClock, - FlashMessage: flashMessage, - DefaultLanguageTag: defaultLanguageTag, - SupportedLanguageTags: supportedLanguageTags, - AuthUISentryDSN: authUISentryDSN, - AuthUIWindowMessageAllowedOrigins: authUIWindowMessageAllowedOrigins, - OAuthClientResolver: oauthclientResolver, - Logger: baseLogger, - } - responseRenderer := &webapp.ResponseRenderer{ - TemplateEngine: engine, - } - authflowV2ErrorHandler := &authflowv2.AuthflowV2ErrorHandler{ - Controller: authflowController, - BaseViewModel: baseViewModeler, - Renderer: responseRenderer, - } - return authflowV2ErrorHandler -} - -func newWebAppCSRFErrorInstructionHandler(p *deps.RequestProvider) http.Handler { - appProvider := p.AppProvider - factory := appProvider.LoggerFactory - authflowControllerLogger := webapp.NewAuthflowControllerLogger(factory) - request := p.Request - rootProvider := appProvider.RootProvider - environmentConfig := rootProvider.EnvironmentConfig - trustProxy := environmentConfig.TrustProxy - httpHost := deps.ProvideHTTPHost(request, trustProxy) - httpProto := deps.ProvideHTTPProto(request, trustProxy) - appContext := appProvider.AppContext - config := appContext.Config - appConfig := config.AppConfig - uiConfig := appConfig.UI - globalUIImplementation := environmentConfig.UIImplementation - globalUISettingsImplementation := environmentConfig.UISettingsImplementation - uiImplementationService := &web.UIImplementationService{ - UIConfig: uiConfig, - GlobalUIImplementation: globalUIImplementation, - GlobalUISettingsImplementation: globalUISettingsImplementation, - } - endpointsEndpoints := &endpoints.Endpoints{ - HTTPHost: httpHost, - HTTPProto: httpProto, - UIImplementationService: uiImplementationService, - } - clockClock := _wireSystemClockValue - httpConfig := appConfig.HTTP - cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) - appID := appConfig.ID - handle := appProvider.Redis - sessionStoreRedis := &webapp2.SessionStoreRedis{ - AppID: appID, - Redis: handle, - } - sessionCookieDef := webapp2.NewSessionCookieDef() - signedUpCookieDef := webapp2.NewSignedUpCookieDef() - featureConfig := config.FeatureConfig - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - httpOrigin := httputil.MakeHTTPOrigin(httpProto, httpHost) - secretConfig := config.SecretConfig - databaseCredentials := deps.ProvideDatabaseCredentials(secretConfig) - sqlBuilderApp := appdb.NewSQLBuilderApp(databaseCredentials, appID) - appdbHandle := appProvider.AppDatabase - sqlExecutor := appdb.NewSQLExecutor(appdbHandle) - store := &user.Store{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - Clock: clockClock, - AppID: appID, - } - rawCommands := &user.RawCommands{ - Store: store, - Clock: clockClock, - } - rawQueries := &user.RawQueries{ - Store: store, - } - userAgentString := deps.ProvideUserAgentString(request) - logger := event.NewLogger(factory) - localizationConfig := appConfig.Localization - sqlBuilder := appdb.NewSQLBuilder(databaseCredentials) - storeImpl := event.NewStoreImpl(sqlBuilder, sqlExecutor) - authenticationConfig := appConfig.Authentication - identityConfig := appConfig.Identity - identityFeatureConfig := featureConfig.Identity - serviceStore := &service.Store{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - } - loginidStore := &loginid.Store{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - } - loginIDConfig := identityConfig.LoginID - manager := appContext.Resources - typeCheckerFactory := &loginid.TypeCheckerFactory{ - UIConfig: uiConfig, - LoginIDConfig: loginIDConfig, - Resources: manager, - } - checker := &loginid.Checker{ - Config: loginIDConfig, - TypeCheckerFactory: typeCheckerFactory, - } - normalizerFactory := &loginid.NormalizerFactory{ - Config: loginIDConfig, - } - provider := &loginid.Provider{ - Store: loginidStore, - Config: loginIDConfig, - Checker: checker, - NormalizerFactory: normalizerFactory, - Clock: clockClock, - } - oauthStore := &oauth3.Store{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - IdentityConfig: identityConfig, - } - oauthProvider := &oauth3.Provider{ - Store: oauthStore, - Clock: clockClock, - IdentityConfig: identityConfig, - } - anonymousStore := &anonymous.Store{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - } - anonymousProvider := &anonymous.Provider{ - Store: anonymousStore, - Clock: clockClock, - } - biometricStore := &biometric.Store{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - } - biometricProvider := &biometric.Provider{ - Store: biometricStore, - Clock: clockClock, - } - passkeyStore := &passkey.Store{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - } - store2 := &passkey2.Store{ - Redis: handle, - AppID: appID, - } - defaultLanguageTag := deps.ProvideDefaultLanguageTag(config) - supportedLanguageTags := deps.ProvideSupportedLanguageTags(config) - resolver := &template.Resolver{ - Resources: manager, - DefaultLanguageTag: defaultLanguageTag, - SupportedLanguageTags: supportedLanguageTags, - } - engine := &template.Engine{ - Resolver: resolver, - } - webAppCDNHost := environmentConfig.WebAppCDNHost - globalEmbeddedResourceManager := rootProvider.EmbeddedResources - staticAssetResolver := &web.StaticAssetResolver{ - Localization: localizationConfig, - HTTPOrigin: httpOrigin, - HTTPProto: httpProto, - WebAppCDNHost: webAppCDNHost, - Resources: manager, - EmbeddedResources: globalEmbeddedResourceManager, - } - translationService := &translation.Service{ - TemplateEngine: engine, - StaticAssets: staticAssetResolver, - } - configService := &passkey2.ConfigService{ - Request: request, - TrustProxy: trustProxy, - TranslationService: translationService, - } - passkeyService := &passkey2.Service{ - Store: store2, - ConfigService: configService, - } - passkeyProvider := &passkey.Provider{ - Store: passkeyStore, - Clock: clockClock, - Passkey: passkeyService, - } - siweStore := &siwe.Store{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -90854,6 +87297,15 @@ func newWebAppCSRFErrorInstructionHandler(p *deps.RequestProvider) http.Handler Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -90928,13 +87380,6 @@ func newWebAppCSRFErrorInstructionHandler(p *deps.RequestProvider) http.Handler UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -90951,7 +87396,6 @@ func newWebAppCSRFErrorInstructionHandler(p *deps.RequestProvider) http.Handler Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -91074,7 +87518,6 @@ func newWebAppCSRFErrorInstructionHandler(p *deps.RequestProvider) http.Handler UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -91186,8 +87629,8 @@ func newWebAppCSRFErrorInstructionHandler(p *deps.RequestProvider) http.Handler AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -91237,7 +87680,7 @@ func newWebAppCSRFErrorInstructionHandler(p *deps.RequestProvider) http.Handler SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -91246,7 +87689,7 @@ func newWebAppCSRFErrorInstructionHandler(p *deps.RequestProvider) http.Handler sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -91285,7 +87728,7 @@ func newWebAppCSRFErrorInstructionHandler(p *deps.RequestProvider) http.Handler UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -91662,49 +88105,28 @@ func newWebAppCSRFErrorInstructionHandler(p *deps.RequestProvider) http.Handler responseRenderer := &webapp.ResponseRenderer{ TemplateEngine: engine, } - csrfErrorInstructionHandler := &webapp.CSRFErrorInstructionHandler{ + authflowV2ErrorHandler := &authflowv2.AuthflowV2ErrorHandler{ Controller: authflowController, BaseViewModel: baseViewModeler, Renderer: responseRenderer, } - return csrfErrorInstructionHandler + return authflowV2ErrorHandler } -func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { +func newWebAppCSRFErrorInstructionHandler(p *deps.RequestProvider) http.Handler { appProvider := p.AppProvider factory := appProvider.LoggerFactory - handle := appProvider.AppDatabase - appredisHandle := appProvider.Redis - appContext := appProvider.AppContext - config := appContext.Config - appConfig := config.AppConfig - appID := appConfig.ID - serviceLogger := webapp2.NewServiceLogger(factory) + authflowControllerLogger := webapp.NewAuthflowControllerLogger(factory) request := p.Request - sessionStoreRedis := &webapp2.SessionStoreRedis{ - AppID: appID, - Redis: appredisHandle, - } - sessionCookieDef := webapp2.NewSessionCookieDef() - signedUpCookieDef := webapp2.NewSignedUpCookieDef() - authenticationConfig := appConfig.Authentication - cookieDef := mfa.NewDeviceTokenCookieDef(authenticationConfig) - errorTokenCookieDef := webapp2.NewErrorTokenCookieDef() rootProvider := appProvider.RootProvider environmentConfig := rootProvider.EnvironmentConfig trustProxy := environmentConfig.TrustProxy - httpConfig := appConfig.HTTP - cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) - errorService := &webapp2.ErrorService{ - AppID: appID, - Cookie: errorTokenCookieDef, - RedisHandle: appredisHandle, - Cookies: cookieManager, - } - oAuthConfig := appConfig.OAuth - uiConfig := appConfig.UI httpHost := deps.ProvideHTTPHost(request, trustProxy) httpProto := deps.ProvideHTTPProto(request, trustProxy) + appContext := appProvider.AppContext + config := appContext.Config + appConfig := config.AppConfig + uiConfig := appConfig.UI globalUIImplementation := environmentConfig.UIImplementation globalUISettingsImplementation := environmentConfig.UISettingsImplementation uiImplementationService := &web.UIImplementationService{ @@ -91717,44 +88139,44 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { HTTPProto: httpProto, UIImplementationService: uiImplementationService, } - uiService := &authenticationinfo.UIService{ - EndpointsProvider: endpointsEndpoints, - } - resolver := &oauthclient.Resolver{ - OAuthConfig: oAuthConfig, - TesterEndpoints: endpointsEndpoints, - } - logger := interaction.NewLogger(factory) - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - sqlExecutor := appdb.NewSQLExecutor(handle) clockClock := _wireSystemClockValue + httpConfig := appConfig.HTTP + cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) + appID := appConfig.ID + handle := appProvider.Redis + sessionStoreRedis := &webapp2.SessionStoreRedis{ + AppID: appID, + Redis: handle, + } + sessionCookieDef := webapp2.NewSessionCookieDef() + signedUpCookieDef := webapp2.NewSignedUpCookieDef() featureConfig := config.FeatureConfig - redisLogger := redis.NewLogger(factory) + remoteIP := deps.ProvideRemoteIP(request, trustProxy) + httpOrigin := httputil.MakeHTTPOrigin(httpProto, httpHost) secretConfig := config.SecretConfig databaseCredentials := deps.ProvideDatabaseCredentials(secretConfig) sqlBuilderApp := appdb.NewSQLBuilderApp(databaseCredentials, appID) - store := &redis.Store{ - Redis: appredisHandle, - AppID: appID, - Logger: redisLogger, + appdbHandle := appProvider.AppDatabase + sqlExecutor := appdb.NewSQLExecutor(appdbHandle) + store := &user.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, Clock: clockClock, + AppID: appID, + } + rawCommands := &user.RawCommands{ + Store: store, + Clock: clockClock, + } + rawQueries := &user.RawQueries{ + Store: store, } userAgentString := deps.ProvideUserAgentString(request) - eventLogger := event.NewLogger(factory) + logger := event.NewLogger(factory) localizationConfig := appConfig.Localization sqlBuilder := appdb.NewSQLBuilder(databaseCredentials) storeImpl := event.NewStoreImpl(sqlBuilder, sqlExecutor) - userStore := &user.Store{ - SQLBuilder: sqlBuilderApp, - SQLExecutor: sqlExecutor, - Clock: clockClock, - AppID: appID, - } - rawQueries := &user.RawQueries{ - Store: userStore, - } + authenticationConfig := appConfig.Authentication identityConfig := appConfig.Identity identityFeatureConfig := featureConfig.Identity serviceStore := &service.Store{ @@ -91817,20 +88239,19 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } store2 := &passkey2.Store{ - Redis: appredisHandle, + Redis: handle, AppID: appID, } defaultLanguageTag := deps.ProvideDefaultLanguageTag(config) supportedLanguageTags := deps.ProvideSupportedLanguageTags(config) - templateResolver := &template.Resolver{ + resolver := &template.Resolver{ Resources: manager, DefaultLanguageTag: defaultLanguageTag, SupportedLanguageTags: supportedLanguageTags, } engine := &template.Engine{ - Resolver: templateResolver, + Resolver: resolver, } - httpOrigin := httputil.MakeHTTPOrigin(httpProto, httpHost) webAppCDNHost := environmentConfig.WebAppCDNHost globalEmbeddedResourceManager := rootProvider.EmbeddedResources staticAssetResolver := &web.StaticAssetResolver{ @@ -91863,36 +88284,9 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -91985,21 +88379,30 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode codeStoreRedis := &otp.CodeStoreRedis{ - Redis: appredisHandle, + Redis: handle, AppID: appID, Clock: clockClock, } lookupStoreRedis := &otp.LookupStoreRedis{ - Redis: appredisHandle, + Redis: handle, AppID: appID, Clock: clockClock, } attemptTrackerRedis := &otp.AttemptTrackerRedis{ - Redis: appredisHandle, + Redis: handle, AppID: appID, Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -92021,7 +88424,7 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { lockoutLogger := lockout.NewLogger(factory) lockoutStorageRedis := &lockout.StorageRedis{ AppID: appID, - Redis: appredisHandle, + Redis: handle, } lockoutService := &lockout.Service{ Logger: lockoutLogger, @@ -92065,21 +88468,14 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, Identities: serviceService, UserQueries: rawQueries, - UserStore: userStore, + UserStore: store, ClaimStore: storePQ, Transformer: pictureTransformer, } customattrsServiceNoEvent := &customattrs.ServiceNoEvent{ Config: userProfileConfig, UserQueries: rawQueries, - UserStore: userStore, - } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, + UserStore: store, } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, @@ -92091,13 +88487,12 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { } userQueries := &user.Queries{ RawQueries: rawQueries, - Store: userStore, + Store: store, Identities: serviceService, Authenticators: service3, Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -92161,11 +88556,11 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { sinkLogger := reindex.NewSinkLogger(factory) searchConfig := appConfig.Search reindexerLogger := reindex.NewReindexerLogger(factory) - userReindexProducer := redisqueue.NewUserReindexProducer(appredisHandle, clockClock) + userReindexProducer := redisqueue.NewUserReindexProducer(handle, clockClock) sourceProvider := &reindex.SourceProvider{ AppID: appID, Users: userQueries, - UserStore: userStore, + UserStore: store, IdentityService: serviceService, RolesGroups: rolesgroupsStore, } @@ -92174,12 +88569,12 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { client := elasticsearch.NewClient(elasticsearchCredentials) elasticsearchService := &elasticsearch.Service{ Clock: clockClock, - Database: handle, + Database: appdbHandle, Logger: elasticsearchServiceLogger, AppID: appID, Client: client, Users: userQueries, - UserStore: userStore, + UserStore: store, IdentityService: serviceService, RolesGroups: rolesgroupsStore, } @@ -92198,9 +88593,9 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { AppID: appID, SearchConfig: searchConfig, Clock: clockClock, - Database: handle, + Database: appdbHandle, Logger: reindexerLogger, - UserStore: userStore, + UserStore: store, Producer: userReindexProducer, SourceProvider: sourceProvider, ElasticsearchReindexer: elasticsearchService, @@ -92209,11 +88604,25 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { reindexSink := &reindex.Sink{ Logger: sinkLogger, Reindexer: reindexer, - Database: handle, + Database: appdbHandle, + } + eventService := event.NewService(appID, remoteIP, userAgentString, logger, appdbHandle, clockClock, localizationConfig, storeImpl, resolverImpl, sink, auditSink, reindexSink) + userCommands := &user.Commands{ + RawCommands: rawCommands, + RawQueries: rawQueries, + Events: eventService, + Verification: verificationService, + UserProfileConfig: userProfileConfig, + StandardAttributes: serviceNoEvent, + CustomAttributes: customattrsServiceNoEvent, + RolesAndGroups: queries, + } + userProvider := &user.Provider{ + Commands: userCommands, + Queries: userQueries, } - eventService := event.NewService(appID, remoteIP, userAgentString, eventLogger, handle, clockClock, localizationConfig, storeImpl, resolverImpl, sink, auditSink, reindexSink) storeDeviceTokenRedis := &mfa.StoreDeviceTokenRedis{ - Redis: appredisHandle, + Redis: handle, AppID: appID, Clock: clockClock, } @@ -92241,7 +88650,7 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { Logger: usageLogger, Clock: clockClock, AppID: appID, - Redis: appredisHandle, + Redis: handle, } messagingConfig := appConfig.Messaging messagingRateLimitsConfig := messagingConfig.RateLimits @@ -92309,18 +88718,18 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { Logger: smsLogger, ClientResolver: clientResolver, } - whatsappServiceLogger := whatsapp.NewServiceLogger(factory) + serviceLogger := whatsapp.NewServiceLogger(factory) whatsappConfig := messagingConfig.Whatsapp whatsappOnPremisesCredentials := deps.ProvideWhatsappOnPremisesCredentials(secretConfig) tokenStore := &whatsapp.TokenStore{ - Redis: appredisHandle, + Redis: handle, AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ - Logger: whatsappServiceLogger, + Logger: serviceLogger, WhatsappConfig: whatsappConfig, LocalizationConfig: localizationConfig, OnPremisesClient: onPremisesClient, @@ -92339,7 +88748,7 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { MailSender: sender, SMSSender: smsClient, WhatsappSender: whatsappService, - Database: handle, + Database: appdbHandle, DevMode: devMode, MessagingFeatureConfig: messagingFeatureConfig, FeatureTestModeEmailSuppressed: featureTestModeEmailSuppressed, @@ -92355,27 +88764,12 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { Sender: messagingSender, Translation: translationService, } - rawCommands := &user.RawCommands{ - Store: userStore, - Clock: clockClock, - } - userCommands := &user.Commands{ - RawCommands: rawCommands, - RawQueries: rawQueries, - Events: eventService, - Verification: verificationService, - UserProfileConfig: userProfileConfig, - StandardAttributes: serviceNoEvent, - CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, - RolesAndGroups: queries, - } stdattrsService := &stdattrs2.Service{ UserProfileConfig: userProfileConfig, ServiceNoEvent: serviceNoEvent, Identities: serviceService, UserQueries: rawQueries, - UserStore: userStore, + UserStore: store, Events: eventService, } authorizationStore := &pq.AuthorizationStore{ @@ -92383,22 +88777,32 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ - Redis: appredisHandle, + storeRedis := &idpsession.StoreRedis{ + Redis: handle, AppID: appID, Clock: clockClock, Logger: storeRedisLogger, } sessionConfig := appConfig.Session - cookieDef2 := session.NewSessionCookieDef(sessionConfig) + cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, - CookieDef: cookieDef2, + CookieDef: cookieDef, + } + redisLogger := redis.NewLogger(factory) + redisStore := &redis.Store{ + Redis: handle, + AppID: appID, + Logger: redisLogger, + SQLBuilder: sqlBuilderApp, + SQLExecutor: sqlExecutor, + Clock: clockClock, } + oAuthConfig := appConfig.OAuth eventStoreRedis := &access.EventStoreRedis{ - Redis: appredisHandle, + Redis: handle, AppID: appID, } eventProvider := &access.EventProvider{ @@ -92420,8 +88824,8 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { RemoteIP: remoteIP, UserAgentString: userAgentString, AppID: appID, - Redis: appredisHandle, - Store: idpsessionStoreRedis, + Redis: handle, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -92429,17 +88833,21 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, Random: idpsessionRand, } + oauthclientResolver := &oauthclient.Resolver{ + OAuthConfig: oAuthConfig, + TesterEndpoints: endpointsEndpoints, + } offlineGrantService := oauth2.OfflineGrantService{ OAuthConfig: oAuthConfig, Clock: clockClock, IDPSessions: idpsessionProvider, - ClientResolver: resolver, + ClientResolver: oauthclientResolver, AccessEvents: eventProvider, MeterService: meterService, - OfflineGrants: store, + OfflineGrants: redisStore, } sessionManager := &oauth2.SessionManager{ - Store: store, + Store: redisStore, Config: oAuthConfig, Service: offlineGrantService, } @@ -92478,40 +88886,30 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { identityFacade := facade.IdentityFacade{ Coordinator: coordinator, } - authenticatorFacade := facade.AuthenticatorFacade{ - Coordinator: coordinator, - } anonymousStoreRedis := &anonymous.StoreRedis{ - Redis: appredisHandle, + Redis: handle, AppID: appID, Clock: clockClock, } + authenticatorFacade := facade.AuthenticatorFacade{ + Coordinator: coordinator, + } + mfaFacade := &facade.MFAFacade{ + Coordinator: coordinator, + } + customattrsService := &customattrs.Service{ + Config: userProfileConfig, + ServiceNoEvent: customattrsServiceNoEvent, + Events: eventService, + } messageSender := &otp.MessageSender{ AppID: appID, Translation: translationService, Endpoints: endpointsEndpoints, Sender: messagingSender, } - oAuthSSOProviderCredentials := deps.ProvideOAuthSSOProviderCredentials(secretConfig) - oAuthHTTPClient := sso.ProvideOAuthHTTPClient(environmentConfig) - simpleStoreRedisFactory := &sso.SimpleStoreRedisFactory{ - AppID: appID, - Redis: appredisHandle, - } - oAuthProviderFactory := &sso.OAuthProviderFactory{ - IdentityConfig: identityConfig, - Credentials: oAuthSSOProviderCredentials, - Clock: clockClock, - StandardAttributesNormalizer: normalizer, - HTTPClient: oAuthHTTPClient, - SimpleStoreRedisFactory: simpleStoreRedisFactory, - } - webappoauthStore := &webappoauth.Store{ - Redis: appredisHandle, - AppID: appID, - } - mfaFacade := &facade.MFAFacade{ - Coordinator: coordinator, + workflowVerificationFacade := facade.WorkflowVerificationFacade{ + Verification: verificationService, } forgotpasswordLogger := forgotpassword.NewLogger(factory) sender2 := forgotpassword.Sender{ @@ -92531,102 +88929,249 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { PasswordSender: sender2, Events: eventService, } - responseWriter := p.ResponseWriter - nonceService := &nonce.Service{ - Cookies: cookieManager, - Request: request, - ResponseWriter: responseWriter, + accountMigrationConfig := appConfig.AccountMigration + accountMigrationHookConfig := accountMigrationConfig.Hook + accountmigrationHookDenoClient := accountmigration.NewHookDenoClient(denoEndpoint, hookLogger, accountMigrationHookConfig) + denoMiddlewareLogger := accountmigration.NewDenoMiddlewareLogger(factory) + accountMigrationDenoHook := &accountmigration.AccountMigrationDenoHook{ + DenoHook: denoHook, + Client: accountmigrationHookDenoClient, + Logger: denoMiddlewareLogger, + } + accountmigrationHookHTTPClient := accountmigration.NewHookHTTPClient(accountMigrationHookConfig) + webhookMiddlewareLogger := accountmigration.NewWebhookMiddlewareLogger(factory) + accountMigrationWebHook := &accountmigration.AccountMigrationWebHook{ + WebHook: hookWebHookImpl, + Client: accountmigrationHookHTTPClient, + Logger: webhookMiddlewareLogger, + } + accountmigrationService := &accountmigration.Service{ + Config: accountMigrationHookConfig, + DenoHook: accountMigrationDenoHook, + WebHook: accountMigrationWebHook, } challengeProvider := &challenge.Provider{ - Redis: appredisHandle, + Redis: handle, AppID: appID, Clock: clockClock, } - userProvider := &user.Provider{ - Commands: userCommands, - Queries: userQueries, + captchaConfig := appConfig.Captcha + providerLogger := captcha.NewProviderLogger(factory) + deprecated_CaptchaCloudflareCredentials := deps.ProvideCaptchaCloudflareCredentials(secretConfig) + captchaHTTPClient := captcha2.NewHTTPClient() + cloudflareClient := captcha2.NewCloudflareClient(deprecated_CaptchaCloudflareCredentials, captchaHTTPClient) + captchaProvider := &captcha.Provider{ + RemoteIP: remoteIP, + Config: captchaConfig, + Logger: providerLogger, + CloudflareClient: cloudflareClient, } - authenticationinfoStoreRedis := &authenticationinfo.StoreRedis{ - Redis: appredisHandle, + botProtectionConfig := appConfig.BotProtection + botprotectionProviderLogger := botprotection.NewProviderLogger(factory) + botProtectionProviderCredentials := deps.ProvideBotProtectionProvidersCredentials(secretConfig) + botprotectionCloudflareClient := botprotection.NewCloudflareClient(botProtectionProviderCredentials, environmentConfig) + recaptchaV2Client := botprotection.NewRecaptchaV2Client(botProtectionProviderCredentials, environmentConfig) + botprotectionProvider := &botprotection.Provider{ + RemoteIP: remoteIP, + Config: botProtectionConfig, + Logger: botprotectionProviderLogger, + CloudflareClient: botprotectionCloudflareClient, + RecaptchaV2Client: recaptchaV2Client, + Events: eventService, + } + oAuthSSOProviderCredentials := deps.ProvideOAuthSSOProviderCredentials(secretConfig) + oAuthHTTPClient := sso.ProvideOAuthHTTPClient(environmentConfig) + simpleStoreRedisFactory := &sso.SimpleStoreRedisFactory{ AppID: appID, + Redis: handle, + } + oAuthProviderFactory := &sso.OAuthProviderFactory{ + IdentityConfig: identityConfig, + Credentials: oAuthSSOProviderCredentials, + Clock: clockClock, + StandardAttributesNormalizer: normalizer, + HTTPClient: oAuthHTTPClient, + SimpleStoreRedisFactory: simpleStoreRedisFactory, + } + requestOptionsService := &passkey2.RequestOptionsService{ + ConfigService: configService, + IdentityService: serviceService, + Store: store2, + } + creationOptionsService := &passkey2.CreationOptionsService{ + ConfigService: configService, + UserService: userQueries, + IdentityService: serviceService, + Store: store2, + } + ldapConfig := identityConfig.LDAP + ldapServerUserCredentials := deps.ProvideLDAPServerUserCredentials(secretConfig) + clientFactory := &ldap2.ClientFactory{ + Config: ldapConfig, + SecretConfig: ldapServerUserCredentials, } manager2 := &session.Manager{ IDPSessions: idpsessionManager, AccessTokenSessions: sessionManager, Events: eventService, } - oauthsessionStoreRedis := &oauthsession.StoreRedis{ - Redis: appredisHandle, + authenticationinfoStoreRedis := &authenticationinfo.StoreRedis{ + Redis: handle, AppID: appID, } - interactionContext := &interaction.Context{ - Request: request, - RemoteIP: remoteIP, - Database: sqlExecutor, - Clock: clockClock, + mfaCookieDef := mfa.NewDeviceTokenCookieDef(authenticationConfig) + userFacade := &facade.UserFacade{ + UserProvider: userProvider, + Coordinator: coordinator, + } + oAuthKeyMaterials := deps.ProvideOAuthKeyMaterials(secretConfig) + idTokenIssuer := &oidc.IDTokenIssuer{ + Secrets: oAuthKeyMaterials, + BaseURL: endpointsEndpoints, + Users: userQueries, + RolesAndGroups: queries, + Clock: clockClock, + } + dependencies := &authenticationflow.Dependencies{ Config: appConfig, FeatureConfig: featureConfig, - OAuthClientResolver: resolver, - OfflineGrants: store, + Clock: clockClock, + RemoteIP: remoteIP, + HTTPOrigin: httpOrigin, + HTTPRequest: request, + Users: userProvider, Identities: identityFacade, - Authenticators: authenticatorFacade, AnonymousIdentities: anonymousProvider, AnonymousUserPromotionCodeStore: anonymousStoreRedis, - BiometricIdentities: biometricProvider, - OTPCodeService: otpService, - OTPSender: messageSender, - OAuthProviderFactory: oAuthProviderFactory, - OAuthRedirectURIBuilder: endpointsEndpoints, - OAuthStateStore: webappoauthStore, + Authenticators: authenticatorFacade, MFA: mfaFacade, + StdAttrsService: stdattrsService, + CustomAttrsService: customattrsService, + OTPCodes: otpService, + OTPSender: messageSender, + Verification: workflowVerificationFacade, ForgotPassword: forgotpasswordService, ResetPassword: forgotpasswordService, - Passkey: passkeyService, - Verification: verificationService, - RateLimiter: limiter, - PasswordGenerator: generator, - Nonces: nonceService, + AccountMigrations: accountmigrationService, Challenges: challengeProvider, - Users: userProvider, - StdAttrsService: stdattrsService, + Captcha: captchaProvider, + BotProtection: botprotectionProvider, + OAuthProviderFactory: oAuthProviderFactory, + PasskeyRequestOptionsService: requestOptionsService, + PasskeyCreationOptionsService: creationOptionsService, + PasskeyService: passkeyService, + LoginIDs: provider, + LDAP: ldapProvider, + LDAPClientFactory: clientFactory, + IDPSessions: idpsessionProvider, + Sessions: manager2, + AuthenticationInfos: authenticationinfoStoreRedis, + SessionCookie: cookieDef, + MFADeviceTokenCookie: mfaCookieDef, + UserFacade: userFacade, + Cookies: cookieManager, Events: eventService, - CookieManager: cookieManager, - AuthenticationInfoService: authenticationinfoStoreRedis, - Sessions: idpsessionProvider, - SessionManager: manager2, - SessionCookie: cookieDef2, - OAuthSessions: oauthsessionStoreRedis, - MFADeviceTokenCookie: cookieDef, + RateLimiter: limiter, + OfflineGrants: redisStore, + IDTokens: idTokenIssuer, } - interactionStoreRedis := &interaction.StoreRedis{ - Redis: appredisHandle, + authenticationflowServiceLogger := authenticationflow.NewServiceLogger(factory) + authenticationflowStoreImpl := &authenticationflow.StoreImpl{ + Redis: handle, AppID: appID, } - interactionService := &interaction.Service{ - Logger: logger, - Context: interactionContext, - Store: interactionStoreRedis, + uiService := &authenticationinfo.UIService{ + EndpointsProvider: endpointsEndpoints, } - webappService2 := &webapp2.Service2{ - Logger: serviceLogger, - Request: request, - Sessions: sessionStoreRedis, - SessionCookie: sessionCookieDef, - SignedUpCookie: signedUpCookieDef, - MFADeviceTokenCookie: cookieDef, - ErrorService: errorService, - Cookies: cookieManager, - OAuthConfig: oAuthConfig, - UIConfig: uiConfig, - TrustProxy: trustProxy, - UIInfoResolver: uiService, - OAuthClientResolver: resolver, - Graph: interactionService, + authenticationflowService := &authenticationflow.Service{ + Deps: dependencies, + Logger: authenticationflowServiceLogger, + Store: authenticationflowStoreImpl, + Database: appdbHandle, + UIConfig: uiConfig, + UIInfoResolver: uiService, + OAuthClientResolver: oauthclientResolver, + } + oauthsessionStoreRedis := &oauthsession.StoreRedis{ + Redis: handle, + AppID: appID, + } + samlsessionStoreRedis := &samlsession.StoreRedis{ + Redis: handle, + AppID: appID, + } + promptResolver := &oauth2.PromptResolver{ + Clock: clockClock, + } + oauthOfflineGrantService := &oauth2.OfflineGrantService{ + OAuthConfig: oAuthConfig, + Clock: clockClock, + IDPSessions: idpsessionProvider, + ClientResolver: oauthclientResolver, + AccessEvents: eventProvider, + MeterService: meterService, + OfflineGrants: redisStore, + } + idTokenHintResolver := &oidc.IDTokenHintResolver{ + Issuer: idTokenIssuer, + Sessions: idpsessionProvider, + OfflineGrantService: oauthOfflineGrantService, + } + uiInfoResolver := &oidc.UIInfoResolver{ + Config: oAuthConfig, + EndpointsProvider: endpointsEndpoints, + PromptResolver: promptResolver, + IDTokenHintResolver: idTokenHintResolver, + Clock: clockClock, + Cookies: cookieManager, + ClientResolver: oauthclientResolver, + } + webappoauthStore := &webappoauth.Store{ + Redis: handle, + AppID: appID, + } + authflowV2Navigator := &authflowv2.AuthflowV2Navigator{ + Endpoints: endpointsEndpoints, + OAuthStateStore: webappoauthStore, + } + errorTokenCookieDef := webapp2.NewErrorTokenCookieDef() + errorService := &webapp2.ErrorService{ + AppID: appID, + Cookie: errorTokenCookieDef, + RedisHandle: handle, + Cookies: cookieManager, + } + authflowNavigator := &webapp2.AuthflowNavigator{ + Endpoints: endpointsEndpoints, + OAuthStateStore: webappoauthStore, + } + errorRenderer := &webapp.ErrorRenderer{ + ErrorService: errorService, + UIImplementationService: uiImplementationService, + AuthflowV1Navigator: authflowNavigator, + AuthflowV2Navigator: authflowV2Navigator, + } + authflowController := &webapp.AuthflowController{ + Logger: authflowControllerLogger, + TesterEndpointsProvider: endpointsEndpoints, + TrustProxy: trustProxy, + Clock: clockClock, + Cookies: cookieManager, + Sessions: sessionStoreRedis, + SessionCookie: sessionCookieDef, + SignedUpCookie: signedUpCookieDef, + Authflows: authenticationflowService, + OAuthSessions: oauthsessionStoreRedis, + SAMLSessions: samlsessionStoreRedis, + UIInfoResolver: uiInfoResolver, + UIConfig: uiConfig, + OAuthClientResolver: oauthclientResolver, + Navigator: authflowV2Navigator, + ErrorRenderer: errorRenderer, } uiFeatureConfig := featureConfig.UI forgotPasswordConfig := appConfig.ForgotPassword googleTagManagerConfig := appConfig.GoogleTagManager - botProtectionConfig := appConfig.BotProtection flashMessage := &httputil.FlashMessage{ Cookies: cookieManager, } @@ -92651,53 +89196,21 @@ func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { SupportedLanguageTags: supportedLanguageTags, AuthUISentryDSN: authUISentryDSN, AuthUIWindowMessageAllowedOrigins: authUIWindowMessageAllowedOrigins, - OAuthClientResolver: resolver, + OAuthClientResolver: oauthclientResolver, Logger: baseLogger, } responseRenderer := &webapp.ResponseRenderer{ TemplateEngine: engine, } - publisher := webapp.NewPublisher(appID, appredisHandle) - authflowNavigator := &webapp2.AuthflowNavigator{ - Endpoints: endpointsEndpoints, - OAuthStateStore: webappoauthStore, - } - authflowV2Navigator := &authflowv2.AuthflowV2Navigator{ - Endpoints: endpointsEndpoints, - OAuthStateStore: webappoauthStore, - } - errorRenderer := &webapp.ErrorRenderer{ - ErrorService: errorService, - UIImplementationService: uiImplementationService, - AuthflowV1Navigator: authflowNavigator, - AuthflowV2Navigator: authflowV2Navigator, - } - controllerDeps := webapp.ControllerDeps{ - Database: handle, - RedisHandle: appredisHandle, - AppID: appID, - Page: webappService2, - BaseViewModel: baseViewModeler, - Renderer: responseRenderer, - Publisher: publisher, - Clock: clockClock, - TesterEndpointsProvider: endpointsEndpoints, - ErrorRenderer: errorRenderer, - TrustProxy: trustProxy, - } - controllerFactory := webapp.ControllerFactory{ - LoggerFactory: factory, - ControllerDeps: controllerDeps, - } - notFoundHandler := &webapp.NotFoundHandler{ - ControllerFactory: controllerFactory, - BaseViewModel: baseViewModeler, - Renderer: responseRenderer, + csrfErrorInstructionHandler := &webapp.CSRFErrorInstructionHandler{ + Controller: authflowController, + BaseViewModel: baseViewModeler, + Renderer: responseRenderer, } - return notFoundHandler + return csrfErrorInstructionHandler } -func newWebAppAuthflowV2NotFoundHandler(p *deps.RequestProvider) http.Handler { +func newWebAppNotFoundHandler(p *deps.RequestProvider) http.Handler { appProvider := p.AppProvider factory := appProvider.LoggerFactory handle := appProvider.AppDatabase @@ -92890,36 +89403,9 @@ func newWebAppAuthflowV2NotFoundHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -93027,6 +89513,15 @@ func newWebAppAuthflowV2NotFoundHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -93101,13 +89596,6 @@ func newWebAppAuthflowV2NotFoundHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -93124,7 +89612,6 @@ func newWebAppAuthflowV2NotFoundHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -93344,8 +89831,8 @@ func newWebAppAuthflowV2NotFoundHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -93394,7 +89881,6 @@ func newWebAppAuthflowV2NotFoundHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -93410,7 +89896,7 @@ func newWebAppAuthflowV2NotFoundHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -93419,7 +89905,7 @@ func newWebAppAuthflowV2NotFoundHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -93448,7 +89934,7 @@ func newWebAppAuthflowV2NotFoundHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -93716,45 +90202,28 @@ func newWebAppAuthflowV2NotFoundHandler(p *deps.RequestProvider) http.Handler { LoggerFactory: factory, ControllerDeps: controllerDeps, } - authflowV2NotFoundHandler := &authflowv2.AuthflowV2NotFoundHandler{ + notFoundHandler := &webapp.NotFoundHandler{ ControllerFactory: controllerFactory, BaseViewModel: baseViewModeler, Renderer: responseRenderer, } - return authflowV2NotFoundHandler + return notFoundHandler } -func newWebAppWebsocketHandler(p *deps.RequestProvider) http.Handler { +func newWebAppAuthflowV2NotFoundHandler(p *deps.RequestProvider) http.Handler { appProvider := p.AppProvider + factory := appProvider.LoggerFactory + handle := appProvider.AppDatabase + appredisHandle := appProvider.Redis appContext := appProvider.AppContext config := appContext.Config appConfig := config.AppConfig appID := appConfig.ID - factory := appProvider.LoggerFactory - handle := appProvider.Redis - publisher := webapp.NewPublisher(appID, handle) - websocketHandler := &webapp.WebsocketHandler{ - AppID: appID, - LoggerFactory: factory, - RedisHandle: handle, - Publisher: publisher, - } - return websocketHandler -} - -func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handler { - appProvider := p.AppProvider - factory := appProvider.LoggerFactory serviceLogger := webapp2.NewServiceLogger(factory) request := p.Request - appContext := appProvider.AppContext - config := appContext.Config - appConfig := config.AppConfig - appID := appConfig.ID - handle := appProvider.Redis sessionStoreRedis := &webapp2.SessionStoreRedis{ AppID: appID, - Redis: handle, + Redis: appredisHandle, } sessionCookieDef := webapp2.NewSessionCookieDef() signedUpCookieDef := webapp2.NewSignedUpCookieDef() @@ -93769,7 +90238,7 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle errorService := &webapp2.ErrorService{ AppID: appID, Cookie: errorTokenCookieDef, - RedisHandle: handle, + RedisHandle: appredisHandle, Cookies: cookieManager, } oAuthConfig := appConfig.OAuth @@ -93797,8 +90266,7 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle } logger := interaction.NewLogger(factory) remoteIP := deps.ProvideRemoteIP(request, trustProxy) - appdbHandle := appProvider.AppDatabase - sqlExecutor := appdb.NewSQLExecutor(appdbHandle) + sqlExecutor := appdb.NewSQLExecutor(handle) clockClock := _wireSystemClockValue featureConfig := config.FeatureConfig redisLogger := redis.NewLogger(factory) @@ -93806,7 +90274,7 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle databaseCredentials := deps.ProvideDatabaseCredentials(secretConfig) sqlBuilderApp := appdb.NewSQLBuilderApp(databaseCredentials, appID) store := &redis.Store{ - Redis: handle, + Redis: appredisHandle, AppID: appID, Logger: redisLogger, SQLBuilder: sqlBuilderApp, @@ -93889,7 +90357,7 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle SQLExecutor: sqlExecutor, } store2 := &passkey2.Store{ - Redis: handle, + Redis: appredisHandle, AppID: appID, } defaultLanguageTag := deps.ProvideDefaultLanguageTag(config) @@ -93935,36 +90403,9 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -94057,21 +90498,30 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode codeStoreRedis := &otp.CodeStoreRedis{ - Redis: handle, + Redis: appredisHandle, AppID: appID, Clock: clockClock, } lookupStoreRedis := &otp.LookupStoreRedis{ - Redis: handle, + Redis: appredisHandle, AppID: appID, Clock: clockClock, } attemptTrackerRedis := &otp.AttemptTrackerRedis{ - Redis: handle, + Redis: appredisHandle, AppID: appID, Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -94093,7 +90543,7 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle lockoutLogger := lockout.NewLogger(factory) lockoutStorageRedis := &lockout.StorageRedis{ AppID: appID, - Redis: handle, + Redis: appredisHandle, } lockoutService := &lockout.Service{ Logger: lockoutLogger, @@ -94146,13 +90596,6 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -94169,7 +90612,6 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -94233,7 +90675,7 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle sinkLogger := reindex.NewSinkLogger(factory) searchConfig := appConfig.Search reindexerLogger := reindex.NewReindexerLogger(factory) - userReindexProducer := redisqueue.NewUserReindexProducer(handle, clockClock) + userReindexProducer := redisqueue.NewUserReindexProducer(appredisHandle, clockClock) sourceProvider := &reindex.SourceProvider{ AppID: appID, Users: userQueries, @@ -94246,7 +90688,7 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle client := elasticsearch.NewClient(elasticsearchCredentials) elasticsearchService := &elasticsearch.Service{ Clock: clockClock, - Database: appdbHandle, + Database: handle, Logger: elasticsearchServiceLogger, AppID: appID, Client: client, @@ -94270,7 +90712,7 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle AppID: appID, SearchConfig: searchConfig, Clock: clockClock, - Database: appdbHandle, + Database: handle, Logger: reindexerLogger, UserStore: userStore, Producer: userReindexProducer, @@ -94281,11 +90723,11 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle reindexSink := &reindex.Sink{ Logger: sinkLogger, Reindexer: reindexer, - Database: appdbHandle, + Database: handle, } - eventService := event.NewService(appID, remoteIP, userAgentString, eventLogger, appdbHandle, clockClock, localizationConfig, storeImpl, resolverImpl, sink, auditSink, reindexSink) + eventService := event.NewService(appID, remoteIP, userAgentString, eventLogger, handle, clockClock, localizationConfig, storeImpl, resolverImpl, sink, auditSink, reindexSink) storeDeviceTokenRedis := &mfa.StoreDeviceTokenRedis{ - Redis: handle, + Redis: appredisHandle, AppID: appID, Clock: clockClock, } @@ -94313,7 +90755,7 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle Logger: usageLogger, Clock: clockClock, AppID: appID, - Redis: handle, + Redis: appredisHandle, } messagingConfig := appConfig.Messaging messagingRateLimitsConfig := messagingConfig.RateLimits @@ -94385,12 +90827,12 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle whatsappConfig := messagingConfig.Whatsapp whatsappOnPremisesCredentials := deps.ProvideWhatsappOnPremisesCredentials(secretConfig) tokenStore := &whatsapp.TokenStore{ - Redis: handle, + Redis: appredisHandle, AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -94411,7 +90853,7 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle MailSender: sender, SMSSender: smsClient, WhatsappSender: whatsappService, - Database: appdbHandle, + Database: handle, DevMode: devMode, MessagingFeatureConfig: messagingFeatureConfig, FeatureTestModeEmailSuppressed: featureTestModeEmailSuppressed, @@ -94439,7 +90881,6 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -94455,8 +90896,8 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ - Redis: handle, + storeRedis := &idpsession.StoreRedis{ + Redis: appredisHandle, AppID: appID, Clock: clockClock, Logger: storeRedisLogger, @@ -94464,13 +90905,13 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, } eventStoreRedis := &access.EventStoreRedis{ - Redis: handle, + Redis: appredisHandle, AppID: appID, } eventProvider := &access.EventProvider{ @@ -94492,8 +90933,8 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle RemoteIP: remoteIP, UserAgentString: userAgentString, AppID: appID, - Redis: handle, - Store: idpsessionStoreRedis, + Redis: appredisHandle, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -94554,7 +90995,7 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle Coordinator: coordinator, } anonymousStoreRedis := &anonymous.StoreRedis{ - Redis: handle, + Redis: appredisHandle, AppID: appID, Clock: clockClock, } @@ -94568,7 +91009,7 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle oAuthHTTPClient := sso.ProvideOAuthHTTPClient(environmentConfig) simpleStoreRedisFactory := &sso.SimpleStoreRedisFactory{ AppID: appID, - Redis: handle, + Redis: appredisHandle, } oAuthProviderFactory := &sso.OAuthProviderFactory{ IdentityConfig: identityConfig, @@ -94579,7 +91020,7 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle SimpleStoreRedisFactory: simpleStoreRedisFactory, } webappoauthStore := &webappoauth.Store{ - Redis: handle, + Redis: appredisHandle, AppID: appID, } mfaFacade := &facade.MFAFacade{ @@ -94610,7 +91051,7 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle ResponseWriter: responseWriter, } challengeProvider := &challenge.Provider{ - Redis: handle, + Redis: appredisHandle, AppID: appID, Clock: clockClock, } @@ -94619,7 +91060,7 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle Queries: userQueries, } authenticationinfoStoreRedis := &authenticationinfo.StoreRedis{ - Redis: handle, + Redis: appredisHandle, AppID: appID, } manager2 := &session.Manager{ @@ -94628,7 +91069,7 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle Events: eventService, } oauthsessionStoreRedis := &oauthsession.StoreRedis{ - Redis: handle, + Redis: appredisHandle, AppID: appID, } interactionContext := &interaction.Context{ @@ -94671,7 +91112,7 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle MFADeviceTokenCookie: cookieDef, } interactionStoreRedis := &interaction.StoreRedis{ - Redis: handle, + Redis: appredisHandle, AppID: appID, } interactionService := &interaction.Service{ @@ -94695,26 +91136,99 @@ func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handle OAuthClientResolver: resolver, Graph: interactionService, } - jsonResponseWriterLogger := httputil.NewJSONResponseWriterLogger(factory) - jsonResponseWriter := &httputil.JSONResponseWriter{ - Logger: jsonResponseWriterLogger, + uiFeatureConfig := featureConfig.UI + forgotPasswordConfig := appConfig.ForgotPassword + googleTagManagerConfig := appConfig.GoogleTagManager + botProtectionConfig := appConfig.BotProtection + flashMessage := &httputil.FlashMessage{ + Cookies: cookieManager, } - creationOptionsService := &passkey2.CreationOptionsService{ - ConfigService: configService, - UserService: userQueries, - IdentityService: serviceService, - Store: store2, + authUISentryDSN := environmentConfig.AuthUISentryDSN + authUIWindowMessageAllowedOrigins := environmentConfig.AuthUIWindowMessageAllowedOrigins + baseLogger := viewmodels.NewBaseLogger(factory) + baseViewModeler := &viewmodels.BaseViewModeler{ + TrustProxy: trustProxy, + OAuth: oAuthConfig, + AuthUI: uiConfig, + AuthUIFeatureConfig: uiFeatureConfig, + StaticAssets: staticAssetResolver, + ForgotPassword: forgotPasswordConfig, + Authentication: authenticationConfig, + GoogleTagManager: googleTagManagerConfig, + BotProtection: botProtectionConfig, + ErrorService: errorService, + Translations: translationService, + Clock: clockClock, + FlashMessage: flashMessage, + DefaultLanguageTag: defaultLanguageTag, + SupportedLanguageTags: supportedLanguageTags, + AuthUISentryDSN: authUISentryDSN, + AuthUIWindowMessageAllowedOrigins: authUIWindowMessageAllowedOrigins, + OAuthClientResolver: resolver, + Logger: baseLogger, } - passkeyCreationOptionsHandler := &webapp.PasskeyCreationOptionsHandler{ - Page: webappService2, - Database: appdbHandle, - JSON: jsonResponseWriter, - Passkey: creationOptionsService, + responseRenderer := &webapp.ResponseRenderer{ + TemplateEngine: engine, } - return passkeyCreationOptionsHandler + publisher := webapp.NewPublisher(appID, appredisHandle) + authflowNavigator := &webapp2.AuthflowNavigator{ + Endpoints: endpointsEndpoints, + OAuthStateStore: webappoauthStore, + } + authflowV2Navigator := &authflowv2.AuthflowV2Navigator{ + Endpoints: endpointsEndpoints, + OAuthStateStore: webappoauthStore, + } + errorRenderer := &webapp.ErrorRenderer{ + ErrorService: errorService, + UIImplementationService: uiImplementationService, + AuthflowV1Navigator: authflowNavigator, + AuthflowV2Navigator: authflowV2Navigator, + } + controllerDeps := webapp.ControllerDeps{ + Database: handle, + RedisHandle: appredisHandle, + AppID: appID, + Page: webappService2, + BaseViewModel: baseViewModeler, + Renderer: responseRenderer, + Publisher: publisher, + Clock: clockClock, + TesterEndpointsProvider: endpointsEndpoints, + ErrorRenderer: errorRenderer, + TrustProxy: trustProxy, + } + controllerFactory := webapp.ControllerFactory{ + LoggerFactory: factory, + ControllerDeps: controllerDeps, + } + authflowV2NotFoundHandler := &authflowv2.AuthflowV2NotFoundHandler{ + ControllerFactory: controllerFactory, + BaseViewModel: baseViewModeler, + Renderer: responseRenderer, + } + return authflowV2NotFoundHandler } -func newWebAppPasskeyRequestOptionsHandler(p *deps.RequestProvider) http.Handler { +func newWebAppWebsocketHandler(p *deps.RequestProvider) http.Handler { + appProvider := p.AppProvider + appContext := appProvider.AppContext + config := appContext.Config + appConfig := config.AppConfig + appID := appConfig.ID + factory := appProvider.LoggerFactory + handle := appProvider.Redis + publisher := webapp.NewPublisher(appID, handle) + websocketHandler := &webapp.WebsocketHandler{ + AppID: appID, + LoggerFactory: factory, + RedisHandle: handle, + Publisher: publisher, + } + return websocketHandler +} + +func newWebAppPasskeyCreationOptionsHandler(p *deps.RequestProvider) http.Handler { appProvider := p.AppProvider factory := appProvider.LoggerFactory serviceLogger := webapp2.NewServiceLogger(factory) @@ -94907,36 +91421,9 @@ func newWebAppPasskeyRequestOptionsHandler(p *deps.RequestProvider) http.Handler SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -95044,6 +91531,15 @@ func newWebAppPasskeyRequestOptionsHandler(p *deps.RequestProvider) http.Handler Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -95118,13 +91614,6 @@ func newWebAppPasskeyRequestOptionsHandler(p *deps.RequestProvider) http.Handler UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -95141,7 +91630,6 @@ func newWebAppPasskeyRequestOptionsHandler(p *deps.RequestProvider) http.Handler Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -95361,8 +91849,8 @@ func newWebAppPasskeyRequestOptionsHandler(p *deps.RequestProvider) http.Handler AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -95411,7 +91899,6 @@ func newWebAppPasskeyRequestOptionsHandler(p *deps.RequestProvider) http.Handler UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -95427,7 +91914,7 @@ func newWebAppPasskeyRequestOptionsHandler(p *deps.RequestProvider) http.Handler SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -95436,7 +91923,7 @@ func newWebAppPasskeyRequestOptionsHandler(p *deps.RequestProvider) http.Handler sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -95465,7 +91952,7 @@ func newWebAppPasskeyRequestOptionsHandler(p *deps.RequestProvider) http.Handler UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -95671,34 +92158,34 @@ func newWebAppPasskeyRequestOptionsHandler(p *deps.RequestProvider) http.Handler jsonResponseWriter := &httputil.JSONResponseWriter{ Logger: jsonResponseWriterLogger, } - requestOptionsService := &passkey2.RequestOptionsService{ + creationOptionsService := &passkey2.CreationOptionsService{ ConfigService: configService, + UserService: userQueries, IdentityService: serviceService, Store: store2, } - passkeyRequestOptionsHandler := &webapp.PasskeyRequestOptionsHandler{ + passkeyCreationOptionsHandler := &webapp.PasskeyCreationOptionsHandler{ Page: webappService2, Database: appdbHandle, JSON: jsonResponseWriter, - Passkey: requestOptionsService, + Passkey: creationOptionsService, } - return passkeyRequestOptionsHandler + return passkeyCreationOptionsHandler } -func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { +func newWebAppPasskeyRequestOptionsHandler(p *deps.RequestProvider) http.Handler { appProvider := p.AppProvider factory := appProvider.LoggerFactory - handle := appProvider.AppDatabase - appredisHandle := appProvider.Redis + serviceLogger := webapp2.NewServiceLogger(factory) + request := p.Request appContext := appProvider.AppContext config := appContext.Config appConfig := config.AppConfig appID := appConfig.ID - serviceLogger := webapp2.NewServiceLogger(factory) - request := p.Request + handle := appProvider.Redis sessionStoreRedis := &webapp2.SessionStoreRedis{ AppID: appID, - Redis: appredisHandle, + Redis: handle, } sessionCookieDef := webapp2.NewSessionCookieDef() signedUpCookieDef := webapp2.NewSignedUpCookieDef() @@ -95713,7 +92200,7 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { errorService := &webapp2.ErrorService{ AppID: appID, Cookie: errorTokenCookieDef, - RedisHandle: appredisHandle, + RedisHandle: handle, Cookies: cookieManager, } oAuthConfig := appConfig.OAuth @@ -95741,7 +92228,8 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { } logger := interaction.NewLogger(factory) remoteIP := deps.ProvideRemoteIP(request, trustProxy) - sqlExecutor := appdb.NewSQLExecutor(handle) + appdbHandle := appProvider.AppDatabase + sqlExecutor := appdb.NewSQLExecutor(appdbHandle) clockClock := _wireSystemClockValue featureConfig := config.FeatureConfig redisLogger := redis.NewLogger(factory) @@ -95749,7 +92237,7 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { databaseCredentials := deps.ProvideDatabaseCredentials(secretConfig) sqlBuilderApp := appdb.NewSQLBuilderApp(databaseCredentials, appID) store := &redis.Store{ - Redis: appredisHandle, + Redis: handle, AppID: appID, Logger: redisLogger, SQLBuilder: sqlBuilderApp, @@ -95832,7 +92320,7 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } store2 := &passkey2.Store{ - Redis: appredisHandle, + Redis: handle, AppID: appID, } defaultLanguageTag := deps.ProvideDefaultLanguageTag(config) @@ -95878,36 +92366,9 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -96000,21 +92461,30 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode codeStoreRedis := &otp.CodeStoreRedis{ - Redis: appredisHandle, + Redis: handle, AppID: appID, Clock: clockClock, } lookupStoreRedis := &otp.LookupStoreRedis{ - Redis: appredisHandle, + Redis: handle, AppID: appID, Clock: clockClock, } attemptTrackerRedis := &otp.AttemptTrackerRedis{ - Redis: appredisHandle, + Redis: handle, AppID: appID, Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -96036,7 +92506,7 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { lockoutLogger := lockout.NewLogger(factory) lockoutStorageRedis := &lockout.StorageRedis{ AppID: appID, - Redis: appredisHandle, + Redis: handle, } lockoutService := &lockout.Service{ Logger: lockoutLogger, @@ -96089,13 +92559,6 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -96112,7 +92575,6 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -96176,7 +92638,7 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { sinkLogger := reindex.NewSinkLogger(factory) searchConfig := appConfig.Search reindexerLogger := reindex.NewReindexerLogger(factory) - userReindexProducer := redisqueue.NewUserReindexProducer(appredisHandle, clockClock) + userReindexProducer := redisqueue.NewUserReindexProducer(handle, clockClock) sourceProvider := &reindex.SourceProvider{ AppID: appID, Users: userQueries, @@ -96189,7 +92651,7 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { client := elasticsearch.NewClient(elasticsearchCredentials) elasticsearchService := &elasticsearch.Service{ Clock: clockClock, - Database: handle, + Database: appdbHandle, Logger: elasticsearchServiceLogger, AppID: appID, Client: client, @@ -96213,7 +92675,7 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { AppID: appID, SearchConfig: searchConfig, Clock: clockClock, - Database: handle, + Database: appdbHandle, Logger: reindexerLogger, UserStore: userStore, Producer: userReindexProducer, @@ -96224,11 +92686,11 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { reindexSink := &reindex.Sink{ Logger: sinkLogger, Reindexer: reindexer, - Database: handle, + Database: appdbHandle, } - eventService := event.NewService(appID, remoteIP, userAgentString, eventLogger, handle, clockClock, localizationConfig, storeImpl, resolverImpl, sink, auditSink, reindexSink) + eventService := event.NewService(appID, remoteIP, userAgentString, eventLogger, appdbHandle, clockClock, localizationConfig, storeImpl, resolverImpl, sink, auditSink, reindexSink) storeDeviceTokenRedis := &mfa.StoreDeviceTokenRedis{ - Redis: appredisHandle, + Redis: handle, AppID: appID, Clock: clockClock, } @@ -96256,7 +92718,7 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { Logger: usageLogger, Clock: clockClock, AppID: appID, - Redis: appredisHandle, + Redis: handle, } messagingConfig := appConfig.Messaging messagingRateLimitsConfig := messagingConfig.RateLimits @@ -96328,12 +92790,12 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { whatsappConfig := messagingConfig.Whatsapp whatsappOnPremisesCredentials := deps.ProvideWhatsappOnPremisesCredentials(secretConfig) tokenStore := &whatsapp.TokenStore{ - Redis: appredisHandle, + Redis: handle, AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -96354,7 +92816,7 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { MailSender: sender, SMSSender: smsClient, WhatsappSender: whatsappService, - Database: handle, + Database: appdbHandle, DevMode: devMode, MessagingFeatureConfig: messagingFeatureConfig, FeatureTestModeEmailSuppressed: featureTestModeEmailSuppressed, @@ -96382,7 +92844,6 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -96398,8 +92859,8 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ - Redis: appredisHandle, + storeRedis := &idpsession.StoreRedis{ + Redis: handle, AppID: appID, Clock: clockClock, Logger: storeRedisLogger, @@ -96407,13 +92868,13 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, } eventStoreRedis := &access.EventStoreRedis{ - Redis: appredisHandle, + Redis: handle, AppID: appID, } eventProvider := &access.EventProvider{ @@ -96435,8 +92896,8 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { RemoteIP: remoteIP, UserAgentString: userAgentString, AppID: appID, - Redis: appredisHandle, - Store: idpsessionStoreRedis, + Redis: handle, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -96497,7 +92958,7 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { Coordinator: coordinator, } anonymousStoreRedis := &anonymous.StoreRedis{ - Redis: appredisHandle, + Redis: handle, AppID: appID, Clock: clockClock, } @@ -96511,7 +92972,7 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { oAuthHTTPClient := sso.ProvideOAuthHTTPClient(environmentConfig) simpleStoreRedisFactory := &sso.SimpleStoreRedisFactory{ AppID: appID, - Redis: appredisHandle, + Redis: handle, } oAuthProviderFactory := &sso.OAuthProviderFactory{ IdentityConfig: identityConfig, @@ -96522,7 +92983,7 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { SimpleStoreRedisFactory: simpleStoreRedisFactory, } webappoauthStore := &webappoauth.Store{ - Redis: appredisHandle, + Redis: handle, AppID: appID, } mfaFacade := &facade.MFAFacade{ @@ -96553,7 +93014,7 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { ResponseWriter: responseWriter, } challengeProvider := &challenge.Provider{ - Redis: appredisHandle, + Redis: handle, AppID: appID, Clock: clockClock, } @@ -96562,7 +93023,7 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { Queries: userQueries, } authenticationinfoStoreRedis := &authenticationinfo.StoreRedis{ - Redis: appredisHandle, + Redis: handle, AppID: appID, } manager2 := &session.Manager{ @@ -96571,7 +93032,7 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { Events: eventService, } oauthsessionStoreRedis := &oauthsession.StoreRedis{ - Redis: appredisHandle, + Redis: handle, AppID: appID, } interactionContext := &interaction.Context{ @@ -96614,7 +93075,7 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { MFADeviceTokenCookie: cookieDef, } interactionStoreRedis := &interaction.StoreRedis{ - Redis: appredisHandle, + Redis: handle, AppID: appID, } interactionService := &interaction.Service{ @@ -96638,91 +93099,25 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { OAuthClientResolver: resolver, Graph: interactionService, } - uiFeatureConfig := featureConfig.UI - forgotPasswordConfig := appConfig.ForgotPassword - googleTagManagerConfig := appConfig.GoogleTagManager - botProtectionConfig := appConfig.BotProtection - flashMessage := &httputil.FlashMessage{ - Cookies: cookieManager, - } - authUISentryDSN := environmentConfig.AuthUISentryDSN - authUIWindowMessageAllowedOrigins := environmentConfig.AuthUIWindowMessageAllowedOrigins - baseLogger := viewmodels.NewBaseLogger(factory) - baseViewModeler := &viewmodels.BaseViewModeler{ - TrustProxy: trustProxy, - OAuth: oAuthConfig, - AuthUI: uiConfig, - AuthUIFeatureConfig: uiFeatureConfig, - StaticAssets: staticAssetResolver, - ForgotPassword: forgotPasswordConfig, - Authentication: authenticationConfig, - GoogleTagManager: googleTagManagerConfig, - BotProtection: botProtectionConfig, - ErrorService: errorService, - Translations: translationService, - Clock: clockClock, - FlashMessage: flashMessage, - DefaultLanguageTag: defaultLanguageTag, - SupportedLanguageTags: supportedLanguageTags, - AuthUISentryDSN: authUISentryDSN, - AuthUIWindowMessageAllowedOrigins: authUIWindowMessageAllowedOrigins, - OAuthClientResolver: resolver, - Logger: baseLogger, - } - responseRenderer := &webapp.ResponseRenderer{ - TemplateEngine: engine, - } - publisher := webapp.NewPublisher(appID, appredisHandle) - authflowNavigator := &webapp2.AuthflowNavigator{ - Endpoints: endpointsEndpoints, - OAuthStateStore: webappoauthStore, - } - authflowV2Navigator := &authflowv2.AuthflowV2Navigator{ - Endpoints: endpointsEndpoints, - OAuthStateStore: webappoauthStore, - } - errorRenderer := &webapp.ErrorRenderer{ - ErrorService: errorService, - UIImplementationService: uiImplementationService, - AuthflowV1Navigator: authflowNavigator, - AuthflowV2Navigator: authflowV2Navigator, - } - controllerDeps := webapp.ControllerDeps{ - Database: handle, - RedisHandle: appredisHandle, - AppID: appID, - Page: webappService2, - BaseViewModel: baseViewModeler, - Renderer: responseRenderer, - Publisher: publisher, - Clock: clockClock, - TesterEndpointsProvider: endpointsEndpoints, - ErrorRenderer: errorRenderer, - TrustProxy: trustProxy, - } - controllerFactory := webapp.ControllerFactory{ - LoggerFactory: factory, - ControllerDeps: controllerDeps, - } - authenticationViewModeler := &viewmodels.AuthenticationViewModeler{ - Authentication: authenticationConfig, - LoginID: loginIDConfig, + jsonResponseWriterLogger := httputil.NewJSONResponseWriterLogger(factory) + jsonResponseWriter := &httputil.JSONResponseWriter{ + Logger: jsonResponseWriterLogger, } - alternativeStepsViewModeler := &viewmodels.AlternativeStepsViewModeler{ - AuthenticationConfig: authenticationConfig, + requestOptionsService := &passkey2.RequestOptionsService{ + ConfigService: configService, + IdentityService: serviceService, + Store: store2, } - connectWeb3AccountHandler := &webapp.ConnectWeb3AccountHandler{ - ControllerFactory: controllerFactory, - BaseViewModel: baseViewModeler, - AuthenticationViewModel: authenticationViewModeler, - AlternativeStepsViewModel: alternativeStepsViewModeler, - Renderer: responseRenderer, - AuthenticationConfig: authenticationConfig, + passkeyRequestOptionsHandler := &webapp.PasskeyRequestOptionsHandler{ + Page: webappService2, + Database: appdbHandle, + JSON: jsonResponseWriter, + Passkey: requestOptionsService, } - return connectWeb3AccountHandler + return passkeyRequestOptionsHandler } -func newWebAppMissingWeb3WalletHandler(p *deps.RequestProvider) http.Handler { +func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { appProvider := p.AppProvider factory := appProvider.LoggerFactory handle := appProvider.AppDatabase @@ -96915,36 +93310,9 @@ func newWebAppMissingWeb3WalletHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -97052,6 +93420,15 @@ func newWebAppMissingWeb3WalletHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -97126,13 +93503,6 @@ func newWebAppMissingWeb3WalletHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -97149,7 +93519,6 @@ func newWebAppMissingWeb3WalletHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -97369,8 +93738,8 @@ func newWebAppMissingWeb3WalletHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -97419,7 +93788,6 @@ func newWebAppMissingWeb3WalletHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -97435,7 +93803,7 @@ func newWebAppMissingWeb3WalletHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -97444,7 +93812,7 @@ func newWebAppMissingWeb3WalletHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -97473,7 +93841,7 @@ func newWebAppMissingWeb3WalletHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -97741,13 +94109,22 @@ func newWebAppMissingWeb3WalletHandler(p *deps.RequestProvider) http.Handler { LoggerFactory: factory, ControllerDeps: controllerDeps, } - missingWeb3WalletHandler := &webapp.MissingWeb3WalletHandler{ - ControllerFactory: controllerFactory, - BaseViewModel: baseViewModeler, - Renderer: responseRenderer, + authenticationViewModeler := &viewmodels.AuthenticationViewModeler{ + Authentication: authenticationConfig, + LoginID: loginIDConfig, + } + alternativeStepsViewModeler := &viewmodels.AlternativeStepsViewModeler{ AuthenticationConfig: authenticationConfig, } - return missingWeb3WalletHandler + connectWeb3AccountHandler := &webapp.ConnectWeb3AccountHandler{ + ControllerFactory: controllerFactory, + BaseViewModel: baseViewModeler, + AuthenticationViewModel: authenticationViewModeler, + AlternativeStepsViewModel: alternativeStepsViewModeler, + Renderer: responseRenderer, + AuthenticationConfig: authenticationConfig, + } + return connectWeb3AccountHandler } func newWebAppFeatureDisabledHandler(p *deps.RequestProvider) http.Handler { @@ -97943,36 +94320,9 @@ func newWebAppFeatureDisabledHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -98080,6 +94430,15 @@ func newWebAppFeatureDisabledHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -98154,13 +94513,6 @@ func newWebAppFeatureDisabledHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -98177,7 +94529,6 @@ func newWebAppFeatureDisabledHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -98397,8 +94748,8 @@ func newWebAppFeatureDisabledHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -98447,7 +94798,6 @@ func newWebAppFeatureDisabledHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -98463,7 +94813,7 @@ func newWebAppFeatureDisabledHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -98472,7 +94822,7 @@ func newWebAppFeatureDisabledHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -98501,7 +94851,7 @@ func newWebAppFeatureDisabledHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -98970,36 +95320,9 @@ func newWebAppTesterHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -99107,6 +95430,15 @@ func newWebAppTesterHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -99181,13 +95513,6 @@ func newWebAppTesterHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -99204,7 +95529,6 @@ func newWebAppTesterHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -99424,8 +95748,8 @@ func newWebAppTesterHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -99474,7 +95798,6 @@ func newWebAppTesterHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -99490,7 +95813,7 @@ func newWebAppTesterHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -99499,7 +95822,7 @@ func newWebAppTesterHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -99528,7 +95851,7 @@ func newWebAppTesterHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -100123,36 +96446,9 @@ func newAPIWorkflowNewHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -100260,6 +96556,15 @@ func newAPIWorkflowNewHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -100334,13 +96639,6 @@ func newAPIWorkflowNewHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -100357,7 +96655,6 @@ func newAPIWorkflowNewHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -100480,7 +96777,6 @@ func newAPIWorkflowNewHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -100592,8 +96888,8 @@ func newAPIWorkflowNewHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -100643,7 +96939,7 @@ func newAPIWorkflowNewHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -100652,7 +96948,7 @@ func newAPIWorkflowNewHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -100691,7 +96987,7 @@ func newAPIWorkflowNewHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -101092,36 +97388,9 @@ func newAPIWorkflowGetHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -101229,6 +97498,15 @@ func newAPIWorkflowGetHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -101303,13 +97581,6 @@ func newAPIWorkflowGetHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -101326,7 +97597,6 @@ func newAPIWorkflowGetHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -101449,7 +97719,6 @@ func newAPIWorkflowGetHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -101561,8 +97830,8 @@ func newAPIWorkflowGetHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -101612,7 +97881,7 @@ func newAPIWorkflowGetHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -101623,7 +97892,7 @@ func newAPIWorkflowGetHandler(p *deps.RequestProvider) http.Handler { cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -101662,7 +97931,7 @@ func newAPIWorkflowGetHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -102023,36 +98292,9 @@ func newAPIWorkflowInputHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -102160,6 +98402,15 @@ func newAPIWorkflowInputHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -102234,13 +98485,6 @@ func newAPIWorkflowInputHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -102257,7 +98501,6 @@ func newAPIWorkflowInputHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -102380,7 +98623,6 @@ func newAPIWorkflowInputHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -102492,8 +98734,8 @@ func newAPIWorkflowInputHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -102543,7 +98785,7 @@ func newAPIWorkflowInputHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -102554,7 +98796,7 @@ func newAPIWorkflowInputHandler(p *deps.RequestProvider) http.Handler { cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -102593,7 +98835,7 @@ func newAPIWorkflowInputHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -102990,36 +99232,9 @@ func newAPIWorkflowV2Handler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -103127,6 +99342,15 @@ func newAPIWorkflowV2Handler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -103201,13 +99425,6 @@ func newAPIWorkflowV2Handler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -103224,7 +99441,6 @@ func newAPIWorkflowV2Handler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -103347,7 +99563,6 @@ func newAPIWorkflowV2Handler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -103459,8 +99674,8 @@ func newAPIWorkflowV2Handler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -103510,7 +99725,7 @@ func newAPIWorkflowV2Handler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -103519,7 +99734,7 @@ func newAPIWorkflowV2Handler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -103558,7 +99773,7 @@ func newAPIWorkflowV2Handler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -103961,36 +100176,9 @@ func newAPIAuthenticationFlowV1CreateHandler(p *deps.RequestProvider) http.Handl SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -104098,6 +100286,15 @@ func newAPIAuthenticationFlowV1CreateHandler(p *deps.RequestProvider) http.Handl Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -104172,13 +100369,6 @@ func newAPIAuthenticationFlowV1CreateHandler(p *deps.RequestProvider) http.Handl UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -104195,7 +100385,6 @@ func newAPIAuthenticationFlowV1CreateHandler(p *deps.RequestProvider) http.Handl Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -104318,7 +100507,6 @@ func newAPIAuthenticationFlowV1CreateHandler(p *deps.RequestProvider) http.Handl UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -104430,8 +100618,8 @@ func newAPIAuthenticationFlowV1CreateHandler(p *deps.RequestProvider) http.Handl AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -104481,7 +100669,7 @@ func newAPIAuthenticationFlowV1CreateHandler(p *deps.RequestProvider) http.Handl SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -104490,7 +100678,7 @@ func newAPIAuthenticationFlowV1CreateHandler(p *deps.RequestProvider) http.Handl sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -104529,7 +100717,7 @@ func newAPIAuthenticationFlowV1CreateHandler(p *deps.RequestProvider) http.Handl UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -105006,36 +101194,9 @@ func newAPIAuthenticationFlowV1InputHandler(p *deps.RequestProvider) http.Handle SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -105143,6 +101304,15 @@ func newAPIAuthenticationFlowV1InputHandler(p *deps.RequestProvider) http.Handle Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -105217,13 +101387,6 @@ func newAPIAuthenticationFlowV1InputHandler(p *deps.RequestProvider) http.Handle UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -105240,7 +101403,6 @@ func newAPIAuthenticationFlowV1InputHandler(p *deps.RequestProvider) http.Handle Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -105363,7 +101525,6 @@ func newAPIAuthenticationFlowV1InputHandler(p *deps.RequestProvider) http.Handle UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -105475,8 +101636,8 @@ func newAPIAuthenticationFlowV1InputHandler(p *deps.RequestProvider) http.Handle AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -105526,7 +101687,7 @@ func newAPIAuthenticationFlowV1InputHandler(p *deps.RequestProvider) http.Handle SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -105535,7 +101696,7 @@ func newAPIAuthenticationFlowV1InputHandler(p *deps.RequestProvider) http.Handle sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -105574,7 +101735,7 @@ func newAPIAuthenticationFlowV1InputHandler(p *deps.RequestProvider) http.Handle UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -106017,36 +102178,9 @@ func newAPIAuthenticationFlowV1GetHandler(p *deps.RequestProvider) http.Handler SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -106154,6 +102288,15 @@ func newAPIAuthenticationFlowV1GetHandler(p *deps.RequestProvider) http.Handler Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -106228,13 +102371,6 @@ func newAPIAuthenticationFlowV1GetHandler(p *deps.RequestProvider) http.Handler UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -106251,7 +102387,6 @@ func newAPIAuthenticationFlowV1GetHandler(p *deps.RequestProvider) http.Handler Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -106374,7 +102509,6 @@ func newAPIAuthenticationFlowV1GetHandler(p *deps.RequestProvider) http.Handler UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -106486,8 +102620,8 @@ func newAPIAuthenticationFlowV1GetHandler(p *deps.RequestProvider) http.Handler AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -106537,7 +102671,7 @@ func newAPIAuthenticationFlowV1GetHandler(p *deps.RequestProvider) http.Handler SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -106548,7 +102682,7 @@ func newAPIAuthenticationFlowV1GetHandler(p *deps.RequestProvider) http.Handler cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -106587,7 +102721,7 @@ func newAPIAuthenticationFlowV1GetHandler(p *deps.RequestProvider) http.Handler UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -107063,36 +103197,9 @@ func newAPIAccountManagementV1IdentificationHandler(p *deps.RequestProvider) htt SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -107200,6 +103307,15 @@ func newAPIAccountManagementV1IdentificationHandler(p *deps.RequestProvider) htt Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -107274,13 +103390,6 @@ func newAPIAccountManagementV1IdentificationHandler(p *deps.RequestProvider) htt UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -107297,7 +103406,6 @@ func newAPIAccountManagementV1IdentificationHandler(p *deps.RequestProvider) htt Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -107420,7 +103528,6 @@ func newAPIAccountManagementV1IdentificationHandler(p *deps.RequestProvider) htt UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -107551,8 +103658,8 @@ func newAPIAccountManagementV1IdentificationHandler(p *deps.RequestProvider) htt AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -107602,7 +103709,7 @@ func newAPIAccountManagementV1IdentificationHandler(p *deps.RequestProvider) htt SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -107613,7 +103720,7 @@ func newAPIAccountManagementV1IdentificationHandler(p *deps.RequestProvider) htt cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -107652,7 +103759,7 @@ func newAPIAccountManagementV1IdentificationHandler(p *deps.RequestProvider) htt UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -107923,36 +104030,9 @@ func newAPIAccountManagementV1IdentificationOAuthHandler(p *deps.RequestProvider SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -108060,6 +104140,15 @@ func newAPIAccountManagementV1IdentificationOAuthHandler(p *deps.RequestProvider Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -108134,13 +104223,6 @@ func newAPIAccountManagementV1IdentificationOAuthHandler(p *deps.RequestProvider UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -108157,7 +104239,6 @@ func newAPIAccountManagementV1IdentificationOAuthHandler(p *deps.RequestProvider Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -108280,7 +104361,6 @@ func newAPIAccountManagementV1IdentificationOAuthHandler(p *deps.RequestProvider UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -108411,8 +104491,8 @@ func newAPIAccountManagementV1IdentificationOAuthHandler(p *deps.RequestProvider AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -108462,7 +104542,7 @@ func newAPIAccountManagementV1IdentificationOAuthHandler(p *deps.RequestProvider SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -108473,7 +104553,7 @@ func newAPIAccountManagementV1IdentificationOAuthHandler(p *deps.RequestProvider cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -108512,7 +104592,7 @@ func newAPIAccountManagementV1IdentificationOAuthHandler(p *deps.RequestProvider UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -108800,36 +104880,9 @@ func newWebAppAuthflowLoginHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -108937,6 +104990,15 @@ func newWebAppAuthflowLoginHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -109011,13 +105073,6 @@ func newWebAppAuthflowLoginHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -109034,7 +105089,6 @@ func newWebAppAuthflowLoginHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -109157,7 +105211,6 @@ func newWebAppAuthflowLoginHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -109269,8 +105322,8 @@ func newWebAppAuthflowLoginHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -109320,7 +105373,7 @@ func newWebAppAuthflowLoginHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -109329,7 +105382,7 @@ func newWebAppAuthflowLoginHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -109368,7 +105421,7 @@ func newWebAppAuthflowLoginHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -109937,36 +105990,9 @@ func newWebAppAuthflowV2LoginHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -110074,6 +106100,15 @@ func newWebAppAuthflowV2LoginHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -110148,13 +106183,6 @@ func newWebAppAuthflowV2LoginHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -110171,7 +106199,6 @@ func newWebAppAuthflowV2LoginHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -110294,7 +106321,6 @@ func newWebAppAuthflowV2LoginHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -110406,8 +106432,8 @@ func newWebAppAuthflowV2LoginHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -110457,7 +106483,7 @@ func newWebAppAuthflowV2LoginHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -110466,7 +106492,7 @@ func newWebAppAuthflowV2LoginHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -110505,7 +106531,7 @@ func newWebAppAuthflowV2LoginHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -111086,36 +107112,9 @@ func newWebAppAuthflowSignupHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -111223,6 +107222,15 @@ func newWebAppAuthflowSignupHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -111297,13 +107305,6 @@ func newWebAppAuthflowSignupHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -111320,7 +107321,6 @@ func newWebAppAuthflowSignupHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -111443,7 +107443,6 @@ func newWebAppAuthflowSignupHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -111555,8 +107554,8 @@ func newWebAppAuthflowSignupHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -111606,7 +107605,7 @@ func newWebAppAuthflowSignupHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -111615,7 +107614,7 @@ func newWebAppAuthflowSignupHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -111654,7 +107653,7 @@ func newWebAppAuthflowSignupHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -112222,36 +108221,9 @@ func newWebAppAuthflowV2SignupHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -112359,6 +108331,15 @@ func newWebAppAuthflowV2SignupHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -112433,13 +108414,6 @@ func newWebAppAuthflowV2SignupHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -112456,7 +108430,6 @@ func newWebAppAuthflowV2SignupHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -112579,7 +108552,6 @@ func newWebAppAuthflowV2SignupHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -112691,8 +108663,8 @@ func newWebAppAuthflowV2SignupHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -112742,7 +108714,7 @@ func newWebAppAuthflowV2SignupHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -112751,7 +108723,7 @@ func newWebAppAuthflowV2SignupHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -112790,7 +108762,7 @@ func newWebAppAuthflowV2SignupHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -113363,36 +109335,9 @@ func newWebAppAuthflowPromoteHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -113500,6 +109445,15 @@ func newWebAppAuthflowPromoteHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -113574,13 +109528,6 @@ func newWebAppAuthflowPromoteHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -113597,7 +109544,6 @@ func newWebAppAuthflowPromoteHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -113720,7 +109666,6 @@ func newWebAppAuthflowPromoteHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -113832,8 +109777,8 @@ func newWebAppAuthflowPromoteHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -113883,7 +109828,7 @@ func newWebAppAuthflowPromoteHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -113892,7 +109837,7 @@ func newWebAppAuthflowPromoteHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -113931,7 +109876,7 @@ func newWebAppAuthflowPromoteHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -114494,36 +110439,9 @@ func newWebAppAuthflowV2PromoteHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -114631,6 +110549,15 @@ func newWebAppAuthflowV2PromoteHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -114705,13 +110632,6 @@ func newWebAppAuthflowV2PromoteHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -114728,7 +110648,6 @@ func newWebAppAuthflowV2PromoteHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -114851,7 +110770,6 @@ func newWebAppAuthflowV2PromoteHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -114963,8 +110881,8 @@ func newWebAppAuthflowV2PromoteHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -115014,7 +110932,7 @@ func newWebAppAuthflowV2PromoteHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -115023,7 +110941,7 @@ func newWebAppAuthflowV2PromoteHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -115062,7 +110980,7 @@ func newWebAppAuthflowV2PromoteHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -115625,36 +111543,9 @@ func newWebAppAuthflowEnterPasswordHandler(p *deps.RequestProvider) http.Handler SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -115762,6 +111653,15 @@ func newWebAppAuthflowEnterPasswordHandler(p *deps.RequestProvider) http.Handler Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -115836,13 +111736,6 @@ func newWebAppAuthflowEnterPasswordHandler(p *deps.RequestProvider) http.Handler UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -115859,7 +111752,6 @@ func newWebAppAuthflowEnterPasswordHandler(p *deps.RequestProvider) http.Handler Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -115982,7 +111874,6 @@ func newWebAppAuthflowEnterPasswordHandler(p *deps.RequestProvider) http.Handler UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -116094,8 +111985,8 @@ func newWebAppAuthflowEnterPasswordHandler(p *deps.RequestProvider) http.Handler AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -116145,7 +112036,7 @@ func newWebAppAuthflowEnterPasswordHandler(p *deps.RequestProvider) http.Handler SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -116154,7 +112045,7 @@ func newWebAppAuthflowEnterPasswordHandler(p *deps.RequestProvider) http.Handler sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -116193,7 +112084,7 @@ func newWebAppAuthflowEnterPasswordHandler(p *deps.RequestProvider) http.Handler UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -116749,36 +112640,9 @@ func newWebAppAuthflowV2EnterPasswordHandler(p *deps.RequestProvider) http.Handl SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -116886,6 +112750,15 @@ func newWebAppAuthflowV2EnterPasswordHandler(p *deps.RequestProvider) http.Handl Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -116960,13 +112833,6 @@ func newWebAppAuthflowV2EnterPasswordHandler(p *deps.RequestProvider) http.Handl UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -116983,7 +112849,6 @@ func newWebAppAuthflowV2EnterPasswordHandler(p *deps.RequestProvider) http.Handl Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -117106,7 +112971,6 @@ func newWebAppAuthflowV2EnterPasswordHandler(p *deps.RequestProvider) http.Handl UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -117218,8 +113082,8 @@ func newWebAppAuthflowV2EnterPasswordHandler(p *deps.RequestProvider) http.Handl AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -117269,7 +113133,7 @@ func newWebAppAuthflowV2EnterPasswordHandler(p *deps.RequestProvider) http.Handl SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -117278,7 +113142,7 @@ func newWebAppAuthflowV2EnterPasswordHandler(p *deps.RequestProvider) http.Handl sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -117317,7 +113181,7 @@ func newWebAppAuthflowV2EnterPasswordHandler(p *deps.RequestProvider) http.Handl UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -117877,36 +113741,9 @@ func newWebAppAuthflowEnterOOBOTPHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -118014,6 +113851,15 @@ func newWebAppAuthflowEnterOOBOTPHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -118088,13 +113934,6 @@ func newWebAppAuthflowEnterOOBOTPHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -118111,7 +113950,6 @@ func newWebAppAuthflowEnterOOBOTPHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -118234,7 +114072,6 @@ func newWebAppAuthflowEnterOOBOTPHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -118346,8 +114183,8 @@ func newWebAppAuthflowEnterOOBOTPHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -118397,7 +114234,7 @@ func newWebAppAuthflowEnterOOBOTPHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -118406,7 +114243,7 @@ func newWebAppAuthflowEnterOOBOTPHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -118445,7 +114282,7 @@ func newWebAppAuthflowEnterOOBOTPHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -119003,36 +114840,9 @@ func newWebAppAuthflowV2EnterOOBOTPHandler(p *deps.RequestProvider) http.Handler SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -119140,6 +114950,15 @@ func newWebAppAuthflowV2EnterOOBOTPHandler(p *deps.RequestProvider) http.Handler Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -119214,13 +115033,6 @@ func newWebAppAuthflowV2EnterOOBOTPHandler(p *deps.RequestProvider) http.Handler UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -119237,7 +115049,6 @@ func newWebAppAuthflowV2EnterOOBOTPHandler(p *deps.RequestProvider) http.Handler Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -119360,7 +115171,6 @@ func newWebAppAuthflowV2EnterOOBOTPHandler(p *deps.RequestProvider) http.Handler UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -119472,8 +115282,8 @@ func newWebAppAuthflowV2EnterOOBOTPHandler(p *deps.RequestProvider) http.Handler AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -119523,7 +115333,7 @@ func newWebAppAuthflowV2EnterOOBOTPHandler(p *deps.RequestProvider) http.Handler SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -119532,7 +115342,7 @@ func newWebAppAuthflowV2EnterOOBOTPHandler(p *deps.RequestProvider) http.Handler sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -119571,7 +115381,7 @@ func newWebAppAuthflowV2EnterOOBOTPHandler(p *deps.RequestProvider) http.Handler UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -120135,36 +115945,9 @@ func newWebAppAuthflowCreatePasswordHandler(p *deps.RequestProvider) http.Handle SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -120272,6 +116055,15 @@ func newWebAppAuthflowCreatePasswordHandler(p *deps.RequestProvider) http.Handle Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -120346,13 +116138,6 @@ func newWebAppAuthflowCreatePasswordHandler(p *deps.RequestProvider) http.Handle UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -120369,7 +116154,6 @@ func newWebAppAuthflowCreatePasswordHandler(p *deps.RequestProvider) http.Handle Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -120492,7 +116276,6 @@ func newWebAppAuthflowCreatePasswordHandler(p *deps.RequestProvider) http.Handle UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -120604,8 +116387,8 @@ func newWebAppAuthflowCreatePasswordHandler(p *deps.RequestProvider) http.Handle AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -120655,7 +116438,7 @@ func newWebAppAuthflowCreatePasswordHandler(p *deps.RequestProvider) http.Handle SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -120664,7 +116447,7 @@ func newWebAppAuthflowCreatePasswordHandler(p *deps.RequestProvider) http.Handle sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -120703,7 +116486,7 @@ func newWebAppAuthflowCreatePasswordHandler(p *deps.RequestProvider) http.Handle UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -121259,36 +117042,9 @@ func newWebAppAuthflowV2CreatePasswordHandler(p *deps.RequestProvider) http.Hand SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -121396,6 +117152,15 @@ func newWebAppAuthflowV2CreatePasswordHandler(p *deps.RequestProvider) http.Hand Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -121470,13 +117235,6 @@ func newWebAppAuthflowV2CreatePasswordHandler(p *deps.RequestProvider) http.Hand UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -121493,7 +117251,6 @@ func newWebAppAuthflowV2CreatePasswordHandler(p *deps.RequestProvider) http.Hand Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -121616,7 +117373,6 @@ func newWebAppAuthflowV2CreatePasswordHandler(p *deps.RequestProvider) http.Hand UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -121728,8 +117484,8 @@ func newWebAppAuthflowV2CreatePasswordHandler(p *deps.RequestProvider) http.Hand AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -121779,7 +117535,7 @@ func newWebAppAuthflowV2CreatePasswordHandler(p *deps.RequestProvider) http.Hand SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -121788,7 +117544,7 @@ func newWebAppAuthflowV2CreatePasswordHandler(p *deps.RequestProvider) http.Hand sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -121827,7 +117583,7 @@ func newWebAppAuthflowV2CreatePasswordHandler(p *deps.RequestProvider) http.Hand UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -122389,36 +118145,9 @@ func newWebAppAuthflowEnterTOTPHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -122526,6 +118255,15 @@ func newWebAppAuthflowEnterTOTPHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -122600,13 +118338,6 @@ func newWebAppAuthflowEnterTOTPHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -122623,7 +118354,6 @@ func newWebAppAuthflowEnterTOTPHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -122746,7 +118476,6 @@ func newWebAppAuthflowEnterTOTPHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -122858,8 +118587,8 @@ func newWebAppAuthflowEnterTOTPHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -122909,7 +118638,7 @@ func newWebAppAuthflowEnterTOTPHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -122918,7 +118647,7 @@ func newWebAppAuthflowEnterTOTPHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -122957,7 +118686,7 @@ func newWebAppAuthflowEnterTOTPHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -123513,36 +119242,9 @@ func newWebAppAuthflowV2EnterTOTPHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -123650,6 +119352,15 @@ func newWebAppAuthflowV2EnterTOTPHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -123724,13 +119435,6 @@ func newWebAppAuthflowV2EnterTOTPHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -123747,7 +119451,6 @@ func newWebAppAuthflowV2EnterTOTPHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -123870,7 +119573,6 @@ func newWebAppAuthflowV2EnterTOTPHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -123982,8 +119684,8 @@ func newWebAppAuthflowV2EnterTOTPHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -124033,7 +119735,7 @@ func newWebAppAuthflowV2EnterTOTPHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -124042,7 +119744,7 @@ func newWebAppAuthflowV2EnterTOTPHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -124081,7 +119783,7 @@ func newWebAppAuthflowV2EnterTOTPHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -124641,36 +120343,9 @@ func newWebAppAuthflowSetupTOTPHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -124778,6 +120453,15 @@ func newWebAppAuthflowSetupTOTPHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -124852,13 +120536,6 @@ func newWebAppAuthflowSetupTOTPHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -124875,7 +120552,6 @@ func newWebAppAuthflowSetupTOTPHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -124998,7 +120674,6 @@ func newWebAppAuthflowSetupTOTPHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -125110,8 +120785,8 @@ func newWebAppAuthflowSetupTOTPHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -125161,7 +120836,7 @@ func newWebAppAuthflowSetupTOTPHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -125170,7 +120845,7 @@ func newWebAppAuthflowSetupTOTPHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -125209,7 +120884,7 @@ func newWebAppAuthflowSetupTOTPHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -125765,36 +121440,9 @@ func newWebAppAuthflowV2SetupTOTPHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -125902,6 +121550,15 @@ func newWebAppAuthflowV2SetupTOTPHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -125976,13 +121633,6 @@ func newWebAppAuthflowV2SetupTOTPHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -125999,7 +121649,6 @@ func newWebAppAuthflowV2SetupTOTPHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -126122,7 +121771,6 @@ func newWebAppAuthflowV2SetupTOTPHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -126234,8 +121882,8 @@ func newWebAppAuthflowV2SetupTOTPHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -126285,7 +121933,7 @@ func newWebAppAuthflowV2SetupTOTPHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -126294,7 +121942,7 @@ func newWebAppAuthflowV2SetupTOTPHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -126333,7 +121981,7 @@ func newWebAppAuthflowV2SetupTOTPHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -126889,36 +122537,9 @@ func newWebAppAuthflowViewRecoveryCodeHandler(p *deps.RequestProvider) http.Hand SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -127026,6 +122647,15 @@ func newWebAppAuthflowViewRecoveryCodeHandler(p *deps.RequestProvider) http.Hand Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -127100,13 +122730,6 @@ func newWebAppAuthflowViewRecoveryCodeHandler(p *deps.RequestProvider) http.Hand UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -127123,7 +122746,6 @@ func newWebAppAuthflowViewRecoveryCodeHandler(p *deps.RequestProvider) http.Hand Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -127246,7 +122868,6 @@ func newWebAppAuthflowViewRecoveryCodeHandler(p *deps.RequestProvider) http.Hand UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -127358,8 +122979,8 @@ func newWebAppAuthflowViewRecoveryCodeHandler(p *deps.RequestProvider) http.Hand AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -127409,7 +123030,7 @@ func newWebAppAuthflowViewRecoveryCodeHandler(p *deps.RequestProvider) http.Hand SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -127418,7 +123039,7 @@ func newWebAppAuthflowViewRecoveryCodeHandler(p *deps.RequestProvider) http.Hand sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -127457,7 +123078,7 @@ func newWebAppAuthflowViewRecoveryCodeHandler(p *deps.RequestProvider) http.Hand UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -128013,36 +123634,9 @@ func newWebAppAuthflowV2ViewRecoveryCodeHandler(p *deps.RequestProvider) http.Ha SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -128150,6 +123744,15 @@ func newWebAppAuthflowV2ViewRecoveryCodeHandler(p *deps.RequestProvider) http.Ha Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -128224,13 +123827,6 @@ func newWebAppAuthflowV2ViewRecoveryCodeHandler(p *deps.RequestProvider) http.Ha UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -128247,7 +123843,6 @@ func newWebAppAuthflowV2ViewRecoveryCodeHandler(p *deps.RequestProvider) http.Ha Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -128370,7 +123965,6 @@ func newWebAppAuthflowV2ViewRecoveryCodeHandler(p *deps.RequestProvider) http.Ha UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -128482,8 +124076,8 @@ func newWebAppAuthflowV2ViewRecoveryCodeHandler(p *deps.RequestProvider) http.Ha AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -128533,7 +124127,7 @@ func newWebAppAuthflowV2ViewRecoveryCodeHandler(p *deps.RequestProvider) http.Ha SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -128542,7 +124136,7 @@ func newWebAppAuthflowV2ViewRecoveryCodeHandler(p *deps.RequestProvider) http.Ha sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -128581,7 +124175,7 @@ func newWebAppAuthflowV2ViewRecoveryCodeHandler(p *deps.RequestProvider) http.Ha UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -129137,36 +124731,9 @@ func newWebAppAuthflowWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -129274,6 +124841,15 @@ func newWebAppAuthflowWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -129348,13 +124924,6 @@ func newWebAppAuthflowWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -129371,7 +124940,6 @@ func newWebAppAuthflowWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -129494,7 +125062,6 @@ func newWebAppAuthflowWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -129606,8 +125173,8 @@ func newWebAppAuthflowWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -129657,7 +125224,7 @@ func newWebAppAuthflowWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -129666,7 +125233,7 @@ func newWebAppAuthflowWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -129705,7 +125272,7 @@ func newWebAppAuthflowWhatsappOTPHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -130263,36 +125830,9 @@ func newWebAppAuthflowOOBOTPLinkHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -130400,6 +125940,15 @@ func newWebAppAuthflowOOBOTPLinkHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -130474,13 +126023,6 @@ func newWebAppAuthflowOOBOTPLinkHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -130497,7 +126039,6 @@ func newWebAppAuthflowOOBOTPLinkHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -130620,7 +126161,6 @@ func newWebAppAuthflowOOBOTPLinkHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -130732,8 +126272,8 @@ func newWebAppAuthflowOOBOTPLinkHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -130783,7 +126323,7 @@ func newWebAppAuthflowOOBOTPLinkHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -130792,7 +126332,7 @@ func newWebAppAuthflowOOBOTPLinkHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -130831,7 +126371,7 @@ func newWebAppAuthflowOOBOTPLinkHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -131389,36 +126929,9 @@ func newWebAppAuthflowV2OOBOTPLinkHandler(p *deps.RequestProvider) http.Handler SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -131526,6 +127039,15 @@ func newWebAppAuthflowV2OOBOTPLinkHandler(p *deps.RequestProvider) http.Handler Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -131600,13 +127122,6 @@ func newWebAppAuthflowV2OOBOTPLinkHandler(p *deps.RequestProvider) http.Handler UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -131623,7 +127138,6 @@ func newWebAppAuthflowV2OOBOTPLinkHandler(p *deps.RequestProvider) http.Handler Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -131746,7 +127260,6 @@ func newWebAppAuthflowV2OOBOTPLinkHandler(p *deps.RequestProvider) http.Handler UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -131858,8 +127371,8 @@ func newWebAppAuthflowV2OOBOTPLinkHandler(p *deps.RequestProvider) http.Handler AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -131909,7 +127422,7 @@ func newWebAppAuthflowV2OOBOTPLinkHandler(p *deps.RequestProvider) http.Handler SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -131918,7 +127431,7 @@ func newWebAppAuthflowV2OOBOTPLinkHandler(p *deps.RequestProvider) http.Handler sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -131957,7 +127470,7 @@ func newWebAppAuthflowV2OOBOTPLinkHandler(p *deps.RequestProvider) http.Handler UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -132518,36 +128031,9 @@ func newWebAppAuthflowChangePasswordHandler(p *deps.RequestProvider) http.Handle SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -132655,6 +128141,15 @@ func newWebAppAuthflowChangePasswordHandler(p *deps.RequestProvider) http.Handle Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -132729,13 +128224,6 @@ func newWebAppAuthflowChangePasswordHandler(p *deps.RequestProvider) http.Handle UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -132752,7 +128240,6 @@ func newWebAppAuthflowChangePasswordHandler(p *deps.RequestProvider) http.Handle Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -132875,7 +128362,6 @@ func newWebAppAuthflowChangePasswordHandler(p *deps.RequestProvider) http.Handle UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -132987,8 +128473,8 @@ func newWebAppAuthflowChangePasswordHandler(p *deps.RequestProvider) http.Handle AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -133038,7 +128524,7 @@ func newWebAppAuthflowChangePasswordHandler(p *deps.RequestProvider) http.Handle SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -133047,7 +128533,7 @@ func newWebAppAuthflowChangePasswordHandler(p *deps.RequestProvider) http.Handle sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -133086,7 +128572,7 @@ func newWebAppAuthflowChangePasswordHandler(p *deps.RequestProvider) http.Handle UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -133647,36 +129133,9 @@ func newWebAppAuthflowV2ChangePasswordHandler(p *deps.RequestProvider) http.Hand SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -133784,6 +129243,15 @@ func newWebAppAuthflowV2ChangePasswordHandler(p *deps.RequestProvider) http.Hand Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -133858,13 +129326,6 @@ func newWebAppAuthflowV2ChangePasswordHandler(p *deps.RequestProvider) http.Hand UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -133881,7 +129342,6 @@ func newWebAppAuthflowV2ChangePasswordHandler(p *deps.RequestProvider) http.Hand Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -134004,7 +129464,6 @@ func newWebAppAuthflowV2ChangePasswordHandler(p *deps.RequestProvider) http.Hand UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -134116,8 +129575,8 @@ func newWebAppAuthflowV2ChangePasswordHandler(p *deps.RequestProvider) http.Hand AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -134167,7 +129626,7 @@ func newWebAppAuthflowV2ChangePasswordHandler(p *deps.RequestProvider) http.Hand SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -134176,7 +129635,7 @@ func newWebAppAuthflowV2ChangePasswordHandler(p *deps.RequestProvider) http.Hand sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -134215,7 +129674,7 @@ func newWebAppAuthflowV2ChangePasswordHandler(p *deps.RequestProvider) http.Hand UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -134777,36 +130236,9 @@ func newWebAppAuthflowV2ChangePasswordSuccessHandler(p *deps.RequestProvider) ht SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -134914,6 +130346,15 @@ func newWebAppAuthflowV2ChangePasswordSuccessHandler(p *deps.RequestProvider) ht Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -134988,13 +130429,6 @@ func newWebAppAuthflowV2ChangePasswordSuccessHandler(p *deps.RequestProvider) ht UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -135011,7 +130445,6 @@ func newWebAppAuthflowV2ChangePasswordSuccessHandler(p *deps.RequestProvider) ht Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -135134,7 +130567,6 @@ func newWebAppAuthflowV2ChangePasswordSuccessHandler(p *deps.RequestProvider) ht UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -135246,8 +130678,8 @@ func newWebAppAuthflowV2ChangePasswordSuccessHandler(p *deps.RequestProvider) ht AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -135297,7 +130729,7 @@ func newWebAppAuthflowV2ChangePasswordSuccessHandler(p *deps.RequestProvider) ht SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -135306,7 +130738,7 @@ func newWebAppAuthflowV2ChangePasswordSuccessHandler(p *deps.RequestProvider) ht sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -135345,7 +130777,7 @@ func newWebAppAuthflowV2ChangePasswordSuccessHandler(p *deps.RequestProvider) ht UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -135901,36 +131333,9 @@ func newWebAppAuthflowUsePasskeyHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -136038,6 +131443,15 @@ func newWebAppAuthflowUsePasskeyHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -136112,13 +131526,6 @@ func newWebAppAuthflowUsePasskeyHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -136135,7 +131542,6 @@ func newWebAppAuthflowUsePasskeyHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -136258,7 +131664,6 @@ func newWebAppAuthflowUsePasskeyHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -136370,8 +131775,8 @@ func newWebAppAuthflowUsePasskeyHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -136421,7 +131826,7 @@ func newWebAppAuthflowUsePasskeyHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -136430,7 +131835,7 @@ func newWebAppAuthflowUsePasskeyHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -136469,7 +131874,7 @@ func newWebAppAuthflowUsePasskeyHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -137025,36 +132430,9 @@ func newWebAppAuthflowV2UsePasskeyHandler(p *deps.RequestProvider) http.Handler SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -137162,6 +132540,15 @@ func newWebAppAuthflowV2UsePasskeyHandler(p *deps.RequestProvider) http.Handler Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -137236,13 +132623,6 @@ func newWebAppAuthflowV2UsePasskeyHandler(p *deps.RequestProvider) http.Handler UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -137259,7 +132639,6 @@ func newWebAppAuthflowV2UsePasskeyHandler(p *deps.RequestProvider) http.Handler Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -137382,7 +132761,6 @@ func newWebAppAuthflowV2UsePasskeyHandler(p *deps.RequestProvider) http.Handler UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -137494,8 +132872,8 @@ func newWebAppAuthflowV2UsePasskeyHandler(p *deps.RequestProvider) http.Handler AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -137545,7 +132923,7 @@ func newWebAppAuthflowV2UsePasskeyHandler(p *deps.RequestProvider) http.Handler SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -137554,7 +132932,7 @@ func newWebAppAuthflowV2UsePasskeyHandler(p *deps.RequestProvider) http.Handler sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -137593,7 +132971,7 @@ func newWebAppAuthflowV2UsePasskeyHandler(p *deps.RequestProvider) http.Handler UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -138153,36 +133531,9 @@ func newWebAppAuthflowPromptCreatePasskeyHandler(p *deps.RequestProvider) http.H SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -138290,6 +133641,15 @@ func newWebAppAuthflowPromptCreatePasskeyHandler(p *deps.RequestProvider) http.H Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -138364,13 +133724,6 @@ func newWebAppAuthflowPromptCreatePasskeyHandler(p *deps.RequestProvider) http.H UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -138387,7 +133740,6 @@ func newWebAppAuthflowPromptCreatePasskeyHandler(p *deps.RequestProvider) http.H Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -138510,7 +133862,6 @@ func newWebAppAuthflowPromptCreatePasskeyHandler(p *deps.RequestProvider) http.H UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -138622,8 +133973,8 @@ func newWebAppAuthflowPromptCreatePasskeyHandler(p *deps.RequestProvider) http.H AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -138673,7 +134024,7 @@ func newWebAppAuthflowPromptCreatePasskeyHandler(p *deps.RequestProvider) http.H SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -138682,7 +134033,7 @@ func newWebAppAuthflowPromptCreatePasskeyHandler(p *deps.RequestProvider) http.H sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -138721,7 +134072,7 @@ func newWebAppAuthflowPromptCreatePasskeyHandler(p *deps.RequestProvider) http.H UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -139277,36 +134628,9 @@ func newWebAppAuthflowV2PromptCreatePasskeyHandler(p *deps.RequestProvider) http SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -139414,6 +134738,15 @@ func newWebAppAuthflowV2PromptCreatePasskeyHandler(p *deps.RequestProvider) http Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -139488,13 +134821,6 @@ func newWebAppAuthflowV2PromptCreatePasskeyHandler(p *deps.RequestProvider) http UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -139511,7 +134837,6 @@ func newWebAppAuthflowV2PromptCreatePasskeyHandler(p *deps.RequestProvider) http Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -139634,7 +134959,6 @@ func newWebAppAuthflowV2PromptCreatePasskeyHandler(p *deps.RequestProvider) http UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -139746,8 +135070,8 @@ func newWebAppAuthflowV2PromptCreatePasskeyHandler(p *deps.RequestProvider) http AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -139797,7 +135121,7 @@ func newWebAppAuthflowV2PromptCreatePasskeyHandler(p *deps.RequestProvider) http SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -139806,7 +135130,7 @@ func newWebAppAuthflowV2PromptCreatePasskeyHandler(p *deps.RequestProvider) http sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -139845,7 +135169,7 @@ func newWebAppAuthflowV2PromptCreatePasskeyHandler(p *deps.RequestProvider) http UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -140401,36 +135725,9 @@ func newWebAppAuthflowEnterRecoveryCodeHandler(p *deps.RequestProvider) http.Han SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -140538,6 +135835,15 @@ func newWebAppAuthflowEnterRecoveryCodeHandler(p *deps.RequestProvider) http.Han Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -140612,13 +135918,6 @@ func newWebAppAuthflowEnterRecoveryCodeHandler(p *deps.RequestProvider) http.Han UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -140635,7 +135934,6 @@ func newWebAppAuthflowEnterRecoveryCodeHandler(p *deps.RequestProvider) http.Han Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -140758,7 +136056,6 @@ func newWebAppAuthflowEnterRecoveryCodeHandler(p *deps.RequestProvider) http.Han UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -140870,8 +136167,8 @@ func newWebAppAuthflowEnterRecoveryCodeHandler(p *deps.RequestProvider) http.Han AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -140921,7 +136218,7 @@ func newWebAppAuthflowEnterRecoveryCodeHandler(p *deps.RequestProvider) http.Han SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -140930,7 +136227,7 @@ func newWebAppAuthflowEnterRecoveryCodeHandler(p *deps.RequestProvider) http.Han sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -140969,7 +136266,7 @@ func newWebAppAuthflowEnterRecoveryCodeHandler(p *deps.RequestProvider) http.Han UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -141525,36 +136822,9 @@ func newWebAppAuthflowV2EnterRecoveryCodeHandler(p *deps.RequestProvider) http.H SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -141662,6 +136932,15 @@ func newWebAppAuthflowV2EnterRecoveryCodeHandler(p *deps.RequestProvider) http.H Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -141736,13 +137015,6 @@ func newWebAppAuthflowV2EnterRecoveryCodeHandler(p *deps.RequestProvider) http.H UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -141759,7 +137031,6 @@ func newWebAppAuthflowV2EnterRecoveryCodeHandler(p *deps.RequestProvider) http.H Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -141882,7 +137153,6 @@ func newWebAppAuthflowV2EnterRecoveryCodeHandler(p *deps.RequestProvider) http.H UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -141994,8 +137264,8 @@ func newWebAppAuthflowV2EnterRecoveryCodeHandler(p *deps.RequestProvider) http.H AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -142045,7 +137315,7 @@ func newWebAppAuthflowV2EnterRecoveryCodeHandler(p *deps.RequestProvider) http.H SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -142054,7 +137324,7 @@ func newWebAppAuthflowV2EnterRecoveryCodeHandler(p *deps.RequestProvider) http.H sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -142093,7 +137363,7 @@ func newWebAppAuthflowV2EnterRecoveryCodeHandler(p *deps.RequestProvider) http.H UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -142649,36 +137919,9 @@ func newWebAppAuthflowSetupOOBOTPHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -142786,6 +138029,15 @@ func newWebAppAuthflowSetupOOBOTPHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -142860,13 +138112,6 @@ func newWebAppAuthflowSetupOOBOTPHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -142883,7 +138128,6 @@ func newWebAppAuthflowSetupOOBOTPHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -143006,7 +138250,6 @@ func newWebAppAuthflowSetupOOBOTPHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -143118,8 +138361,8 @@ func newWebAppAuthflowSetupOOBOTPHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -143169,7 +138412,7 @@ func newWebAppAuthflowSetupOOBOTPHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -143178,7 +138421,7 @@ func newWebAppAuthflowSetupOOBOTPHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -143217,7 +138460,7 @@ func newWebAppAuthflowSetupOOBOTPHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -143773,36 +139016,9 @@ func newWebAppAuthflowV2SetupOOBOTPHandler(p *deps.RequestProvider) http.Handler SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -143910,6 +139126,15 @@ func newWebAppAuthflowV2SetupOOBOTPHandler(p *deps.RequestProvider) http.Handler Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -143984,13 +139209,6 @@ func newWebAppAuthflowV2SetupOOBOTPHandler(p *deps.RequestProvider) http.Handler UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -144007,7 +139225,6 @@ func newWebAppAuthflowV2SetupOOBOTPHandler(p *deps.RequestProvider) http.Handler Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -144130,7 +139347,6 @@ func newWebAppAuthflowV2SetupOOBOTPHandler(p *deps.RequestProvider) http.Handler UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -144242,8 +139458,8 @@ func newWebAppAuthflowV2SetupOOBOTPHandler(p *deps.RequestProvider) http.Handler AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -144293,7 +139509,7 @@ func newWebAppAuthflowV2SetupOOBOTPHandler(p *deps.RequestProvider) http.Handler SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -144302,7 +139518,7 @@ func newWebAppAuthflowV2SetupOOBOTPHandler(p *deps.RequestProvider) http.Handler sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -144341,7 +139557,7 @@ func newWebAppAuthflowV2SetupOOBOTPHandler(p *deps.RequestProvider) http.Handler UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -144897,36 +140113,9 @@ func newWebAppAuthflowTerminateOtherSessionsHandler(p *deps.RequestProvider) htt SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -145034,6 +140223,15 @@ func newWebAppAuthflowTerminateOtherSessionsHandler(p *deps.RequestProvider) htt Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -145108,13 +140306,6 @@ func newWebAppAuthflowTerminateOtherSessionsHandler(p *deps.RequestProvider) htt UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -145131,7 +140322,6 @@ func newWebAppAuthflowTerminateOtherSessionsHandler(p *deps.RequestProvider) htt Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -145254,7 +140444,6 @@ func newWebAppAuthflowTerminateOtherSessionsHandler(p *deps.RequestProvider) htt UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -145366,8 +140555,8 @@ func newWebAppAuthflowTerminateOtherSessionsHandler(p *deps.RequestProvider) htt AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -145417,7 +140606,7 @@ func newWebAppAuthflowTerminateOtherSessionsHandler(p *deps.RequestProvider) htt SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -145426,7 +140615,7 @@ func newWebAppAuthflowTerminateOtherSessionsHandler(p *deps.RequestProvider) htt sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -145465,7 +140654,7 @@ func newWebAppAuthflowTerminateOtherSessionsHandler(p *deps.RequestProvider) htt UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -146021,36 +141210,9 @@ func newWebAppAuthflowV2TerminateOtherSessionsHandler(p *deps.RequestProvider) h SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -146158,6 +141320,15 @@ func newWebAppAuthflowV2TerminateOtherSessionsHandler(p *deps.RequestProvider) h Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -146232,13 +141403,6 @@ func newWebAppAuthflowV2TerminateOtherSessionsHandler(p *deps.RequestProvider) h UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -146255,7 +141419,6 @@ func newWebAppAuthflowV2TerminateOtherSessionsHandler(p *deps.RequestProvider) h Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -146378,7 +141541,6 @@ func newWebAppAuthflowV2TerminateOtherSessionsHandler(p *deps.RequestProvider) h UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -146490,8 +141652,8 @@ func newWebAppAuthflowV2TerminateOtherSessionsHandler(p *deps.RequestProvider) h AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -146541,7 +141703,7 @@ func newWebAppAuthflowV2TerminateOtherSessionsHandler(p *deps.RequestProvider) h SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -146550,7 +141712,7 @@ func newWebAppAuthflowV2TerminateOtherSessionsHandler(p *deps.RequestProvider) h sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -146589,7 +141751,7 @@ func newWebAppAuthflowV2TerminateOtherSessionsHandler(p *deps.RequestProvider) h UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -147145,36 +142307,9 @@ func newWebAppAuthflowWechatHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -147282,6 +142417,15 @@ func newWebAppAuthflowWechatHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -147356,13 +142500,6 @@ func newWebAppAuthflowWechatHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -147379,7 +142516,6 @@ func newWebAppAuthflowWechatHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -147502,7 +142638,6 @@ func newWebAppAuthflowWechatHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -147614,8 +142749,8 @@ func newWebAppAuthflowWechatHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -147665,7 +142800,7 @@ func newWebAppAuthflowWechatHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -147674,7 +142809,7 @@ func newWebAppAuthflowWechatHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -147713,7 +142848,7 @@ func newWebAppAuthflowWechatHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -148270,36 +143405,9 @@ func newWebAppAuthflowForgotPasswordHandler(p *deps.RequestProvider) http.Handle SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -148407,6 +143515,15 @@ func newWebAppAuthflowForgotPasswordHandler(p *deps.RequestProvider) http.Handle Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -148481,13 +143598,6 @@ func newWebAppAuthflowForgotPasswordHandler(p *deps.RequestProvider) http.Handle UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -148504,7 +143614,6 @@ func newWebAppAuthflowForgotPasswordHandler(p *deps.RequestProvider) http.Handle Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -148627,7 +143736,6 @@ func newWebAppAuthflowForgotPasswordHandler(p *deps.RequestProvider) http.Handle UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -148739,8 +143847,8 @@ func newWebAppAuthflowForgotPasswordHandler(p *deps.RequestProvider) http.Handle AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -148790,7 +143898,7 @@ func newWebAppAuthflowForgotPasswordHandler(p *deps.RequestProvider) http.Handle SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -148799,7 +143907,7 @@ func newWebAppAuthflowForgotPasswordHandler(p *deps.RequestProvider) http.Handle sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -148838,7 +143946,7 @@ func newWebAppAuthflowForgotPasswordHandler(p *deps.RequestProvider) http.Handle UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -149394,36 +144502,9 @@ func newWebAppAuthflowV2ForgotPasswordHandler(p *deps.RequestProvider) http.Hand SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -149531,6 +144612,15 @@ func newWebAppAuthflowV2ForgotPasswordHandler(p *deps.RequestProvider) http.Hand Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -149605,13 +144695,6 @@ func newWebAppAuthflowV2ForgotPasswordHandler(p *deps.RequestProvider) http.Hand UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -149628,7 +144711,6 @@ func newWebAppAuthflowV2ForgotPasswordHandler(p *deps.RequestProvider) http.Hand Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -149751,7 +144833,6 @@ func newWebAppAuthflowV2ForgotPasswordHandler(p *deps.RequestProvider) http.Hand UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -149863,8 +144944,8 @@ func newWebAppAuthflowV2ForgotPasswordHandler(p *deps.RequestProvider) http.Hand AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -149914,7 +144995,7 @@ func newWebAppAuthflowV2ForgotPasswordHandler(p *deps.RequestProvider) http.Hand SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -149923,7 +145004,7 @@ func newWebAppAuthflowV2ForgotPasswordHandler(p *deps.RequestProvider) http.Hand sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -149962,7 +145043,7 @@ func newWebAppAuthflowV2ForgotPasswordHandler(p *deps.RequestProvider) http.Hand UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -150524,36 +145605,9 @@ func newWebAppAuthflowForgotPasswordOTPHandler(p *deps.RequestProvider) http.Han SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -150661,6 +145715,15 @@ func newWebAppAuthflowForgotPasswordOTPHandler(p *deps.RequestProvider) http.Han Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -150735,13 +145798,6 @@ func newWebAppAuthflowForgotPasswordOTPHandler(p *deps.RequestProvider) http.Han UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -150758,7 +145814,6 @@ func newWebAppAuthflowForgotPasswordOTPHandler(p *deps.RequestProvider) http.Han Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -150881,7 +145936,6 @@ func newWebAppAuthflowForgotPasswordOTPHandler(p *deps.RequestProvider) http.Han UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -150993,8 +146047,8 @@ func newWebAppAuthflowForgotPasswordOTPHandler(p *deps.RequestProvider) http.Han AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -151044,7 +146098,7 @@ func newWebAppAuthflowForgotPasswordOTPHandler(p *deps.RequestProvider) http.Han SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -151053,7 +146107,7 @@ func newWebAppAuthflowForgotPasswordOTPHandler(p *deps.RequestProvider) http.Han sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -151092,7 +146146,7 @@ func newWebAppAuthflowForgotPasswordOTPHandler(p *deps.RequestProvider) http.Han UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -151650,36 +146704,9 @@ func newWebAppAuthflowV2ForgotPasswordOTPHandler(p *deps.RequestProvider) http.H SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -151787,6 +146814,15 @@ func newWebAppAuthflowV2ForgotPasswordOTPHandler(p *deps.RequestProvider) http.H Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -151861,13 +146897,6 @@ func newWebAppAuthflowV2ForgotPasswordOTPHandler(p *deps.RequestProvider) http.H UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -151884,7 +146913,6 @@ func newWebAppAuthflowV2ForgotPasswordOTPHandler(p *deps.RequestProvider) http.H Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -152007,7 +147035,6 @@ func newWebAppAuthflowV2ForgotPasswordOTPHandler(p *deps.RequestProvider) http.H UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -152119,8 +147146,8 @@ func newWebAppAuthflowV2ForgotPasswordOTPHandler(p *deps.RequestProvider) http.H AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -152170,7 +147197,7 @@ func newWebAppAuthflowV2ForgotPasswordOTPHandler(p *deps.RequestProvider) http.H SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -152179,7 +147206,7 @@ func newWebAppAuthflowV2ForgotPasswordOTPHandler(p *deps.RequestProvider) http.H sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -152218,7 +147245,7 @@ func newWebAppAuthflowV2ForgotPasswordOTPHandler(p *deps.RequestProvider) http.H UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -152776,36 +147803,9 @@ func newWebAppAuthflowForgotPasswordSuccessHandler(p *deps.RequestProvider) http SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -152913,6 +147913,15 @@ func newWebAppAuthflowForgotPasswordSuccessHandler(p *deps.RequestProvider) http Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -152987,13 +147996,6 @@ func newWebAppAuthflowForgotPasswordSuccessHandler(p *deps.RequestProvider) http UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -153010,7 +148012,6 @@ func newWebAppAuthflowForgotPasswordSuccessHandler(p *deps.RequestProvider) http Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -153133,7 +148134,6 @@ func newWebAppAuthflowForgotPasswordSuccessHandler(p *deps.RequestProvider) http UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -153245,8 +148245,8 @@ func newWebAppAuthflowForgotPasswordSuccessHandler(p *deps.RequestProvider) http AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -153296,7 +148296,7 @@ func newWebAppAuthflowForgotPasswordSuccessHandler(p *deps.RequestProvider) http SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -153305,7 +148305,7 @@ func newWebAppAuthflowForgotPasswordSuccessHandler(p *deps.RequestProvider) http sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -153344,7 +148344,7 @@ func newWebAppAuthflowForgotPasswordSuccessHandler(p *deps.RequestProvider) http UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -153900,36 +148900,9 @@ func newWebAppAuthflowV2ForgotPasswordLinkSentHandler(p *deps.RequestProvider) h SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -154037,6 +149010,15 @@ func newWebAppAuthflowV2ForgotPasswordLinkSentHandler(p *deps.RequestProvider) h Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -154111,13 +149093,6 @@ func newWebAppAuthflowV2ForgotPasswordLinkSentHandler(p *deps.RequestProvider) h UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -154134,7 +149109,6 @@ func newWebAppAuthflowV2ForgotPasswordLinkSentHandler(p *deps.RequestProvider) h Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -154257,7 +149231,6 @@ func newWebAppAuthflowV2ForgotPasswordLinkSentHandler(p *deps.RequestProvider) h UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -154369,8 +149342,8 @@ func newWebAppAuthflowV2ForgotPasswordLinkSentHandler(p *deps.RequestProvider) h AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -154420,7 +149393,7 @@ func newWebAppAuthflowV2ForgotPasswordLinkSentHandler(p *deps.RequestProvider) h SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -154429,7 +149402,7 @@ func newWebAppAuthflowV2ForgotPasswordLinkSentHandler(p *deps.RequestProvider) h sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -154468,7 +149441,7 @@ func newWebAppAuthflowV2ForgotPasswordLinkSentHandler(p *deps.RequestProvider) h UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -155047,36 +150020,9 @@ func newWebAppReauthHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -155184,6 +150130,15 @@ func newWebAppReauthHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -155258,13 +150213,6 @@ func newWebAppReauthHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -155281,7 +150229,6 @@ func newWebAppReauthHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -155501,8 +150448,8 @@ func newWebAppReauthHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -155551,7 +150498,6 @@ func newWebAppReauthHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -155567,7 +150513,7 @@ func newWebAppReauthHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -155576,7 +150522,7 @@ func newWebAppReauthHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -155605,7 +150551,7 @@ func newWebAppReauthHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -156050,36 +150996,9 @@ func newWebAppAuthflowReauthHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -156187,6 +151106,15 @@ func newWebAppAuthflowReauthHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -156261,13 +151189,6 @@ func newWebAppAuthflowReauthHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -156284,7 +151205,6 @@ func newWebAppAuthflowReauthHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -156407,7 +151327,6 @@ func newWebAppAuthflowReauthHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -156519,8 +151438,8 @@ func newWebAppAuthflowReauthHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -156570,7 +151489,7 @@ func newWebAppAuthflowReauthHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -156579,7 +151498,7 @@ func newWebAppAuthflowReauthHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -156618,7 +151537,7 @@ func newWebAppAuthflowReauthHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -157140,36 +152059,9 @@ func newWebAppAuthflowV2ReauthHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -157277,6 +152169,15 @@ func newWebAppAuthflowV2ReauthHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -157351,13 +152252,6 @@ func newWebAppAuthflowV2ReauthHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -157374,7 +152268,6 @@ func newWebAppAuthflowV2ReauthHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -157497,7 +152390,6 @@ func newWebAppAuthflowV2ReauthHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -157609,8 +152501,8 @@ func newWebAppAuthflowV2ReauthHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -157660,7 +152552,7 @@ func newWebAppAuthflowV2ReauthHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -157669,7 +152561,7 @@ func newWebAppAuthflowV2ReauthHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -157708,7 +152600,7 @@ func newWebAppAuthflowV2ReauthHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -158230,36 +153122,9 @@ func newWebAppAuthflowResetPasswordHandler(p *deps.RequestProvider) http.Handler SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -158367,6 +153232,15 @@ func newWebAppAuthflowResetPasswordHandler(p *deps.RequestProvider) http.Handler Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -158441,13 +153315,6 @@ func newWebAppAuthflowResetPasswordHandler(p *deps.RequestProvider) http.Handler UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -158464,7 +153331,6 @@ func newWebAppAuthflowResetPasswordHandler(p *deps.RequestProvider) http.Handler Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -158587,7 +153453,6 @@ func newWebAppAuthflowResetPasswordHandler(p *deps.RequestProvider) http.Handler UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -158699,8 +153564,8 @@ func newWebAppAuthflowResetPasswordHandler(p *deps.RequestProvider) http.Handler AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -158750,7 +153615,7 @@ func newWebAppAuthflowResetPasswordHandler(p *deps.RequestProvider) http.Handler SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -158759,7 +153624,7 @@ func newWebAppAuthflowResetPasswordHandler(p *deps.RequestProvider) http.Handler sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -158798,7 +153663,7 @@ func newWebAppAuthflowResetPasswordHandler(p *deps.RequestProvider) http.Handler UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -159376,36 +154241,9 @@ func newWebAppAuthflowV2ResetPasswordHandler(p *deps.RequestProvider) http.Handl SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -159513,6 +154351,15 @@ func newWebAppAuthflowV2ResetPasswordHandler(p *deps.RequestProvider) http.Handl Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -159587,13 +154434,6 @@ func newWebAppAuthflowV2ResetPasswordHandler(p *deps.RequestProvider) http.Handl UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -159610,7 +154450,6 @@ func newWebAppAuthflowV2ResetPasswordHandler(p *deps.RequestProvider) http.Handl Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -159830,8 +154669,8 @@ func newWebAppAuthflowV2ResetPasswordHandler(p *deps.RequestProvider) http.Handl AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -159880,7 +154719,6 @@ func newWebAppAuthflowV2ResetPasswordHandler(p *deps.RequestProvider) http.Handl UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -159896,7 +154734,7 @@ func newWebAppAuthflowV2ResetPasswordHandler(p *deps.RequestProvider) http.Handl SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -159905,7 +154743,7 @@ func newWebAppAuthflowV2ResetPasswordHandler(p *deps.RequestProvider) http.Handl sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -159934,7 +154772,7 @@ func newWebAppAuthflowV2ResetPasswordHandler(p *deps.RequestProvider) http.Handl UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -160572,36 +155410,9 @@ func newWebAppAuthflowResetPasswordSuccessHandler(p *deps.RequestProvider) http. SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -160709,6 +155520,15 @@ func newWebAppAuthflowResetPasswordSuccessHandler(p *deps.RequestProvider) http. Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -160783,13 +155603,6 @@ func newWebAppAuthflowResetPasswordSuccessHandler(p *deps.RequestProvider) http. UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -160806,7 +155619,6 @@ func newWebAppAuthflowResetPasswordSuccessHandler(p *deps.RequestProvider) http. Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -160929,7 +155741,6 @@ func newWebAppAuthflowResetPasswordSuccessHandler(p *deps.RequestProvider) http. UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -161041,8 +155852,8 @@ func newWebAppAuthflowResetPasswordSuccessHandler(p *deps.RequestProvider) http. AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -161092,7 +155903,7 @@ func newWebAppAuthflowResetPasswordSuccessHandler(p *deps.RequestProvider) http. SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -161101,7 +155912,7 @@ func newWebAppAuthflowResetPasswordSuccessHandler(p *deps.RequestProvider) http. sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -161140,7 +155951,7 @@ func newWebAppAuthflowResetPasswordSuccessHandler(p *deps.RequestProvider) http. UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -161696,36 +156507,9 @@ func newWebAppAuthflowV2ResetPasswordSuccessHandler(p *deps.RequestProvider) htt SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -161833,6 +156617,15 @@ func newWebAppAuthflowV2ResetPasswordSuccessHandler(p *deps.RequestProvider) htt Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -161907,13 +156700,6 @@ func newWebAppAuthflowV2ResetPasswordSuccessHandler(p *deps.RequestProvider) htt UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -161930,7 +156716,6 @@ func newWebAppAuthflowV2ResetPasswordSuccessHandler(p *deps.RequestProvider) htt Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -162053,7 +156838,6 @@ func newWebAppAuthflowV2ResetPasswordSuccessHandler(p *deps.RequestProvider) htt UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -162165,8 +156949,8 @@ func newWebAppAuthflowV2ResetPasswordSuccessHandler(p *deps.RequestProvider) htt AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -162216,7 +157000,7 @@ func newWebAppAuthflowV2ResetPasswordSuccessHandler(p *deps.RequestProvider) htt SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -162225,7 +157009,7 @@ func newWebAppAuthflowV2ResetPasswordSuccessHandler(p *deps.RequestProvider) htt sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -162264,7 +157048,7 @@ func newWebAppAuthflowV2ResetPasswordSuccessHandler(p *deps.RequestProvider) htt UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -163156,36 +157940,9 @@ func newWebAppAuthflowFinishFlowHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -163293,6 +158050,15 @@ func newWebAppAuthflowFinishFlowHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -163367,13 +158133,6 @@ func newWebAppAuthflowFinishFlowHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -163390,7 +158149,6 @@ func newWebAppAuthflowFinishFlowHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -163513,7 +158271,6 @@ func newWebAppAuthflowFinishFlowHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -163625,8 +158382,8 @@ func newWebAppAuthflowFinishFlowHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -163676,7 +158433,7 @@ func newWebAppAuthflowFinishFlowHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -163685,7 +158442,7 @@ func newWebAppAuthflowFinishFlowHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -163724,7 +158481,7 @@ func newWebAppAuthflowFinishFlowHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -164280,36 +159037,9 @@ func newWebAppAuthflowV2FinishFlowHandler(p *deps.RequestProvider) http.Handler SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -164417,6 +159147,15 @@ func newWebAppAuthflowV2FinishFlowHandler(p *deps.RequestProvider) http.Handler Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -164491,13 +159230,6 @@ func newWebAppAuthflowV2FinishFlowHandler(p *deps.RequestProvider) http.Handler UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -164514,7 +159246,6 @@ func newWebAppAuthflowV2FinishFlowHandler(p *deps.RequestProvider) http.Handler Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -164637,7 +159368,6 @@ func newWebAppAuthflowV2FinishFlowHandler(p *deps.RequestProvider) http.Handler UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -164749,8 +159479,8 @@ func newWebAppAuthflowV2FinishFlowHandler(p *deps.RequestProvider) http.Handler AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -164800,7 +159530,7 @@ func newWebAppAuthflowV2FinishFlowHandler(p *deps.RequestProvider) http.Handler SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -164809,7 +159539,7 @@ func newWebAppAuthflowV2FinishFlowHandler(p *deps.RequestProvider) http.Handler sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -164848,7 +159578,7 @@ func newWebAppAuthflowV2FinishFlowHandler(p *deps.RequestProvider) http.Handler UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -165404,36 +160134,9 @@ func newWebAppAuthflowV2AccountLinkingHandler(p *deps.RequestProvider) http.Hand SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -165541,6 +160244,15 @@ func newWebAppAuthflowV2AccountLinkingHandler(p *deps.RequestProvider) http.Hand Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -165615,13 +160327,6 @@ func newWebAppAuthflowV2AccountLinkingHandler(p *deps.RequestProvider) http.Hand UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -165638,7 +160343,6 @@ func newWebAppAuthflowV2AccountLinkingHandler(p *deps.RequestProvider) http.Hand Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -165761,7 +160465,6 @@ func newWebAppAuthflowV2AccountLinkingHandler(p *deps.RequestProvider) http.Hand UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -165873,8 +160576,8 @@ func newWebAppAuthflowV2AccountLinkingHandler(p *deps.RequestProvider) http.Hand AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -165924,7 +160627,7 @@ func newWebAppAuthflowV2AccountLinkingHandler(p *deps.RequestProvider) http.Hand SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -165933,7 +160636,7 @@ func newWebAppAuthflowV2AccountLinkingHandler(p *deps.RequestProvider) http.Hand sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -165972,7 +160675,7 @@ func newWebAppAuthflowV2AccountLinkingHandler(p *deps.RequestProvider) http.Hand UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -166641,36 +161344,9 @@ func newWebAppAuthflowV2WechatHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -166778,6 +161454,15 @@ func newWebAppAuthflowV2WechatHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -166852,13 +161537,6 @@ func newWebAppAuthflowV2WechatHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -166875,7 +161553,6 @@ func newWebAppAuthflowV2WechatHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -166998,7 +161675,6 @@ func newWebAppAuthflowV2WechatHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -167110,8 +161786,8 @@ func newWebAppAuthflowV2WechatHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -167161,7 +161837,7 @@ func newWebAppAuthflowV2WechatHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -167170,7 +161846,7 @@ func newWebAppAuthflowV2WechatHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -167209,7 +161885,7 @@ func newWebAppAuthflowV2WechatHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -167766,36 +162442,9 @@ func newWebAppAuthflowV2LDAPLoginHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -167903,6 +162552,15 @@ func newWebAppAuthflowV2LDAPLoginHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -167977,13 +162635,6 @@ func newWebAppAuthflowV2LDAPLoginHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -168000,7 +162651,6 @@ func newWebAppAuthflowV2LDAPLoginHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -168123,7 +162773,6 @@ func newWebAppAuthflowV2LDAPLoginHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -168235,8 +162884,8 @@ func newWebAppAuthflowV2LDAPLoginHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -168286,7 +162935,7 @@ func newWebAppAuthflowV2LDAPLoginHandler(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -168295,7 +162944,7 @@ func newWebAppAuthflowV2LDAPLoginHandler(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -168334,7 +162983,7 @@ func newWebAppAuthflowV2LDAPLoginHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -168876,38 +163525,9 @@ func newSAMLMetadataHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - factory := appProvider.LoggerFactory - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -168944,7 +163564,8 @@ func newSAMLMetadataHandler(p *deps.RequestProvider) http.Handler { } authenticatorConfig := appConfig.Authenticator authenticatorPasswordConfig := authenticatorConfig.Password - passwordLogger := password.NewLogger(factory) + factory := appProvider.LoggerFactory + logger := password.NewLogger(factory) historyStore := &password.HistoryStore{ Clock: clockClock, SQLBuilder: sqlBuilderApp, @@ -168963,7 +163584,7 @@ func newSAMLMetadataHandler(p *deps.RequestProvider) http.Handler { Store: passwordStore, Config: authenticatorPasswordConfig, Clock: clockClock, - Logger: passwordLogger, + Logger: logger, PasswordHistory: historyStore, PasswordChecker: passwordChecker, Expiry: expiry, @@ -168999,6 +163620,7 @@ func newSAMLMetadataHandler(p *deps.RequestProvider) http.Handler { } testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode + remoteIP := deps.ProvideRemoteIP(request, trustProxy) codeStoreRedis := &otp.CodeStoreRedis{ Redis: appredisHandle, AppID: appID, @@ -169015,6 +163637,15 @@ func newSAMLMetadataHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -169089,13 +163720,6 @@ func newSAMLMetadataHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -169112,7 +163736,6 @@ func newSAMLMetadataHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } idTokenIssuer := &oidc.IDTokenIssuer{ @@ -169124,7 +163747,7 @@ func newSAMLMetadataHandler(p *deps.RequestProvider) http.Handler { } userAgentString := deps.ProvideUserAgentString(request) storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -169155,7 +163778,7 @@ func newSAMLMetadataHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -169363,37 +163986,9 @@ func newSAMLLoginHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -169430,7 +164025,7 @@ func newSAMLLoginHandler(p *deps.RequestProvider) http.Handler { } authenticatorConfig := appConfig.Authenticator authenticatorPasswordConfig := authenticatorConfig.Password - passwordLogger := password.NewLogger(factory) + logger := password.NewLogger(factory) historyStore := &password.HistoryStore{ Clock: clockClock, SQLBuilder: sqlBuilderApp, @@ -169449,7 +164044,7 @@ func newSAMLLoginHandler(p *deps.RequestProvider) http.Handler { Store: passwordStore, Config: authenticatorPasswordConfig, Clock: clockClock, - Logger: passwordLogger, + Logger: logger, PasswordHistory: historyStore, PasswordChecker: passwordChecker, Expiry: expiry, @@ -169485,6 +164080,7 @@ func newSAMLLoginHandler(p *deps.RequestProvider) http.Handler { } testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode + remoteIP := deps.ProvideRemoteIP(request, trustProxy) codeStoreRedis := &otp.CodeStoreRedis{ Redis: appredisHandle, AppID: appID, @@ -169501,6 +164097,15 @@ func newSAMLLoginHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -169575,13 +164180,6 @@ func newSAMLLoginHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -169598,7 +164196,6 @@ func newSAMLLoginHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } idTokenIssuer := &oidc.IDTokenIssuer{ @@ -169610,7 +164207,7 @@ func newSAMLLoginHandler(p *deps.RequestProvider) http.Handler { } userAgentString := deps.ProvideUserAgentString(request) storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -169641,7 +164238,7 @@ func newSAMLLoginHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -169818,7 +164415,6 @@ func newSAMLLoginHandler(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -169930,8 +164526,8 @@ func newSAMLLoginHandler(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -169984,7 +164580,7 @@ func newSAMLLoginHandler(p *deps.RequestProvider) http.Handler { cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -170219,37 +164815,9 @@ func newSAMLLoginFinishHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -170286,7 +164854,7 @@ func newSAMLLoginFinishHandler(p *deps.RequestProvider) http.Handler { } authenticatorConfig := appConfig.Authenticator authenticatorPasswordConfig := authenticatorConfig.Password - passwordLogger := password.NewLogger(factory) + logger := password.NewLogger(factory) historyStore := &password.HistoryStore{ Clock: clockClock, SQLBuilder: sqlBuilderApp, @@ -170305,7 +164873,7 @@ func newSAMLLoginFinishHandler(p *deps.RequestProvider) http.Handler { Store: passwordStore, Config: authenticatorPasswordConfig, Clock: clockClock, - Logger: passwordLogger, + Logger: logger, PasswordHistory: historyStore, PasswordChecker: passwordChecker, Expiry: expiry, @@ -170341,6 +164909,7 @@ func newSAMLLoginFinishHandler(p *deps.RequestProvider) http.Handler { } testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode + remoteIP := deps.ProvideRemoteIP(request, trustProxy) codeStoreRedis := &otp.CodeStoreRedis{ Redis: appredisHandle, AppID: appID, @@ -170357,6 +164926,15 @@ func newSAMLLoginFinishHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -170431,13 +165009,6 @@ func newSAMLLoginFinishHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -170454,7 +165025,6 @@ func newSAMLLoginFinishHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } idTokenIssuer := &oidc.IDTokenIssuer{ @@ -170466,7 +165036,7 @@ func newSAMLLoginFinishHandler(p *deps.RequestProvider) http.Handler { } userAgentString := deps.ProvideUserAgentString(request) storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -170497,7 +165067,7 @@ func newSAMLLoginFinishHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -170729,37 +165299,9 @@ func newSAMLLogoutHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -170796,7 +165338,7 @@ func newSAMLLogoutHandler(p *deps.RequestProvider) http.Handler { } authenticatorConfig := appConfig.Authenticator authenticatorPasswordConfig := authenticatorConfig.Password - passwordLogger := password.NewLogger(factory) + logger := password.NewLogger(factory) historyStore := &password.HistoryStore{ Clock: clockClock, SQLBuilder: sqlBuilderApp, @@ -170815,7 +165357,7 @@ func newSAMLLogoutHandler(p *deps.RequestProvider) http.Handler { Store: passwordStore, Config: authenticatorPasswordConfig, Clock: clockClock, - Logger: passwordLogger, + Logger: logger, PasswordHistory: historyStore, PasswordChecker: passwordChecker, Expiry: expiry, @@ -170851,6 +165393,7 @@ func newSAMLLogoutHandler(p *deps.RequestProvider) http.Handler { } testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode + remoteIP := deps.ProvideRemoteIP(request, trustProxy) codeStoreRedis := &otp.CodeStoreRedis{ Redis: appredisHandle, AppID: appID, @@ -170867,6 +165410,15 @@ func newSAMLLogoutHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -170941,13 +165493,6 @@ func newSAMLLogoutHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -170964,7 +165509,6 @@ func newSAMLLogoutHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } idTokenIssuer := &oidc.IDTokenIssuer{ @@ -170976,7 +165520,7 @@ func newSAMLLogoutHandler(p *deps.RequestProvider) http.Handler { } userAgentString := deps.ProvideUserAgentString(request) storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -171007,7 +165551,7 @@ func newSAMLLogoutHandler(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -171054,7 +165598,7 @@ func newSAMLLogoutHandler(p *deps.RequestProvider) http.Handler { cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -171415,36 +165959,9 @@ func newWebAppAuthflowV2SettingsProfile(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -171552,6 +166069,15 @@ func newWebAppAuthflowV2SettingsProfile(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -171626,13 +166152,6 @@ func newWebAppAuthflowV2SettingsProfile(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -171649,7 +166168,6 @@ func newWebAppAuthflowV2SettingsProfile(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -171869,8 +166387,8 @@ func newWebAppAuthflowV2SettingsProfile(p *deps.RequestProvider) http.Handler { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -171919,7 +166437,6 @@ func newWebAppAuthflowV2SettingsProfile(p *deps.RequestProvider) http.Handler { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -171935,7 +166452,7 @@ func newWebAppAuthflowV2SettingsProfile(p *deps.RequestProvider) http.Handler { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -171944,7 +166461,7 @@ func newWebAppAuthflowV2SettingsProfile(p *deps.RequestProvider) http.Handler { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -171973,7 +166490,7 @@ func newWebAppAuthflowV2SettingsProfile(p *deps.RequestProvider) http.Handler { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -172454,36 +166971,9 @@ func newWebAppAuthflowV2SettingsIdentityAddEmailHandler(p *deps.RequestProvider) SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -172591,6 +167081,15 @@ func newWebAppAuthflowV2SettingsIdentityAddEmailHandler(p *deps.RequestProvider) Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -172665,13 +167164,6 @@ func newWebAppAuthflowV2SettingsIdentityAddEmailHandler(p *deps.RequestProvider) UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -172688,7 +167180,6 @@ func newWebAppAuthflowV2SettingsIdentityAddEmailHandler(p *deps.RequestProvider) Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -172908,8 +167399,8 @@ func newWebAppAuthflowV2SettingsIdentityAddEmailHandler(p *deps.RequestProvider) AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -172958,7 +167449,6 @@ func newWebAppAuthflowV2SettingsIdentityAddEmailHandler(p *deps.RequestProvider) UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -172974,7 +167464,7 @@ func newWebAppAuthflowV2SettingsIdentityAddEmailHandler(p *deps.RequestProvider) SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -172983,7 +167473,7 @@ func newWebAppAuthflowV2SettingsIdentityAddEmailHandler(p *deps.RequestProvider) sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -173012,7 +167502,7 @@ func newWebAppAuthflowV2SettingsIdentityAddEmailHandler(p *deps.RequestProvider) UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -173508,36 +167998,9 @@ func newWebAppAuthflowV2SettingsIdentityEditEmailHandler(p *deps.RequestProvider SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -173645,6 +168108,15 @@ func newWebAppAuthflowV2SettingsIdentityEditEmailHandler(p *deps.RequestProvider Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -173719,13 +168191,6 @@ func newWebAppAuthflowV2SettingsIdentityEditEmailHandler(p *deps.RequestProvider UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -173742,7 +168207,6 @@ func newWebAppAuthflowV2SettingsIdentityEditEmailHandler(p *deps.RequestProvider Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -173962,8 +168426,8 @@ func newWebAppAuthflowV2SettingsIdentityEditEmailHandler(p *deps.RequestProvider AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -174012,7 +168476,6 @@ func newWebAppAuthflowV2SettingsIdentityEditEmailHandler(p *deps.RequestProvider UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -174028,7 +168491,7 @@ func newWebAppAuthflowV2SettingsIdentityEditEmailHandler(p *deps.RequestProvider SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -174037,7 +168500,7 @@ func newWebAppAuthflowV2SettingsIdentityEditEmailHandler(p *deps.RequestProvider sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -174066,7 +168529,7 @@ func newWebAppAuthflowV2SettingsIdentityEditEmailHandler(p *deps.RequestProvider UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -174502,38 +168965,9 @@ func newWebAppAuthflowV2SettingsIdentityListEmailHandler(p *deps.RequestProvider SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - factory := appProvider.LoggerFactory - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -174560,6 +168994,7 @@ func newWebAppAuthflowV2SettingsIdentityListEmailHandler(p *deps.RequestProvider SIWE: siweProvider, LDAP: ldapProvider, } + factory := appProvider.LoggerFactory serviceLogger := webapp2.NewServiceLogger(factory) sessionStoreRedis := &webapp2.SessionStoreRedis{ AppID: appID, @@ -174597,7 +169032,8 @@ func newWebAppAuthflowV2SettingsIdentityListEmailHandler(p *deps.RequestProvider OAuthConfig: oAuthConfig, TesterEndpoints: endpointsEndpoints, } - interactionLogger := interaction.NewLogger(factory) + logger := interaction.NewLogger(factory) + remoteIP := deps.ProvideRemoteIP(request, trustProxy) redisLogger := redis.NewLogger(factory) redisStore := &redis.Store{ Redis: appredisHandle, @@ -174701,6 +169137,15 @@ func newWebAppAuthflowV2SettingsIdentityListEmailHandler(p *deps.RequestProvider Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -174775,13 +169220,6 @@ func newWebAppAuthflowV2SettingsIdentityListEmailHandler(p *deps.RequestProvider UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -174798,7 +169236,6 @@ func newWebAppAuthflowV2SettingsIdentityListEmailHandler(p *deps.RequestProvider Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -175018,8 +169455,8 @@ func newWebAppAuthflowV2SettingsIdentityListEmailHandler(p *deps.RequestProvider AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -175068,7 +169505,6 @@ func newWebAppAuthflowV2SettingsIdentityListEmailHandler(p *deps.RequestProvider UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -175084,7 +169520,7 @@ func newWebAppAuthflowV2SettingsIdentityListEmailHandler(p *deps.RequestProvider SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -175093,7 +169529,7 @@ func newWebAppAuthflowV2SettingsIdentityListEmailHandler(p *deps.RequestProvider sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -175122,7 +169558,7 @@ func newWebAppAuthflowV2SettingsIdentityListEmailHandler(p *deps.RequestProvider UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -175304,7 +169740,7 @@ func newWebAppAuthflowV2SettingsIdentityListEmailHandler(p *deps.RequestProvider AppID: appID, } interactionService := &interaction.Service{ - Logger: interactionLogger, + Logger: logger, Context: interactionContext, Store: interactionStoreRedis, } @@ -175606,36 +170042,9 @@ func newWebAppAuthflowV2SettingsIdentityVerifyEmailHandler(p *deps.RequestProvid SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -175743,6 +170152,15 @@ func newWebAppAuthflowV2SettingsIdentityVerifyEmailHandler(p *deps.RequestProvid Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -175817,13 +170235,6 @@ func newWebAppAuthflowV2SettingsIdentityVerifyEmailHandler(p *deps.RequestProvid UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -175840,7 +170251,6 @@ func newWebAppAuthflowV2SettingsIdentityVerifyEmailHandler(p *deps.RequestProvid Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -176060,8 +170470,8 @@ func newWebAppAuthflowV2SettingsIdentityVerifyEmailHandler(p *deps.RequestProvid AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -176110,7 +170520,6 @@ func newWebAppAuthflowV2SettingsIdentityVerifyEmailHandler(p *deps.RequestProvid UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -176126,7 +170535,7 @@ func newWebAppAuthflowV2SettingsIdentityVerifyEmailHandler(p *deps.RequestProvid SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -176135,7 +170544,7 @@ func newWebAppAuthflowV2SettingsIdentityVerifyEmailHandler(p *deps.RequestProvid sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -176164,7 +170573,7 @@ func newWebAppAuthflowV2SettingsIdentityVerifyEmailHandler(p *deps.RequestProvid UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -176603,38 +171012,9 @@ func newWebAppAuthflowV2SettingsIdentityViewEmailHandler(p *deps.RequestProvider SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - factory := appProvider.LoggerFactory - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -176661,6 +171041,7 @@ func newWebAppAuthflowV2SettingsIdentityViewEmailHandler(p *deps.RequestProvider SIWE: siweProvider, LDAP: ldapProvider, } + factory := appProvider.LoggerFactory serviceLogger := webapp2.NewServiceLogger(factory) sessionStoreRedis := &webapp2.SessionStoreRedis{ AppID: appID, @@ -176698,7 +171079,8 @@ func newWebAppAuthflowV2SettingsIdentityViewEmailHandler(p *deps.RequestProvider OAuthConfig: oAuthConfig, TesterEndpoints: endpointsEndpoints, } - interactionLogger := interaction.NewLogger(factory) + logger := interaction.NewLogger(factory) + remoteIP := deps.ProvideRemoteIP(request, trustProxy) redisLogger := redis.NewLogger(factory) redisStore := &redis.Store{ Redis: appredisHandle, @@ -176802,6 +171184,15 @@ func newWebAppAuthflowV2SettingsIdentityViewEmailHandler(p *deps.RequestProvider Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -176876,13 +171267,6 @@ func newWebAppAuthflowV2SettingsIdentityViewEmailHandler(p *deps.RequestProvider UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -176899,7 +171283,6 @@ func newWebAppAuthflowV2SettingsIdentityViewEmailHandler(p *deps.RequestProvider Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -177119,8 +171502,8 @@ func newWebAppAuthflowV2SettingsIdentityViewEmailHandler(p *deps.RequestProvider AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -177169,7 +171552,6 @@ func newWebAppAuthflowV2SettingsIdentityViewEmailHandler(p *deps.RequestProvider UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -177185,7 +171567,7 @@ func newWebAppAuthflowV2SettingsIdentityViewEmailHandler(p *deps.RequestProvider SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -177194,7 +171576,7 @@ func newWebAppAuthflowV2SettingsIdentityViewEmailHandler(p *deps.RequestProvider sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -177223,7 +171605,7 @@ func newWebAppAuthflowV2SettingsIdentityViewEmailHandler(p *deps.RequestProvider UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -177405,7 +171787,7 @@ func newWebAppAuthflowV2SettingsIdentityViewEmailHandler(p *deps.RequestProvider AppID: appID, } interactionService := &interaction.Service{ - Logger: interactionLogger, + Logger: logger, Context: interactionContext, Store: interactionStoreRedis, } @@ -177729,36 +172111,9 @@ func newWebAppAuthflowV2SettingsIdentityChangePrimaryEmailHandler(p *deps.Reques SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -177866,6 +172221,15 @@ func newWebAppAuthflowV2SettingsIdentityChangePrimaryEmailHandler(p *deps.Reques Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -177940,13 +172304,6 @@ func newWebAppAuthflowV2SettingsIdentityChangePrimaryEmailHandler(p *deps.Reques UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -177963,7 +172320,6 @@ func newWebAppAuthflowV2SettingsIdentityChangePrimaryEmailHandler(p *deps.Reques Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -178183,8 +172539,8 @@ func newWebAppAuthflowV2SettingsIdentityChangePrimaryEmailHandler(p *deps.Reques AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -178233,7 +172589,6 @@ func newWebAppAuthflowV2SettingsIdentityChangePrimaryEmailHandler(p *deps.Reques UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -178249,7 +172604,7 @@ func newWebAppAuthflowV2SettingsIdentityChangePrimaryEmailHandler(p *deps.Reques SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -178258,7 +172613,7 @@ func newWebAppAuthflowV2SettingsIdentityChangePrimaryEmailHandler(p *deps.Reques sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -178287,7 +172642,7 @@ func newWebAppAuthflowV2SettingsIdentityChangePrimaryEmailHandler(p *deps.Reques UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -178775,36 +173130,9 @@ func newWebAppAuthflowV2SettingsIdentityAddPhoneHandler(p *deps.RequestProvider) SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -178912,6 +173240,15 @@ func newWebAppAuthflowV2SettingsIdentityAddPhoneHandler(p *deps.RequestProvider) Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -178986,13 +173323,6 @@ func newWebAppAuthflowV2SettingsIdentityAddPhoneHandler(p *deps.RequestProvider) UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -179009,7 +173339,6 @@ func newWebAppAuthflowV2SettingsIdentityAddPhoneHandler(p *deps.RequestProvider) Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -179229,8 +173558,8 @@ func newWebAppAuthflowV2SettingsIdentityAddPhoneHandler(p *deps.RequestProvider) AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -179279,7 +173608,6 @@ func newWebAppAuthflowV2SettingsIdentityAddPhoneHandler(p *deps.RequestProvider) UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -179295,7 +173623,7 @@ func newWebAppAuthflowV2SettingsIdentityAddPhoneHandler(p *deps.RequestProvider) SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -179304,7 +173632,7 @@ func newWebAppAuthflowV2SettingsIdentityAddPhoneHandler(p *deps.RequestProvider) sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -179333,7 +173661,7 @@ func newWebAppAuthflowV2SettingsIdentityAddPhoneHandler(p *deps.RequestProvider) UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -179830,36 +174158,9 @@ func newWebAppAuthflowV2SettingsIdentityEditPhoneHandler(p *deps.RequestProvider SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -179967,6 +174268,15 @@ func newWebAppAuthflowV2SettingsIdentityEditPhoneHandler(p *deps.RequestProvider Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -180041,13 +174351,6 @@ func newWebAppAuthflowV2SettingsIdentityEditPhoneHandler(p *deps.RequestProvider UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -180064,7 +174367,6 @@ func newWebAppAuthflowV2SettingsIdentityEditPhoneHandler(p *deps.RequestProvider Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -180284,8 +174586,8 @@ func newWebAppAuthflowV2SettingsIdentityEditPhoneHandler(p *deps.RequestProvider AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -180334,7 +174636,6 @@ func newWebAppAuthflowV2SettingsIdentityEditPhoneHandler(p *deps.RequestProvider UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -180350,7 +174651,7 @@ func newWebAppAuthflowV2SettingsIdentityEditPhoneHandler(p *deps.RequestProvider SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -180359,7 +174660,7 @@ func newWebAppAuthflowV2SettingsIdentityEditPhoneHandler(p *deps.RequestProvider sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -180388,7 +174689,7 @@ func newWebAppAuthflowV2SettingsIdentityEditPhoneHandler(p *deps.RequestProvider UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -180825,38 +175126,9 @@ func newWebAppAuthflowV2SettingsIdentityListPhoneHandler(p *deps.RequestProvider SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - factory := appProvider.LoggerFactory - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -180883,6 +175155,7 @@ func newWebAppAuthflowV2SettingsIdentityListPhoneHandler(p *deps.RequestProvider SIWE: siweProvider, LDAP: ldapProvider, } + factory := appProvider.LoggerFactory serviceLogger := webapp2.NewServiceLogger(factory) sessionStoreRedis := &webapp2.SessionStoreRedis{ AppID: appID, @@ -180920,7 +175193,8 @@ func newWebAppAuthflowV2SettingsIdentityListPhoneHandler(p *deps.RequestProvider OAuthConfig: oAuthConfig, TesterEndpoints: endpointsEndpoints, } - interactionLogger := interaction.NewLogger(factory) + logger := interaction.NewLogger(factory) + remoteIP := deps.ProvideRemoteIP(request, trustProxy) redisLogger := redis.NewLogger(factory) redisStore := &redis.Store{ Redis: appredisHandle, @@ -181024,6 +175298,15 @@ func newWebAppAuthflowV2SettingsIdentityListPhoneHandler(p *deps.RequestProvider Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -181098,13 +175381,6 @@ func newWebAppAuthflowV2SettingsIdentityListPhoneHandler(p *deps.RequestProvider UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -181121,7 +175397,6 @@ func newWebAppAuthflowV2SettingsIdentityListPhoneHandler(p *deps.RequestProvider Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -181341,8 +175616,8 @@ func newWebAppAuthflowV2SettingsIdentityListPhoneHandler(p *deps.RequestProvider AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -181391,7 +175666,6 @@ func newWebAppAuthflowV2SettingsIdentityListPhoneHandler(p *deps.RequestProvider UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -181407,7 +175681,7 @@ func newWebAppAuthflowV2SettingsIdentityListPhoneHandler(p *deps.RequestProvider SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -181416,7 +175690,7 @@ func newWebAppAuthflowV2SettingsIdentityListPhoneHandler(p *deps.RequestProvider sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -181445,7 +175719,7 @@ func newWebAppAuthflowV2SettingsIdentityListPhoneHandler(p *deps.RequestProvider UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -181627,7 +175901,7 @@ func newWebAppAuthflowV2SettingsIdentityListPhoneHandler(p *deps.RequestProvider AppID: appID, } interactionService := &interaction.Service{ - Logger: interactionLogger, + Logger: logger, Context: interactionContext, Store: interactionStoreRedis, } @@ -181867,38 +176141,9 @@ func newWebAppAuthflowV2SettingsIdentityViewPhoneHandler(p *deps.RequestProvider SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - factory := appProvider.LoggerFactory - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -181925,6 +176170,7 @@ func newWebAppAuthflowV2SettingsIdentityViewPhoneHandler(p *deps.RequestProvider SIWE: siweProvider, LDAP: ldapProvider, } + factory := appProvider.LoggerFactory serviceLogger := webapp2.NewServiceLogger(factory) sessionStoreRedis := &webapp2.SessionStoreRedis{ AppID: appID, @@ -181962,7 +176208,8 @@ func newWebAppAuthflowV2SettingsIdentityViewPhoneHandler(p *deps.RequestProvider OAuthConfig: oAuthConfig, TesterEndpoints: endpointsEndpoints, } - interactionLogger := interaction.NewLogger(factory) + logger := interaction.NewLogger(factory) + remoteIP := deps.ProvideRemoteIP(request, trustProxy) redisLogger := redis.NewLogger(factory) redisStore := &redis.Store{ Redis: appredisHandle, @@ -182066,6 +176313,15 @@ func newWebAppAuthflowV2SettingsIdentityViewPhoneHandler(p *deps.RequestProvider Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -182140,13 +176396,6 @@ func newWebAppAuthflowV2SettingsIdentityViewPhoneHandler(p *deps.RequestProvider UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -182163,7 +176412,6 @@ func newWebAppAuthflowV2SettingsIdentityViewPhoneHandler(p *deps.RequestProvider Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -182383,8 +176631,8 @@ func newWebAppAuthflowV2SettingsIdentityViewPhoneHandler(p *deps.RequestProvider AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -182433,7 +176681,6 @@ func newWebAppAuthflowV2SettingsIdentityViewPhoneHandler(p *deps.RequestProvider UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -182449,7 +176696,7 @@ func newWebAppAuthflowV2SettingsIdentityViewPhoneHandler(p *deps.RequestProvider SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -182458,7 +176705,7 @@ func newWebAppAuthflowV2SettingsIdentityViewPhoneHandler(p *deps.RequestProvider sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -182487,7 +176734,7 @@ func newWebAppAuthflowV2SettingsIdentityViewPhoneHandler(p *deps.RequestProvider UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -182669,7 +176916,7 @@ func newWebAppAuthflowV2SettingsIdentityViewPhoneHandler(p *deps.RequestProvider AppID: appID, } interactionService := &interaction.Service{ - Logger: interactionLogger, + Logger: logger, Context: interactionContext, Store: interactionStoreRedis, } @@ -182988,36 +177235,9 @@ func newWebAppAuthflowV2SettingsIdentityChangePrimaryPhoneHandler(p *deps.Reques SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -183125,6 +177345,15 @@ func newWebAppAuthflowV2SettingsIdentityChangePrimaryPhoneHandler(p *deps.Reques Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -183199,13 +177428,6 @@ func newWebAppAuthflowV2SettingsIdentityChangePrimaryPhoneHandler(p *deps.Reques UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -183222,7 +177444,6 @@ func newWebAppAuthflowV2SettingsIdentityChangePrimaryPhoneHandler(p *deps.Reques Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -183442,8 +177663,8 @@ func newWebAppAuthflowV2SettingsIdentityChangePrimaryPhoneHandler(p *deps.Reques AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -183492,7 +177713,6 @@ func newWebAppAuthflowV2SettingsIdentityChangePrimaryPhoneHandler(p *deps.Reques UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -183508,7 +177728,7 @@ func newWebAppAuthflowV2SettingsIdentityChangePrimaryPhoneHandler(p *deps.Reques SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -183517,7 +177737,7 @@ func newWebAppAuthflowV2SettingsIdentityChangePrimaryPhoneHandler(p *deps.Reques sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -183546,7 +177766,7 @@ func newWebAppAuthflowV2SettingsIdentityChangePrimaryPhoneHandler(p *deps.Reques UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -184034,36 +178254,9 @@ func newWebAppAuthflowV2SettingsIdentityVerifyPhoneHandler(p *deps.RequestProvid SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -184171,6 +178364,15 @@ func newWebAppAuthflowV2SettingsIdentityVerifyPhoneHandler(p *deps.RequestProvid Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -184245,13 +178447,6 @@ func newWebAppAuthflowV2SettingsIdentityVerifyPhoneHandler(p *deps.RequestProvid UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -184268,7 +178463,6 @@ func newWebAppAuthflowV2SettingsIdentityVerifyPhoneHandler(p *deps.RequestProvid Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -184488,8 +178682,8 @@ func newWebAppAuthflowV2SettingsIdentityVerifyPhoneHandler(p *deps.RequestProvid AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -184538,7 +178732,6 @@ func newWebAppAuthflowV2SettingsIdentityVerifyPhoneHandler(p *deps.RequestProvid UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -184554,7 +178747,7 @@ func newWebAppAuthflowV2SettingsIdentityVerifyPhoneHandler(p *deps.RequestProvid SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -184563,7 +178756,7 @@ func newWebAppAuthflowV2SettingsIdentityVerifyPhoneHandler(p *deps.RequestProvid sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -184592,7 +178785,7 @@ func newWebAppAuthflowV2SettingsIdentityVerifyPhoneHandler(p *deps.RequestProvid UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -185031,38 +179224,9 @@ func newWebAppAuthflowV2SettingsIdentityListUsernameHandler(p *deps.RequestProvi SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - factory := appProvider.LoggerFactory - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -185089,6 +179253,7 @@ func newWebAppAuthflowV2SettingsIdentityListUsernameHandler(p *deps.RequestProvi SIWE: siweProvider, LDAP: ldapProvider, } + factory := appProvider.LoggerFactory serviceLogger := webapp2.NewServiceLogger(factory) sessionStoreRedis := &webapp2.SessionStoreRedis{ AppID: appID, @@ -185126,7 +179291,8 @@ func newWebAppAuthflowV2SettingsIdentityListUsernameHandler(p *deps.RequestProvi OAuthConfig: oAuthConfig, TesterEndpoints: endpointsEndpoints, } - interactionLogger := interaction.NewLogger(factory) + logger := interaction.NewLogger(factory) + remoteIP := deps.ProvideRemoteIP(request, trustProxy) redisLogger := redis.NewLogger(factory) redisStore := &redis.Store{ Redis: appredisHandle, @@ -185230,6 +179396,15 @@ func newWebAppAuthflowV2SettingsIdentityListUsernameHandler(p *deps.RequestProvi Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -185304,13 +179479,6 @@ func newWebAppAuthflowV2SettingsIdentityListUsernameHandler(p *deps.RequestProvi UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -185327,7 +179495,6 @@ func newWebAppAuthflowV2SettingsIdentityListUsernameHandler(p *deps.RequestProvi Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -185547,8 +179714,8 @@ func newWebAppAuthflowV2SettingsIdentityListUsernameHandler(p *deps.RequestProvi AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -185597,7 +179764,6 @@ func newWebAppAuthflowV2SettingsIdentityListUsernameHandler(p *deps.RequestProvi UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -185613,7 +179779,7 @@ func newWebAppAuthflowV2SettingsIdentityListUsernameHandler(p *deps.RequestProvi SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -185622,7 +179788,7 @@ func newWebAppAuthflowV2SettingsIdentityListUsernameHandler(p *deps.RequestProvi sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -185651,7 +179817,7 @@ func newWebAppAuthflowV2SettingsIdentityListUsernameHandler(p *deps.RequestProvi UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -185833,7 +179999,7 @@ func newWebAppAuthflowV2SettingsIdentityListUsernameHandler(p *deps.RequestProvi AppID: appID, } interactionService := &interaction.Service{ - Logger: interactionLogger, + Logger: logger, Context: interactionContext, Store: interactionStoreRedis, } @@ -186080,36 +180246,9 @@ func newWebAppAuthflowV2SettingsIdentityNewUsernameHandler(p *deps.RequestProvid SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -186217,6 +180356,15 @@ func newWebAppAuthflowV2SettingsIdentityNewUsernameHandler(p *deps.RequestProvid Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -186291,13 +180439,6 @@ func newWebAppAuthflowV2SettingsIdentityNewUsernameHandler(p *deps.RequestProvid UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -186314,7 +180455,6 @@ func newWebAppAuthflowV2SettingsIdentityNewUsernameHandler(p *deps.RequestProvid Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -186437,7 +180577,6 @@ func newWebAppAuthflowV2SettingsIdentityNewUsernameHandler(p *deps.RequestProvid UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -186568,8 +180707,8 @@ func newWebAppAuthflowV2SettingsIdentityNewUsernameHandler(p *deps.RequestProvid AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -186619,7 +180758,7 @@ func newWebAppAuthflowV2SettingsIdentityNewUsernameHandler(p *deps.RequestProvid SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -186630,7 +180769,7 @@ func newWebAppAuthflowV2SettingsIdentityNewUsernameHandler(p *deps.RequestProvid cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -186669,7 +180808,7 @@ func newWebAppAuthflowV2SettingsIdentityNewUsernameHandler(p *deps.RequestProvid UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -187135,36 +181274,9 @@ func newWebAppAuthflowV2SettingsIdentityViewUsernameHandler(p *deps.RequestProvi SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -187272,6 +181384,15 @@ func newWebAppAuthflowV2SettingsIdentityViewUsernameHandler(p *deps.RequestProvi Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -187346,13 +181467,6 @@ func newWebAppAuthflowV2SettingsIdentityViewUsernameHandler(p *deps.RequestProvi UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -187369,7 +181483,6 @@ func newWebAppAuthflowV2SettingsIdentityViewUsernameHandler(p *deps.RequestProvi Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -187492,7 +181605,6 @@ func newWebAppAuthflowV2SettingsIdentityViewUsernameHandler(p *deps.RequestProvi UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -187623,8 +181735,8 @@ func newWebAppAuthflowV2SettingsIdentityViewUsernameHandler(p *deps.RequestProvi AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -187674,7 +181786,7 @@ func newWebAppAuthflowV2SettingsIdentityViewUsernameHandler(p *deps.RequestProvi SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -187685,7 +181797,7 @@ func newWebAppAuthflowV2SettingsIdentityViewUsernameHandler(p *deps.RequestProvi cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -187724,7 +181836,7 @@ func newWebAppAuthflowV2SettingsIdentityViewUsernameHandler(p *deps.RequestProvi UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -188192,36 +182304,9 @@ func newWebAppAuthflowV2SettingsIdentityEditUsernameHandler(p *deps.RequestProvi SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -188329,6 +182414,15 @@ func newWebAppAuthflowV2SettingsIdentityEditUsernameHandler(p *deps.RequestProvi Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -188403,13 +182497,6 @@ func newWebAppAuthflowV2SettingsIdentityEditUsernameHandler(p *deps.RequestProvi UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -188426,7 +182513,6 @@ func newWebAppAuthflowV2SettingsIdentityEditUsernameHandler(p *deps.RequestProvi Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -188549,7 +182635,6 @@ func newWebAppAuthflowV2SettingsIdentityEditUsernameHandler(p *deps.RequestProvi UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userProvider := &user.Provider{ @@ -188680,8 +182765,8 @@ func newWebAppAuthflowV2SettingsIdentityEditUsernameHandler(p *deps.RequestProvi AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -188731,7 +182816,7 @@ func newWebAppAuthflowV2SettingsIdentityEditUsernameHandler(p *deps.RequestProvi SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -188742,7 +182827,7 @@ func newWebAppAuthflowV2SettingsIdentityEditUsernameHandler(p *deps.RequestProvi cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -188781,7 +182866,7 @@ func newWebAppAuthflowV2SettingsIdentityEditUsernameHandler(p *deps.RequestProvi UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -189291,36 +183376,9 @@ func newWebAppAuthflowV2SettingsIdentityListOAuthHandler(p *deps.RequestProvider SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -189428,6 +183486,15 @@ func newWebAppAuthflowV2SettingsIdentityListOAuthHandler(p *deps.RequestProvider Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -189502,13 +183569,6 @@ func newWebAppAuthflowV2SettingsIdentityListOAuthHandler(p *deps.RequestProvider UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -189525,7 +183585,6 @@ func newWebAppAuthflowV2SettingsIdentityListOAuthHandler(p *deps.RequestProvider Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -189745,8 +183804,8 @@ func newWebAppAuthflowV2SettingsIdentityListOAuthHandler(p *deps.RequestProvider AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -189795,7 +183854,6 @@ func newWebAppAuthflowV2SettingsIdentityListOAuthHandler(p *deps.RequestProvider UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -189811,7 +183869,7 @@ func newWebAppAuthflowV2SettingsIdentityListOAuthHandler(p *deps.RequestProvider SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -189820,7 +183878,7 @@ func newWebAppAuthflowV2SettingsIdentityListOAuthHandler(p *deps.RequestProvider sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -189849,7 +183907,7 @@ func newWebAppAuthflowV2SettingsIdentityListOAuthHandler(p *deps.RequestProvider UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -190958,36 +185016,9 @@ func newSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - siweStoreRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: siweStoreRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -191095,6 +185126,15 @@ func newSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -191169,13 +185209,6 @@ func newSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -191192,7 +185225,6 @@ func newSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } idTokenIssuer := &oidc.IDTokenIssuer{ @@ -191422,8 +185454,8 @@ func newSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -191472,7 +185504,6 @@ func newSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -191780,36 +185811,9 @@ func newWebAppSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -191917,6 +185921,15 @@ func newWebAppSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -191991,13 +186004,6 @@ func newWebAppSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -192014,7 +186020,6 @@ func newWebAppSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -192234,8 +186239,8 @@ func newWebAppSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: whatsappServiceLogger, WhatsappConfig: whatsappConfig, @@ -192284,7 +186289,6 @@ func newWebAppSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -192300,7 +186304,7 @@ func newWebAppSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: handle, AppID: appID, Clock: clockClock, @@ -192309,7 +186313,7 @@ func newWebAppSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { sessionConfig := appConfig.Session cookieDef2 := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef2, @@ -192338,7 +186342,7 @@ func newWebAppSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { UserAgentString: userAgentString, AppID: appID, Redis: handle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -192768,38 +186772,9 @@ func newWebAppUIParamMiddleware(p *deps.RequestProvider) httproute.Middleware { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - factory := appProvider.LoggerFactory - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -192836,7 +186811,8 @@ func newWebAppUIParamMiddleware(p *deps.RequestProvider) httproute.Middleware { } authenticatorConfig := appConfig.Authenticator authenticatorPasswordConfig := authenticatorConfig.Password - passwordLogger := password.NewLogger(factory) + factory := appProvider.LoggerFactory + logger := password.NewLogger(factory) historyStore := &password.HistoryStore{ Clock: clockClock, SQLBuilder: sqlBuilderApp, @@ -192855,7 +186831,7 @@ func newWebAppUIParamMiddleware(p *deps.RequestProvider) httproute.Middleware { Store: passwordStore, Config: authenticatorPasswordConfig, Clock: clockClock, - Logger: passwordLogger, + Logger: logger, PasswordHistory: historyStore, PasswordChecker: passwordChecker, Expiry: expiry, @@ -192891,6 +186867,7 @@ func newWebAppUIParamMiddleware(p *deps.RequestProvider) httproute.Middleware { } testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode + remoteIP := deps.ProvideRemoteIP(request, trustProxy) codeStoreRedis := &otp.CodeStoreRedis{ Redis: appredisHandle, AppID: appID, @@ -192907,6 +186884,15 @@ func newWebAppUIParamMiddleware(p *deps.RequestProvider) httproute.Middleware { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -192981,13 +186967,6 @@ func newWebAppUIParamMiddleware(p *deps.RequestProvider) httproute.Middleware { UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -193004,7 +186983,6 @@ func newWebAppUIParamMiddleware(p *deps.RequestProvider) httproute.Middleware { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } idTokenIssuer := &oidc.IDTokenIssuer{ @@ -193016,7 +186994,7 @@ func newWebAppUIParamMiddleware(p *deps.RequestProvider) httproute.Middleware { } userAgentString := deps.ProvideUserAgentString(request) storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -193047,7 +187025,7 @@ func newWebAppUIParamMiddleware(p *deps.RequestProvider) httproute.Middleware { UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -193316,36 +187294,9 @@ func newSettingsSubRoutesMiddleware(p *deps.RequestProvider) httproute.Middlewar SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -193453,6 +187404,15 @@ func newSettingsSubRoutesMiddleware(p *deps.RequestProvider) httproute.Middlewar Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -193527,13 +187487,6 @@ func newSettingsSubRoutesMiddleware(p *deps.RequestProvider) httproute.Middlewar UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -193550,7 +187503,6 @@ func newSettingsSubRoutesMiddleware(p *deps.RequestProvider) httproute.Middlewar Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -193770,8 +187722,8 @@ func newSettingsSubRoutesMiddleware(p *deps.RequestProvider) httproute.Middlewar AppID: appID, Clock: clockClock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -193820,7 +187772,6 @@ func newSettingsSubRoutesMiddleware(p *deps.RequestProvider) httproute.Middlewar UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -193836,7 +187787,7 @@ func newSettingsSubRoutesMiddleware(p *deps.RequestProvider) httproute.Middlewar SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clockClock, @@ -193847,7 +187798,7 @@ func newSettingsSubRoutesMiddleware(p *deps.RequestProvider) httproute.Middlewar cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -193886,7 +187837,7 @@ func newSettingsSubRoutesMiddleware(p *deps.RequestProvider) httproute.Middlewar UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, diff --git a/pkg/auth/wire_handler.go b/pkg/auth/wire_handler.go index 2edd825bf0..c9fb309109 100644 --- a/pkg/auth/wire_handler.go +++ b/pkg/auth/wire_handler.go @@ -12,7 +12,6 @@ import ( handlerapi "github.com/authgear/authgear-server/pkg/auth/handler/api" handleroauth "github.com/authgear/authgear-server/pkg/auth/handler/oauth" handlersaml "github.com/authgear/authgear-server/pkg/auth/handler/saml" - handlersiwe "github.com/authgear/authgear-server/pkg/auth/handler/siwe" handlerwebapp "github.com/authgear/authgear-server/pkg/auth/handler/webapp" handlerwebappauthflowv2 "github.com/authgear/authgear-server/pkg/auth/handler/webapp/authflowv2" "github.com/authgear/authgear-server/pkg/lib/deps" @@ -114,13 +113,6 @@ func newOAuthProxyRedirectHandler(p *deps.RequestProvider) http.Handler { )) } -func newSIWENonceHandler(p *deps.RequestProvider) http.Handler { - panic(wire.Build( - DependencySet, - wire.Bind(new(http.Handler), new(*handlersiwe.NonceHandler)), - )) -} - func newAPIAnonymousUserSignupHandler(p *deps.RequestProvider) http.Handler { panic(wire.Build( DependencySet, @@ -758,13 +750,6 @@ func newWebAppConnectWeb3AccountHandler(p *deps.RequestProvider) http.Handler { )) } -func newWebAppMissingWeb3WalletHandler(p *deps.RequestProvider) http.Handler { - panic(wire.Build( - DependencySet, - wire.Bind(new(http.Handler), new(*handlerwebapp.MissingWeb3WalletHandler)), - )) -} - func newWebAppFeatureDisabledHandler(p *deps.RequestProvider) http.Handler { panic(wire.Build( DependencySet, diff --git a/pkg/lib/authn/identity/siwe/provider.go b/pkg/lib/authn/identity/siwe/provider.go index f4de3c148c..84b9403c79 100644 --- a/pkg/lib/authn/identity/siwe/provider.go +++ b/pkg/lib/authn/identity/siwe/provider.go @@ -2,24 +2,16 @@ package siwe import ( "context" - "crypto/ecdsa" + "fmt" "sort" - "github.com/authgear/authgear-server/pkg/api/model" "github.com/authgear/authgear-server/pkg/lib/authn/identity" "github.com/authgear/authgear-server/pkg/util/clock" - "github.com/authgear/authgear-server/pkg/util/uuid" ) -// nolint: golint -type SIWEService interface { - VerifyMessage(ctx context.Context, msg string, signature string) (*model.SIWEWallet, *ecdsa.PublicKey, error) -} - type Provider struct { Store *Store Clock clock.Clock - SIWE SIWEService } func (p *Provider) List(ctx context.Context, userID string) ([]*identity.SIWE, error) { @@ -37,12 +29,7 @@ func (p *Provider) Get(ctx context.Context, userID, id string) (*identity.SIWE, } func (p *Provider) GetByMessage(ctx context.Context, msg string, signature string) (*identity.SIWE, error) { - wallet, _, err := p.SIWE.VerifyMessage(ctx, msg, signature) - if err != nil { - return nil, err - } - - return p.Store.GetByAddress(ctx, wallet.ChainID, wallet.Address) + panic(fmt.Errorf("siwe: SIWE is deprecated")) } func (p *Provider) GetMany(ctx context.Context, ids []string) ([]*identity.SIWE, error) { @@ -55,29 +42,7 @@ func (p *Provider) New( msg string, signature string, ) (*identity.SIWE, error) { - wallet, pubKey, err := p.SIWE.VerifyMessage(ctx, msg, signature) - if err != nil { - return nil, err - } - - encodedPublicKey, err := model.NewSIWEPublicKey(pubKey) - if err != nil { - return nil, err - } - - i := &identity.SIWE{ - ID: uuid.New(), - UserID: userID, - Address: wallet.Address, - ChainID: wallet.ChainID, - - Data: &model.SIWEVerifiedData{ - Message: msg, - Signature: signature, - EncodedPublicKey: encodedPublicKey, - }, - } - return i, nil + panic(fmt.Errorf("siwe: SIWE is deprecated")) } func (p *Provider) Create(ctx context.Context, i *identity.SIWE) error { diff --git a/pkg/lib/authn/user/commands.go b/pkg/lib/authn/user/commands.go index 9ac733738c..50b282d743 100644 --- a/pkg/lib/authn/user/commands.go +++ b/pkg/lib/authn/user/commands.go @@ -25,7 +25,6 @@ type Commands struct { UserProfileConfig *config.UserProfileConfig StandardAttributes StandardAttributesService CustomAttributes CustomAttributesService - Web3 Web3Service RolesAndGroups RolesAndGroupsService } @@ -51,11 +50,6 @@ func (c *Commands) AfterCreate( return err } - web3Info, err := c.Web3.GetWeb3Info(ctx, identities) - if err != nil { - return err - } - roles, err := c.RolesAndGroups.ListRolesByUserID(ctx, user.ID) if err != nil { return err @@ -74,7 +68,7 @@ func (c *Commands) AfterCreate( groupKeys[i] = v.Key } - userModel := newUserModel(user, identities, authenticators, isVerified, stdAttrs, customAttrs, web3Info, roleKeys, groupKeys) + userModel := newUserModel(user, identities, authenticators, isVerified, stdAttrs, customAttrs, roleKeys, groupKeys) var identityModels []model.Identity for _, i := range identities { identityModels = append(identityModels, i.ToModel()) diff --git a/pkg/lib/authn/user/model.go b/pkg/lib/authn/user/model.go index 6acbb6b762..04461d777d 100644 --- a/pkg/lib/authn/user/model.go +++ b/pkg/lib/authn/user/model.go @@ -293,7 +293,6 @@ func newUserModel( isVerified bool, derivedStandardAttributes map[string]interface{}, customAttributes map[string]interface{}, - web3Info *model.UserWeb3Info, roles []string, groups []string, ) *model.User { @@ -333,12 +332,11 @@ func newUserModel( CanReauthenticate: canReauthenticate, StandardAttributes: derivedStandardAttributes, CustomAttributes: customAttributes, - Web3: web3Info, Roles: roles, Groups: groups, MFAGracePeriodtEndAt: user.MFAGracePeriodtEndAt, - EndUserAccountID: computeEndUserAccountID(derivedStandardAttributes, identities, web3Info), + EndUserAccountID: computeEndUserAccountID(derivedStandardAttributes, identities), } } @@ -349,7 +347,7 @@ type UserForExport struct { Authenticators []*authenticator.Info } -func computeEndUserAccountID(derivedStandardAttributes map[string]interface{}, identities []*identity.Info, web3Info *model.UserWeb3Info) string { +func computeEndUserAccountID(derivedStandardAttributes map[string]interface{}, identities []*identity.Info) string { var endUserAccountID string var ldapDisplayID string @@ -368,9 +366,6 @@ func computeEndUserAccountID(derivedStandardAttributes map[string]interface{}, i endUserAccountID = s } else if ldapDisplayID != "" { endUserAccountID = ldapDisplayID - } else if web3Info != nil && len(web3Info.Accounts) > 0 { - first := web3Info.Accounts[0] - endUserAccountID = first.EndUserAccountID() } return endUserAccountID diff --git a/pkg/lib/authn/user/model_test.go b/pkg/lib/authn/user/model_test.go index e925d83016..4b6f3a26c3 100644 --- a/pkg/lib/authn/user/model_test.go +++ b/pkg/lib/authn/user/model_test.go @@ -160,32 +160,32 @@ func TestComputeUserEndUserActionID(t *testing.T) { // }).EndUserAccountID(), ShouldEqual, "user@example.com") // }) Convey("ComputeUserEndUserActionID", t, func() { - So(computeEndUserAccountID(map[string]interface{}{}, nil, nil), ShouldEqual, "") + So(computeEndUserAccountID(map[string]interface{}{}, nil), ShouldEqual, "") So(computeEndUserAccountID( map[string]interface{}{ "email": "user@example.com", }, - nil, nil), ShouldEqual, "user@example.com") + nil), ShouldEqual, "user@example.com") So(computeEndUserAccountID( map[string]interface{}{ "preferred_username": "user", }, - nil, nil), ShouldEqual, "user") + nil), ShouldEqual, "user") So(computeEndUserAccountID( map[string]interface{}{ "phone_number": "+85298765432", }, - nil, nil), ShouldEqual, "+85298765432") + nil), ShouldEqual, "+85298765432") So(computeEndUserAccountID( map[string]interface{}{ "preferred_username": "user", "phone_number": "+85298765432", }, - nil, nil), ShouldEqual, "user") + nil), ShouldEqual, "user") So(computeEndUserAccountID( map[string]interface{}{ @@ -193,7 +193,7 @@ func TestComputeUserEndUserActionID(t *testing.T) { "preferred_username": "user", "phone_number": "+85298765432", }, - nil, nil), ShouldEqual, "user@example.com") + nil), ShouldEqual, "user@example.com") So(computeEndUserAccountID( map[string]interface{}{ @@ -210,19 +210,6 @@ func TestComputeUserEndUserActionID(t *testing.T) { }, }, }, - }, - &model.UserWeb3Info{ - Accounts: []model.NFTOwnership{ - { - AccountIdentifier: model.AccountIdentifier{ - Address: "0x0", - }, - NetworkIdentifier: model.NetworkIdentifier{ - Blockchain: "ethereum", - Network: "10", - }, - }, - }, }), ShouldEqual, "user@example.com") So(computeEndUserAccountID(map[string]interface{}{}, []*identity.Info{ @@ -234,18 +221,6 @@ func TestComputeUserEndUserActionID(t *testing.T) { }, }, }, - }, &model.UserWeb3Info{ - Accounts: []model.NFTOwnership{ - { - AccountIdentifier: model.AccountIdentifier{ - Address: "0x0", - }, - NetworkIdentifier: model.NetworkIdentifier{ - Blockchain: "ethereum", - Network: "10", - }, - }, - }, }), ShouldEqual, "cn=user,dc=example,dc=org") So(computeEndUserAccountID(map[string]interface{}{}, []*identity.Info{ @@ -256,20 +231,6 @@ func TestComputeUserEndUserActionID(t *testing.T) { UserIDAttributeValue: []byte("example-user"), }, }, - }, nil), ShouldEqual, "uid=example-user") - - So(computeEndUserAccountID(map[string]interface{}{}, nil, &model.UserWeb3Info{ - Accounts: []model.NFTOwnership{ - { - AccountIdentifier: model.AccountIdentifier{ - Address: "0x0", - }, - NetworkIdentifier: model.NetworkIdentifier{ - Blockchain: "ethereum", - Network: "10", - }, - }, - }, - }), ShouldEqual, "ethereum:0x0@10") + }), ShouldEqual, "uid=example-user") }) } diff --git a/pkg/lib/authn/user/queries.go b/pkg/lib/authn/user/queries.go index b6d9fe3826..3371532ddb 100644 --- a/pkg/lib/authn/user/queries.go +++ b/pkg/lib/authn/user/queries.go @@ -44,10 +44,6 @@ type CustomAttributesService interface { ) (map[string]map[string]interface{}, error) } -type Web3Service interface { - GetWeb3Info(ctx context.Context, identities []*identity.Info) (*model.UserWeb3Info, error) -} - type RolesAndGroupsService interface { ListRolesByUserID(ctx context.Context, userID string) ([]*model.Role, error) ListGroupsByUserID(ctx context.Context, userID string) ([]*model.Group, error) @@ -63,7 +59,6 @@ type Queries struct { Verification VerificationService StandardAttributes StandardAttributesService CustomAttributes CustomAttributesService - Web3 Web3Service RolesAndGroups RolesAndGroupsService } @@ -153,10 +148,6 @@ func (p *Queries) GetMany(ctx context.Context, ids []string, role accesscontrol. isVerified := isVerifiedByUserID[rawUser.ID] stdAttrs := stdAttrsByUserID[rawUser.ID] customAttrs := customAttrsByUserID[rawUser.ID] - web3Info, web3err := p.Web3.GetWeb3Info(ctx, identities) - if web3err != nil { - return nil, web3err - } roles := rolesByUserID[rawUser.ID] roleKeys := make([]string, len(roles)) for i, v := range roles { @@ -175,7 +166,6 @@ func (p *Queries) GetMany(ctx context.Context, ids []string, role accesscontrol. isVerified, stdAttrs, customAttrs, - web3Info, roleKeys, groupKeys, ) @@ -260,10 +250,6 @@ func (p *Queries) GetPageForExport(ctx context.Context, offset uint64, limit uin isVerified := isVerifiedByUserID[rawUser.ID] stdAttrs := stdAttrsByUserID[rawUser.ID] customAttrs := customAttrsByUserID[rawUser.ID] - web3Info, web3err := p.Web3.GetWeb3Info(ctx, identities) - if web3err != nil { - return nil, web3err - } roles := rolesByUserID[rawUser.ID] roleKeys := make([]string, len(roles)) for i, v := range roles { @@ -282,7 +268,6 @@ func (p *Queries) GetPageForExport(ctx context.Context, offset uint64, limit uin isVerified, stdAttrs, customAttrs, - web3Info, roleKeys, groupKeys, ) diff --git a/pkg/lib/config/config.go b/pkg/lib/config/config.go index 47239d9061..ef78262a7a 100644 --- a/pkg/lib/config/config.go +++ b/pkg/lib/config/config.go @@ -84,7 +84,7 @@ type AppConfig struct { Verification *VerificationConfig `json:"verification,omitempty"` Deprecated_OTP *OTPLegacyConfig `json:"otp,omitempty"` - Web3 *Web3Config `json:"web3,omitempty"` + Deprecated_Web3 *Deprecated_Web3Config `json:"web3,omitempty"` GoogleTagManager *GoogleTagManagerConfig `json:"google_tag_manager,omitempty"` diff --git a/pkg/lib/config/configsource/resources.go b/pkg/lib/config/configsource/resources.go index 9668151a18..8fea3a52f8 100644 --- a/pkg/lib/config/configsource/resources.go +++ b/pkg/lib/config/configsource/resources.go @@ -361,18 +361,6 @@ func (d AuthgearYAMLDescriptor) validateBasedOnFeatureConfig(appConfig *config.A ) } - if len(appConfig.Web3.NFT.Collections) > *fc.Web3.NFT.Maximum { - validationCtx.Child( - "web3", - "nft", - ).EmitErrorMessage( - fmt.Sprintf("exceed the maximum number of nft collections, actual: %d, expected: %d", - len(appConfig.Web3.NFT.Collections), - *fc.Web3.NFT.Maximum, - ), - ) - } - for _, identity := range appConfig.Authentication.Identities { if identity == model.IdentityTypeBiometric && *fc.Identity.Biometric.Disabled { validationCtx.Child( diff --git a/pkg/lib/config/environment.go b/pkg/lib/config/environment.go index 9ea1272fb6..01ccf728ae 100644 --- a/pkg/lib/config/environment.go +++ b/pkg/lib/config/environment.go @@ -18,8 +18,6 @@ type WebAppCDNHost string type CORSAllowedOrigins string -type NFTIndexerAPIEndpoint string - type DenoEndpoint string type AppHostSuffixes []string @@ -83,7 +81,8 @@ type EnvironmentConfig struct { AllowedFrameAncestors AllowedFrameAncestors `envconfig:"ALLOWED_FRAME_ANCESTORS"` - NFTIndexerAPIEndpoint NFTIndexerAPIEndpoint `envconfig:"NFT_INDEXER_API_ENDPOINT"` + // NFT_INDEXER_API_ENDPOINT is deprecated. It is ignored. + // Deprecated_NFTIndexerAPIEndpoint NFTIndexerAPIEndpoint `envconfig:"NFT_INDEXER_API_ENDPOINT"` DenoEndpoint DenoEndpoint `envconfig:"DENO_ENDPOINT"` diff --git a/pkg/lib/config/feature.go b/pkg/lib/config/feature.go index 275a3c22e3..2d985ce22e 100644 --- a/pkg/lib/config/feature.go +++ b/pkg/lib/config/feature.go @@ -44,7 +44,7 @@ type FeatureConfig struct { RateLimits *RateLimitsFeatureConfig `json:"rate_limits,omitempty"` Messaging *MessagingFeatureConfig `json:"messaging,omitempty"` Collaborator *CollaboratorFeatureConfig `json:"collaborator,omitempty"` - Web3 *Web3FeatureConfig `json:"web3,omitempty"` + Deprecated_Web3 *Deprecated_Web3FeatureConfig `json:"web3,omitempty"` AdminAPI *AdminAPIFeatureConfig `json:"admin_api,omitempty"` TestMode *TestModeFeatureConfig `json:"test_mode,omitempty"` } diff --git a/pkg/lib/config/feature_web3.go b/pkg/lib/config/feature_web3.go index c5ab2f105e..356ed2de65 100644 --- a/pkg/lib/config/feature_web3.go +++ b/pkg/lib/config/feature_web3.go @@ -10,8 +10,8 @@ var _ = FeatureConfigSchema.Add("Web3FeatureConfig", ` } `) -type Web3FeatureConfig struct { - NFT *Web3NFTFeatureConfig `json:"nft,omitempty"` +type Deprecated_Web3FeatureConfig struct { + Deprecated_NFT *Deprecated_Web3NFTFeatureConfig `json:"nft,omitempty"` } var _ = FeatureConfigSchema.Add("Web3NFTFeatureConfig", ` @@ -24,11 +24,11 @@ var _ = FeatureConfigSchema.Add("Web3NFTFeatureConfig", ` } `) -type Web3NFTFeatureConfig struct { +type Deprecated_Web3NFTFeatureConfig struct { Maximum *int `json:"maximum,omitempty"` } -func (c *Web3NFTFeatureConfig) SetDefaults() { +func (c *Deprecated_Web3NFTFeatureConfig) SetDefaults() { if c.Maximum == nil { c.Maximum = newInt(3) } diff --git a/pkg/lib/config/web3.go b/pkg/lib/config/web3.go index 4f9fe57354..5fb3662054 100644 --- a/pkg/lib/config/web3.go +++ b/pkg/lib/config/web3.go @@ -18,7 +18,7 @@ var _ = Schema.Add("NFTConfig", ` } `) -type NFTConfig struct { +type Deprecated_NFTConfig struct { Collections []string `json:"collections,omitempty"` } @@ -40,7 +40,7 @@ var _ = Schema.Add("SIWEConfig", ` } `) -type SIWEConfig struct { +type Deprecated_SIWEConfig struct { Networks []string `json:"networks,omitempty"` } @@ -55,7 +55,7 @@ var _ = Schema.Add("Web3Config", ` } `) -type Web3Config struct { - SIWE *SIWEConfig `json:"siwe,omitempty"` - NFT *NFTConfig `json:"nft,omitempty"` +type Deprecated_Web3Config struct { + SIWE *Deprecated_SIWEConfig `json:"siwe,omitempty"` + NFT *Deprecated_NFTConfig `json:"nft,omitempty"` } diff --git a/pkg/lib/deps/deps_common.go b/pkg/lib/deps/deps_common.go index a211af1245..150175c458 100644 --- a/pkg/lib/deps/deps_common.go +++ b/pkg/lib/deps/deps_common.go @@ -41,10 +41,8 @@ import ( featurecustomattrs "github.com/authgear/authgear-server/pkg/lib/feature/customattrs" "github.com/authgear/authgear-server/pkg/lib/feature/forgotpassword" featurepasskey "github.com/authgear/authgear-server/pkg/lib/feature/passkey" - featuresiwe "github.com/authgear/authgear-server/pkg/lib/feature/siwe" featurestdattrs "github.com/authgear/authgear-server/pkg/lib/feature/stdattrs" "github.com/authgear/authgear-server/pkg/lib/feature/verification" - featureweb3 "github.com/authgear/authgear-server/pkg/lib/feature/web3" "github.com/authgear/authgear-server/pkg/lib/healthz" "github.com/authgear/authgear-server/pkg/lib/hook" "github.com/authgear/authgear-server/pkg/lib/ldap" @@ -526,7 +524,6 @@ var CommonDependencySet = wire.NewSet( wire.Bind(new(otp.RateLimiter), new(*ratelimit.Limiter)), wire.Bind(new(messaging.RateLimiter), new(*ratelimit.Limiter)), wire.Bind(new(mfa.RateLimiter), new(*ratelimit.Limiter)), - wire.Bind(new(featuresiwe.RateLimiter), new(*ratelimit.Limiter)), ), wire.NewSet( @@ -595,16 +592,6 @@ var CommonDependencySet = wire.NewSet( wire.Bind(new(accountmanagement.PasskeyService), new(*featurepasskey.Service)), ), - wire.NewSet( - featuresiwe.DependencySet, - wire.Bind(new(identitysiwe.SIWEService), new(*featuresiwe.Service)), - ), - - wire.NewSet( - featureweb3.DependencySet, - wire.Bind(new(user.Web3Service), new(*featureweb3.Service)), - ), - wire.NewSet( workflow.DependencySet, ), diff --git a/pkg/lib/deps/deps_config.go b/pkg/lib/deps/deps_config.go index b2593697db..6fc95deba9 100644 --- a/pkg/lib/deps/deps_config.go +++ b/pkg/lib/deps/deps_config.go @@ -28,7 +28,7 @@ var ConfigDeps = wire.NewSet( "Verification", "AccountDeletion", "AccountAnonymization", - "Web3", + "Deprecated_Web3", "GoogleTagManager", "AccountMigration", "Captcha", diff --git a/pkg/lib/deps/deps_provider.go b/pkg/lib/deps/deps_provider.go index 3847097659..0497178f1f 100644 --- a/pkg/lib/deps/deps_provider.go +++ b/pkg/lib/deps/deps_provider.go @@ -35,7 +35,6 @@ var EnvConfigDeps = wire.NewSet( "CORSAllowedOrigins", "AllowedFrameAncestors", "RedisConfig", - "NFTIndexerAPIEndpoint", "DenoEndpoint", "RateLimits", "SAML", diff --git a/pkg/lib/feature/siwe/deps.go b/pkg/lib/feature/siwe/deps.go deleted file mode 100644 index 172f9dab6f..0000000000 --- a/pkg/lib/feature/siwe/deps.go +++ /dev/null @@ -1,10 +0,0 @@ -package siwe - -import "github.com/google/wire" - -var DependencySet = wire.NewSet( - wire.Struct(new(StoreRedis), "*"), - wire.Bind(new(NonceStore), new(*StoreRedis)), - NewLogger, - wire.Struct(new(Service), "*"), -) diff --git a/pkg/lib/feature/siwe/errors.go b/pkg/lib/feature/siwe/errors.go deleted file mode 100644 index ca2c3d99b3..0000000000 --- a/pkg/lib/feature/siwe/errors.go +++ /dev/null @@ -1,10 +0,0 @@ -package siwe - -import ( - "github.com/authgear/authgear-server/pkg/api/apierrors" -) - -var InvalidNonce = apierrors.Forbidden.WithReason("InvalidNonce") -var InvalidNetwork = apierrors.BadRequest.WithReason("InvalidNetwork") - -var ErrNonceNotFound = InvalidNonce.NewWithCause("nonce is expired or invalid", apierrors.StringCause("NonceNotFound")) diff --git a/pkg/lib/feature/siwe/nonce.go b/pkg/lib/feature/siwe/nonce.go deleted file mode 100644 index 67e4121a9b..0000000000 --- a/pkg/lib/feature/siwe/nonce.go +++ /dev/null @@ -1,8 +0,0 @@ -package siwe - -import "time" - -type Nonce struct { - Nonce string `json:"nonce"` - ExpireAt time.Time `json:"expire_at"` -} diff --git a/pkg/lib/feature/siwe/service.go b/pkg/lib/feature/siwe/service.go deleted file mode 100644 index 0669799f1f..0000000000 --- a/pkg/lib/feature/siwe/service.go +++ /dev/null @@ -1,174 +0,0 @@ -package siwe - -import ( - "context" - "crypto/ecdsa" - "errors" - "fmt" - "net/url" - "strconv" - "time" - - siwego "github.com/spruceid/siwe-go" - - "github.com/authgear/authgear-server/pkg/api/apierrors" - "github.com/authgear/authgear-server/pkg/api/model" - "github.com/authgear/authgear-server/pkg/lib/config" - "github.com/authgear/authgear-server/pkg/lib/ratelimit" - "github.com/authgear/authgear-server/pkg/util/clock" - "github.com/authgear/authgear-server/pkg/util/duration" - "github.com/authgear/authgear-server/pkg/util/httputil" - "github.com/authgear/authgear-server/pkg/util/log" - "github.com/authgear/authgear-server/pkg/util/rand" - "github.com/authgear/authgear-server/pkg/util/web3" -) - -//go:generate mockgen -source=service.go -destination=service_mock_test.go -package siwe - -// siwe-go library regex does not support underscore so we define a new one for this case -// https://github.com/spruceid/siwe-go/blob/fc1b0374f4ffff68e3455839655e680be7e0f862/regex.go#L17 -const Alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - -const ( - SIWENoncePerIP ratelimit.BucketName = "SIWENoncePerIP" - SIWEVerifyPerIP ratelimit.BucketName = "SIWEVerifyPerIP" -) - -type NonceStore interface { - Create(ctx context.Context, nonce *Nonce) error - Get(ctx context.Context, nonce *Nonce) (*Nonce, error) - Delete(ctx context.Context, nonce *Nonce) error -} - -type RateLimiter interface { - Allow(ctx context.Context, spec ratelimit.BucketSpec) (*ratelimit.FailedReservation, error) - Reserve(ctx context.Context, spec ratelimit.BucketSpec) (*ratelimit.Reservation, *ratelimit.FailedReservation, error) - Cancel(ctx context.Context, r *ratelimit.Reservation) -} - -type Logger struct{ *log.Logger } - -func NewLogger(lf *log.Factory) Logger { return Logger{lf.New("siwe")} } - -type Service struct { - RemoteIP httputil.RemoteIP - HTTPOrigin httputil.HTTPOrigin - Web3Config *config.Web3Config - AuthenticationConfig *config.AuthenticationConfig - - Clock clock.Clock - NonceStore NonceStore - RateLimiter RateLimiter - Logger Logger -} - -func (s *Service) rateLimitGenerateNonce() ratelimit.BucketSpec { - enabled := true - return ratelimit.NewBucketSpec(&config.RateLimitConfig{ - Enabled: &enabled, - Period: config.DurationString(time.Minute.String()), - Burst: 100, - }, SIWENoncePerIP, string(s.RemoteIP)) -} - -func (s *Service) rateLimitVerifyMessage() ratelimit.BucketSpec { - return ratelimit.NewBucketSpec( - s.AuthenticationConfig.RateLimits.SIWE.PerIP, SIWEVerifyPerIP, - string(s.RemoteIP), - ) -} - -func (s *Service) CreateNewNonce(ctx context.Context) (*Nonce, error) { - nonce := rand.StringWithAlphabet(16, Alphabet, rand.SecureRand) - nonceModel := &Nonce{ - Nonce: nonce, - ExpireAt: s.Clock.NowUTC().Add(duration.Short), - } - - failed, err := s.RateLimiter.Allow(ctx, s.rateLimitGenerateNonce()) - if err != nil { - return nil, err - } - if err := failed.Error(); err != nil { - return nil, err - } - - err = s.NonceStore.Create(ctx, nonceModel) - if err != nil { - return nil, err - } - - return nonceModel, nil -} - -func (s *Service) VerifyMessage(ctx context.Context, msg string, signature string) (*model.SIWEWallet, *ecdsa.PublicKey, error) { - message, err := siwego.ParseMessage(msg) - if err != nil { - return nil, nil, err - } - - chainID := message.GetChainID() - - var expectedNetworkID *web3.ContractID - mismatchNetwork := true - for _, networkURL := range s.Web3Config.SIWE.Networks { - expectedNetworkID, err = web3.ParseContractID(networkURL) - if err != nil { - return nil, nil, err - } - - if expectedNetworkID.Network == strconv.Itoa(chainID) { - mismatchNetwork = false - break - } - - } - - if mismatchNetwork { - return nil, nil, InvalidNetwork.NewWithInfo("network does not match expected network", apierrors.Details{"expected_chain_id": fmt.Sprintf("_%s", expectedNetworkID.Network)}) - } - - reservation, failed, err := s.RateLimiter.Reserve(ctx, s.rateLimitVerifyMessage()) - if err != nil { - return nil, nil, err - } - if err := failed.Error(); err != nil { - return nil, nil, err - } - defer s.RateLimiter.Cancel(ctx, reservation) - - messageNonce := message.GetNonce() - existingNonce, err := s.NonceStore.Get(ctx, &Nonce{ - Nonce: messageNonce, - }) - if errors.Is(err, ErrNonceNotFound) { - reservation.PreventCancel() - return nil, nil, err - } else if err != nil { - return nil, nil, err - } - - publicOrigin, err := url.Parse(string(s.HTTPOrigin)) - if err != nil { - return nil, nil, err - } - - now := s.Clock.NowUTC() - pubKey, err := message.Verify(signature, &publicOrigin.Host, &existingNonce.Nonce, &now) - if err != nil { - reservation.PreventCancel() - return nil, nil, err - } - - eip55, err := web3.NewEIP55(message.GetAddress().Hex()) - if err != nil { - return nil, nil, err - } - - wallet := &model.SIWEWallet{ - Address: eip55, - ChainID: message.GetChainID(), - } - - return wallet, pubKey, nil -} diff --git a/pkg/lib/feature/siwe/service_mock_test.go b/pkg/lib/feature/siwe/service_mock_test.go deleted file mode 100644 index b02a8483c8..0000000000 --- a/pkg/lib/feature/siwe/service_mock_test.go +++ /dev/null @@ -1,145 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: service.go - -// Package siwe is a generated GoMock package. -package siwe - -import ( - context "context" - reflect "reflect" - - ratelimit "github.com/authgear/authgear-server/pkg/lib/ratelimit" - gomock "github.com/golang/mock/gomock" -) - -// MockNonceStore is a mock of NonceStore interface. -type MockNonceStore struct { - ctrl *gomock.Controller - recorder *MockNonceStoreMockRecorder -} - -// MockNonceStoreMockRecorder is the mock recorder for MockNonceStore. -type MockNonceStoreMockRecorder struct { - mock *MockNonceStore -} - -// NewMockNonceStore creates a new mock instance. -func NewMockNonceStore(ctrl *gomock.Controller) *MockNonceStore { - mock := &MockNonceStore{ctrl: ctrl} - mock.recorder = &MockNonceStoreMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockNonceStore) EXPECT() *MockNonceStoreMockRecorder { - return m.recorder -} - -// Create mocks base method. -func (m *MockNonceStore) Create(ctx context.Context, nonce *Nonce) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Create", ctx, nonce) - ret0, _ := ret[0].(error) - return ret0 -} - -// Create indicates an expected call of Create. -func (mr *MockNonceStoreMockRecorder) Create(ctx, nonce interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockNonceStore)(nil).Create), ctx, nonce) -} - -// Delete mocks base method. -func (m *MockNonceStore) Delete(ctx context.Context, nonce *Nonce) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Delete", ctx, nonce) - ret0, _ := ret[0].(error) - return ret0 -} - -// Delete indicates an expected call of Delete. -func (mr *MockNonceStoreMockRecorder) Delete(ctx, nonce interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockNonceStore)(nil).Delete), ctx, nonce) -} - -// Get mocks base method. -func (m *MockNonceStore) Get(ctx context.Context, nonce *Nonce) (*Nonce, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Get", ctx, nonce) - ret0, _ := ret[0].(*Nonce) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Get indicates an expected call of Get. -func (mr *MockNonceStoreMockRecorder) Get(ctx, nonce interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockNonceStore)(nil).Get), ctx, nonce) -} - -// MockRateLimiter is a mock of RateLimiter interface. -type MockRateLimiter struct { - ctrl *gomock.Controller - recorder *MockRateLimiterMockRecorder -} - -// MockRateLimiterMockRecorder is the mock recorder for MockRateLimiter. -type MockRateLimiterMockRecorder struct { - mock *MockRateLimiter -} - -// NewMockRateLimiter creates a new mock instance. -func NewMockRateLimiter(ctrl *gomock.Controller) *MockRateLimiter { - mock := &MockRateLimiter{ctrl: ctrl} - mock.recorder = &MockRateLimiterMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockRateLimiter) EXPECT() *MockRateLimiterMockRecorder { - return m.recorder -} - -// Allow mocks base method. -func (m *MockRateLimiter) Allow(ctx context.Context, spec ratelimit.BucketSpec) (*ratelimit.FailedReservation, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Allow", ctx, spec) - ret0, _ := ret[0].(*ratelimit.FailedReservation) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Allow indicates an expected call of Allow. -func (mr *MockRateLimiterMockRecorder) Allow(ctx, spec interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Allow", reflect.TypeOf((*MockRateLimiter)(nil).Allow), ctx, spec) -} - -// Cancel mocks base method. -func (m *MockRateLimiter) Cancel(ctx context.Context, r *ratelimit.Reservation) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "Cancel", ctx, r) -} - -// Cancel indicates an expected call of Cancel. -func (mr *MockRateLimiterMockRecorder) Cancel(ctx, r interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Cancel", reflect.TypeOf((*MockRateLimiter)(nil).Cancel), ctx, r) -} - -// Reserve mocks base method. -func (m *MockRateLimiter) Reserve(ctx context.Context, spec ratelimit.BucketSpec) (*ratelimit.Reservation, *ratelimit.FailedReservation, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Reserve", ctx, spec) - ret0, _ := ret[0].(*ratelimit.Reservation) - ret1, _ := ret[1].(*ratelimit.FailedReservation) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 -} - -// Reserve indicates an expected call of Reserve. -func (mr *MockRateLimiterMockRecorder) Reserve(ctx, spec interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reserve", reflect.TypeOf((*MockRateLimiter)(nil).Reserve), ctx, spec) -} diff --git a/pkg/lib/feature/siwe/store_redis.go b/pkg/lib/feature/siwe/store_redis.go deleted file mode 100644 index f633fb2758..0000000000 --- a/pkg/lib/feature/siwe/store_redis.go +++ /dev/null @@ -1,81 +0,0 @@ -package siwe - -import ( - "context" - "encoding/json" - "errors" - "fmt" - - goredis "github.com/redis/go-redis/v9" - - "github.com/authgear/authgear-server/pkg/lib/config" - "github.com/authgear/authgear-server/pkg/lib/infra/redis" - "github.com/authgear/authgear-server/pkg/lib/infra/redis/appredis" - "github.com/authgear/authgear-server/pkg/util/clock" -) - -type StoreRedis struct { - Redis *appredis.Handle - AppID config.AppID - Clock clock.Clock -} - -func (s *StoreRedis) Create(ctx context.Context, nonce *Nonce) error { - data, err := json.Marshal(nonce) - if err != nil { - return err - } - - return s.Redis.WithConnContext(ctx, func(ctx context.Context, conn redis.Redis_6_0_Cmdable) error { - nonceKey := redisNonceKey(s.AppID, nonce) - ttl := nonce.ExpireAt.Sub(s.Clock.NowUTC()) - _, err := conn.SetNX(ctx, nonceKey, data, ttl).Result() - if errors.Is(err, goredis.Nil) { - return errors.New("duplicated nonce") - } else if err != nil { - return err - } - - return nil - }) -} - -func (s *StoreRedis) Get(ctx context.Context, nonce *Nonce) (*Nonce, error) { - key := redisNonceKey(s.AppID, nonce) - var nonceModel *Nonce - err := s.Redis.WithConnContext(ctx, func(ctx context.Context, conn redis.Redis_6_0_Cmdable) error { - data, err := conn.Get(ctx, key).Bytes() - if errors.Is(err, goredis.Nil) { - return ErrNonceNotFound - } else if err != nil { - return err - } - - err = json.Unmarshal(data, &nonceModel) - if err != nil { - return err - } - - return nil - }) - if err != nil { - return nil, err - } - - return nonceModel, nil -} - -func (s *StoreRedis) Delete(ctx context.Context, codeKey *Nonce) error { - return s.Redis.WithConnContext(ctx, func(ctx context.Context, conn redis.Redis_6_0_Cmdable) error { - key := redisNonceKey(s.AppID, codeKey) - _, err := conn.Del(ctx, key).Result() - if err != nil { - return err - } - return err - }) -} - -func redisNonceKey(appID config.AppID, nonce *Nonce) string { - return fmt.Sprintf("app:%s:siwe-nonce:%s", appID, nonce.Nonce) -} diff --git a/pkg/lib/feature/web3/deps.go b/pkg/lib/feature/web3/deps.go deleted file mode 100644 index 54edb018a8..0000000000 --- a/pkg/lib/feature/web3/deps.go +++ /dev/null @@ -1,25 +0,0 @@ -package web3 - -import ( - "net/http" - "time" - - "github.com/google/wire" - - "github.com/authgear/authgear-server/pkg/util/httputil" -) - -type HTTPClient struct { - *http.Client -} - -func NewHTTPClient() HTTPClient { - return HTTPClient{ - httputil.NewExternalClient(5 * time.Second), - } -} - -var DependencySet = wire.NewSet( - wire.Struct(new(Service), "*"), - NewHTTPClient, -) diff --git a/pkg/lib/feature/web3/errors.go b/pkg/lib/feature/web3/errors.go deleted file mode 100644 index 3fd7eb5771..0000000000 --- a/pkg/lib/feature/web3/errors.go +++ /dev/null @@ -1,7 +0,0 @@ -package web3 - -import ( - "github.com/authgear/authgear-server/pkg/api/apierrors" -) - -var ErrInvalidEndpoint = apierrors.NotFound.WithReason("InvalidURL").New("invalid endpoint") diff --git a/pkg/lib/feature/web3/service.go b/pkg/lib/feature/web3/service.go deleted file mode 100644 index 30dd1ec31e..0000000000 --- a/pkg/lib/feature/web3/service.go +++ /dev/null @@ -1,137 +0,0 @@ -package web3 - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "net/url" - - "github.com/authgear/authgear-server/pkg/api/apierrors" - "github.com/authgear/authgear-server/pkg/api/model" - "github.com/authgear/authgear-server/pkg/lib/authn/identity" - "github.com/authgear/authgear-server/pkg/lib/config" - "github.com/authgear/authgear-server/pkg/util/httputil" - "github.com/authgear/authgear-server/pkg/util/web3" -) - -type Service struct { - APIEndpoint config.NFTIndexerAPIEndpoint - Web3Config *config.Web3Config - HTTPClient HTTPClient -} - -type ListOwnerNFTsResponse struct { - Result model.NFTOwnership `json:"result"` - Error *apierrors.APIError `json:"error"` -} - -func (s *Service) GetWeb3Info(ctx context.Context, identities []*identity.Info) (*model.UserWeb3Info, error) { - if s.Web3Config == nil || s.Web3Config.NFT == nil { - return nil, fmt.Errorf("NFTConfig not defined") - } - nftCollections := s.Web3Config.NFT.Collections - contractIDs := make([]web3.ContractID, 0, len(nftCollections)) - for _, collection := range nftCollections { - contractID, err := web3.ParseContractID(collection) - if err != nil { - return nil, err - } - contractIDs = append(contractIDs, *contractID) - } - - ownerships := make([]model.NFTOwnership, 0) - for _, identity := range identities { - if identity == nil { - continue - } - var ownerID *web3.ContractID - switch identity.Type { - case model.IdentityTypeSIWE: - id, err := identity.SIWE.ToContractID() - if err != nil { - return nil, err - } - - ownerID = id - break - - default: - // No supported identities - break - } - - if ownerID == nil { - continue - } - - nft, err := s.ListOwnerNFTs(ctx, *ownerID, contractIDs) - if err != nil { - return nil, err - } - - if nft == nil { - return nil, fmt.Errorf("Failed to fetch nfts for user") - } - - ownerships = append(ownerships, *nft) - - } - - web3Info := &model.UserWeb3Info{ - Accounts: ownerships, - } - - return web3Info, nil -} - -func (s *Service) ListOwnerNFTs(ctx context.Context, ownerID web3.ContractID, contractIDs []web3.ContractID) (*model.NFTOwnership, error) { - endpoint, err := url.Parse(string(s.APIEndpoint)) - if err != nil { - return nil, err - } - - endpoint.Path = "nfts" - - ownerURL, err := ownerID.URL() - if err != nil { - return nil, err - } - - contractUrls := make([]string, 0, len(contractIDs)) - for _, contract := range contractIDs { - url, err := contract.URL() - if err != nil { - return nil, err - } - contractUrls = append(contractUrls, url.String()) - } - - request := model.ListOwnerNFTsRequest{ - OwnerAddress: ownerURL.String(), - ContractIDs: contractUrls, - } - - data, err := json.Marshal(request) - if err != nil { - return nil, err - } - - res, err := httputil.PostWithContext(ctx, s.HTTPClient.Client, endpoint.String(), "application/json", bytes.NewBuffer(data)) - if err != nil { - return nil, err - } - defer res.Body.Close() - - var response ListOwnerNFTsResponse - err = json.NewDecoder(res.Body).Decode(&response) - if err != nil { - return nil, err - } - - if response.Error != nil { - return nil, response.Error - } - - return &response.Result, nil -} diff --git a/pkg/lib/oauth/oidc/id_token.go b/pkg/lib/oauth/oidc/id_token.go index 81e79d3cbd..9fb9141d71 100644 --- a/pkg/lib/oauth/oidc/id_token.go +++ b/pkg/lib/oauth/oidc/id_token.go @@ -272,7 +272,6 @@ func (ti *IDTokenIssuer) GetUserInfo(ctx context.Context, userID string, clientL } out["custom_attributes"] = user.CustomAttributes - out["x_web3"] = user.Web3 } else { // When the client is third party, we include the standard claims according to scopes. for k, v := range user.StandardAttributes { diff --git a/pkg/portal/config/web3.go b/pkg/portal/config/web3.go deleted file mode 100644 index 8801cecd07..0000000000 --- a/pkg/portal/config/web3.go +++ /dev/null @@ -1,5 +0,0 @@ -package config - -type Web3Config struct { - Enabled bool `envconfig:"ENABLED" default:"false"` -} diff --git a/pkg/portal/deps.go b/pkg/portal/deps.go index f7381477b6..f3d13d54c0 100644 --- a/pkg/portal/deps.go +++ b/pkg/portal/deps.go @@ -114,7 +114,6 @@ var DependencySet = wire.NewSet( wire.Bind(new(graphql.StripeService), new(*libstripe.Service)), wire.Bind(new(graphql.SubscriptionService), new(*service.SubscriptionService)), wire.Bind(new(graphql.UsageService), new(*service.UsageService)), - wire.Bind(new(graphql.NFTService), new(*service.NFTService)), wire.Bind(new(graphql.DenoService), new(*hook.DenoClientImpl)), wire.Bind(new(graphql.AuditService), new(*service.AuditService)), wire.Bind(new(graphql.OnboardService), new(*service.OnboardService)), diff --git a/pkg/portal/deps/deps.go b/pkg/portal/deps/deps.go index 018236dee9..29241a759f 100644 --- a/pkg/portal/deps/deps.go +++ b/pkg/portal/deps/deps.go @@ -55,7 +55,6 @@ var DependencySet = wire.NewSet( "KubernetesConfig", "DomainImplementation", "SearchConfig", - "Web3Config", "AuditLogConfig", "AnalyticConfig", "StripeConfig", @@ -77,7 +76,6 @@ var DependencySet = wire.NewSet( "SentryDSN", "GlobalDatabase", "DatabaseConfig", - "NFTIndexerAPIEndpoint", "DenoEndpoint", "AppHostSuffixes", "UIImplementation", diff --git a/pkg/portal/deps/providers.go b/pkg/portal/deps/providers.go index 239968f24a..abb2e1d38c 100644 --- a/pkg/portal/deps/providers.go +++ b/pkg/portal/deps/providers.go @@ -31,7 +31,6 @@ type RootProvider struct { KubernetesConfig *portalconfig.KubernetesConfig DomainImplementation portalconfig.DomainImplementationType SearchConfig *portalconfig.SearchConfig - Web3Config *portalconfig.Web3Config AuditLogConfig *portalconfig.AuditLogConfig AnalyticConfig *config.AnalyticConfig StripeConfig *portalconfig.StripeConfig @@ -65,7 +64,6 @@ func NewRootProvider( kubernetesConfig *portalconfig.KubernetesConfig, domainImplementation portalconfig.DomainImplementationType, searchConfig *portalconfig.SearchConfig, - web3Config *portalconfig.Web3Config, auditLogConfig *portalconfig.AuditLogConfig, analyticConfig *config.AnalyticConfig, stripeConfig *portalconfig.StripeConfig, @@ -111,7 +109,6 @@ func NewRootProvider( KubernetesConfig: kubernetesConfig, DomainImplementation: domainImplementation, SearchConfig: searchConfig, - Web3Config: web3Config, AuditLogConfig: auditLogConfig, AnalyticConfig: analyticConfig, StripeConfig: stripeConfig, diff --git a/pkg/portal/graphql/app.go b/pkg/portal/graphql/app.go index 105013be2f..af701efb78 100644 --- a/pkg/portal/graphql/app.go +++ b/pkg/portal/graphql/app.go @@ -14,7 +14,6 @@ import ( "github.com/authgear/authgear-server/pkg/portal/service" "github.com/authgear/authgear-server/pkg/portal/session" "github.com/authgear/authgear-server/pkg/util/resource" - "github.com/authgear/authgear-server/pkg/util/web3" ) var oauthSSOProviderClientSecret = graphql.NewObject(graphql.ObjectConfig{ @@ -601,42 +600,6 @@ var nodeApp = node( return entry, nil }, }, - "nftCollections": &graphql.Field{ - Type: graphql.NewNonNull(graphql.NewList(graphql.NewNonNull(nftCollection))), - Resolve: func(p graphql.ResolveParams) (interface{}, error) { - ctx := p.Context - gqlCtx := GQLContext(ctx) - config := p.Source.(*model.App).Context.Config.AppConfig - if config.Web3 == nil { - return []interface{}{}, nil - } - - if config.Web3.NFT == nil { - return []interface{}{}, nil - } - - if len(config.Web3.NFT.Collections) == 0 { - return []interface{}{}, nil - } - - contractIDs := make([]web3.ContractID, 0, len(config.Web3.NFT.Collections)) - for _, url := range config.Web3.NFT.Collections { - contractID, err := web3.ParseContractID(url) - if err != nil { - return nil, err - } - - contractIDs = append(contractIDs, *contractID) - } - - collections, err := gqlCtx.NFTService.GetContractMetadata(ctx, contractIDs) - if err != nil { - return nil, err - } - - return collections, nil - }, - }, "samlIdpEntityID": &graphql.Field{ Type: graphql.NewNonNull(graphql.String), Resolve: func(p graphql.ResolveParams) (interface{}, error) { diff --git a/pkg/portal/graphql/context.go b/pkg/portal/graphql/context.go index 85e9eaa063..8938755563 100644 --- a/pkg/portal/graphql/context.go +++ b/pkg/portal/graphql/context.go @@ -21,7 +21,6 @@ import ( "github.com/authgear/authgear-server/pkg/portal/smtp" "github.com/authgear/authgear-server/pkg/util/graphqlutil" "github.com/authgear/authgear-server/pkg/util/log" - "github.com/authgear/authgear-server/pkg/util/web3" ) type UserLoader interface { @@ -159,11 +158,6 @@ type UsageService interface { ) (*model.Usage, error) } -type NFTService interface { - ProbeNFTCollection(ctx context.Context, contractID web3.ContractID) (*apimodel.ProbeCollectionResult, error) - GetContractMetadata(ctx context.Context, contracts []web3.ContractID) ([]apimodel.NFTCollection, error) -} - type DenoService interface { Check(ctx context.Context, snippet string) error } @@ -200,7 +194,6 @@ type Context struct { StripeService StripeService SubscriptionService SubscriptionService UsageService UsageService - NFTService NFTService DenoService DenoService AuditService AuditService OnboardService OnboardService diff --git a/pkg/portal/graphql/query.go b/pkg/portal/graphql/query.go index 24ef9d3026..c4739da4b6 100644 --- a/pkg/portal/graphql/query.go +++ b/pkg/portal/graphql/query.go @@ -6,11 +6,9 @@ import ( "github.com/graphql-go/graphql" - "github.com/authgear/authgear-server/pkg/api/apierrors" "github.com/authgear/authgear-server/pkg/portal/service" "github.com/authgear/authgear-server/pkg/portal/session" "github.com/authgear/authgear-server/pkg/util/graphqlutil" - "github.com/authgear/authgear-server/pkg/util/web3" ) var checkCollaboratorInvitationPayload = graphql.NewObject(graphql.ObjectConfig{ @@ -273,35 +271,5 @@ var query = graphql.NewObject(graphql.ObjectConfig{ return plans, nil }, }, - "nftContractMetadata": &graphql.Field{ - Description: "Fetch NFT Contract Metadata", - Type: nftCollection, - Args: graphql.FieldConfigArgument{ - "contractID": &graphql.ArgumentConfig{ - Type: graphql.NewNonNull(graphql.String), - }, - }, - Resolve: func(p graphql.ResolveParams) (interface{}, error) { - ctx := p.Context - gqlCtx := GQLContext(ctx) - contractURL := p.Args["contractID"].(string) - - contractID, err := web3.ParseContractID(contractURL) - if err != nil { - return nil, err - } - - metadata, err := gqlCtx.NFTService.GetContractMetadata(ctx, []web3.ContractID{*contractID}) - if err != nil { - return nil, err - } - - if len(metadata) == 0 { - return nil, apierrors.NewInternalError("failed to fetch contract metadata") - } - - return metadata[0], nil - }, - }, }, }) diff --git a/pkg/portal/graphql/web3.go b/pkg/portal/graphql/web3.go deleted file mode 100644 index 565313ddd3..0000000000 --- a/pkg/portal/graphql/web3.go +++ /dev/null @@ -1,46 +0,0 @@ -package graphql - -import ( - "github.com/graphql-go/graphql" - - "github.com/authgear/authgear-server/pkg/api/model" -) - -const typeNFTCollection = "NFTCollection" - -var nftCollection = graphql.NewObject(graphql.ObjectConfig{ - Name: typeNFTCollection, - Description: "Web3 NFT Collection", - Fields: graphql.Fields{ - "blockchain": &graphql.Field{ - Type: graphql.NewNonNull(graphql.String), - }, - "network": &graphql.Field{ - Type: graphql.NewNonNull(graphql.String), - }, - "name": &graphql.Field{ - Type: graphql.NewNonNull(graphql.String), - }, - "contractAddress": &graphql.Field{ - Type: graphql.NewNonNull(graphql.String), - }, - "totalSupply": &graphql.Field{ - Type: graphql.String, - Resolve: func(p graphql.ResolveParams) (interface{}, error) { - source := p.Source.(model.NFTCollection) - - if source.TotalSupply == nil { - return nil, nil - } - - return source.TotalSupply.String(), nil - }, - }, - "tokenType": &graphql.Field{ - Type: graphql.NewNonNull(graphql.String), - }, - "createdAt": &graphql.Field{ - Type: graphql.NewNonNull(graphql.DateTime), - }, - }, -}) diff --git a/pkg/portal/graphql/web3_mutation.go b/pkg/portal/graphql/web3_mutation.go deleted file mode 100644 index b3dbee0d58..0000000000 --- a/pkg/portal/graphql/web3_mutation.go +++ /dev/null @@ -1,60 +0,0 @@ -package graphql - -import ( - "github.com/graphql-go/graphql" - - "github.com/authgear/authgear-server/pkg/util/graphqlutil" - "github.com/authgear/authgear-server/pkg/util/web3" -) - -var probeNFTCollectionInput = graphql.NewInputObject(graphql.InputObjectConfig{ - Name: "ProbeNFTCollectionInput", - Fields: graphql.InputObjectConfigFieldMap{ - "contractID": &graphql.InputObjectFieldConfig{ - Type: graphql.NewNonNull(graphql.String), - }, - }, -}) - -var probeNFTCollectionsPayload = graphql.NewObject(graphql.ObjectConfig{ - Name: "ProbeNFTCollectionsPayload", - Fields: graphql.Fields{ - "isLargeCollection": &graphql.Field{ - Type: graphql.NewNonNull(graphql.Boolean), - }, - }, -}) - -var _ = registerMutationField( - "probeNFTCollection", - &graphql.Field{ - Description: "Probes a NFT Collection to see whether it is a large collection", - Type: graphql.NewNonNull(probeNFTCollectionsPayload), - Args: graphql.FieldConfigArgument{ - "input": &graphql.ArgumentConfig{ - Type: graphql.NewNonNull(probeNFTCollectionInput), - }, - }, - Resolve: func(p graphql.ResolveParams) (interface{}, error) { - input := p.Args["input"].(map[string]interface{}) - rawContractURL := input["contractID"].(string) - - ctx := p.Context - gqlCtx := GQLContext(ctx) - - contractID, err := web3.ParseContractID(rawContractURL) - if err != nil { - return nil, err - } - - res, err := gqlCtx.NFTService.ProbeNFTCollection(ctx, *contractID) - if err != nil { - return nil, err - } - - return graphqlutil.NewLazyValue(map[string]interface{}{ - "isLargeCollection": res.IsLargeCollection, - }).Value, nil - }, - }, -) diff --git a/pkg/portal/model/system_config.go b/pkg/portal/model/system_config.go index c5484013c2..24c48528a6 100644 --- a/pkg/portal/model/system_config.go +++ b/pkg/portal/model/system_config.go @@ -14,7 +14,6 @@ type SystemConfig struct { Themes interface{} `json:"themes,omitempty"` Translations interface{} `json:"translations,omitempty"` SearchEnabled bool `json:"searchEnabled"` - Web3Enabled bool `json:"web3Enabled"` AuditLogEnabled bool `json:"auditLogEnabled"` AnalyticEnabled bool `json:"analyticEnabled"` AnalyticEpoch *timeutil.Date `json:"analyticEpoch,omitempty"` diff --git a/pkg/portal/service/deps.go b/pkg/portal/service/deps.go index 274eec4532..26b01ba0a9 100644 --- a/pkg/portal/service/deps.go +++ b/pkg/portal/service/deps.go @@ -47,7 +47,6 @@ var DependencySet = wire.NewSet( wire.Struct(new(SystemConfigProvider), "*"), wire.Struct(new(SubscriptionService), "*"), wire.Struct(new(UsageService), "*"), - wire.Struct(new(NFTService), "*"), wire.Struct(new(AuditService), "*"), wire.Struct(new(OnboardService), "*"), NewConfigServiceLogger, diff --git a/pkg/portal/service/nft.go b/pkg/portal/service/nft.go deleted file mode 100644 index be5c707dc8..0000000000 --- a/pkg/portal/service/nft.go +++ /dev/null @@ -1,116 +0,0 @@ -package service - -import ( - "bytes" - "context" - "encoding/json" - "net/url" - - "github.com/authgear/authgear-server/pkg/api/apierrors" - "github.com/authgear/authgear-server/pkg/api/model" - apimodel "github.com/authgear/authgear-server/pkg/api/model" - "github.com/authgear/authgear-server/pkg/lib/config" - "github.com/authgear/authgear-server/pkg/util/httputil" - "github.com/authgear/authgear-server/pkg/util/web3" -) - -type ProbeColletionResponse struct { - Result apimodel.ProbeCollectionResult `json:"result"` - Error *apierrors.APIError `json:"error"` -} - -type GetContractMetadataResponse struct { - Result apimodel.GetContractMetadataResult `json:"result"` - Error *apierrors.APIError `json:"error"` -} - -type NFTService struct { - HTTPClient HTTPClient - APIEndpoint config.NFTIndexerAPIEndpoint -} - -func (s *NFTService) ProbeNFTCollection(ctx context.Context, contractID web3.ContractID) (*apimodel.ProbeCollectionResult, error) { - endpoint, err := url.Parse(string(s.APIEndpoint)) - if err != nil { - return nil, err - } - - endpoint.Path = "probe" - - contractURL, err := contractID.URL() - if err != nil { - return nil, err - } - - request := model.ProbeCollectionRequest{ - ContractID: contractURL.String(), - } - - data, err := json.Marshal(request) - if err != nil { - return nil, err - } - - res, err := httputil.PostWithContext(ctx, s.HTTPClient.Client, endpoint.String(), "application/json", bytes.NewBuffer(data)) - if err != nil { - return nil, err - } - defer res.Body.Close() - - var response ProbeColletionResponse - err = json.NewDecoder(res.Body).Decode(&response) - if err != nil { - return nil, err - } - - if response.Error != nil { - return nil, response.Error - } - - return &response.Result, nil -} - -func (s *NFTService) GetContractMetadata(ctx context.Context, contracts []web3.ContractID) ([]apimodel.NFTCollection, error) { - endpoint, err := url.Parse(string(s.APIEndpoint)) - if err != nil { - return nil, err - } - - endpoint.Path = "metadata" - - contractURLs := make([]string, 0, len(contracts)) - for _, contract := range contracts { - contractURL, err := contract.URL() - if err != nil { - return nil, err - } - contractURLs = append(contractURLs, contractURL.String()) - } - - request := model.GetContractMetadataRequest{ - ContractIDs: contractURLs, - } - - data, err := json.Marshal(request) - if err != nil { - return nil, err - } - - res, err := httputil.PostWithContext(ctx, s.HTTPClient.Client, endpoint.String(), "application/json", bytes.NewBuffer(data)) - if err != nil { - return nil, err - } - defer res.Body.Close() - - var response GetContractMetadataResponse - err = json.NewDecoder(res.Body).Decode(&response) - if err != nil { - return nil, err - } - - if response.Error != nil { - return nil, response.Error - } - - return response.Result.Collections, nil -} diff --git a/pkg/portal/service/system_config.go b/pkg/portal/service/system_config.go index 6d49668c7c..536e294041 100644 --- a/pkg/portal/service/system_config.go +++ b/pkg/portal/service/system_config.go @@ -23,7 +23,6 @@ type SystemConfigProvider struct { AuthgearConfig *config.AuthgearConfig AppConfig *config.AppConfig SearchConfig *config.SearchConfig - Web3Config *config.Web3Config AuditLogConfig *config.AuditLogConfig AnalyticConfig *configlib.AnalyticConfig GTMConfig *config.GoogleTagManagerConfig @@ -59,7 +58,6 @@ func (p *SystemConfigProvider) SystemConfig() (*model.SystemConfig, error) { Themes: themes, Translations: translations, SearchEnabled: p.SearchConfig.Enabled, - Web3Enabled: p.Web3Config.Enabled, AuditLogEnabled: p.AuditLogConfig.Enabled, AnalyticEnabled: p.AnalyticConfig.Enabled, AnalyticEpoch: analyticEpoch, diff --git a/pkg/portal/wire_gen.go b/pkg/portal/wire_gen.go index fa245abe9d..3e6307b4e7 100644 --- a/pkg/portal/wire_gen.go +++ b/pkg/portal/wire_gen.go @@ -308,11 +308,6 @@ func newGraphQLHandler(p *deps.RequestProvider) http.Handler { GlobalDatabase: handle, UsageStore: globalDBStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - nftService := &service.NFTService{ - HTTPClient: httpClient, - APIEndpoint: nftIndexerAPIEndpoint, - } remoteIP := deps.ProvideRemoteIP(request, trustProxy) userAgentString := deps.ProvideUserAgentString(request) writeHandle := auditdb.NewWriteHandle(pool, databaseEnvironmentConfig, auditDatabaseCredentials, logFactory) @@ -356,7 +351,6 @@ func newGraphQLHandler(p *deps.RequestProvider) http.Handler { StripeService: libstripeService, SubscriptionService: subscriptionService, UsageService: usageService, - NFTService: nftService, DenoService: denoClientImpl, AuditService: auditService, OnboardService: onboardService, @@ -378,7 +372,6 @@ func newSystemConfigHandler(p *deps.RequestProvider) http.Handler { authgearConfig := rootProvider.AuthgearConfig appConfig := rootProvider.AppConfig searchConfig := rootProvider.SearchConfig - web3Config := rootProvider.Web3Config auditLogConfig := rootProvider.AuditLogConfig analyticConfig := rootProvider.AnalyticConfig googleTagManagerConfig := rootProvider.GoogleTagManagerConfig @@ -391,7 +384,6 @@ func newSystemConfigHandler(p *deps.RequestProvider) http.Handler { AuthgearConfig: authgearConfig, AppConfig: appConfig, SearchConfig: searchConfig, - Web3Config: web3Config, AuditLogConfig: auditLogConfig, AnalyticConfig: analyticConfig, GTMConfig: googleTagManagerConfig, diff --git a/pkg/redisqueue/wire_gen.go b/pkg/redisqueue/wire_gen.go index 1f0e485346..e46d974936 100644 --- a/pkg/redisqueue/wire_gen.go +++ b/pkg/redisqueue/wire_gen.go @@ -34,10 +34,8 @@ import ( "github.com/authgear/authgear-server/pkg/lib/feature/customattrs" "github.com/authgear/authgear-server/pkg/lib/feature/forgotpassword" passkey2 "github.com/authgear/authgear-server/pkg/lib/feature/passkey" - siwe2 "github.com/authgear/authgear-server/pkg/lib/feature/siwe" stdattrs2 "github.com/authgear/authgear-server/pkg/lib/feature/stdattrs" "github.com/authgear/authgear-server/pkg/lib/feature/verification" - "github.com/authgear/authgear-server/pkg/lib/feature/web3" "github.com/authgear/authgear-server/pkg/lib/hook" "github.com/authgear/authgear-server/pkg/lib/infra/db/appdb" "github.com/authgear/authgear-server/pkg/lib/infra/db/auditdb" @@ -219,36 +217,9 @@ func newUserImportService(ctx context.Context, p *deps.AppProvider) *userimport. SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -356,6 +327,15 @@ func newUserImportService(ctx context.Context, p *deps.AppProvider) *userimport. Clock: clock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clock, AppID: appID, @@ -430,13 +410,6 @@ func newUserImportService(ctx context.Context, p *deps.AppProvider) *userimport. UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -453,7 +426,6 @@ func newUserImportService(ctx context.Context, p *deps.AppProvider) *userimport. Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolverImpl := &event.ResolverImpl{ @@ -673,8 +645,8 @@ func newUserImportService(ctx context.Context, p *deps.AppProvider) *userimport. AppID: appID, Clock: clock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -723,7 +695,6 @@ func newUserImportService(ctx context.Context, p *deps.AppProvider) *userimport. UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -739,7 +710,7 @@ func newUserImportService(ctx context.Context, p *deps.AppProvider) *userimport. SQLExecutor: sqlExecutor, } storeRedisLogger := idpsession.NewStoreRedisLogger(factory) - idpsessionStoreRedis := &idpsession.StoreRedis{ + storeRedis := &idpsession.StoreRedis{ Redis: appredisHandle, AppID: appID, Clock: clock, @@ -750,7 +721,7 @@ func newUserImportService(ctx context.Context, p *deps.AppProvider) *userimport. cookieManager := deps.NewCookieManager(request, trustProxy, httpConfig) cookieDef := session.NewSessionCookieDef(sessionConfig) idpsessionManager := &idpsession.Manager{ - Store: idpsessionStoreRedis, + Store: storeRedis, Config: sessionConfig, Cookies: cookieManager, CookieDef: cookieDef, @@ -789,7 +760,7 @@ func newUserImportService(ctx context.Context, p *deps.AppProvider) *userimport. UserAgentString: userAgentString, AppID: appID, Redis: appredisHandle, - Store: idpsessionStoreRedis, + Store: storeRedis, AccessEvents: eventProvider, MeterService: meterService, TrustProxy: trustProxy, @@ -1029,38 +1000,9 @@ func newUserExportService(ctx context.Context, p *deps.AppProvider) *userexport. SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRedisQueueRemoteIP() - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - factory := p.LoggerFactory - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -1097,7 +1039,8 @@ func newUserExportService(ctx context.Context, p *deps.AppProvider) *userexport. } authenticatorConfig := appConfig.Authenticator authenticatorPasswordConfig := authenticatorConfig.Password - passwordLogger := password.NewLogger(factory) + factory := p.LoggerFactory + logger := password.NewLogger(factory) historyStore := &password.HistoryStore{ Clock: clockClock, SQLBuilder: sqlBuilderApp, @@ -1116,7 +1059,7 @@ func newUserExportService(ctx context.Context, p *deps.AppProvider) *userexport. Store: passwordStore, Config: authenticatorPasswordConfig, Clock: clockClock, - Logger: passwordLogger, + Logger: logger, PasswordHistory: historyStore, PasswordChecker: passwordChecker, Expiry: expiry, @@ -1152,6 +1095,7 @@ func newUserExportService(ctx context.Context, p *deps.AppProvider) *userexport. } testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode + remoteIP := deps.ProvideRedisQueueRemoteIP() codeStoreRedis := &otp.CodeStoreRedis{ Redis: appredisHandle, AppID: appID, @@ -1168,6 +1112,15 @@ func newUserExportService(ctx context.Context, p *deps.AppProvider) *userexport. Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -1241,13 +1194,6 @@ func newUserExportService(ctx context.Context, p *deps.AppProvider) *userexport. UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -1264,11 +1210,10 @@ func newUserExportService(ctx context.Context, p *deps.AppProvider) *userexport. Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } userexportLogger := userexport.NewLogger(factory) - userexportHTTPClient := userexport.NewHTTPClient() + httpClient := userexport.NewHTTPClient() userExportObjectStoreConfig := environmentConfig.UserExportObjectStore userExportCloudStorage := userexport.NewCloudStorage(userExportObjectStoreConfig, clockClock) userExportService := &userexport.UserExportService{ @@ -1277,7 +1222,7 @@ func newUserExportService(ctx context.Context, p *deps.AppProvider) *userexport. UserQueries: userQueries, Logger: userexportLogger, HTTPOrigin: httpOrigin, - HTTPClient: userexportHTTPClient, + HTTPClient: httpClient, CloudStorage: userExportCloudStorage, Clock: clockClock, } @@ -1427,37 +1372,9 @@ func newSearchReindexer(ctx context.Context, p *deps.AppProvider) *reindex.Reind SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRedisQueueRemoteIP() - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -1494,7 +1411,7 @@ func newSearchReindexer(ctx context.Context, p *deps.AppProvider) *reindex.Reind } authenticatorConfig := appConfig.Authenticator authenticatorPasswordConfig := authenticatorConfig.Password - passwordLogger := password.NewLogger(factory) + logger := password.NewLogger(factory) historyStore := &password.HistoryStore{ Clock: clockClock, SQLBuilder: sqlBuilderApp, @@ -1513,7 +1430,7 @@ func newSearchReindexer(ctx context.Context, p *deps.AppProvider) *reindex.Reind Store: passwordStore, Config: authenticatorPasswordConfig, Clock: clockClock, - Logger: passwordLogger, + Logger: logger, PasswordHistory: historyStore, PasswordChecker: passwordChecker, Expiry: expiry, @@ -1549,6 +1466,7 @@ func newSearchReindexer(ctx context.Context, p *deps.AppProvider) *reindex.Reind } testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode + remoteIP := deps.ProvideRedisQueueRemoteIP() codeStoreRedis := &otp.CodeStoreRedis{ Redis: appredisHandle, AppID: appID, @@ -1565,6 +1483,15 @@ func newSearchReindexer(ctx context.Context, p *deps.AppProvider) *reindex.Reind Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -1639,13 +1566,6 @@ func newSearchReindexer(ctx context.Context, p *deps.AppProvider) *reindex.Reind UserQueries: rawQueries, UserStore: store, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -1662,7 +1582,6 @@ func newSearchReindexer(ctx context.Context, p *deps.AppProvider) *reindex.Reind Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } sourceProvider := &reindex.SourceProvider{ diff --git a/pkg/resolver/wire_gen.go b/pkg/resolver/wire_gen.go index de9d4dc074..9aa4286856 100644 --- a/pkg/resolver/wire_gen.go +++ b/pkg/resolver/wire_gen.go @@ -34,10 +34,8 @@ import ( "github.com/authgear/authgear-server/pkg/lib/feature/customattrs" "github.com/authgear/authgear-server/pkg/lib/feature/forgotpassword" passkey2 "github.com/authgear/authgear-server/pkg/lib/feature/passkey" - siwe2 "github.com/authgear/authgear-server/pkg/lib/feature/siwe" stdattrs2 "github.com/authgear/authgear-server/pkg/lib/feature/stdattrs" "github.com/authgear/authgear-server/pkg/lib/feature/verification" - "github.com/authgear/authgear-server/pkg/lib/feature/web3" "github.com/authgear/authgear-server/pkg/lib/healthz" "github.com/authgear/authgear-server/pkg/lib/hook" "github.com/authgear/authgear-server/pkg/lib/infra/db/appdb" @@ -343,36 +341,9 @@ func newSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - web3Config := appConfig.Web3 - siweStoreRedis := &siwe2.StoreRedis{ - Redis: handle, - AppID: appID, - Clock: clock, - } - ratelimitLogger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(handle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: ratelimitLogger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clock, - NonceStore: siweStoreRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -480,6 +451,15 @@ func newSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { Clock: clock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(handle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clock, AppID: appID, @@ -554,13 +534,6 @@ func newSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -577,7 +550,6 @@ func newSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } idTokenIssuer := &oidc.IDTokenIssuer{ @@ -807,8 +779,8 @@ func newSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { AppID: appID, Clock: clock, } - whatsappHTTPClient := whatsapp.NewHTTPClient() - onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, whatsappHTTPClient) + httpClient := whatsapp.NewHTTPClient() + onPremisesClient := whatsapp.NewWhatsappOnPremisesClient(whatsappConfig, whatsappOnPremisesCredentials, tokenStore, httpClient) whatsappService := &whatsapp.Service{ Logger: serviceLogger, WhatsappConfig: whatsappConfig, @@ -857,7 +829,6 @@ func newSessionMiddleware(p *deps.RequestProvider) httproute.Middleware { UserProfileConfig: userProfileConfig, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } stdattrsService := &stdattrs2.Service{ @@ -1109,38 +1080,9 @@ func newSessionResolveHandler(p *deps.RequestProvider) http.Handler { SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, } - remoteIP := deps.ProvideRemoteIP(request, trustProxy) - web3Config := appConfig.Web3 - storeRedis := &siwe2.StoreRedis{ - Redis: appredisHandle, - AppID: appID, - Clock: clockClock, - } - factory := appProvider.LoggerFactory - logger := ratelimit.NewLogger(factory) - storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) - rateLimitsFeatureConfig := featureConfig.RateLimits - limiter := &ratelimit.Limiter{ - Logger: logger, - Storage: storageRedis, - AppID: appID, - Config: rateLimitsFeatureConfig, - } - siweLogger := siwe2.NewLogger(factory) - siweService := &siwe2.Service{ - RemoteIP: remoteIP, - HTTPOrigin: httpOrigin, - Web3Config: web3Config, - AuthenticationConfig: authenticationConfig, - Clock: clockClock, - NonceStore: storeRedis, - RateLimiter: limiter, - Logger: siweLogger, - } siweProvider := &siwe.Provider{ Store: siweStore, Clock: clockClock, - SIWE: siweService, } ldapStore := &ldap.Store{ SQLBuilder: sqlBuilderApp, @@ -1179,6 +1121,7 @@ func newSessionResolveHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, ClaimStore: storePQ, } + factory := appProvider.LoggerFactory resolveHandlerLogger := handler.NewResolveHandlerLogger(factory) userStore := &user.Store{ SQLBuilder: sqlBuilderApp, @@ -1199,7 +1142,7 @@ func newSessionResolveHandler(p *deps.RequestProvider) http.Handler { } authenticatorConfig := appConfig.Authenticator authenticatorPasswordConfig := authenticatorConfig.Password - passwordLogger := password.NewLogger(factory) + logger := password.NewLogger(factory) historyStore := &password.HistoryStore{ Clock: clockClock, SQLBuilder: sqlBuilderApp, @@ -1218,7 +1161,7 @@ func newSessionResolveHandler(p *deps.RequestProvider) http.Handler { Store: passwordStore, Config: authenticatorPasswordConfig, Clock: clockClock, - Logger: passwordLogger, + Logger: logger, PasswordHistory: historyStore, PasswordChecker: passwordChecker, Expiry: expiry, @@ -1254,6 +1197,7 @@ func newSessionResolveHandler(p *deps.RequestProvider) http.Handler { } testModeConfig := appConfig.TestMode testModeFeatureConfig := featureConfig.TestMode + remoteIP := deps.ProvideRemoteIP(request, trustProxy) codeStoreRedis := &otp.CodeStoreRedis{ Redis: appredisHandle, AppID: appID, @@ -1270,6 +1214,15 @@ func newSessionResolveHandler(p *deps.RequestProvider) http.Handler { Clock: clockClock, } otpLogger := otp.NewLogger(factory) + ratelimitLogger := ratelimit.NewLogger(factory) + storageRedis := ratelimit.NewAppStorageRedis(appredisHandle) + rateLimitsFeatureConfig := featureConfig.RateLimits + limiter := &ratelimit.Limiter{ + Logger: ratelimitLogger, + Storage: storageRedis, + AppID: appID, + Config: rateLimitsFeatureConfig, + } otpService := &otp.Service{ Clock: clockClock, AppID: appID, @@ -1332,13 +1285,6 @@ func newSessionResolveHandler(p *deps.RequestProvider) http.Handler { UserQueries: rawQueries, UserStore: userStore, } - nftIndexerAPIEndpoint := environmentConfig.NFTIndexerAPIEndpoint - httpClient := web3.NewHTTPClient() - web3Service := &web3.Service{ - APIEndpoint: nftIndexerAPIEndpoint, - Web3Config: web3Config, - HTTPClient: httpClient, - } rolesgroupsStore := &rolesgroups.Store{ SQLBuilder: sqlBuilderApp, SQLExecutor: sqlExecutor, @@ -1355,7 +1301,6 @@ func newSessionResolveHandler(p *deps.RequestProvider) http.Handler { Verification: verificationService, StandardAttributes: serviceNoEvent, CustomAttributes: customattrsServiceNoEvent, - Web3: web3Service, RolesAndGroups: queries, } resolveHandler := &handler.ResolveHandler{ diff --git a/pkg/util/web3/eip55.go b/pkg/util/web3/eip55.go index ade5f3eea9..b38b2e849e 100644 --- a/pkg/util/web3/eip55.go +++ b/pkg/util/web3/eip55.go @@ -4,8 +4,6 @@ import ( "fmt" "regexp" - "github.com/ethereum/go-ethereum/common" - "github.com/authgear/authgear-server/pkg/util/hexstring" ) @@ -24,7 +22,7 @@ func NewEIP55(s string) (EIP55, error) { return EIP55("0x0"), nil } - address := common.HexToAddress(s) + address := HexToAddress(s) return EIP55(address.Hex()), nil } diff --git a/pkg/util/web3/eip55_vendor.go b/pkg/util/web3/eip55_vendor.go new file mode 100644 index 0000000000..3ff419c77a --- /dev/null +++ b/pkg/util/web3/eip55_vendor.go @@ -0,0 +1,83 @@ +package web3 + +// The file contains the vendored code from "github.com/ethereum/go-ethereum/common" +// The entrypoint is HexToAddress and Address.Hex. + +import ( + "encoding/hex" + + "golang.org/x/crypto/sha3" +) + +const ( + // AddressLength is the expected length of the address + AddressLength = 20 +) + +type Address [AddressLength]byte + +func (a *Address) SetBytes(b []byte) { + if len(b) > len(a) { + b = b[len(b)-AddressLength:] + } + copy(a[AddressLength-len(b):], b) +} + +func (a Address) Hex() string { + return string(a.checksumHex()) +} + +func (a Address) hex() []byte { + var buf [len(a)*2 + 2]byte + copy(buf[:2], "0x") + hex.Encode(buf[2:], a[:]) + return buf[:] +} + +func (a *Address) checksumHex() []byte { + buf := a.hex() + + // compute checksum + sha := sha3.NewLegacyKeccak256() + sha.Write(buf[2:]) + hash := sha.Sum(nil) + for i := 2; i < len(buf); i++ { + hashByte := hash[(i-2)/2] + if i%2 == 0 { + hashByte = hashByte >> 4 + } else { + hashByte &= 0xf + } + if buf[i] > '9' && hashByte > 7 { + buf[i] -= 32 + } + } + return buf[:] +} + +func BytesToAddress(b []byte) Address { + var a Address + a.SetBytes(b) + return a +} + +func HexToAddress(s string) Address { return BytesToAddress(FromHex(s)) } + +func FromHex(s string) []byte { + if has0xPrefix(s) { + s = s[2:] + } + if len(s)%2 == 1 { + s = "0" + s + } + return Hex2Bytes(s) +} + +func has0xPrefix(str string) bool { + return len(str) >= 2 && str[0] == '0' && (str[1] == 'x' || str[1] == 'X') +} + +func Hex2Bytes(str string) []byte { + h, _ := hex.DecodeString(str) + return h +} diff --git a/portal/src/AppRoot.tsx b/portal/src/AppRoot.tsx index fefb5929c9..b00a7272d4 100644 --- a/portal/src/AppRoot.tsx +++ b/portal/src/AppRoot.tsx @@ -123,9 +123,6 @@ const AdminAPIConfigurationScreen = lazy( const LoginMethodConfigurationScreen = lazy( async () => import("./graphql/portal/LoginMethodConfigurationScreen") ); -const Web3ConfigurationScreen = lazy( - async () => import("./graphql/portal/Web3ConfigurationScreen") -); const BiometricConfigurationScreen = lazy( async () => import("./graphql/portal/BiometricConfigurationScreen") ); @@ -564,14 +561,6 @@ const AppRoot: React.VFC = function AppRoot() { } /> - }> - - - } - /> = function ScreenNav(props) { false; const skippedTutorial = app?.tutorialStatus.data.skipped === true; - const { auditLogEnabled, analyticEnabled, web3Enabled } = useSystemConfig(); + const { auditLogEnabled, analyticEnabled } = useSystemConfig(); const app2appEnabled = useMemo(() => { if (effectiveFeatureConfig != null) { @@ -220,15 +220,6 @@ const ScreenNav: React.VFC = function ScreenNav(props) { textKey: "ScreenNav.mfa", url: `/project/${appID}/configuration/authentication/2fa`, }, - ...(web3Enabled - ? [ - { - type: "link" as const, - textKey: "ScreenNav.web3", - url: `/project/${appID}/configuration/authentication/web3`, - }, - ] - : []), { type: "link" as const, textKey: "ScreenNav.anonymous-users", @@ -387,7 +378,6 @@ const ScreenNav: React.VFC = function ScreenNav(props) { skippedTutorial, appID, analyticEnabled, - web3Enabled, app2appEnabled, showIntegrations, auditLogEnabled, diff --git a/portal/src/graphql/adminapi/NFTCollectionDetailDialog.tsx b/portal/src/graphql/adminapi/NFTCollectionDetailDialog.tsx deleted file mode 100644 index 3cbc045182..0000000000 --- a/portal/src/graphql/adminapi/NFTCollectionDetailDialog.tsx +++ /dev/null @@ -1,168 +0,0 @@ -import React, { useCallback, useContext, useMemo } from "react"; -import { - DetailsList, - Dialog, - DialogFooter, - IColumn, - IDialogContentProps, - SelectionMode, -} from "@fluentui/react"; -import { NFTContract, NFTToken } from "../../types"; -import { truncateAddress } from "../../util/hex"; - -import { FormattedMessage, Context } from "@oursky/react-messageformat"; -import { useSystemConfig } from "../../context/SystemConfigContext"; -import ExternalLink from "../../ExternalLink"; -import { explorerBlock, explorerTx } from "../../util/eip681"; -import DefaultButton from "../../DefaultButton"; - -const DIALOG_MAX_WIDTH = "80%"; - -interface NFTCollectionDetailDialogProps { - contract: NFTContract; - tokens: NFTToken[]; - eip681String: string; - - isVisible: boolean; - onDismiss: () => void; -} - -const NFTCollectionDetailDialog: React.VFC = ( - props -) => { - const { contract, tokens, eip681String, isVisible, onDismiss } = props; - const { themes } = useSystemConfig(); - const { renderToString } = useContext(Context); - - const dialogContentProps: IDialogContentProps = useMemo(() => { - return { - title: `${contract.name} (${truncateAddress(contract.address)})`, - }; - }, [contract]); - - const columns = useMemo(() => { - return [ - { - key: "token-id", - name: renderToString( - "UserDetails.connected-identities.siwe.nft-collections.token-id" - ), - minWidth: 100, - maxWidth: 100, - }, - { - key: "transcation-hash", - name: renderToString( - "UserDetails.connected-identities.siwe.nft-collections.transaction-hash" - ), - minWidth: 221, - maxWidth: 221, - }, - { - key: "balance", - name: renderToString( - "UserDetails.connected-identities.siwe.nft-collections.balance" - ), - minWidth: 60, - maxWidth: 60, - }, - { - key: "block-index", - name: renderToString( - "UserDetails.connected-identities.siwe.nft-collections.block" - ), - minWidth: 100, - maxWidth: 100, - }, - { - key: "timestamp", - name: renderToString( - "UserDetails.connected-identities.siwe.nft-collections.timestamp" - ), - minWidth: 205, - maxWidth: 205, - }, - ]; - }, [renderToString]); - - const onRenderItemColumn = useCallback( - (item?: NFTToken, _index?: number, column?: IColumn) => { - if (item == null) { - return null; - } - - switch (column?.key) { - case "token-id": - return ( - - {truncateAddress(item.token_id)} - - ); - case "transcation-hash": - return ( - - {truncateAddress(item.transaction_identifier.hash)} - - ); - case "balance": - return ( - - {item.balance} - - ); - case "block-index": - return ( - - {item.block_identifier.index} - - ); - case "timestamp": - return ( - - {item.block_identifier.timestamp} - - ); - default: - return null; - } - }, - [ - eip681String, - themes.main.palette.neutralDark, - themes.main.palette.neutralSecondary, - ] - ); - - return ( - - ); -}; - -export default NFTCollectionDetailDialog; diff --git a/portal/src/graphql/adminapi/UserDetailSummary.tsx b/portal/src/graphql/adminapi/UserDetailSummary.tsx index 3a7ada0330..dfb2dd1958 100644 --- a/portal/src/graphql/adminapi/UserDetailSummary.tsx +++ b/portal/src/graphql/adminapi/UserDetailSummary.tsx @@ -7,8 +7,6 @@ import { Context, FormattedMessage } from "@oursky/react-messageformat"; import { formatDatetime } from "../../util/formatDatetime"; import styles from "./UserDetailSummary.module.css"; -import { explorerAddress, parseEIP681 } from "../../util/eip681"; -import ExternalLink from "../../ExternalLink"; const warnBadgeStyle: IStyle = { padding: 4, @@ -17,16 +15,6 @@ const warnBadgeStyle: IStyle = { backgroundColor: "#e23d3d", }; -function shouldRenderExplorerURL(addressURL: string): boolean { - try { - parseEIP681(addressURL); - } catch { - return false; - } - - return true; -} - interface UserDetailSummaryProps { className?: string; isAnonymous: boolean; @@ -108,16 +96,7 @@ const UserDetailSummary: React.VFC = ) : null} {rawUserID} - {endUserAccountIdentifier && - shouldRenderExplorerURL(endUserAccountIdentifier) ? ( - - - {endUserAccountIdentifier} - - - ) : ( - {endUserAccountIdentifier ?? ""} - )} + {endUserAccountIdentifier ?? ""} {formattedName ? formattedName : ""} diff --git a/portal/src/graphql/adminapi/UserDetailsConnectedIdentities.module.css b/portal/src/graphql/adminapi/UserDetailsConnectedIdentities.module.css index 5ffbb97aa1..34ea2fffa2 100644 --- a/portal/src/graphql/adminapi/UserDetailsConnectedIdentities.module.css +++ b/portal/src/graphql/adminapi/UserDetailsConnectedIdentities.module.css @@ -106,26 +106,6 @@ flex-direction: row; } -.NFTListCell { - display: flex; - flex-direction: column; - margin: 4px 0; -} - -.NFTListCellBtn { - margin-top: 8px; -} - -.NFTListCellBtnLabel { - color: inherit; -} - -.NFTListHeader { - display: flex; - margin-top: 12px; - font-weight: 600; -} - .buttonGroup { grid-area: button-group; display: grid; diff --git a/portal/src/graphql/adminapi/UserDetailsConnectedIdentities.tsx b/portal/src/graphql/adminapi/UserDetailsConnectedIdentities.tsx index 5d6d927924..b3bf639c5e 100644 --- a/portal/src/graphql/adminapi/UserDetailsConnectedIdentities.tsx +++ b/portal/src/graphql/adminapi/UserDetailsConnectedIdentities.tsx @@ -20,29 +20,14 @@ import DefaultButton from "../../DefaultButton"; import { useDeleteIdentityMutation } from "./mutations/deleteIdentityMutation"; import { useSetVerifiedStatusMutation } from "./mutations/setVerifiedStatusMutation"; import { formatDatetime } from "../../util/formatDatetime"; -import { - LoginIDKeyType, - NFT, - NFTContract, - NFTToken, - OAuthSSOProviderType, - Web3Claims, -} from "../../types"; +import { LoginIDKeyType, OAuthSSOProviderType } from "../../types"; import { UserQueryNodeFragment } from "./query/userQuery.generated"; import styles from "./UserDetailsConnectedIdentities.module.css"; import { useSystemConfig } from "../../context/SystemConfigContext"; import { useIsLoading, useLoading } from "../../hook/loading"; import { useProvideError } from "../../hook/error"; -import { - createEIP681URL, - explorerAddress, - parseEIP681, -} from "../../util/eip681"; import ExternalLink, { ExternalLinkProps } from "../../ExternalLink"; -import { truncateAddress } from "../../util/hex"; -import LinkButton from "../../LinkButton"; -import NFTCollectionDetailDialog from "./NFTCollectionDetailDialog"; // Always disable virtualization for List component, as it wont work properly with mobile view const onShouldVirtualize = () => { @@ -81,7 +66,6 @@ interface UserDetailsConnectedIdentitiesProps { identities: Identity[]; verifiedClaims: VerifiedClaims; availableLoginIdIdentities: string[]; - web3Claims: Web3Claims; } // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -100,7 +84,6 @@ type IdentityListItem = | LoginIDIdentityListItem | BiometricIdentityListItem | AnonymousIdentityListItem - | SIWEIdentityListItem | LDAPIdentityListItem; interface OAuthIdentityListItem { id: string; @@ -138,16 +121,6 @@ interface AnonymousIdentityListItem { connectedOn: string; } -interface SIWEIdentityListItem { - id: string; - type: "siwe"; - address: string; - chainId: number; - verified: undefined; - connectedOn: string; - nfts: NFT[] | undefined; -} - interface LDAPIdentityListItem { id: string; type: "ldap"; @@ -165,7 +138,6 @@ export interface IdentityLists { username: LoginIDIdentityListItem[]; biometric: BiometricIdentityListItem[]; anonymous: AnonymousIdentityListItem[]; - siwe: SIWEIdentityListItem[]; ldap: LDAPIdentityListItem[]; } @@ -201,7 +173,6 @@ const loginIdIconMap: Record = { const biometricIcon: React.ReactNode = ; const anonymousIcon: React.ReactNode = ; -const siweIcon: React.ReactNode = ; const ldapIcon: React.ReactNode = ; const removeButtonTextId: Record = { @@ -236,8 +207,6 @@ function getIdentityName( return renderToString( "UserDetails.connected-identities.anonymous.anonymous-user" ); - case "siwe": - return createEIP681URL({ chainId: item.chainId, address: item.address }); case "ldap": return item.lastLoginUserName ?? ""; default: @@ -297,109 +266,6 @@ const VerifyButton: React.VFC = function VerifyButton( ); }; -interface NFTCollectionListCellProps { - contract: NFTContract; - tokens: NFTToken[]; - eip681String: string; -} - -const NFTCollectionListCell: React.VFC = ( - props -) => { - const { contract, tokens, eip681String } = props; - const [isDetailDialogVisible, setIsDetailDialogVisible] = useState(false); - - const eip681 = useMemo(() => parseEIP681(eip681String), [eip681String]); - - const contractEIP681 = useMemo( - () => - createEIP681URL({ address: contract.address, chainId: eip681.chainId }), - [contract.address, eip681.chainId] - ); - - const openDetailDialog = useCallback(() => { - setIsDetailDialogVisible(true); - }, []); - - const onDismissDetailDialog = useCallback(() => { - setIsDetailDialogVisible(false); - }, []); - - return ( -
- - - - - - - - - - - -
- ); -}; - -interface NFTCollectionListProps { - nfts?: NFT[]; - eip681String: string; -} - -const NFTCollectionList: React.VFC = (props) => { - const { nfts, eip681String } = props; - - const onRenderCollectionCell = useCallback( - (item?: NFT, _index?: number): React.ReactNode => { - if (item == null) { - return null; - } - - return ( - - ); - }, - [eip681String] - ); - - if (nfts == null || nfts.length === 0) { - return null; - } - - return ( -
- - - - -
- ); -}; - interface BaseIdentityListCellTitleProps { icon?: React.ReactNode; as?: "ExternalLink" | "Text"; @@ -818,59 +684,6 @@ const OAuthIdentityListCell: React.VFC = ( ); }; -interface SIWEIdentityListCellProps extends BaseIdentityListCellProps { - nfts?: NFT[]; -} - -const SIWEIdentityListCell: React.VFC = (props) => { - const { - icon, - identityID, - identityType, - identityName, - verified, - connectedOn, - nfts, - setVerifiedStatus, - onRemoveClicked, - } = props; - - const externalLinkProps: ExternalLinkProps = useMemo(() => { - return { - href: explorerAddress(identityName), - }; - }, [identityName]); - - return ( - - - {identityName} - - -
- - -
-
- -
- ); -}; - interface LDAPIdentityListCellProps { icon: React.ReactNode; identityID: string; @@ -916,12 +729,7 @@ const UserDetailsConnectedIdentities: React.VFC - account.account_identifier?.address === formattedAddress - )?.nfts; - siweIdentityList.push({ - id: identity.id, - type: "siwe", - verified: undefined, - address: formattedAddress, - chainId: formattedChainId, - connectedOn: createdAtStr, - nfts: nfts, - }); - } if (identity.type === "LDAP") { ldapIdentityList.push({ id: identity.id, @@ -1126,10 +912,9 @@ const UserDetailsConnectedIdentities: React.VFC { @@ -1250,20 +1035,6 @@ const UserDetailsConnectedIdentities: React.VFC ); - case "siwe": - return ( - - ); case "ldap": return ( - {identityLists.siwe.length === 0 ? ( - - } - /> - ) : null} + + } + />
{identityLists.oauth.length > 0 ? ( @@ -1440,18 +1209,6 @@ const UserDetailsConnectedIdentities: React.VFC ) : null} - {identityLists.siwe.length > 0 ? ( -
- - - - -
- ) : null} {identityLists.ldap.length > 0 ? (
diff --git a/portal/src/graphql/adminapi/UserDetailsScreen.module.css b/portal/src/graphql/adminapi/UserDetailsScreen.module.css index e896e0945e..54f29908e5 100644 --- a/portal/src/graphql/adminapi/UserDetailsScreen.module.css +++ b/portal/src/graphql/adminapi/UserDetailsScreen.module.css @@ -6,10 +6,6 @@ @apply flex flex-col; } -.siweEnabledTabWarningMessageBar { - @apply mt-5; -} - .screenContent { @apply flex-1-0-auto; diff --git a/portal/src/graphql/adminapi/UserDetailsScreen.tsx b/portal/src/graphql/adminapi/UserDetailsScreen.tsx index abe282e6f7..23a4068b53 100644 --- a/portal/src/graphql/adminapi/UserDetailsScreen.tsx +++ b/portal/src/graphql/adminapi/UserDetailsScreen.tsx @@ -48,7 +48,6 @@ import { extractRawID } from "../../util/graphql"; import styles from "./UserDetailsScreen.module.css"; import { makeInvariantViolatedErrorParseRule } from "../../error/parse"; -import { IdentityType } from "./globalTypes.generated"; import AnonymizeUserDialog from "./AnonymizeUserDialog"; import UserDetailsScreenGroupListContainer from "../../components/roles-and-groups/list/UserDetailsScreenGroupListContainer"; import UserDetailsScreenRoleListContainer from "../../components/roles-and-groups/list/UserDetailsScreenRoleListContainer"; @@ -302,8 +301,6 @@ const UserDetails: React.VFC = function UserDetails( [setState] ); - const web3Claims = data.web3; - const verifiedClaims = data.verifiedClaims; const identities = useMemo( @@ -334,11 +331,6 @@ const UserDetails: React.VFC = function UserDetails( return level === "readwrite"; }, [standardAttributeAccessControl]); - const isSIWEIdentity = useMemo( - () => identities.some((i) => i.type === IdentityType.Siwe), - [identities] - ); - const dataStatusBadgeTextId = React.useMemo(() => { let badgeTextId = null; if (data.isDisabled) { @@ -443,19 +435,13 @@ const UserDetails: React.VFC = function UserDetails( itemKey={ACCOUNT_SECURITY_PIVOT_KEY} headerText={renderToString("UserDetails.account-security.header")} > - {isSIWEIdentity ? ( - - - - ) : ( - - )} + = function UserDetails( identities={identities} verifiedClaims={verifiedClaims} availableLoginIdIdentities={availableLoginIdIdentities} - web3Claims={web3Claims} /> Promise; - probeCollection: (contractId: string) => Promise; - onAdd: (collection: CollectionItem) => void; - onDismiss: () => void; -} - -const Web3ConfigurationAddCollectionForm: React.VFC = - function Web3ConfigurationAddCollectionForm(props) { - const { renderToString } = useContext(Context); - - const { - onAdd, - onDismiss, - fetchMetadata, - probeCollection, - initialValues = defaultValues, - className, - selectedNetwork, - } = props; - - const { - hidden: contactUsDialogHidden, - onDismiss: onDismissContactUsDialog, - } = useErrorDialog({ - parentJSONPointer: "", - fieldName: "", - rules: [makeReasonErrorParseRule("AlchemyProtocol", "")], - }); - - const [validationErrorId, setValidationErrorId] = useState( - null - ); - const [activeDialog, setActiveDialog] = useState< - "largeCollection" | "tokenTracking" | null - >(null); - const [isLoading, setIsLoading] = useState(false); - const [values, setValues] = - useState(initialValues); - - const buildContractID = useCallback( - (address: string): string => { - const contractId = { - blockchain: selectedNetwork.blockchain, - network: selectedNetwork.network, - address: address, - }; - - return createContractIDURL(contractId); - }, - [selectedNetwork] - ); - - const isModified = useMemo(() => { - return values.contractAddress !== ""; - }, [values]); - - const resetValues = useCallback(() => { - setValues(initialValues); - }, [initialValues, setValues]); - - const onChangeContractAddress = useCallback( - (_e, newValue) => { - if (newValue != null) { - setValues((prev) => ({ ...prev, contractAddress: newValue })); - } - }, - [setValues] - ); - - const dismissDialogs = useCallback(() => { - setActiveDialog(null); - }, []); - - const handleAddCollection = useCallback( - async (tokenIDs?: string[]) => { - setIsLoading(true); - setValidationErrorId(null); - dismissDialogs(); - - let contractID: string; - try { - contractID = buildContractID(values.contractAddress); - } catch (_: unknown) { - setValidationErrorId("errors.invalid-address"); - setIsLoading(false); - return; - } - - try { - const probeResult = await probeCollection(contractID); - if (probeResult) { - setActiveDialog("largeCollection"); - setIsLoading(false); - return; - } - - const metadata = await fetchMetadata(contractID); - if (!metadata) { - setIsLoading(false); - return; - } - - if (metadata.tokenType === "erc1155" && !tokenIDs?.length) { - setActiveDialog("tokenTracking"); - setIsLoading(false); - return; - } - - onAdd({ - ...metadata, - createdAt: DateTime.now().toISO(), - tokenIDs: tokenIDs ?? [], - status: "pending", - }); - } catch (_: unknown) { - // Error handled by parent component - setIsLoading(false); - return; - } - - setIsLoading(false); - resetValues(); - }, - [ - buildContractID, - dismissDialogs, - fetchMetadata, - onAdd, - probeCollection, - resetValues, - values.contractAddress, - ] - ); - - const onAddCollection = useCallback( - (e) => { - e.preventDefault(); - e.stopPropagation(); - - handleAddCollection().catch(() => {}); - }, - [handleAddCollection] - ); - - const onCancel = useCallback( - (e) => { - e.preventDefault(); - e.stopPropagation(); - onDismiss(); - }, - [onDismiss] - ); - - return ( - <> -
- -
- - ) : ( - - ) - } - /> - } - /> -
- - - - - - ); - }; - -export default Web3ConfigurationAddCollectionForm; diff --git a/portal/src/graphql/portal/Web3ConfigurationCollectionDeletionDialog.module.css b/portal/src/graphql/portal/Web3ConfigurationCollectionDeletionDialog.module.css deleted file mode 100644 index 74b0213dd0..0000000000 --- a/portal/src/graphql/portal/Web3ConfigurationCollectionDeletionDialog.module.css +++ /dev/null @@ -1,23 +0,0 @@ -.contentContainer { - @apply flex flex-col gap-y-5; -} - -.contractAddressContainer { - @apply overflow-hidden text-ellipsis break-all whitespace-nowrap; -} - -.fieldContainer { - @apply flex flex-col gap-y-1; -} - -.fieldTitle { - @apply font-bold; -} - -.removeCollectionButton { - @apply p-0; -} - -.removeCollectionButtonContainer { - @apply -mx-1; -} diff --git a/portal/src/graphql/portal/Web3ConfigurationCollectionDeletionDialog.tsx b/portal/src/graphql/portal/Web3ConfigurationCollectionDeletionDialog.tsx deleted file mode 100644 index 7118b7f20a..0000000000 --- a/portal/src/graphql/portal/Web3ConfigurationCollectionDeletionDialog.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import React, { useCallback, useContext, useMemo } from "react"; -import { Dialog, DialogFooter } from "@fluentui/react"; -import { Context, FormattedMessage } from "@oursky/react-messageformat"; -import DefaultButton from "../../DefaultButton"; -import { useSystemConfig } from "../../context/SystemConfigContext"; -import { getNetworkNameID } from "../../util/networkId"; -import PrimaryButton from "../../PrimaryButton"; -import { truncateAddress } from "../../util/hex"; -import { CollectionItem } from "./Web3ConfigurationScreen"; - -interface Web3ConfigurationCollectionDeletionDialogProps { - nftCollection: CollectionItem; - - isVisible: boolean; - onConfirm: (nftCollection: CollectionItem) => void; - onDismiss: () => void; -} - -const Web3ConfigurationCollectionDeletionDialog: React.VFC = - function Web3ConfigurationCollectionDeletionDialog(props) { - const { nftCollection, isVisible, onConfirm, onDismiss } = props; - - const { themes } = useSystemConfig(); - const { renderToString } = useContext(Context); - - const dialogContentProps = useMemo(() => { - const networkNameId = getNetworkNameID(nftCollection); - return { - title: renderToString("Web3ConfigurationScreen.deletion-dialog.title"), - subText: renderToString( - "Web3ConfigurationScreen.deletion-dialog.description", - { - collection: renderToString("NftCollection.item.identifier", { - name: nftCollection.name, - network: renderToString(networkNameId), - address: truncateAddress(nftCollection.contractAddress), - }), - } - ), - }; - }, [nftCollection, renderToString]); - - const onConfirmDelete = useCallback(() => { - onConfirm(nftCollection); - }, [nftCollection, onConfirm]); - - return ( - - ); - }; - -export default Web3ConfigurationCollectionDeletionDialog; diff --git a/portal/src/graphql/portal/Web3ConfigurationConfirmationDialog.module.css b/portal/src/graphql/portal/Web3ConfigurationConfirmationDialog.module.css deleted file mode 100644 index 19667ff4bd..0000000000 --- a/portal/src/graphql/portal/Web3ConfigurationConfirmationDialog.module.css +++ /dev/null @@ -1,31 +0,0 @@ -.changesSectionContainer { - @apply flex flex-col gap-y-1; -} - -.changesSectionTitle { - @apply text-sm leading-5 font-bold; -} - -.changesSectionCollectionList { - @apply list-inside; -} - -.changesSectionCollectionListItem { - @apply flex flex-row gap-x-1; -} - -.changesSectionCollectionName { - @apply shrink-0; -} - -.changesSectionCollectionNetworkName { - @apply shrink-0; -} - -.changesSectionCollectionContractAddress { - @apply flex-1 overflow-hidden text-ellipsis; -} - -.changesContainer { - @apply flex flex-col gap-y-5; -} diff --git a/portal/src/graphql/portal/Web3ConfigurationConfirmationDialog.tsx b/portal/src/graphql/portal/Web3ConfigurationConfirmationDialog.tsx deleted file mode 100644 index ab6c5ff401..0000000000 --- a/portal/src/graphql/portal/Web3ConfigurationConfirmationDialog.tsx +++ /dev/null @@ -1,267 +0,0 @@ -import React, { useContext, useMemo } from "react"; -import { Dialog, DialogFooter, Text } from "@fluentui/react"; -import { Context, FormattedMessage } from "@oursky/react-messageformat"; -import { - FormState as Web3ConfigurationFormState, - isNFTCollectionEqual, -} from "./Web3ConfigurationScreen"; -import PrimaryButton from "../../PrimaryButton"; -import DefaultButton from "../../DefaultButton"; -import { NftCollection } from "./globalTypes.generated"; -import styles from "./Web3ConfigurationConfirmationDialog.module.css"; -import { - getNetworkNameID, - NetworkID, - sameNetworkID, -} from "../../util/networkId"; -import { truncateAddress } from "../../util/hex"; - -interface Web3ConfigurationConfirmationDialogProps { - initialState: Web3ConfigurationFormState; - currentState: Web3ConfigurationFormState; - - isVisible: boolean; - onConfirm: () => void; - onDismiss: () => void; -} - -interface FormChanges { - siweEnabled: boolean | null; - networkChange: { - from: NetworkID; - to: NetworkID; - } | null; - - tokenIDChanges: NftCollection[]; - - collectionAdded: NftCollection[]; - collectionRemoved: NftCollection[]; -} - -const Web3ConfigurationConfirmationDialog: React.VFC = - function Web3ConfigurationConfirmationDialog(props) { - const { initialState, currentState, isVisible, onConfirm, onDismiss } = - props; - - const { renderToString } = useContext(Context); - - const dialogContentProps = useMemo(() => { - return { - title: ( - - ), - }; - }, []); - - const formChanges: FormChanges = useMemo(() => { - const changes: FormChanges = { - siweEnabled: null, - networkChange: null, - tokenIDChanges: [], - collectionAdded: [], - collectionRemoved: [], - }; - - if (initialState.siweChecked !== currentState.siweChecked) { - changes.siweEnabled = currentState.siweChecked; - } - - if (!sameNetworkID(initialState.network, currentState.network)) { - changes.networkChange = { - from: initialState.network, - to: currentState.network, - }; - } - - // We remove all collections if siwe is disabled - // Remove all collections if siwe is disabled - if (changes.siweEnabled === false) { - changes.collectionAdded = []; - changes.collectionRemoved = initialState.collections; - } else if (!sameNetworkID(initialState.network, currentState.network)) { - changes.collectionAdded = currentState.collections.filter((c) => - sameNetworkID(c, currentState.network) - ); - changes.collectionRemoved = initialState.collections; - } else { - changes.collectionAdded = currentState.collections.filter( - (c) => - initialState.collections.findIndex((cc) => - isNFTCollectionEqual(c, cc) - ) === -1 - ); - - changes.collectionRemoved = initialState.collections.filter( - (c) => - currentState.collections.findIndex((cc) => - isNFTCollectionEqual(c, cc) - ) === -1 - ); - } - - changes.tokenIDChanges = currentState.collections.filter( - (c) => - initialState.collections.findIndex( - (cc) => - isNFTCollectionEqual(c, cc) && - !c.tokenIDs.every((ct) => cc.tokenIDs.includes(ct)) - ) !== -1 - ); - - return changes; - }, [initialState, currentState]); - - return ( - - ); - }; - -export default Web3ConfigurationConfirmationDialog; diff --git a/portal/src/graphql/portal/Web3ConfigurationContactUsDialog.tsx b/portal/src/graphql/portal/Web3ConfigurationContactUsDialog.tsx deleted file mode 100644 index 3205024217..0000000000 --- a/portal/src/graphql/portal/Web3ConfigurationContactUsDialog.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import React, { useContext, useMemo, useCallback } from "react"; -import { Dialog, DialogFooter, IDialogProps } from "@fluentui/react"; -import { Context, FormattedMessage } from "@oursky/react-messageformat"; -import DefaultButton from "../../DefaultButton"; -import PrimaryButton from "../../PrimaryButton"; -import ExternalLink from "../../ExternalLink"; - -const DIALOG_MAX_WIDTH = "33%"; - -interface Web3ConfigurationContactUsDialogProps { - isVisible: boolean; - onDismiss: IDialogProps["onDismiss"]; -} -const Web3ConfigurationContactUsDialog: React.VFC< - Web3ConfigurationContactUsDialogProps -> = (props) => { - const { isVisible, onDismiss } = props; - const { renderToString } = useContext(Context); - const dialogContentProps = useMemo(() => { - return { - title: renderToString("Web3ConfigurationScreen.contact-us-dialog.title"), - subText: ( - - ), - }; - }, [renderToString]); - - const onClickCancel = useCallback( - (e) => { - e?.preventDefault(); - e?.stopPropagation(); - onDismiss?.(); - }, - [onDismiss] - ); - - return ( - - ); -}; - -export default Web3ConfigurationContactUsDialog; diff --git a/portal/src/graphql/portal/Web3ConfigurationDetailDialog.module.css b/portal/src/graphql/portal/Web3ConfigurationDetailDialog.module.css deleted file mode 100644 index b06ab7fbe7..0000000000 --- a/portal/src/graphql/portal/Web3ConfigurationDetailDialog.module.css +++ /dev/null @@ -1,31 +0,0 @@ -.contentContainer { - @apply flex flex-col; -} - -.contractAddressContainer { - @apply overflow-hidden text-ellipsis break-all whitespace-nowrap; -} - -.fieldContainer { - @apply flex flex-col gap-y-1 mt-5; -} - -.fieldTitle { - @apply font-bold; -} - -.actionButton { - @apply p-0 h-auto; -} - -.actionButtonContainer { - @apply -mx-1; -} - -.deleteCollectionButtonContainer { - @apply mt-4; -} - -.footer { - @apply pt-3; -} diff --git a/portal/src/graphql/portal/Web3ConfigurationDetailDialog.tsx b/portal/src/graphql/portal/Web3ConfigurationDetailDialog.tsx deleted file mode 100644 index 58e8ee82ae..0000000000 --- a/portal/src/graphql/portal/Web3ConfigurationDetailDialog.tsx +++ /dev/null @@ -1,187 +0,0 @@ -import React, { useCallback, useMemo } from "react"; -import cn from "classnames"; -import { Dialog, DialogFooter, Text } from "@fluentui/react"; -import { FormattedMessage } from "@oursky/react-messageformat"; -import DefaultButton from "../../DefaultButton"; -import styles from "./Web3ConfigurationDetailDialog.module.css"; -import { useSystemConfig } from "../../context/SystemConfigContext"; -import { getNetworkNameID } from "../../util/networkId"; -import ActionButton from "../../ActionButton"; -import { explorerAddress } from "../../util/eip681"; -import ExternalLink from "../../ExternalLink"; -import { createContractIDURL } from "../../util/contractId"; -import { CollectionItem } from "./Web3ConfigurationScreen"; - -interface Web3ConfigurationDetailDialogProps { - nftCollection: CollectionItem; - - isVisible: boolean; - onEditTrackedTokens: () => void; - onDelete: (nftCollection: CollectionItem) => void; - onDismiss: () => void; -} - -const Web3ConfigurationDetailDialog: React.VFC = - function Web3ConfigurationDetailDialog(props) { - const { - nftCollection, - isVisible, - onDelete, - onDismiss, - onEditTrackedTokens, - } = props; - - const { themes } = useSystemConfig(); - - const dialogContentProps = useMemo(() => { - return { - title: nftCollection.name, - }; - }, [nftCollection]); - - const onRemoveCollection = useCallback(() => { - onDelete(nftCollection); - }, [nftCollection, onDelete]); - - const contractID = useMemo( - () => - createContractIDURL({ - address: nftCollection.contractAddress, - blockchain: nftCollection.blockchain, - network: nftCollection.network, - }), - [nftCollection] - ); - - const tokenTypeMessageId = useMemo(() => { - switch (nftCollection.tokenType) { - case "erc721": - return "Web3ConfigurationScreen.detail-dialog.token-type.erc721"; - case "erc1155": - return "Web3ConfigurationScreen.detail-dialog.token-type.erc1155"; - default: - return "Web3ConfigurationScreen.detail-dialog.token-type.unknown"; - } - }, [nftCollection]); - - const displayedTokens = useMemo(() => { - const totalSupplyNotAvailable = - !nftCollection.totalSupply || nftCollection.totalSupply === "0"; - - // Check if collection is ERC-1155 - if (nftCollection.tokenIDs.length !== 0) { - // Return tracked token count over total supply if available - // otherwise just tracked token count - return totalSupplyNotAvailable - ? nftCollection.tokenIDs.length - : `${nftCollection.tokenIDs.length}/${nftCollection.totalSupply}`; - } - - // Return dash is total supply not available - return totalSupplyNotAvailable ? "-" : nftCollection.totalSupply; - }, [nftCollection]); - - return ( - - ); - }; - -export default Web3ConfigurationDetailDialog; diff --git a/portal/src/graphql/portal/Web3ConfigurationLargeCollectionDialog.tsx b/portal/src/graphql/portal/Web3ConfigurationLargeCollectionDialog.tsx deleted file mode 100644 index 98a5588ce5..0000000000 --- a/portal/src/graphql/portal/Web3ConfigurationLargeCollectionDialog.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import React, { useContext, useMemo } from "react"; -import { Dialog, DialogFooter } from "@fluentui/react"; -import { Context, FormattedMessage } from "@oursky/react-messageformat"; -import DefaultButton from "../../DefaultButton"; -import PrimaryButton from "../../PrimaryButton"; -import ExternalLink from "../../ExternalLink"; - -const DIALOG_MAX_WIDTH = "33%"; - -interface Web3ConfigurationLargeCollectionDialogProps { - isVisible: boolean; - onDismiss: () => void; -} -const Web3ConfigurationLargeCollectionDialog: React.VFC< - Web3ConfigurationLargeCollectionDialogProps -> = (props) => { - const { isVisible, onDismiss } = props; - const { renderToString } = useContext(Context); - const dialogContentProps = useMemo(() => { - return { - title: ( - - ), - subText: renderToString( - "Web3ConfigurationScreen.collection-list.add-collection.large-collection-dialog.description" - ), - }; - }, [renderToString]); - return ( - - ); -}; - -export default Web3ConfigurationLargeCollectionDialog; diff --git a/portal/src/graphql/portal/Web3ConfigurationNetworkChangeDialog.tsx b/portal/src/graphql/portal/Web3ConfigurationNetworkChangeDialog.tsx deleted file mode 100644 index 556b669d23..0000000000 --- a/portal/src/graphql/portal/Web3ConfigurationNetworkChangeDialog.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import React, { useContext, useMemo } from "react"; -import { Dialog, DialogFooter } from "@fluentui/react"; -import { Context, FormattedMessage } from "@oursky/react-messageformat"; -import { useSystemConfig } from "../../context/SystemConfigContext"; -import PrimaryButton from "../../PrimaryButton"; -import DefaultButton from "../../DefaultButton"; - -interface Web3ConfigurationNetworkChangeDialogProps { - isVisible: boolean; - onConfirm: () => void; - onDismiss: () => void; -} - -const Web3ConfigurationNetworkChangeDialog: React.VFC = - function Web3ConfigurationNetworkChangeDialog(props) { - const { isVisible, onConfirm, onDismiss } = props; - - const { renderToString } = useContext(Context); - - const { themes } = useSystemConfig(); - - const dialogContentProps = useMemo(() => { - return { - title: ( - - ), - subText: renderToString( - "Web3ConfigurationScreen.network-change-dialog.description" - ), - }; - }, [renderToString]); - - return ( - - ); - }; - -export default Web3ConfigurationNetworkChangeDialog; diff --git a/portal/src/graphql/portal/Web3ConfigurationScreen.module.css b/portal/src/graphql/portal/Web3ConfigurationScreen.module.css deleted file mode 100644 index de0ce34cb3..0000000000 --- a/portal/src/graphql/portal/Web3ConfigurationScreen.module.css +++ /dev/null @@ -1,33 +0,0 @@ -.widget { - grid-column: 1 / span 8; - - @apply tablet:col-span-full; -} - -.actionButton { - @apply h-auto leading-4 text-xs; -} - -.networkSection { - @apply flex flex-col mt-2 mb-4; -} - -.networkDropdown { - @apply mb-1; -} - -.nftCollectionTitle { - @apply font-bold mb-2; -} - -.nftCollectionList { - @apply mt-2; -} - -.addCollectionForm { - @apply mt-1.5; -} - -.addCollectionButton { - @apply p-2; -} diff --git a/portal/src/graphql/portal/Web3ConfigurationScreen.tsx b/portal/src/graphql/portal/Web3ConfigurationScreen.tsx deleted file mode 100644 index 4944828e47..0000000000 --- a/portal/src/graphql/portal/Web3ConfigurationScreen.tsx +++ /dev/null @@ -1,821 +0,0 @@ -import React, { useCallback, useContext, useMemo, useState } from "react"; -import { - Text, - Dropdown, - IColumn, - SelectionMode, - DetailsList, -} from "@fluentui/react"; -import { APIError } from "../../error/error"; -import { produce } from "immer"; -import { Context, FormattedMessage } from "@oursky/react-messageformat"; -import { PortalAPIAppConfig } from "../../types"; -import { useCheckbox, useDropdown } from "../../hook/useInput"; -import { clearEmptyObject } from "../../util/misc"; -import { useParams } from "react-router-dom"; -import { - AppConfigFormModel, - useAppConfigForm, -} from "../../hook/useAppConfigForm"; -import ShowLoading from "../../ShowLoading"; -import ShowError from "../../ShowError"; -import ScreenContent from "../../ScreenContent"; -import ScreenTitle from "../../ScreenTitle"; -import ScreenDescription from "../../ScreenDescription"; -import Widget from "../../Widget"; -import FormContainer from "../../FormContainer"; - -import styles from "./Web3ConfigurationScreen.module.css"; -import { useSystemConfig } from "../../context/SystemConfigContext"; -import { useNftCollectionsQuery } from "./query/nftCollectionsQuery"; -import { NftCollection } from "./globalTypes.generated"; -import { createContractIDURL, parseContractID } from "../../util/contractId"; -import { useNftContractMetadataLazyQuery } from "./query/nftContractMetadataQuery"; -import { ErrorParseRule, makeReasonErrorParseRule } from "../../error/parse"; -import { - ALL_SUPPORTED_NETWORKS, - createNetworkIDURL, - getNetworkNameID, - NetworkID, - parseNetworkID, - sameNetworkID, -} from "../../util/networkId"; -import Web3ConfigurationConfirmationDialog from "./Web3ConfigurationConfirmationDialog"; -import Web3ConfigurationDetailDialog from "./Web3ConfigurationDetailDialog"; -import Web3ConfigurationCollectionDeletionDialog from "./Web3ConfigurationCollectionDeletionDialog"; -import Web3ConfigurationAddCollectionSection from "./Web3ConfigurationAddCollectionSection"; -import CommandBarButton from "../../CommandBarButton"; -import ActionButton from "../../ActionButton"; -import Toggle from "../../Toggle"; -import { useAppFeatureConfigQuery } from "./query/appFeatureConfigQuery"; -import FeatureDisabledMessageBar from "./FeatureDisabledMessageBar"; -import HorizontalDivider from "../../HorizontalDivider"; -import { useProbeNFTCollectionMutation } from "./mutations/probeNFTCollectionMutation"; -import Web3ConfigurationTokenTrackingDialog from "./Web3ConfigurationTokenTrackingDialog"; -import { truncateAddress } from "../../util/hex"; -import Web3ConfigurationNetworkChangeDialog from "./Web3ConfigurationNetworkChangeDialog"; -import { FormModel } from "../../FormContainerBase"; - -export interface CollectionItem extends NftCollection { - status: "pending" | "active"; - tokenIDs: string[]; -} - -export function isNFTCollectionEqual( - a: NftCollection, - b: NftCollection -): boolean { - return ( - a.blockchain === b.blockchain && - a.network === b.network && - a.contractAddress === b.contractAddress - ); -} -export interface FormState { - network: NetworkID; - collections: CollectionItem[]; - - siweChecked: boolean; -} - -function constructConfig( - config: PortalAPIAppConfig, - _initialState: FormState, - currentState: FormState -): PortalAPIAppConfig { - return produce(config, (config) => { - config.authentication ??= {}; - config.authentication.primary_authenticators ??= []; - config.identity ??= {}; - config.identity.login_id ??= {}; - config.web3 ??= {}; - config.web3.nft ??= {}; - config.web3.siwe ??= {}; - - if (currentState.siweChecked) { - config.authentication.identities = ["siwe"]; - config.identity.login_id.keys = []; - config.authentication.primary_authenticators = []; - } else { - config.authentication.identities = ["login_id", "oauth"]; - config.identity.login_id.keys = [{ type: "email" }]; - config.authentication.primary_authenticators = ["password"]; - } - - const selectedNetwork = createNetworkIDURL(currentState.network); - - let collections: CollectionItem[]; - - if (!currentState.siweChecked) { - // Clear collection list if SIWE is disabled - collections = []; - } else if (!config.web3.siwe.networks?.includes(selectedNetwork)) { - // Clear unrelated collections if network is changed - collections = currentState.collections.filter((c) => - sameNetworkID(c, currentState.network) - ); - } else { - // Proceed with changes - collections = currentState.collections; - } - - config.web3.siwe.networks = [selectedNetwork]; - config.web3.nft.collections = collections.map((c) => { - return createContractIDURL({ - blockchain: c.blockchain, - network: c.network, - address: c.contractAddress, - query: - c.tokenIDs.length !== 0 - ? new URLSearchParams(c.tokenIDs.map((t) => ["token_ids", t])) - : undefined, - }); - }); - - clearEmptyObject(config); - }); -} - -const DuplicatedContractError: APIError = { - errorName: "DuplicatedContractError", - reason: "ValidationFailed", - info: { - causes: [ - { - location: "/contract_address", - kind: "__local", - details: { - error: { - messageID: "errors.duplicated-contract", - }, - }, - }, - ], - }, -}; - -const ALL_NETWORK_OPTIONS: string[] = ALL_SUPPORTED_NETWORKS.map((n) => - createNetworkIDURL(n) -); - -interface Web3ConfigurationContentProps { - nftCollections: NftCollection[]; - isAddCollectionFieldVisible: boolean; - showAddCollectionField: () => void; - hideAddCollectionField: () => void; - - maximumCollections: number; - fetchMetadata: (contractId: string) => Promise; - probeCollection: (contractId: string) => Promise; - form: AppConfigFormModel; -} - -type Web3ConfigurationContentDialogs = - | "deletionConfirmation" - | "detail" - | "networkChange" - | null; - -const Web3ConfigurationContent: React.VFC = - function Web3ConfigurationContent(props) { - const { state, setState } = props.form; - const { themes } = useSystemConfig(); - - const [activeDialog, setActiveDialog] = - useState(null); - const [selectedCollectionIdx, setSelectedCollectionIdx] = - useState(-1); - const [isTokenTrackingDialogVisible, setIsTokenTrackingDialogVisible] = - useState(false); - - const [pendingNetwork, setPendingNetwork] = useState(null); - - const { renderToString } = useContext(Context); - - const { onChange: onChangeSIWEChecked } = useCheckbox( - (checked: boolean) => { - setState((prev) => ({ - ...prev, - siweChecked: checked, - })); - } - ); - - const renderBlockchainNetwork = useCallback( - (networkIdUrl: string) => { - const networkId = parseNetworkID(networkIdUrl); - return renderToString(getNetworkNameID(networkId)); - }, - [renderToString] - ); - - const onNetworkDropdownOptionChange = useCallback( - (option: string) => { - const networkId = parseNetworkID(option); - if ( - state.collections.length > 0 && - !sameNetworkID(networkId, state.network) - ) { - setPendingNetwork(option); - setActiveDialog("networkChange"); - return; - } - - setState((prev) => ({ - ...prev, - network: networkId, - })); - }, - [state.collections, state.network, setState] - ); - - const { options: blockchainOptions, onChange: onBlockchainChange } = - useDropdown( - ALL_NETWORK_OPTIONS, - onNetworkDropdownOptionChange, - createNetworkIDURL(state.network), - renderBlockchainNetwork - ); - - const openDetailDialog = useCallback(() => { - setActiveDialog("detail"); - }, [setActiveDialog]); - - const openDeleteConfirmationDialog = useCallback(() => { - setActiveDialog("deletionConfirmation"); - }, [setActiveDialog]); - - const dismissAllDialogs = useCallback(() => { - setActiveDialog(null); - }, [setActiveDialog]); - - const onSelectCollection = useCallback( - (collection: CollectionItem) => { - const idx = state.collections.findIndex((c) => - isNFTCollectionEqual(collection, c) - ); - - setSelectedCollectionIdx(idx); - }, - [state.collections] - ); - - const onAddNewCollection = useCallback( - (collection: CollectionItem) => { - if ( - state.collections.findIndex( - (c) => - c.blockchain === collection.blockchain && - c.network === collection.network && - c.contractAddress === collection.contractAddress - ) !== -1 - ) { - // eslint-disable-next-line @typescript-eslint/only-throw-error - throw DuplicatedContractError; - } - - setState((prev) => { - const existingCollections = prev.collections; - - return { - ...prev, - collections: [collection, ...existingCollections], - }; - }); - }, - [state, setState] - ); - - const onRequireConfirmRemoveCollection = useCallback( - (collection: CollectionItem) => { - onSelectCollection(collection); - - openDeleteConfirmationDialog(); - }, - [onSelectCollection, openDeleteConfirmationDialog] - ); - - const onRemoveCollection = useCallback( - (collection: NftCollection) => { - setSelectedCollectionIdx(-1); - setState((prev) => { - const collections = prev.collections; - const index = collections.findIndex((c) => - isNFTCollectionEqual(c, collection) - ); - - if (index < 0) { - return prev; - } - - return { - ...prev, - collections: [ - ...collections.slice(0, index), - ...collections.slice(index + 1), - ], - }; - }); - - dismissAllDialogs(); - }, - [setState, dismissAllDialogs] - ); - - const confirmNetworkChange = useCallback(() => { - if (!pendingNetwork) { - return; - } - - setState((prev) => ({ - ...prev, - network: parseNetworkID(pendingNetwork), - collections: [], - })); - - setPendingNetwork(null); - }, [pendingNetwork, setState]); - - const onCollectionUserActionClick = useCallback( - (e: React.MouseEvent, collection: CollectionItem) => { - e.preventDefault(); - e.stopPropagation(); - - switch (collection.status) { - case "pending": - onRemoveCollection(collection); - break; - case "active": - onSelectCollection(collection); - - openDetailDialog(); - break; - } - }, - [onRemoveCollection, onSelectCollection, openDetailDialog] - ); - - const showTokenTrackingDialog = useCallback(() => { - setIsTokenTrackingDialogVisible(true); - }, []); - - const dismissTokenTrackingDialog = useCallback(() => { - setIsTokenTrackingDialogVisible(false); - }, []); - - const onEditSelectedCollectionTokenIds = useCallback( - (tokenIDs: string[]) => { - if (selectedCollectionIdx === -1) { - return; - } - - setState((prev) => { - const collections = prev.collections; - const updatedCollection = { - ...prev.collections[selectedCollectionIdx], - tokenIDs: tokenIDs, - }; - collections.splice(selectedCollectionIdx, 1, updatedCollection); - return { - ...prev, - collections, - }; - }); - dismissTokenTrackingDialog(); - }, - [selectedCollectionIdx, setState, dismissTokenTrackingDialog] - ); - - const onRenderItemColumn = useCallback( - (item?: CollectionItem, _index?: number, column?: IColumn) => { - if (item == null) { - return null; - } - switch (column?.key) { - case "name": - return ( - - {item.name} - - ); - case "contract-address": - return truncateAddress(item.contractAddress); - case "status": - if (item.status === "pending") { - return renderToString( - "Web3ConfigurationScreen.collection-list.status.pending" - ); - } - return ""; - case "action": { - const theme = - item.status === "pending" - ? themes.destructive - : themes.actionButton; - - const text = - item.status === "pending" ? ( - - ) : ( - - ); - - return ( - onCollectionUserActionClick(event, item)} - text={text} - /> - ); - } - - default: - return null; - } - }, - [onCollectionUserActionClick, renderToString, themes] - ); - - const collectionColumns: IColumn[] = useMemo( - () => [ - { - key: "name", - name: "", - minWidth: 179, - maxWidth: 179, - isMultiline: true, - }, - { - key: "contract-address", - name: "", - flexGrow: 1, - minWidth: 103, - maxWidth: 103, - }, - { - key: "status", - name: "", - minWidth: 103, - maxWidth: 103, - }, - { - key: "action", - name: "", - minWidth: 103, - maxWidth: 103, - targetWidthProportion: 1, - }, - ], - [] - ); - - const collectionLimitReached = useMemo(() => { - return state.collections.length >= props.maximumCollections; - }, [props.maximumCollections, state.collections.length]); - - const selectedCollection = useMemo(() => { - if (selectedCollectionIdx === -1) { - return null; - } - - return state.collections[selectedCollectionIdx] ?? null; - }, [state, selectedCollectionIdx]); - - return ( - <> - - - - - - - - - -
-
- - } - /> -
-
- - - - -
- -
- - - - - - {props.isAddCollectionFieldVisible && - !collectionLimitReached ? ( - - ) : null} -
- {collectionLimitReached ? ( - - ) : null} - -
- {state.siweChecked ? ( - - - - ) : null} -
-
-
-
- {selectedCollection !== null ? ( - - ) : null} - {selectedCollection !== null ? ( - - ) : null} - {selectedCollection !== null ? ( - - ) : null} - {pendingNetwork !== null ? ( - - ) : null} - - ); - }; - -const Web3ConfigurationScreen: React.VFC = function Web3ConfigurationScreen() { - const { appID } = useParams() as { appID: string }; - const [isConfirmationDialogVisible, setIsConfirmationDialogVisible] = - useState(false); - - const [isAddCollectionFieldVisible, setIsAddCollectionFieldVisible] = - useState(false); - - const nftCollections = useNftCollectionsQuery(appID); - - const featureConfig = useAppFeatureConfigQuery(appID); - - const { fetch: fetchMetadata, error: fetchMetadataError } = - useNftContractMetadataLazyQuery(); - - const { probeNFTCollection, error: probeNFTCollectionError } = - useProbeNFTCollectionMutation(); - - const constructFormState = useCallback( - (config: PortalAPIAppConfig) => { - const siweIndex = config.authentication?.identities?.indexOf("siwe"); - const siweChecked = siweIndex != null && siweIndex >= 0; - - let siweNetworks = (config.web3?.siwe?.networks ?? []).map((n) => - parseNetworkID(n) - ); - if (siweNetworks.length === 0) { - siweNetworks = [ - { - blockchain: "ethereum", - network: "1", - }, - ]; - } - - // We support 1 chain for now - const [selectedNetwork] = siweNetworks; - - const contractIDs = config.web3?.nft?.collections ?? []; - - const collectionMap = new Map(); - nftCollections.collections.forEach((c) => { - collectionMap.set( - createContractIDURL({ - blockchain: c.blockchain, - network: c.network, - address: c.contractAddress, - }), - c - ); - }); - - const existingCollections = contractIDs - .map((c) => parseContractID(c)) - .map((cid) => { - const collection = collectionMap.get( - createContractIDURL({ - blockchain: cid.blockchain, - network: cid.network, - address: cid.address, - }) - ); - - const tokens = cid.query?.getAll("token_ids") ?? []; - - if (!collection) { - return null; - } - - return { - ...collection, - tokenIDs: tokens, - status: "active", - }; - }) - .filter((c): c is CollectionItem => c !== null); - - return { - siweChecked, - collections: existingCollections, - network: selectedNetwork, - }; - }, - [nftCollections] - ); - - const form = useAppConfigForm({ - appID, - constructFormState, - constructConfig, - }); - - const openConfirmationDialog = useCallback(() => { - setIsConfirmationDialogVisible(true); - }, [setIsConfirmationDialogVisible]); - - const dismissConfirmationDialog = useCallback(() => { - setIsConfirmationDialogVisible(false); - }, [setIsConfirmationDialogVisible]); - - const showAddCollectionField = useCallback(() => { - setIsAddCollectionFieldVisible(true); - }, []); - - const hideAddCollectionField = useCallback(() => { - setIsAddCollectionFieldVisible(false); - }, []); - - const saveForm = useCallback(async () => { - dismissConfirmationDialog(); - hideAddCollectionField(); - - await form.save(); - - await nftCollections.refetch(); - }, [form, nftCollections, dismissConfirmationDialog, hideAddCollectionField]); - - const onFormSave = useCallback(async () => { - openConfirmationDialog(); - }, [openConfirmationDialog]); - - const formModel: FormModel = { - ...form, - save: onFormSave, - }; - - const errorRules: ErrorParseRule[] = useMemo(() => { - return [ - makeReasonErrorParseRule( - "ServiceUnavailable", - "errors.service-unavailable" - ), - makeReasonErrorParseRule("BadNFTCollection", "errors.bad-nft-collection"), - ]; - }, []); - - const collectionsMaximum = useMemo(() => { - return featureConfig.effectiveFeatureConfig?.web3?.nft?.maximum ?? 3; - }, [featureConfig]); - - if (form.isLoading || nftCollections.loading) { - return ; - } - - if (form.loadError) { - return ( - { - form.reload(); - }} - /> - ); - } - - if (nftCollections.error) { - return ( - - ); - } - - return ( - - - - - - ); -}; - -export default Web3ConfigurationScreen; diff --git a/portal/src/graphql/portal/Web3ConfigurationTokenTrackingDialog.tsx b/portal/src/graphql/portal/Web3ConfigurationTokenTrackingDialog.tsx deleted file mode 100644 index f5e551392a..0000000000 --- a/portal/src/graphql/portal/Web3ConfigurationTokenTrackingDialog.tsx +++ /dev/null @@ -1,129 +0,0 @@ -import React, { useCallback, useContext, useMemo, useState } from "react"; -import { Dialog, DialogFooter, Text } from "@fluentui/react"; -import { Context, FormattedMessage } from "@oursky/react-messageformat"; -import DefaultButton from "../../DefaultButton"; -import PrimaryButton from "../../PrimaryButton"; -import TextField from "../../TextField"; -import { convertToHexstring, parseHexstring } from "../../util/hex"; - -const TOKEN_ID_REGEX = /^0x[a-fA-F0-9]+$/; -const DIALOG_MAX_WIDTH = "33%"; -const MAX_TOKEN_COUNT = 10; - -interface Web3ConfigurationTokenTrackingDialogProps { - isVisible: boolean; - initialValue?: string[]; - onContinue: (tokenIDs: string[]) => void; - onDismiss: () => void; -} -const Web3ConfigurationTokenTrackingDialog: React.VFC< - Web3ConfigurationTokenTrackingDialogProps -> = (props) => { - const { isVisible, initialValue, onContinue, onDismiss } = props; - const [validationErrorId, setValidationErrorId] = useState( - null - ); - - const { renderToString } = useContext(Context); - - const defaultValue = useMemo(() => { - if (!initialValue) { - return []; - } - - return initialValue.map((i) => parseHexstring(i)); - }, [initialValue]); - - const [value, setValue] = useState(defaultValue); - - const dialogContentProps = useMemo(() => { - return { - title: ( - - ), - subText: renderToString( - "Web3ConfigurationScreen.collection-list.add-collection.toke-tracking-dialog.description" - ), - }; - }, [renderToString]); - - const tokenIDs = useMemo(() => { - return value.join("\n"); - }, [value]); - - const onTextChange = useCallback( - (_, newValue?: string) => { - setValidationErrorId(null); - const tokens = newValue?.split("\n") ?? []; - if ( - tokens.length <= 1 || - (tokens.length <= MAX_TOKEN_COUNT && tokens[tokens.length - 2]) - ) { - setValue(tokens); - } - }, - [setValue] - ); - - const onProceed = useCallback(() => { - const hexValues = value.map((v) => convertToHexstring(v)); - if (!hexValues.every((t) => TOKEN_ID_REGEX.test(t))) { - setValidationErrorId("errors.invalid-token-id"); - return; - } - - onContinue(hexValues); - }, [value, onContinue]); - - const onCancel = useCallback(() => { - setValue(defaultValue); - - onDismiss(); - }, [defaultValue, onDismiss]); - - return ( - - ); -}; - -export default Web3ConfigurationTokenTrackingDialog; diff --git a/portal/src/graphql/portal/apollo.ts b/portal/src/graphql/portal/apollo.ts index 4780a63210..f431e62e92 100644 --- a/portal/src/graphql/portal/apollo.ts +++ b/portal/src/graphql/portal/apollo.ts @@ -38,10 +38,6 @@ export function createCache(): ApolloCache { }, }, }, - // NFTCollection does not have id, so we must teach Apollo what is the key of NFTCollection. - NFTCollection: { - keyFields: ["blockchain", "network", "contractAddress"], - }, // AppResource does not have id, so we must teach Apollo what is the key of AppResource. AppResource: { keyFields: ["path"], diff --git a/portal/src/graphql/portal/globalTypes.generated.ts b/portal/src/graphql/portal/globalTypes.generated.ts index 9fd7aabeeb..2825bf63df 100644 --- a/portal/src/graphql/portal/globalTypes.generated.ts +++ b/portal/src/graphql/portal/globalTypes.generated.ts @@ -66,7 +66,6 @@ export type App = Node & { id: Scalars['ID']['output']; isProcessingSubscription: Scalars['Boolean']['output']; lastStripeError?: Maybe; - nftCollections: Array; planName: Scalars['String']['output']; rawAppConfig: Scalars['AppConfig']['output']; rawAppConfigChecksum: Scalars['AppConfig']['output']; @@ -365,8 +364,6 @@ export type Mutation = { generateTesterToken: GenerateTestTokenPayload; /** Preview update subscription */ previewUpdateSubscription: PreviewUpdateSubscriptionPayload; - /** Probes a NFT Collection to see whether it is a large collection */ - probeNFTCollection: ProbeNftCollectionsPayload; /** Reconcile the completed checkout session */ reconcileCheckoutSession: ReconcileCheckoutSessionPayload; /** Updates the current user's custom attribute with 'survey' key */ @@ -458,11 +455,6 @@ export type MutationPreviewUpdateSubscriptionArgs = { }; -export type MutationProbeNftCollectionArgs = { - input: ProbeNftCollectionInput; -}; - - export type MutationReconcileCheckoutSessionArgs = { input: ReconcileCheckoutSession; }; @@ -507,18 +499,6 @@ export type MutationVerifyDomainArgs = { input: VerifyDomainInput; }; -/** Web3 NFT Collection */ -export type NftCollection = { - __typename?: 'NFTCollection'; - blockchain: Scalars['String']['output']; - contractAddress: Scalars['String']['output']; - createdAt: Scalars['DateTime']['output']; - name: Scalars['String']['output']; - network: Scalars['String']['output']; - tokenType: Scalars['String']['output']; - totalSupply?: Maybe; -}; - /** An object with an ID */ export type Node = { /** The id of the object */ @@ -575,15 +555,6 @@ export type PreviewUpdateSubscriptionPayload = { currency: Scalars['String']['output']; }; -export type ProbeNftCollectionInput = { - contractID: Scalars['String']['input']; -}; - -export type ProbeNftCollectionsPayload = { - __typename?: 'ProbeNFTCollectionsPayload'; - isLargeCollection: Scalars['Boolean']['output']; -}; - export type Query = { __typename?: 'Query'; /** Active users chart dataset */ @@ -592,8 +563,6 @@ export type Query = { appList?: Maybe>; /** Check whether the viewer can accept the collaboration invitation */ checkCollaboratorInvitation?: Maybe; - /** Fetch NFT Contract Metadata */ - nftContractMetadata?: Maybe; /** Fetches an object given its ID */ node?: Maybe; /** Lookup nodes by a list of IDs. */ @@ -624,11 +593,6 @@ export type QueryCheckCollaboratorInvitationArgs = { }; -export type QueryNftContractMetadataArgs = { - contractID: Scalars['String']['input']; -}; - - export type QueryNodeArgs = { id: Scalars['ID']['input']; }; diff --git a/portal/src/graphql/portal/mutations/probeNFTCollectionMutation.generated.ts b/portal/src/graphql/portal/mutations/probeNFTCollectionMutation.generated.ts deleted file mode 100644 index b3f5146b1d..0000000000 --- a/portal/src/graphql/portal/mutations/probeNFTCollectionMutation.generated.ts +++ /dev/null @@ -1,46 +0,0 @@ -import * as Types from '../globalTypes.generated'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type ProbeNftCollectionMutationMutationVariables = Types.Exact<{ - contractID: Types.Scalars['String']['input']; -}>; - - -export type ProbeNftCollectionMutationMutation = { __typename?: 'Mutation', probeNFTCollection: { __typename?: 'ProbeNFTCollectionsPayload', isLargeCollection: boolean } }; - - -export const ProbeNftCollectionMutationDocument = gql` - mutation probeNFTCollectionMutation($contractID: String!) { - probeNFTCollection(input: {contractID: $contractID}) { - isLargeCollection - } -} - `; -export type ProbeNftCollectionMutationMutationFn = Apollo.MutationFunction; - -/** - * __useProbeNftCollectionMutationMutation__ - * - * To run a mutation, you first call `useProbeNftCollectionMutationMutation` within a React component and pass it any options that fit your needs. - * When your component renders, `useProbeNftCollectionMutationMutation` returns a tuple that includes: - * - A mutate function that you can call at any time to execute the mutation - * - An object with fields that represent the current status of the mutation's execution - * - * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; - * - * @example - * const [probeNftCollectionMutationMutation, { data, loading, error }] = useProbeNftCollectionMutationMutation({ - * variables: { - * contractID: // value for 'contractID' - * }, - * }); - */ -export function useProbeNftCollectionMutationMutation(baseOptions?: Apollo.MutationHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useMutation(ProbeNftCollectionMutationDocument, options); - } -export type ProbeNftCollectionMutationMutationHookResult = ReturnType; -export type ProbeNftCollectionMutationMutationResult = Apollo.MutationResult; -export type ProbeNftCollectionMutationMutationOptions = Apollo.BaseMutationOptions; \ No newline at end of file diff --git a/portal/src/graphql/portal/mutations/probeNFTCollectionMutation.graphql b/portal/src/graphql/portal/mutations/probeNFTCollectionMutation.graphql deleted file mode 100644 index dab707fbf4..0000000000 --- a/portal/src/graphql/portal/mutations/probeNFTCollectionMutation.graphql +++ /dev/null @@ -1,5 +0,0 @@ -mutation probeNFTCollectionMutation($contractID: String!) { - probeNFTCollection(input: { contractID: $contractID }) { - isLargeCollection - } -} diff --git a/portal/src/graphql/portal/mutations/probeNFTCollectionMutation.ts b/portal/src/graphql/portal/mutations/probeNFTCollectionMutation.ts deleted file mode 100644 index 1792cf7cb6..0000000000 --- a/portal/src/graphql/portal/mutations/probeNFTCollectionMutation.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { useCallback } from "react"; -import { useMutation } from "@apollo/client"; - -import { usePortalClient } from "../apollo"; -import { - ProbeNftCollectionMutationMutation, - ProbeNftCollectionMutationDocument, -} from "./probeNFTCollectionMutation.generated"; - -export function useProbeNFTCollectionMutation(): { - probeNFTCollection: (contractId: string) => Promise; - loading: boolean; - error: unknown; -} { - const client = usePortalClient(); - const [mutationFunction, { error, loading }] = - useMutation( - ProbeNftCollectionMutationDocument, - { - client, - } - ); - const probeNFTCollection = useCallback( - async (contractId: string) => { - const res = await mutationFunction({ - variables: { contractID: contractId }, - }); - return res.data?.probeNFTCollection.isLargeCollection ?? false; - }, - [mutationFunction] - ); - - return { probeNFTCollection, error, loading }; -} diff --git a/portal/src/graphql/portal/query/nftCollectionsQuery.generated.ts b/portal/src/graphql/portal/query/nftCollectionsQuery.generated.ts deleted file mode 100644 index 268dae003f..0000000000 --- a/portal/src/graphql/portal/query/nftCollectionsQuery.generated.ts +++ /dev/null @@ -1,65 +0,0 @@ -import * as Types from '../globalTypes.generated'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type NftCollectionsQueryQueryVariables = Types.Exact<{ - appID: Types.Scalars['ID']['input']; -}>; - - -export type NftCollectionsQueryQuery = { __typename?: 'Query', node?: { __typename: 'App', id: string, nftCollections: Array<{ __typename?: 'NFTCollection', name: string, blockchain: string, network: string, contractAddress: string, totalSupply?: string | null, tokenType: string, createdAt: any }> } | { __typename: 'User' } | { __typename: 'Viewer' } | null }; - - -export const NftCollectionsQueryDocument = gql` - query nftCollectionsQuery($appID: ID!) { - node(id: $appID) { - __typename - ... on App { - id - nftCollections { - name - blockchain - network - contractAddress - totalSupply - tokenType - createdAt - } - } - } -} - `; - -/** - * __useNftCollectionsQueryQuery__ - * - * To run a query within a React component, call `useNftCollectionsQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useNftCollectionsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useNftCollectionsQueryQuery({ - * variables: { - * appID: // value for 'appID' - * }, - * }); - */ -export function useNftCollectionsQueryQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(NftCollectionsQueryDocument, options); - } -export function useNftCollectionsQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(NftCollectionsQueryDocument, options); - } -export function useNftCollectionsQuerySuspenseQuery(baseOptions?: Apollo.SuspenseQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useSuspenseQuery(NftCollectionsQueryDocument, options); - } -export type NftCollectionsQueryQueryHookResult = ReturnType; -export type NftCollectionsQueryLazyQueryHookResult = ReturnType; -export type NftCollectionsQuerySuspenseQueryHookResult = ReturnType; -export type NftCollectionsQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/portal/src/graphql/portal/query/nftCollectionsQuery.graphql b/portal/src/graphql/portal/query/nftCollectionsQuery.graphql deleted file mode 100644 index 8740d884e7..0000000000 --- a/portal/src/graphql/portal/query/nftCollectionsQuery.graphql +++ /dev/null @@ -1,17 +0,0 @@ -query nftCollectionsQuery($appID: ID!) { - node(id: $appID) { - __typename - ... on App { - id - nftCollections { - name - blockchain - network - contractAddress - totalSupply - tokenType - createdAt - } - } - } -} diff --git a/portal/src/graphql/portal/query/nftCollectionsQuery.ts b/portal/src/graphql/portal/query/nftCollectionsQuery.ts deleted file mode 100644 index 00c942abc1..0000000000 --- a/portal/src/graphql/portal/query/nftCollectionsQuery.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { QueryResult, useQuery } from "@apollo/client"; -import { useMemo } from "react"; -import { usePortalClient } from "../../portal/apollo"; -import { NftCollection } from "../globalTypes.generated"; -import { - NftCollectionsQueryQuery, - NftCollectionsQueryQueryVariables, - NftCollectionsQueryDocument, -} from "./nftCollectionsQuery.generated"; - -interface NftCollectionsQueryResult - extends Pick< - QueryResult, - "loading" | "error" | "refetch" - > { - collections: NftCollection[]; -} - -export function useNftCollectionsQuery( - appID: string -): NftCollectionsQueryResult { - const client = usePortalClient(); - const { data, loading, error, refetch } = useQuery( - NftCollectionsQueryDocument, - { - client, - variables: { - appID, - }, - } - ); - - const collections = useMemo(() => { - const appNode = data?.node?.__typename === "App" ? data.node : null; - return appNode?.nftCollections ?? []; - }, [data]); - - return { collections, loading, error, refetch }; -} diff --git a/portal/src/graphql/portal/query/nftContractMetadataQuery.generated.ts b/portal/src/graphql/portal/query/nftContractMetadataQuery.generated.ts deleted file mode 100644 index 3fc53df146..0000000000 --- a/portal/src/graphql/portal/query/nftContractMetadataQuery.generated.ts +++ /dev/null @@ -1,59 +0,0 @@ -import * as Types from '../globalTypes.generated'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type NftContractMetadataQueryQueryVariables = Types.Exact<{ - contractID: Types.Scalars['String']['input']; -}>; - - -export type NftContractMetadataQueryQuery = { __typename?: 'Query', nftContractMetadata?: { __typename?: 'NFTCollection', name: string, blockchain: string, network: string, contractAddress: string, totalSupply?: string | null, tokenType: string, createdAt: any } | null }; - - -export const NftContractMetadataQueryDocument = gql` - query nftContractMetadataQuery($contractID: String!) { - nftContractMetadata(contractID: $contractID) { - name - blockchain - network - contractAddress - totalSupply - tokenType - createdAt - } -} - `; - -/** - * __useNftContractMetadataQueryQuery__ - * - * To run a query within a React component, call `useNftContractMetadataQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useNftContractMetadataQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useNftContractMetadataQueryQuery({ - * variables: { - * contractID: // value for 'contractID' - * }, - * }); - */ -export function useNftContractMetadataQueryQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(NftContractMetadataQueryDocument, options); - } -export function useNftContractMetadataQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(NftContractMetadataQueryDocument, options); - } -export function useNftContractMetadataQuerySuspenseQuery(baseOptions?: Apollo.SuspenseQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useSuspenseQuery(NftContractMetadataQueryDocument, options); - } -export type NftContractMetadataQueryQueryHookResult = ReturnType; -export type NftContractMetadataQueryLazyQueryHookResult = ReturnType; -export type NftContractMetadataQuerySuspenseQueryHookResult = ReturnType; -export type NftContractMetadataQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/portal/src/graphql/portal/query/nftContractMetadataQuery.graphql b/portal/src/graphql/portal/query/nftContractMetadataQuery.graphql deleted file mode 100644 index 733d75b6aa..0000000000 --- a/portal/src/graphql/portal/query/nftContractMetadataQuery.graphql +++ /dev/null @@ -1,11 +0,0 @@ -query nftContractMetadataQuery($contractID: String!) { - nftContractMetadata(contractID: $contractID) { - name - blockchain - network - contractAddress - totalSupply - tokenType - createdAt - } -} diff --git a/portal/src/graphql/portal/query/nftContractMetadataQuery.ts b/portal/src/graphql/portal/query/nftContractMetadataQuery.ts deleted file mode 100644 index dc13ca96e1..0000000000 --- a/portal/src/graphql/portal/query/nftContractMetadataQuery.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { useLazyQuery } from "@apollo/client"; -import { useCallback } from "react"; -import { usePortalClient } from "../apollo"; -import { NftCollection } from "../globalTypes.generated"; -import { - NftContractMetadataQueryQuery, - NftContractMetadataQueryDocument, -} from "./nftContractMetadataQuery.generated"; - -interface NftContractMetadataQueryResult { - fetch: (contractId: string) => Promise; - loading: boolean; - error: unknown; -} - -export function useNftContractMetadataLazyQuery(): NftContractMetadataQueryResult { - const client = usePortalClient(); - const [fetch, { loading, error }] = - useLazyQuery( - NftContractMetadataQueryDocument, - { - client, - } - ); - - const fetchData = useCallback( - async (contractId: string) => { - const res = await fetch({ - variables: { - contractID: contractId, - }, - }); - - return res.data?.nftContractMetadata ?? null; - }, - [fetch] - ); - - return { fetch: fetchData, loading, error }; -} diff --git a/portal/src/graphql/portal/schema.graphql b/portal/src/graphql/portal/schema.graphql index f2fd46121b..5d8e3bcc93 100644 --- a/portal/src/graphql/portal/schema.graphql +++ b/portal/src/graphql/portal/schema.graphql @@ -66,9 +66,6 @@ type App implements Node { """""" lastStripeError: StripeError - """""" - nftCollections: [NFTCollection!]! - """""" planName: String! @@ -508,9 +505,6 @@ type Mutation { """Preview update subscription""" previewUpdateSubscription(input: PreviewUpdateSubscriptionInput!): PreviewUpdateSubscriptionPayload! - """Probes a NFT Collection to see whether it is a large collection""" - probeNFTCollection(input: ProbeNFTCollectionInput!): ProbeNFTCollectionsPayload! - """Reconcile the completed checkout session""" reconcileCheckoutSession(input: reconcileCheckoutSession!): reconcileCheckoutSessionPayload! @@ -539,30 +533,6 @@ type Mutation { verifyDomain(input: VerifyDomainInput!): VerifyDomainPayload! } -"""Web3 NFT Collection""" -type NFTCollection { - """""" - blockchain: String! - - """""" - contractAddress: String! - - """""" - createdAt: DateTime! - - """""" - name: String! - - """""" - network: String! - - """""" - tokenType: String! - - """""" - totalSupply: String -} - """An object with an ID""" interface Node { """The id of the object""" @@ -650,18 +620,6 @@ type PreviewUpdateSubscriptionPayload { currency: String! } -"""""" -input ProbeNFTCollectionInput { - """""" - contractID: String! -} - -"""""" -type ProbeNFTCollectionsPayload { - """""" - isLargeCollection: Boolean! -} - """""" type Query { """Active users chart dataset""" @@ -685,9 +643,6 @@ type Query { """Check whether the viewer can accept the collaboration invitation""" checkCollaboratorInvitation(code: String!): CheckCollaboratorInvitationPayload - """Fetch NFT Contract Metadata""" - nftContractMetadata(contractID: String!): NFTCollection - """Fetches an object given its ID""" node( """The ID of an object""" diff --git a/portal/src/locale-data/en.json b/portal/src/locale-data/en.json index d58a5d8fb9..22e1c9d600 100644 --- a/portal/src/locale-data/en.json +++ b/portal/src/locale-data/en.json @@ -151,7 +151,6 @@ "ScreenNav.authentication": "Authentication", "ScreenNav.anonymous-users": "Anonymous Users", "ScreenNav.app2app": "App2App", - "ScreenNav.web3": "Ethereum & NFT", "ScreenNav.biometric": "Biometric", "ScreenNav.mfa": "2FA", "ScreenNav.external-oauth": "Social / Enterprise Login", @@ -459,15 +458,6 @@ "UserDetails.connected-identities.biometric": "Biometric", "UserDetails.connected-identities.biometric.unknown-device": "Unknown Device", "UserDetails.connected-identities.anonymous": "Anonymous", - "UserDetails.connected-identities.siwe": "Ethereum Wallet", - "UserDetails.connected-identities.siwe.nft-collections.title": "NFTs", - "UserDetails.connected-identities.siwe.nft-collections.name": "{name} ({address})", - "UserDetails.connected-identities.siwe.nft-collections.token-id": "Token ID", - "UserDetails.connected-identities.siwe.nft-collections.transaction-hash": "Txn Hash", - "UserDetails.connected-identities.siwe.nft-collections.balance": "Balance", - "UserDetails.connected-identities.siwe.nft-collections.timestamp": "Timestamp", - "UserDetails.connected-identities.siwe.nft-collections.block": "Block", - "UserDetails.connected-identities.siwe.nft-collections.view-tokens": "View tokens", "UserDetails.connected-identities.anonymous.anonymous-user": "Anonymous User", "UserDetails.connected-identities.ldap": "LDAP", @@ -592,70 +582,6 @@ "AuthenticatorConfigurationScreen.columns.activate": "Activate", "AuthenticatorConfigurationScreen.columns.authenticator": "Authenticator", - "Web3ConfigurationScreen.title": "Ethereum & NFT", - "Web3ConfigurationScreen.description": "Authenticate the user by crypto wallets and NFT ownership. Their wallet addresses and the list of NFTs owned will be available as user info.", - "Web3ConfigurationScreen.siwe.title": "Login with Ethereum", - "Web3ConfigurationScreen.siwe.description": "Add a button to the signup/login screen for the users to login with their crypto wallet such as MetaMask. Enabling this will replace all other login methods. See the {DocLink, react, href{https://docs.authgear.com/strategies/web3#platform-support} children{list of supported wallets here.}}", - "Web3ConfigurationScreen.network-droplist.label": "Network", - "Web3ConfigurationScreen.collection-list.title": "NFT Collections", - "Web3ConfigurationScreen.collection-list.status.pending": "Pending", - "Web3ConfigurationScreen.collection-list.status.indexing": "Indexing", - "Web3ConfigurationScreen.colleciton-list.action.remove": "Remove", - "Web3ConfigurationScreen.colleciton-list.action.details": "Details", - "Web3ConfigurationScreen.collection-list.description": "Add your collection contracts here. Authgear will monitor them and verify the ownership for your users.", - "Web3ConfigurationScreen.collection-list.add-collection": "Add Collection", - "Web3ConfigurationScreen.collection-list.add-collection.contract-address": "Contract Address", - "Web3ConfigurationScreen.collection-list.add-collection.placeholder": "e.g. 0x06012c8cf97bead5deae237070f9587f8e7a266d", - "Web3ConfigurationScreen.collection-list.add-collection.metadata-error": "Failed to fetch metadata for contract", - "Web3ConfigurationScreen.collection-list.add-collection.token-type-button.erc721.title": "ERC-721", - "Web3ConfigurationScreen.collection-list.add-collection.token-type-button.erc721.description": "Non-fungible Token standard", - "Web3ConfigurationScreen.collection-list.add-collection.token-type-button.erc1155.title": "ERC-1155", - "Web3ConfigurationScreen.collection-list.add-collection.token-type-button.erc1155.description": "Multiple Token Standard", - "Web3ConfigurationScreen.collection-list.add-collection.large-collection-dialog.title": "This collection is not supported yet", - "Web3ConfigurationScreen.collection-list.add-collection.large-collection-dialog.description": "The size of the collection you entered is too large. Please contact us if this is the contract you want to use it in your project.", - "Web3ConfigurationScreen.collection-list.add-collection.large-collection-dialog.contact-sales": "Contact sales", - "Web3ConfigurationScreen.collection-list.add-collection.toke-tracking-dialog.title": "Which tokens should we track?", - "Web3ConfigurationScreen.collection-list.add-collection.toke-tracking-dialog.description": "Enter the token IDs of the NFTs you want to track and report in the user info. Type in a new line for each item.", - "Web3ConfigurationScreen.collection-list.add-collection.toke-tracking-dialog.placeholder": "One token ID per each line", - "Web3ConfigurationScreen.collection-list.add-collection.toke-tracking-dialog.item-count": "{count}/{max} items", - - "Web3ConfigurationScreen.confirmation-dialog.title": "Confirm Changes?", - "Web3ConfigurationScreen.confirmation-dialog.siwe-enabled.title": "Enabling Login with Ethereum", - "Web3ConfigurationScreen.confirmation-dialog.siwe-enabled.description": "This will replace all other login methods. Users cannot login with email, phone, username or social / enterprise connections. All your current authentication settings will be lost.", - "Web3ConfigurationScreen.confirmation-dialog.siwe-disabled.title": "Disabling Login with Ethereum", - "Web3ConfigurationScreen.confirmation-dialog.siwe-disabled.description": "This will set your login methods to the default values.", - "Web3ConfigurationScreen.confirmation-dialog.collection-added.title": "Adding NFT Collections", - "Web3ConfigurationScreen.confirmation-dialog.collection-added.description": "The following collections will be added to your project.", - "Web3ConfigurationScreen.confirmation-dialog.collection-removed.title": "Removing NFT Collections", - "Web3ConfigurationScreen.confirmation-dialog.collection-removed.description": "The following collections will be removed from your project.", - "Web3ConfigurationScreen.confirmation-dialog.tracked-token-changed.title": "Changing Tracked Tokens", - "Web3ConfigurationScreen.confirmation-dialog.tracked-token-changed.description": "The following collections will have their tracked tokens updated.", - "Web3ConfigurationScreen.confirmation-dialog.network-changed.title": "Changing Network", - "Web3ConfigurationScreen.confirmation-dialog.network-changed.description": "The target network will change from {b, react, children{{old}}} to {b, react, children{{new}}}", - "Web3ConfigurationScreen.confirmation-dialog.confirm": "Confirm and save", - "Web3ConfigurationScreen.network-change-dialog.title": "Changing Network", - "Web3ConfigurationScreen.network-change-dialog.description": "Changing to a different network will remove all saved NFT collections, are you sure to proceed?", - "Web3ConfigurationScreen.detail-dialog.recent-added-info": "Syncing chain. It will take few minutes.", - "Web3ConfigurationScreen.network-droplist.warning": "Switching to another network will clear your NFT Collections", - "Web3ConfigurationScreen.detail-dialog.contract-address": "Contract Address", - "Web3ConfigurationScreen.detail-dialog.view-on-explorer": "View on Explorer", - "Web3ConfigurationScreen.detail-dialog.network": "Network", - "Web3ConfigurationScreen.detail-dialog.token-type": "Token Type", - "Web3ConfigurationScreen.detail-dialog.token-type.erc721": "ERC-721", - "Web3ConfigurationScreen.detail-dialog.token-type.erc1155": "ERC-1155", - "Web3ConfigurationScreen.detail-dialog.token-type.unknown": "Unknown", - "Web3ConfigurationScreen.detail-dialog.block-height": "Block Height", - "Web3ConfigurationScreen.detail-dialog.block-height.description": "{currentHeight} / {DocLink, react, href{{explorerUrl}} children{Latest Block Height}}", - "Web3ConfigurationScreen.detail-dialog.total-supply": "Tokens", - "Web3ConfigurationScreen.detail-dialog.tracked-tokens": "Tracked Tokens", - "Web3ConfigurationScreen.detail-dialog.edit-tracked-tokens": "Edit tracked tokens", - "Web3ConfigurationScreen.detail-dialog.remove-collection": "Remove Collection", - "Web3ConfigurationScreen.deletion-dialog.title": "Remove collection", - "Web3ConfigurationScreen.deletion-dialog.description": "Are you sure you want to remove {collection} from your project?", - "Web3ConfigurationScreen.contact-us-dialog.title": "Contact us", - "Web3ConfigurationScreen.contact-us-dialog.description": "The collection you entered cannot be added.{br, react}Please contact us if this is the contract you want to use it in your project.", - "Web3ConfigurationScreen.contact-us-dialog.action": "Contact us", - "SIWE.disable-first": "Your project has enabled Sign in with Ethereum. Disable it{ReactRouterLink, react, to{{href}} children{here}} beforing choosing other login methods.", "VerificationConfigurationScreen.otp-valid-seconds.label": "6-digit OTP valid duration (seconds)", @@ -1912,13 +1838,6 @@ "GetStartedScreen.card.action-label.invite": "Invite members", "GetStartedScreen.card.skip-button.label": "Skip this", - "NetworkId.ethereum-mainnet": "Ethereum Mainnet", - "NetworkId.ethereum-goerli": "Ethereum Goerli", - "NetworkId.polygon-mainnet": "Polygon Mainnet", - "NetworkId.polygon-mumbai": "Polygon Mumbai", - - "NftCollection.item.identifier": "{name} ({network}: {address})", - "MFAConfigurationScreen.title": "2-Factor Authentication", "MFAConfigurationScreen.description": "Enhance your users' security during login to prevent unauthorized access.", "MFAConfigurationScreen.policy.title": "Policy", diff --git a/portal/src/system-config.ts b/portal/src/system-config.ts index b03ff927ff..a040e2072a 100644 --- a/portal/src/system-config.ts +++ b/portal/src/system-config.ts @@ -12,7 +12,6 @@ export interface SystemConfig { themes: SystemConfigThemes; translations: SystemConfigTranslations; searchEnabled: boolean; - web3Enabled: boolean; auditLogEnabled: boolean; gitCommitHash: string; analyticEnabled: boolean; @@ -263,7 +262,6 @@ export function instantiateSystemConfig( en: config.translations?.en ?? {}, }, searchEnabled: config.searchEnabled ?? false, - web3Enabled: config.web3Enabled ?? false, auditLogEnabled: config.auditLogEnabled ?? false, gitCommitHash: config.gitCommitHash ?? "", analyticEnabled: config.analyticEnabled ?? false, diff --git a/portal/src/types.ts b/portal/src/types.ts index a074ef328a..94e3bd580a 100644 --- a/portal/src/types.ts +++ b/portal/src/types.ts @@ -598,20 +598,6 @@ export interface UserProfileConfig { custom_attributes?: CustomAttributesConfig; } -// Web3 Configs -export interface SIWEConfig { - networks?: string[]; -} - -export interface NFTConfig { - collections?: string[]; -} - -export interface Web3Config { - nft?: NFTConfig; - siwe?: SIWEConfig; -} - // PortalAPIAppConfig export interface PortalAPIAppConfig { id: string; @@ -627,7 +613,6 @@ export interface PortalAPIAppConfig { oauth?: OAuthConfig; session?: SessionConfig; hook?: HookConfig; - web3?: Web3Config; user_profile?: UserProfileConfig; account_deletion?: AccountDeletionConfig; account_anonymization?: AccountAnonymizationConfig; @@ -815,7 +800,6 @@ export interface PortalAPIFeatureConfig { audit_log?: AuditLogFeatureConfig; google_tag_manager?: GoogleTagManagerFeatureConfig; collaborator?: CollaboratorFeatureConfig; - web3?: Web3FeatureConfig; } export interface AuthenticatorFeatureConfig { @@ -856,14 +840,6 @@ export interface AuthenticatorOOBOTBSMSFeatureConfig { disabled?: boolean; } -export interface Web3NFTFeatureConfig { - maximum?: number; -} - -export interface Web3FeatureConfig { - nft?: Web3NFTFeatureConfig; -} - export interface IdentityFeatureConfig { login_id?: LoginIDFeatureConfig; oauth?: OAuthSSOFeatureConfig; @@ -1038,51 +1014,6 @@ export interface StandardAttributesAddress { country?: string; } -export interface NFTContract { - name: string; - address: string; - type: string; -} - -export interface TransactionIdentifier { - hash: string; -} - -export interface BlockIdentifier { - index: number; - timestamp: Date; -} - -export interface NFTToken { - token_id: string; - transaction_identifier: TransactionIdentifier; - block_identifier: BlockIdentifier; - balance: string; -} - -export interface NFT { - contract: NFTContract; - tokens: NFTToken[]; -} - -export interface AccountIdentifier { - address?: string; -} - -export interface NetworkIdentifier { - blockchain?: string; - network?: string; -} -export interface Web3Account { - account_identifier?: AccountIdentifier; - network_identifier?: NetworkIdentifier; - nfts?: NFT[]; -} - -export interface Web3Claims { - accounts?: Web3Account[]; -} - export interface Identity { id: string; claims: IdentityClaims; diff --git a/portal/src/util/contractId.test.ts b/portal/src/util/contractId.test.ts deleted file mode 100644 index b4629aea48..0000000000 --- a/portal/src/util/contractId.test.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { describe, it, expect } from "@jest/globals"; -import { parseContractID, ContractID, createContractIDURL } from "./contractId"; - -describe("ContractID", () => { - it("parses contract id", () => { - function test(uri: string, expected: ContractID) { - const contractId = parseContractID(uri); - - expect(contractId).toEqual(expected); - } - - test("ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@1", { - blockchain: "ethereum", - network: "1", - address: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", - }); - - test( - "ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@1?token_ids=0x1&token_ids=0x2", - { - blockchain: "ethereum", - network: "1", - address: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", - query: new URLSearchParams([ - ["token_ids", "0x1"], - ["token_ids", "0x2"], - ]), - } - ); - }); - - it("generate contract id url", () => { - function test(contractId: ContractID, expected: string) { - const url = createContractIDURL(contractId); - - expect(url).toEqual(expected); - } - - test( - { - blockchain: "ethereum", - network: "1", - address: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", - }, - "ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@1" - ); - - test( - { - blockchain: "ethereum", - network: "1", - address: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", - query: new URLSearchParams([ - ["token_ids", "0x1"], - ["token_ids", "0x2"], - ]), - }, - "ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@1?token_ids=0x1&token_ids=0x2" - ); - }); -}); diff --git a/portal/src/util/contractId.ts b/portal/src/util/contractId.ts deleted file mode 100644 index f9f0b7d49a..0000000000 --- a/portal/src/util/contractId.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { createEIP681URL, parseEIP681 } from "./eip681"; - -export interface ContractID { - blockchain: string; - network: string; - address: string; - query?: URLSearchParams; -} - -export function parseContractID( - url: string, - skipAddressCheck: boolean = false -): ContractID { - const curl = new URL(url); - - const protocol = curl.protocol.replace(":", ""); - - switch (protocol) { - case "ethereum": { - const eip681 = parseEIP681(url, skipAddressCheck); - - return { - blockchain: "ethereum", - network: eip681.chainId.toString(), - address: eip681.address, - query: eip681.query, - }; - } - - default: - throw new Error(`Unknown protocol: ${protocol}`); - } -} - -export function createContractIDURL(contractId: ContractID): string { - switch (contractId.blockchain) { - case "ethereum": - return createEIP681URL({ - chainId: parseInt(contractId.network, 10), - address: contractId.address, - query: contractId.query, - }); - default: - throw new Error(`Unknown blockchain: ${contractId.blockchain}`); - } -} diff --git a/portal/src/util/eip681.test.ts b/portal/src/util/eip681.test.ts deleted file mode 100644 index a85239ec5c..0000000000 --- a/portal/src/util/eip681.test.ts +++ /dev/null @@ -1,318 +0,0 @@ -import { describe, it, expect } from "@jest/globals"; -import { - createEIP681URL, - EIP681, - explorerAddress, - explorerBlock, - explorerBlocks, - explorerTx, - explorerURL, - parseEIP681, -} from "./eip681"; - -describe("EIP681", () => { - it("parses eip681 success with address check", () => { - function test(uri: string, expected: EIP681) { - const eip681 = parseEIP681(uri); - - expect(eip681).toEqual(expected); - } - - test("ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@1", { - chainId: 1, - address: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", - }); - - test("ethereum:0xdc0479cc5bba033b3e7de9f178607150b3abce1f@1231", { - chainId: 1231, - address: "0xdc0479cc5bba033b3e7de9f178607150b3abce1f", - }); - - test("ethereum:0x71c7656ec7ab88b098defb751b7401b5f6d8976f@23821", { - chainId: 23821, - address: "0x71c7656ec7ab88b098defb751b7401b5f6d8976f", - }); - - test( - "ethereum:0x71c7656ec7ab88b098defb751b7401b5f6d8976f@23821?token_ids=0x1&token_ids=0x2", - { - chainId: 23821, - address: "0x71c7656ec7ab88b098defb751b7401b5f6d8976f", - query: new URLSearchParams([ - ["token_ids", "0x1"], - ["token_ids", "0x2"], - ]), - } - ); - }); - - it("parses eip681 without address check", () => { - function test(uri: string, expected: EIP681) { - const eip681 = parseEIP681(uri, true); - - expect(eip681).toEqual(expected); - } - - test("ethereum:0x0@1", { - chainId: 1, - address: "0x0", - }); - - test("ethereum:0x0@1231", { - chainId: 1231, - address: "0x0", - }); - - test("ethereum:0x0@23821", { - chainId: 23821, - address: "0x0", - }); - }); - - it("create eip681 url with address check", () => { - function test(eip681: EIP681, expected: string) { - const url = createEIP681URL(eip681); - - expect(url).toEqual(expected); - } - - test( - { - chainId: 1, - address: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", - }, - "ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@1" - ); - - test( - { - chainId: 1231, - address: "0xdc0479cc5bba033b3e7de9f178607150b3abce1f", - }, - "ethereum:0xdc0479cc5bba033b3e7de9f178607150b3abce1f@1231" - ); - - test( - { - chainId: 23821, - address: "0x71c7656ec7ab88b098defb751b7401b5f6d8976f", - }, - "ethereum:0x71c7656ec7ab88b098defb751b7401b5f6d8976f@23821" - ); - }); - - it("create eip681 url without address check", () => { - function test(eip681: EIP681, expected: string) { - const url = createEIP681URL(eip681, true); - - expect(url).toEqual(expected); - } - - test( - { - chainId: 1, - address: "0x0", - }, - "ethereum:0x0@1" - ); - - test( - { - chainId: 1231, - address: "0x0", - }, - "ethereum:0x0@1231" - ); - - test( - { - chainId: 23821, - address: "0x0", - }, - "ethereum:0x0@23821" - ); - }); - - it("create etherscan url with address check", () => { - function test(uri: string, expected: string) { - const url = explorerURL(uri); - - expect(url).toEqual(expected); - } - - test( - "ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@1", - "https://etherscan.io/" - ); - - test( - "ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@5", - "https://goerli.etherscan.io/" - ); - - test("ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@1234", ""); - }); - - it("create etherscan url without address check", () => { - function test(uri: string, expected: string) { - const url = explorerURL(uri, true); - - expect(url).toEqual(expected); - } - - test("ethereum:0x0@1", "https://etherscan.io/"); - - test("ethereum:0x0@5", "https://goerli.etherscan.io/"); - - test("ethereum:0x0@1234", ""); - }); - - it("create etherscan address url with address check", () => { - function test(uri: string, expected: string) { - const url = explorerAddress(uri); - - expect(url).toEqual(expected); - } - - test( - "ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@1", - "https://etherscan.io/address/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d" - ); - - test( - "ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@5", - "https://goerli.etherscan.io/address/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d" - ); - - test( - "ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@1234", - "address/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d" - ); - }); - - it("create etherscan address url without address check", () => { - function test(uri: string, expected: string) { - const url = explorerAddress(uri, true); - - expect(url).toEqual(expected); - } - - test("ethereum:0x0@1", "https://etherscan.io/address/0x0"); - - test("ethereum:0x0@5", "https://goerli.etherscan.io/address/0x0"); - - test("ethereum:0x0@1234", "address/0x0"); - }); - - it("create etherscan transaction hash url with address check", () => { - function test(uri: string, tx: string, expected: string) { - const url = explorerTx(uri, tx); - - expect(url).toEqual(expected); - } - - test( - "ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@1", - "0x13aec95326ee5d0ba5d09d814746a7580a7d2a8bf5fb907b6fa398112353abd3", - "https://etherscan.io/tx/0x13aec95326ee5d0ba5d09d814746a7580a7d2a8bf5fb907b6fa398112353abd3" - ); - - test( - "ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@5", - "0x13aec95326ee5d0ba5d09d814746a7580a7d2a8bf5fb907b6fa398112353abd3", - "https://goerli.etherscan.io/tx/0x13aec95326ee5d0ba5d09d814746a7580a7d2a8bf5fb907b6fa398112353abd3" - ); - - test( - "ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@1234", - "0x13aec95326ee5d0ba5d09d814746a7580a7d2a8bf5fb907b6fa398112353abd3", - "tx/0x13aec95326ee5d0ba5d09d814746a7580a7d2a8bf5fb907b6fa398112353abd3" - ); - }); - - it("create etherscan transaction hash url without address check", () => { - function test(uri: string, tx: string, expected: string) { - const url = explorerTx(uri, tx, true); - - expect(url).toEqual(expected); - } - - test( - "ethereum:0x0@1", - "0x13aec95326ee5d0ba5d09d814746a7580a7d2a8bf5fb907b6fa398112353abd3", - "https://etherscan.io/tx/0x13aec95326ee5d0ba5d09d814746a7580a7d2a8bf5fb907b6fa398112353abd3" - ); - - test( - "ethereum:0x0@5", - "0x13aec95326ee5d0ba5d09d814746a7580a7d2a8bf5fb907b6fa398112353abd3", - "https://goerli.etherscan.io/tx/0x13aec95326ee5d0ba5d09d814746a7580a7d2a8bf5fb907b6fa398112353abd3" - ); - - test( - "ethereum:0x0@1234", - "0x13aec95326ee5d0ba5d09d814746a7580a7d2a8bf5fb907b6fa398112353abd3", - "tx/0x13aec95326ee5d0ba5d09d814746a7580a7d2a8bf5fb907b6fa398112353abd3" - ); - }); - - it("create etherscan block url with address check", () => { - function test(uri: string, block: string, expected: string) { - const url = explorerBlock(uri, block); - - expect(url).toEqual(expected); - } - - test( - "ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@1", - "1234", - "https://etherscan.io/block/1234" - ); - - test( - "ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@5", - "1234", - "https://goerli.etherscan.io/block/1234" - ); - - test( - "ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@1234", - "1234", - "block/1234" - ); - }); - - it("create etherscan block url without address check", () => { - function test(uri: string, block: string, expected: string) { - const url = explorerBlock(uri, block, true); - - expect(url).toEqual(expected); - } - - test("ethereum:0x0@1", "1234", "https://etherscan.io/block/1234"); - - test("ethereum:0x0@5", "1234", "https://goerli.etherscan.io/block/1234"); - - test("ethereum:0x0@1234", "1234", "block/1234"); - }); - - it("create etherscan blocks url with address check", () => { - function test(uri: string, expected: string) { - const url = explorerBlocks(uri); - - expect(url).toEqual(expected); - } - - test( - "ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@1", - "https://etherscan.io/blocks/" - ); - - test( - "ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@5", - "https://goerli.etherscan.io/blocks/" - ); - - test("ethereum:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d@1234", "blocks/"); - }); -}); diff --git a/portal/src/util/eip681.ts b/portal/src/util/eip681.ts deleted file mode 100644 index 9612519ebf..0000000000 --- a/portal/src/util/eip681.ts +++ /dev/null @@ -1,121 +0,0 @@ -const ETHEREUM_ADDRESS_REGEX = /^0x[a-fA-F0-9]{40}$/; - -export interface EIP681 { - chainId: number; - address: string; - query?: URLSearchParams; -} - -export function parseEIP681( - uri: string, - skipAddressCheck: boolean = false -): EIP681 { - const url = new URL(uri); - if (url.protocol !== "ethereum:") { - throw new Error(`Invalid protocol: ${url.protocol}`); - } - - const addressURI = url.pathname.split("@"); - - if (addressURI.length !== 2) { - throw new Error(`Invalid URI: ${url.pathname}`); - } - - const address = addressURI[0]; - if (!skipAddressCheck && !ETHEREUM_ADDRESS_REGEX.test(address)) { - throw new Error(`Invalid address: ${address}`); - } - - const chainId = parseInt(addressURI[1], 10); - if (chainId < 0) { - throw new Error(`Chain ID cannot be negative: ${chainId}`); - } - - const query = - url.searchParams.toString() !== "" ? url.searchParams : undefined; - - return { - chainId, - address, - query, - }; -} - -export function createEIP681URL( - eip681: EIP681, - skipAddressCheck: boolean = false -): string { - const query = eip681.query?.toString() ?? ""; - const url = `ethereum:${eip681.address}@${eip681.chainId}${ - query !== "" ? "?" + query : "" - }`; - // Confirm the format is correct - parseEIP681(url, skipAddressCheck); - return url; -} - -export function explorerURL( - eip681String: string, - skipAddressCheck: boolean = false -): string { - const eip681 = parseEIP681(eip681String, skipAddressCheck); - - let prefix: string; - switch (eip681.chainId) { - case 1: - prefix = "https://etherscan.io/"; - break; - case 5: - prefix = "https://goerli.etherscan.io/"; - break; - case 137: - prefix = "https://polygonscan.com/"; - break; - case 80001: - prefix = "https://mumbai.polygonscan.com/"; - break; - default: - prefix = ""; - } - - return prefix; -} - -export function explorerAddress( - eip681String: string, - skipAddressCheck: boolean = false -): string { - const eip681 = parseEIP681(eip681String, skipAddressCheck); - const prefix = explorerURL(eip681String, skipAddressCheck) + "address/"; - - return prefix + eip681.address; -} - -export function explorerTx( - eip681String: string, - tx: string, - skipAddressCheck: boolean = false -): string { - const prefix = explorerURL(eip681String, skipAddressCheck) + "tx/"; - - return prefix + tx; -} - -export function explorerBlock( - eip681String: string, - block: string, - skipAddressCheck: boolean = false -): string { - const prefix = explorerURL(eip681String, skipAddressCheck) + "block/"; - - return prefix + block; -} - -export function explorerBlocks( - eip681String: string, - skipAddressCheck: boolean = false -): string { - const prefix = explorerURL(eip681String, skipAddressCheck) + "blocks/"; - - return prefix; -} diff --git a/portal/src/util/networkId.test.ts b/portal/src/util/networkId.test.ts deleted file mode 100644 index 760a0c6fc4..0000000000 --- a/portal/src/util/networkId.test.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { describe, it, expect } from "@jest/globals"; -import { createNetworkIDURL, NetworkID, parseNetworkID } from "./networkId"; - -describe("NetworkId", () => { - it("parses network id", () => { - function test(uri: string, expected: NetworkID) { - const networkId = parseNetworkID(uri); - - expect(networkId).toEqual(expected); - } - - test("ethereum:0x0@1", { - blockchain: "ethereum", - network: "1", - }); - }); - - it("generate network id url", () => { - function test(networkId: NetworkID, expected: string) { - const url = createNetworkIDURL(networkId); - - expect(url).toEqual(expected); - } - - test( - { - blockchain: "ethereum", - network: "1", - }, - "ethereum:0x0@1" - ); - }); -}); diff --git a/portal/src/util/networkId.ts b/portal/src/util/networkId.ts deleted file mode 100644 index c13ab49913..0000000000 --- a/portal/src/util/networkId.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { createEIP681URL, parseEIP681 } from "./eip681"; - -export const ALL_SUPPORTED_NETWORKS: NetworkID[] = [ - { - blockchain: "ethereum", - network: "1", - }, - { - blockchain: "ethereum", - network: "5", - }, - { - blockchain: "ethereum", - network: "137", - }, - { - blockchain: "ethereum", - network: "80001", - }, -]; -export interface NetworkID { - blockchain: string; - network: string; -} - -export function sameNetworkID(a: NetworkID, b: NetworkID): boolean { - return a.blockchain === b.blockchain && a.network === b.network; -} - -export function parseNetworkID(url: string): NetworkID { - const curl = new URL(url); - - const protocol = curl.protocol.replace(":", ""); - - switch (protocol) { - case "ethereum": { - const eip681 = parseEIP681(url, true); - - if (eip681.address !== "0x0") { - throw new Error(`Unknown network Id: ${url}`); - } - - return { - blockchain: "ethereum", - network: eip681.chainId.toString(), - }; - } - - default: - throw new Error(`Unknown protocol: ${protocol}`); - } -} - -export function createNetworkIDURL(networkID: NetworkID): string { - switch (networkID.blockchain) { - case "ethereum": - return createEIP681URL( - { - chainId: parseInt(networkID.network, 10), - address: "0x0", - }, - true - ); - default: - throw new Error(`Unknown blockchain: ${networkID.blockchain}`); - } -} - -export function getNetworkNameID(networkID: NetworkID): string { - switch (networkID.blockchain) { - case "ethereum": - switch (networkID.network) { - case "1": - return "NetworkId.ethereum-mainnet"; - case "5": - return "NetworkId.ethereum-goerli"; - case "137": - return "NetworkId.polygon-mainnet"; - case "80001": - return "NetworkId.polygon-mumbai"; - default: - throw new Error(`Unsupported chain id: ${networkID.network}`); - } - default: - throw new Error(`Unsupported blockchain: ${networkID.blockchain}`); - } -} diff --git a/resources/authgear/templates/de/translation.json b/resources/authgear/templates/de/translation.json index 495b68ccc0..d771ba2cc0 100644 --- a/resources/authgear/templates/de/translation.json +++ b/resources/authgear/templates/de/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "Passkey wurde auf Ihrem Gerät nicht gefunden. {type, select, password{Melden Sie sich stattdessen mit dem Passwort an?} oob_otp_email{Melden Sie sich stattdessen mit dem Einmalpasswort an?} oob_otp_sms{Melden Sie sich stattdessen mit dem Einmalpasswort an?} other{Versuchen Sie es mit einem anderen Gerät?}}", "error-passkey-empty-allow-credentials": "Die Anmeldung mit Passkey wird auf diesem Gerät nicht vollständig unterstützt.{variant, select, phone{ Bitte fahren Sie mit Ihrer Telefonnummer fort.} email{ Bitte fahren Sie mit Ihrer E-Mail-Adresse fort.} username{ Bitte fahren Sie mit Ihrem Benutzernamen fort.} other{ Bitte fahren Sie mit Ihrer E-Mail-Adresse oder Ihrem Benutzernamen fort.}}", "error-passkey-duplicate": "Sie haben bereits einen Passkey auf diesem Gerät.", - "error-metamask-unauthorized": "Sie haben den Vorgang nicht autorisiert.", - "error-metamask-unsupported-method": "Die angeforderte Methode wird nicht unterstützt.", - "error-metamask-disconnected": "Der Provider ist von der angegebenen Kette getrennt.", - "error-failed-to-connect-wallet": "Verbindung zum Wallet fehlgeschlagen.", "error-page-not-found": "Die Seite kann nicht gefunden werden", "error-page-not-found-action": "Zurück zur Startseite", "error-app-not-found": "{host} ist kein gültiges Projekt", diff --git a/resources/authgear/templates/el/translation.json b/resources/authgear/templates/el/translation.json index 1aaa2b83c7..2b6f91447c 100644 --- a/resources/authgear/templates/el/translation.json +++ b/resources/authgear/templates/el/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "Το Passkey δεν βρέθηκε στη συσκευή σας. {type, select, password{Να συνδεθείτε με τον κωδικό πρόσβασης αντ'' αυτού;} oob_otp_email{Να συνδεθείτε με τον εφάπαξ κωδικό αντ'' αυτού;} oob_otp_sms{Να συνδεθείτε με τον εφάπαξ κωδικό αντ'' αυτού;} other{Να δοκιμάσετε μια άλλη συσκευή;}}", "error-passkey-empty-allow-credentials": "Η σύνδεση με Passkey δεν υποστηρίζεται πλήρως σε αυτή τη συσκευή.{variant, select, phone{ Παρακαλώ συνεχίστε με τον αριθμό του τηλεφώνου σας.} email{ Παρακαλώ συνεχίστε με τη διεύθυνση email σας.} username{ Παρακαλώ συνεχίστε με το όνομα χρήστη σας.} other{ Παρακαλώ συνεχίστε με τη διεύθυνση email ή το όνομα χρήστη σας.}}", "error-passkey-duplicate": "Έχετε ήδη ένα Passkey σε αυτή τη συσκευή.", - "error-metamask-unauthorized": "Δεν εξουσιοδοτήσατε τη λειτουργία.", - "error-metamask-unsupported-method": "Η ζητούμενη μέθοδος δεν υποστηρίζεται.", - "error-metamask-disconnected": "Ο πάροχος είναι αποσυνδεδεμένος από την καθορισμένη αλυσίδα.", - "error-failed-to-connect-wallet": "Αποτυχία σύνδεσης με το πορτοφόλι.", "error-page-not-found": "Η σελίδα δεν μπορεί να βρεθεί", "error-page-not-found-action": "Επιστροφή στην Αρχική", "error-app-not-found": "{host} δεν είναι έγκυρο έργο", diff --git a/resources/authgear/templates/en/translation.json b/resources/authgear/templates/en/translation.json index a4cafb1817..d8918e3928 100644 --- a/resources/authgear/templates/en/translation.json +++ b/resources/authgear/templates/en/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "Passkey is not found on your device. {type, select, password{Sign in with password instead?} oob_otp_email{Sign in with one-time password instead?} oob_otp_sms{Sign in with one-time password instead?} other{Try another device?}}", "error-passkey-empty-allow-credentials": "Sign in with passkey is not fully supported on this device.{variant, select, phone{ Please continue with your phone number.} email{ Please continue with your email address.} username{ Please continue with your username.} other{ Please continue with your email address or username.}}", "error-passkey-duplicate": "You have a passkey on this device already.", - "error-metamask-unauthorized": "You did not authorize the operation.", - "error-metamask-unsupported-method": "The requested method is not supported.", - "error-metamask-disconnected": "The provider is disconnected from the specified chain.", - "error-failed-to-connect-wallet": "Failed to connect to wallet.", "error-page-not-found": "The page cannot be found", "error-page-not-found-action": "Return to Home", "error-app-not-found": "{host} a not valid project", diff --git a/resources/authgear/templates/en/web/__error.html b/resources/authgear/templates/en/web/__error.html index 71b37628bb..0915412e4f 100644 --- a/resources/authgear/templates/en/web/__error.html +++ b/resources/authgear/templates/en/web/__error.html @@ -46,18 +46,6 @@ - - - - {{ if $display_error }} {{ $info := .Error.info }} {{ if eq .Error.reason "ValidationFailed" }} {{ range .Error.info.causes }} {{ if (eq .kind diff --git a/resources/authgear/templates/en/web/connect_web3_account.html b/resources/authgear/templates/en/web/connect_web3_account.html index a7caa86eb1..a6c42a8350 100644 --- a/resources/authgear/templates/en/web/connect_web3_account.html +++ b/resources/authgear/templates/en/web/connect_web3_account.html @@ -13,20 +13,14 @@

-
@@ -36,24 +30,20 @@

class="hidden" name="x_siwe_message" type="hidden" - data-web3-wallet-confirmation-target="message" /> diff --git a/resources/authgear/templates/en/web/missing_web3_wallet.html b/resources/authgear/templates/en/web/missing_web3_wallet.html deleted file mode 100644 index 68b3a1eb3e..0000000000 --- a/resources/authgear/templates/en/web/missing_web3_wallet.html +++ /dev/null @@ -1,36 +0,0 @@ -{{ template "__page_frame.html" . }} {{ define "page-content" }} -
-

- {{ template "missing-web3-wallet-page-title" }} -

- - -
- {{ template "missing-web3-wallet-page-description" (dict "provider" - ($.Translations.RenderText (printf "web3-provider-%s" $.Provider) nil)) }} -
- - - {{ template "__watermark.html" . }} -
-{{ end }} diff --git a/resources/authgear/templates/es-419/translation.json b/resources/authgear/templates/es-419/translation.json index c2fcd3bb46..36edb51bb8 100644 --- a/resources/authgear/templates/es-419/translation.json +++ b/resources/authgear/templates/es-419/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "No se encuentra la Passkey en su dispositivo. {type, select, password{¿Iniciar sesión con contraseña en su lugar?} oob_otp_email{¿Iniciar sesión con contraseña de un solo uso en su lugar?} oob_otp_sms{¿Iniciar sesión con contraseña de un solo uso en su lugar?} other{¿Probar otro dispositivo?}}", "error-passkey-empty-allow-credentials": "El inicio de sesión con Passkey no es totalmente compatible con este dispositivo.{variant, select, phone{ Por favor, continúe con su número de teléfono.} email{ Por favor, continúe con su dirección de correo electrónico.} username{ Por favor, continúe con su nombre de usuario.} other{ Por favor, continúe con su dirección de correo electrónico o nombre de usuario.}}", "error-passkey-duplicate": "Ya tiene una Passkey en este dispositivo.", - "error-metamask-unauthorized": "No autorizó la operación.", - "error-metamask-unsupported-method": "El método solicitado no es compatible.", - "error-metamask-disconnected": "El proveedor está desconectado de la cadena especificada.", - "error-failed-to-connect-wallet": "No se pudo conectar a la billetera.", "error-page-not-found": "No se puede encontrar la página", "error-page-not-found-action": "Volver al inicio", "error-app-not-found": "{host} no es un proyecto válido", diff --git a/resources/authgear/templates/es-ES/translation.json b/resources/authgear/templates/es-ES/translation.json index dd99f16245..273883ddea 100644 --- a/resources/authgear/templates/es-ES/translation.json +++ b/resources/authgear/templates/es-ES/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "No se encuentra la Passkey en su dispositivo. {type, select, password{¿Iniciar sesión con contraseña en su lugar?} oob_otp_email{¿Iniciar sesión con contraseña de un solo uso en su lugar?} oob_otp_sms{¿Iniciar sesión con contraseña de un solo uso en su lugar?} other{¿Probar otro dispositivo?}}", "error-passkey-empty-allow-credentials": "El inicio de sesión con Passkey no es totalmente compatible con este dispositivo.{variant, select, phone{ Por favor, continúe con su número de teléfono.} email{ Por favor, continúe con su dirección de correo electrónico.} username{ Por favor, continúe con su nombre de usuario.} other{ Por favor, continúe con su dirección de correo electrónico o nombre de usuario.}}", "error-passkey-duplicate": "Ya tiene una Passkey en este dispositivo.", - "error-metamask-unauthorized": "No autorizó la operación.", - "error-metamask-unsupported-method": "El método solicitado no es compatible.", - "error-metamask-disconnected": "El proveedor está desconectado de la cadena especificada.", - "error-failed-to-connect-wallet": "No se pudo conectar a la billetera.", "error-page-not-found": "No se puede encontrar la página", "error-page-not-found-action": "Volver al inicio", "error-app-not-found": "{host} no es un proyecto válido", diff --git a/resources/authgear/templates/es/translation.json b/resources/authgear/templates/es/translation.json index 93c7174c66..111b4c20de 100644 --- a/resources/authgear/templates/es/translation.json +++ b/resources/authgear/templates/es/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "No se encuentra Passkey en tu dispositivo. {type, select, password{¿Iniciar sesión con contraseña en su lugar?} oob_otp_email{¿Iniciar sesión con contraseña de un solo uso en su lugar?} oob_otp_sms{¿Iniciar sesión con contraseña de un solo uso en su lugar?} other{¿Intentar con otro dispositivo?}}", "error-passkey-empty-allow-credentials": "El inicio de sesión con passkey no está totalmente admitido en este dispositivo.{variant, select, phone{ Continúa con tu número de teléfono.} email{ Continúa con tu dirección de correo electrónico.} username{ Continúa con tu nombre de usuario.} other{ Continúa con tu dirección de correo electrónico o nombre de usuario.}}", "error-passkey-duplicate": "Ya tienes un passkey en este dispositivo.", - "error-metamask-unauthorized": "No autorizaste la operación.", - "error-metamask-unsupported-method": "El método solicitado no está admitido.", - "error-metamask-disconnected": "El proveedor está desconectado de la cadena especificada.", - "error-failed-to-connect-wallet": "Error al conectar con la billetera.", "error-page-not-found": "No se puede encontrar la página", "error-page-not-found-action": "Volver al Inicio", "error-app-not-found": "{host} no es un proyecto válido", diff --git a/resources/authgear/templates/fil/translation.json b/resources/authgear/templates/fil/translation.json index 43a810097b..9fdb292dbb 100644 --- a/resources/authgear/templates/fil/translation.json +++ b/resources/authgear/templates/fil/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "Ang Passkey ay hindi makita sa iyong device. {type, select, password{Mag-sign in gamit ang password sa halip?} oob_otp_email{Mag-sign in gamit ang one-time password sa halip?} oob_otp_sms{Mag-sign in gamit ang one-time password sa halip?} other{Subukang gumamit ng ibang device?}}", "error-passkey-empty-allow-credentials": "Ang pag-sign in gamit ang passkey ay hindi ganap na suportado sa device na ito.{variant, select, phone{ Mangyaring magpatuloy gamit ang iyong numero ng telepono.} email{ Mangyaring magpatuloy gamit ang iyong email address.} username{ Mangyaring magpatuloy gamit ang iyong username.} other{ Mangyaring magpatuloy gamit ang iyong email address o username.}}", "error-passkey-duplicate": "Mayroon ka nang passkey sa device na ito.", - "error-metamask-unauthorized": "Hindi mo binigyan ng pahintulot ang operasyon.", - "error-metamask-unsupported-method": "Ang hiniling na method ay hindi suportado.", - "error-metamask-disconnected": "Ang provider ay nadiskonekta mula sa tinukoy na chain.", - "error-failed-to-connect-wallet": "Hindi makakonekta sa wallet.", "error-page-not-found": "Hindi mahanap ang pahina", "error-page-not-found-action": "Bumalik sa Home", "error-app-not-found": "{host} ay hindi isang valid na proyekto", diff --git a/resources/authgear/templates/fr/translation.json b/resources/authgear/templates/fr/translation.json index f62af83f56..3123d70027 100644 --- a/resources/authgear/templates/fr/translation.json +++ b/resources/authgear/templates/fr/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "Passkey n''est pas trouvé sur votre appareil. {type, select, password{Connectez-vous avec le mot de passe à la place ?} oob_otp_email{Connectez-vous avec le mot de passe à usage unique à la place ?} oob_otp_sms{Connectez-vous avec le mot de passe à usage unique à la place ?} other{Essayez un autre appareil ?}}", "error-passkey-empty-allow-credentials": "La connexion avec Passkey n''est pas complètement prise en charge sur cet appareil.{variant, select, phone{ Veuillez continuer avec votre numéro de téléphone.} email{ Veuillez continuer avec votre adresse e-mail.} username{ Veuillez continuer avec votre nom d''utilisateur.} other{ Veuillez continuer avec votre adresse e-mail ou votre nom d''utilisateur.}}", "error-passkey-duplicate": "Vous avez déjà un Passkey sur cet appareil.", - "error-metamask-unauthorized": "Vous n''avez pas autorisé l''opération.", - "error-metamask-unsupported-method": "La méthode demandée n''est pas prise en charge.", - "error-metamask-disconnected": "Le fournisseur est déconnecté de la chaîne spécifiée.", - "error-failed-to-connect-wallet": "Échec de la connexion au portefeuille.", "error-page-not-found": "La page est introuvable", "error-page-not-found-action": "Retour à l''accueil", "error-app-not-found": "{host} n''est pas un projet valide", diff --git a/resources/authgear/templates/id/translation.json b/resources/authgear/templates/id/translation.json index c58f7c3b7d..fe009693f1 100644 --- a/resources/authgear/templates/id/translation.json +++ b/resources/authgear/templates/id/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "Passkey tidak ditemukan di perangkat Anda. {type, select, password{Masuk dengan kata sandi sebagai gantinya?} oob_otp_email{Masuk dengan kata sandi satu kali sebagai gantinya?} oob_otp_sms{Masuk dengan kata sandi satu kali sebagai gantinya?} other{Coba perangkat lain?}}", "error-passkey-empty-allow-credentials": "Masuk dengan passkey tidak sepenuhnya didukung di perangkat ini.{variant, select, phone{ Silakan lanjutkan dengan nomor telepon Anda.} email{ Silakan lanjutkan dengan alamat email Anda.} username{ Silakan lanjutkan dengan nama pengguna Anda.} other{ Silakan lanjutkan dengan alamat email atau nama pengguna Anda.}}", "error-passkey-duplicate": "Anda sudah memiliki passkey di perangkat ini.", - "error-metamask-unauthorized": "Anda tidak mengotorisasi operasi tersebut.", - "error-metamask-unsupported-method": "Metode yang diminta tidak didukung.", - "error-metamask-disconnected": "Penyedia terputus dari rantai yang ditentukan.", - "error-failed-to-connect-wallet": "Gagal terhubung ke dompet.", "error-page-not-found": "Halaman tidak dapat ditemukan", "error-page-not-found-action": "Kembali ke Beranda", "error-app-not-found": "{host} bukan proyek yang valid", diff --git a/resources/authgear/templates/it/translation.json b/resources/authgear/templates/it/translation.json index 8f4a61ddac..1f2c26db09 100644 --- a/resources/authgear/templates/it/translation.json +++ b/resources/authgear/templates/it/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "Passkey non è stato trovato sul tuo dispositivo. {type, select, password{Accedi invece con la password?} oob_otp_email{Accedi invece con una password monouso?} oob_otp_sms{Accedi invece con una password monouso?} other{Prova con un altro dispositivo?}}", "error-passkey-empty-allow-credentials": "L''accesso con Passkey non è completamente supportato su questo dispositivo.{variant, select, phone{ Per favore, continua con il tuo numero di telefono.} email{ Per favore, continua con il tuo indirizzo email.} username{ Per favore, continua con il tuo nome utente.} other{ Per favore, continua con il tuo indirizzo email o nome utente.}}", "error-passkey-duplicate": "Hai già un Passkey su questo dispositivo.", - "error-metamask-unauthorized": "Non hai autorizzato l''operazione.", - "error-metamask-unsupported-method": "Il metodo richiesto non è supportato.", - "error-metamask-disconnected": "Il provider è disconnesso dalla catena specificata.", - "error-failed-to-connect-wallet": "Impossibile connettersi al portafoglio.", "error-page-not-found": "La pagina non può essere trovata", "error-page-not-found-action": "Torna alla Home", "error-app-not-found": "{host} non è un progetto valido", diff --git a/resources/authgear/templates/ja/translation.json b/resources/authgear/templates/ja/translation.json index 8fd1358ceb..5b30054580 100644 --- a/resources/authgear/templates/ja/translation.json +++ b/resources/authgear/templates/ja/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "デバイスにPasskeyが見つかりません。{type, select, password{パスワードでサインインしますか?} oob_otp_email{ワンタイムパスワードでサインインしますか?} oob_otp_sms{ワンタイムパスワードでサインインしますか?} other{別のデバイスを試してください?}}", "error-passkey-empty-allow-credentials": "このデバイスではPasskeyでのサインインが完全にサポートされていません。{variant, select, phone{代わりに電話番号でサインインしてください。} email{代わりにメールアドレスでサインインしてください。} username{代わりにユーザー名でサインインしてください。} other{代わりにメールアドレスまたはユーザー名でサインインしてください。}}", "error-passkey-duplicate": "このデバイスにはすでにPasskeyがあります。", - "error-metamask-unauthorized": "操作を承認していません。", - "error-metamask-unsupported-method": "要求されたメソッドはサポートされていません。", - "error-metamask-disconnected": "プロバイダが指定されたチェーンから切断されています。", - "error-failed-to-connect-wallet": "ウォレットに接続できませんでした。", "error-page-not-found": "ページが見つかりません", "error-page-not-found-action": "ホームに戻る", "error-app-not-found": "{host}は有効なプロジェクトではありません", diff --git a/resources/authgear/templates/ko/translation.json b/resources/authgear/templates/ko/translation.json index 619ecccc79..08fdead86e 100644 --- a/resources/authgear/templates/ko/translation.json +++ b/resources/authgear/templates/ko/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "기기에서 Passkey를 찾을 수 없습니다. {type, select, password{대신 비밀번호로 로그인하시겠습니까?} oob_otp_email{대신 일회성 비밀번호로 로그인하시겠습니까?} oob_otp_sms{대신 일회성 비밀번호로 로그인하시겠습니까?} other{다른 기기를 시도해 보세요?}}", "error-passkey-empty-allow-credentials": "이 기기에서는 Passkey 로그인이 완전히 지원되지 않습니다.{variant, select, phone{ 대신 전화번호로 계속하세요.} email{ 대신 이메일 주소로 계속하세요.} username{ 대신 사용자 이름으로 계속하세요.} other{ 대신 이메일 주소 또는 사용자 이름으로 계속하세요.}}", "error-passkey-duplicate": "이 기기에 이미 Passkey가 있습니다.", - "error-metamask-unauthorized": "작업을 승인하지 않았습니다.", - "error-metamask-unsupported-method": "요청된 메서드가 지원되지 않습니다.", - "error-metamask-disconnected": "제공자가 지정된 체인에서 연결이 끊겼습니다.", - "error-failed-to-connect-wallet": "지갑에 연결하지 못했습니다.", "error-page-not-found": "페이지를 찾을 수 없습니다", "error-page-not-found-action": "홈으로 돌아가기", "error-app-not-found": "{host}은(는) 유효한 프로젝트가 아닙니다", diff --git a/resources/authgear/templates/ms/translation.json b/resources/authgear/templates/ms/translation.json index 19dc0fe99e..8cc3670891 100644 --- a/resources/authgear/templates/ms/translation.json +++ b/resources/authgear/templates/ms/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "Passkey tidak ditemui pada peranti anda. {type, select, password{Log masuk dengan kata laluan sebaliknya?} oob_otp_email{Log masuk dengan kata laluan sekali guna sebaliknya?} oob_otp_sms{Log masuk dengan kata laluan sekali guna sebaliknya?} other{Cuba peranti lain?}}", "error-passkey-empty-allow-credentials": "Log masuk dengan passkey tidak disokong sepenuhnya pada peranti ini.{variant, select, phone{ Sila teruskan dengan nombor telefon anda.} email{ Sila teruskan dengan alamat e-mel anda.} username{ Sila teruskan dengan nama pengguna anda.} other{ Sila teruskan dengan alamat e-mel atau nama pengguna anda.}}", "error-passkey-duplicate": "Anda sudah mempunyai passkey pada peranti ini.", - "error-metamask-unauthorized": "Anda tidak membenarkan operasi tersebut.", - "error-metamask-unsupported-method": "Kaedah yang diminta tidak disokong.", - "error-metamask-disconnected": "Pembekal telah terputus daripada rantaian yang dinyatakan.", - "error-failed-to-connect-wallet": "Gagal menyambung ke dompet.", "error-page-not-found": "Halaman tidak dapat ditemui", "error-page-not-found-action": "Kembali ke Laman Utama", "error-app-not-found": "{host} bukan projek yang sah", diff --git a/resources/authgear/templates/nl/translation.json b/resources/authgear/templates/nl/translation.json index 26ec5765a7..cb28c6d891 100644 --- a/resources/authgear/templates/nl/translation.json +++ b/resources/authgear/templates/nl/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "Passkey is niet gevonden op uw apparaat. {type, select, password{Meld u aan met wachtwoord in plaats daarvan?} oob_otp_email{Meld u aan met eenmalig wachtwoord in plaats daarvan?} oob_otp_sms{Meld u aan met eenmalig wachtwoord in plaats daarvan?} other{Probeer een ander apparaat?}}", "error-passkey-empty-allow-credentials": "Aanmelden met passkey wordt op dit apparaat niet volledig ondersteund.{variant, select, phone{ Ga verder met uw telefoonnummer.} email{ Ga verder met uw e-mailadres.} username{ Ga verder met uw gebruikersnaam.} other{ Ga verder met uw e-mailadres of gebruikersnaam.}}", "error-passkey-duplicate": "U heeft al een passkey op dit apparaat.", - "error-metamask-unauthorized": "U hebt de bewerking niet geautoriseerd.", - "error-metamask-unsupported-method": "De aangevraagde methode wordt niet ondersteund.", - "error-metamask-disconnected": "De provider is losgekoppeld van de opgegeven keten.", - "error-failed-to-connect-wallet": "Kan niet verbinden met portemonnee.", "error-page-not-found": "De pagina kan niet worden gevonden", "error-page-not-found-action": "Terug naar startpagina", "error-app-not-found": "{host} is geen geldig project", diff --git a/resources/authgear/templates/pl/translation.json b/resources/authgear/templates/pl/translation.json index dc99662295..14c3528932 100644 --- a/resources/authgear/templates/pl/translation.json +++ b/resources/authgear/templates/pl/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "Passkey nie został znaleziony na Twoim urządzeniu. {type, select, password{Zaloguj się zamiast tego hasłem?} oob_otp_email{Zaloguj się zamiast tego jednorazowym hasłem?} oob_otp_sms{Zaloguj się zamiast tego jednorazowym hasłem?} other{Spróbuj innego urządzenia?}}", "error-passkey-empty-allow-credentials": "Logowanie za pomocą Passkey nie jest w pełni obsługiwane na tym urządzeniu.{variant, select, phone{ Kontynuuj za pomocą numeru telefonu.} email{ Kontynuuj za pomocą adresu e-mail.} username{ Kontynuuj za pomocą nazwy użytkownika.} other{ Kontynuuj za pomocą adresu e-mail lub nazwy użytkownika.}}", "error-passkey-duplicate": "Masz już Passkey na tym urządzeniu.", - "error-metamask-unauthorized": "Nie autoryzowałeś tej operacji.", - "error-metamask-unsupported-method": "Żądana metoda nie jest obsługiwana.", - "error-metamask-disconnected": "Dostawca jest odłączony od określonego łańcucha.", - "error-failed-to-connect-wallet": "Nie udało się połączyć z portfelem.", "error-page-not-found": "Nie można znaleźć strony", "error-page-not-found-action": "Wróć do strony głównej", "error-app-not-found": "{host} to nieprawidłowy projekt", diff --git a/resources/authgear/templates/pt-BR/translation.json b/resources/authgear/templates/pt-BR/translation.json index 159717934d..ec512b967f 100644 --- a/resources/authgear/templates/pt-BR/translation.json +++ b/resources/authgear/templates/pt-BR/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "Passkey não encontrado em seu dispositivo. {type, select, password{Entrar com senha em vez disso?} oob_otp_email{Entrar com senha de uso único em vez disso?} oob_otp_sms{Entrar com senha de uso único em vez disso?} other{Tente outro dispositivo?}}", "error-passkey-empty-allow-credentials": "O login com Passkey não é totalmente compatível neste dispositivo.{variant, select, phone{ Por favor, continue com seu número de telefone.} email{ Por favor, continue com seu endereço de e-mail.} username{ Por favor, continue com seu nome de usuário.} other{ Por favor, continue com seu endereço de e-mail ou nome de usuário.}}", "error-passkey-duplicate": "Você já tem um Passkey neste dispositivo.", - "error-metamask-unauthorized": "Você não autorizou a operação.", - "error-metamask-unsupported-method": "O método solicitado não é compatível.", - "error-metamask-disconnected": "O provedor está desconectado da cadeia especificada.", - "error-failed-to-connect-wallet": "Falha ao conectar à carteira.", "error-page-not-found": "A página não pode ser encontrada", "error-page-not-found-action": "Voltar para a Home", "error-app-not-found": "{host} não é um projeto válido", diff --git a/resources/authgear/templates/pt-PT/translation.json b/resources/authgear/templates/pt-PT/translation.json index f959b351d4..cf1d61d9e0 100644 --- a/resources/authgear/templates/pt-PT/translation.json +++ b/resources/authgear/templates/pt-PT/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "Passkey não é encontrado no seu dispositivo. {type, select, password{Entrar com senha em vez disso?} oob_otp_email{Entrar com senha de uso único em vez disso?} oob_otp_sms{Entrar com senha de uso único em vez disso?} other{Tente outro dispositivo?}}", "error-passkey-empty-allow-credentials": "O login com Passkey não é totalmente suportado neste dispositivo.{variant, select, phone{ Por favor, continue com o seu número de telefone.} email{ Por favor, continue com o seu endereço de e-mail.} username{ Por favor, continue com o seu nome de utilizador.} other{ Por favor, continue com o seu endereço de e-mail ou nome de utilizador.}}", "error-passkey-duplicate": "Você já tem um Passkey neste dispositivo.", - "error-metamask-unauthorized": "Você não autorizou a operação.", - "error-metamask-unsupported-method": "O método solicitado não é suportado.", - "error-metamask-disconnected": "O provedor está desconectado da cadeia especificada.", - "error-failed-to-connect-wallet": "Falha ao conectar à carteira.", "error-page-not-found": "A página não pode ser encontrada", "error-page-not-found-action": "Voltar para a Home", "error-app-not-found": "{host} não é um projeto válido", diff --git a/resources/authgear/templates/pt/translation.json b/resources/authgear/templates/pt/translation.json index ef783c6ac7..0811ab1493 100644 --- a/resources/authgear/templates/pt/translation.json +++ b/resources/authgear/templates/pt/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "Passkey não foi encontrada no seu dispositivo. {type, select, password{Entrar com senha?} oob_otp_email{Entrar com senha única por e-mail?} oob_otp_sms{Entrar com senha única por SMS?} other{Tentar outro dispositivo?}}", "error-passkey-empty-allow-credentials": "O login com passkey não é totalmente suportado neste dispositivo.{variant, select, phone{ Por favor, continue com seu número de telefone.} email{ Por favor, continue com seu endereço de e-mail.} username{ Por favor, continue com seu nome de usuário.} other{ Por favor, continue com seu endereço de e-mail ou nome de usuário.}}", "error-passkey-duplicate": "Você já tem uma passkey neste dispositivo.", - "error-metamask-unauthorized": "Você não autorizou a operação.", - "error-metamask-unsupported-method": "O método solicitado não é suportado.", - "error-metamask-disconnected": "O provedor está desconectado da cadeia especificada.", - "error-failed-to-connect-wallet": "Falha ao conectar à carteira.", "error-page-not-found": "A página não pode ser encontrada", "error-page-not-found-action": "Retornar à Página Inicial", "error-app-not-found": "{host} não é um projeto válido", diff --git a/resources/authgear/templates/th/translation.json b/resources/authgear/templates/th/translation.json index dfba0187f5..a580101d7c 100644 --- a/resources/authgear/templates/th/translation.json +++ b/resources/authgear/templates/th/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "ไม่พบ Passkey บนอุปกรณ์ของคุณ {type, select, password{ลงชื่อเข้าใช้ด้วยรหัสผ่านแทน?} oob_otp_email{ลงชื่อเข้าใช้ด้วยรหัสผ่านแบบใช้ครั้งเดียวแทน?} oob_otp_sms{ลงชื่อเข้าใช้ด้วยรหัสผ่านแบบใช้ครั้งเดียวแทน?} other{ลองอุปกรณ์อื่น?}}", "error-passkey-empty-allow-credentials": "การลงชื่อเข้าใช้ด้วย Passkey ไม่ได้รับการสนับสนุนอย่างเต็มที่บนอุปกรณ์นี้{variant, select, phone{ โปรดดำเนินการต่อด้วยหมายเลขโทรศัพท์ของคุณ} email{ โปรดดำเนินการต่อด้วยที่อยู่อีเมลของคุณ} username{ โปรดดำเนินการต่อด้วยชื่อผู้ใช้ของคุณ} other{ โปรดดำเนินการต่อด้วยที่อยู่อีเมลหรือชื่อผู้ใช้ของคุณ}}", "error-passkey-duplicate": "คุณมี Passkey บนอุปกรณ์นี้อยู่แล้ว", - "error-metamask-unauthorized": "คุณไม่ได้อนุญาตการดำเนินการ", - "error-metamask-unsupported-method": "วิธีการที่ร้องขอไม่ได้รับการสนับสนุน", - "error-metamask-disconnected": "ผู้ให้บริการถูกตัดการเชื่อมต่อจากโซ่ที่ระบุ", - "error-failed-to-connect-wallet": "ไม่สามารถเชื่อมต่อกับกระเป๋าเงินได้", "error-page-not-found": "ไม่พบหน้านี้", "error-page-not-found-action": "กลับไปยังหน้าหลัก", "error-app-not-found": "{host} ไม่ใช่โครงการที่ถูกต้อง", diff --git a/resources/authgear/templates/vi/translation.json b/resources/authgear/templates/vi/translation.json index 5a2c5f2e9a..b03d0e2d17 100644 --- a/resources/authgear/templates/vi/translation.json +++ b/resources/authgear/templates/vi/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "Không tìm thấy Passkey trên thiết bị của bạn. {type, select, password{Đăng nhập bằng mật khẩu thay vào đó?} oob_otp_email{Đăng nhập bằng mật khẩu một lần thay vào đó?} oob_otp_sms{Đăng nhập bằng mật khẩu một lần thay vào đó?} other{Thử thiết bị khác?}}", "error-passkey-empty-allow-credentials": "Đăng nhập bằng Passkey không được hỗ trợ đầy đủ trên thiết bị này.{variant, select, phone{ Vui lòng tiếp tục bằng số điện thoại của bạn.} email{ Vui lòng tiếp tục bằng địa chỉ email của bạn.} username{ Vui lòng tiếp tục bằng tên người dùng của bạn.} other{ Vui lòng tiếp tục bằng địa chỉ email hoặc tên người dùng của bạn.}}", "error-passkey-duplicate": "Bạn đã có Passkey trên thiết bị này rồi.", - "error-metamask-unauthorized": "Bạn chưa ủy quyền cho hoạt động này.", - "error-metamask-unsupported-method": "Phương thức yêu cầu không được hỗ trợ.", - "error-metamask-disconnected": "Nhà cung cấp đã ngắt kết nối khỏi chuỗi được chỉ định.", - "error-failed-to-connect-wallet": "Không thể kết nối với ví.", "error-page-not-found": "Không tìm thấy trang", "error-page-not-found-action": "Quay lại Trang chủ", "error-app-not-found": "{host} không phải là một dự án hợp lệ", diff --git a/resources/authgear/templates/zh-CN/translation.json b/resources/authgear/templates/zh-CN/translation.json index c5d87984aa..e4cfbc4c7c 100644 --- a/resources/authgear/templates/zh-CN/translation.json +++ b/resources/authgear/templates/zh-CN/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "在您的设备上找不到Passkey。{type, select, password{改用密码登录?} oob_otp_email{改用一次性密码登录?} oob_otp_sms{改用一次性密码登录?} other{尝试另一台设备?}}", "error-passkey-empty-allow-credentials": "此设备不完全支持Passkey登录。{variant, select, phone{ 请继续使用您的手机号码。} email{ 请继续使用您的电子邮件地址。} username{ 请继续使用您的用户名。} other{ 请继续使用您的电子邮件地址或用户名。}}", "error-passkey-duplicate": "您的这台设备上已经有一个Passkey了。", - "error-metamask-unauthorized": "您没有授权该操作。", - "error-metamask-unsupported-method": "所请求的方法不受支持。", - "error-metamask-disconnected": "该提供程序已与指定的链断开连接。", - "error-failed-to-connect-wallet": "无法连接到钱包。", "error-page-not-found": "找不到该页面", "error-page-not-found-action": "返回主页", "error-app-not-found": "{host} 不是有效的项目", diff --git a/resources/authgear/templates/zh-HK/translation.json b/resources/authgear/templates/zh-HK/translation.json index a7946c1326..de16fc1cd4 100644 --- a/resources/authgear/templates/zh-HK/translation.json +++ b/resources/authgear/templates/zh-HK/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "在你的裝置沒有通行密匙。{type, select, password{請使用密碼登入。} oob_otp_email{請使用一次性密碼登入。} oob_otp_sms{請使用一次性密碼登入。} other{請嘗試使用另一個裝置。}}", "error-passkey-empty-allow-credentials": "你的裝置不完全支援通行密匙。{variant, select, phone{請先以電話號碼繼續。} email{請先以電郵地址繼續。} username{請先以用戶名稱繼續。} other{請先以電郵地址或用戶名稱繼續。}}", "error-passkey-duplicate": "此裝置已有通行密匙。", - "error-metamask-unauthorized": "你拒絕了授權。", - "error-metamask-unsupported-method": "無效的請求方式。", - "error-metamask-disconnected": "已從區塊鏈斷開連接。", - "error-failed-to-connect-wallet": "無法連接到錢包。", "error-page-not-found": "找不到頁面", "error-page-not-found-action": "返回主頁", "error-app-not-found": "{host} a not valid project", diff --git a/resources/authgear/templates/zh-TW/translation.json b/resources/authgear/templates/zh-TW/translation.json index 84f8f43dbd..b844982287 100644 --- a/resources/authgear/templates/zh-TW/translation.json +++ b/resources/authgear/templates/zh-TW/translation.json @@ -88,10 +88,6 @@ "error-no-passkey": "在你的裝置沒有通行密鑰。{type, select, password{請使用密碼登入。} oob_otp_email{請使用一次性密碼登入。} oob_otp_sms{請使用一次性密碼登入。} other{請嘗試使用另一個裝置。}}", "error-passkey-empty-allow-credentials": "你的裝置不完全支援通行密鑰。{variant, select, phone{請先以電話號碼繼續。} email{請先以電郵地址繼續。} username{請先以用戶名稱繼續。} other{請先以電郵地址或用戶名稱繼續。}}", "error-passkey-duplicate": "此裝置已有通行密鑰。", - "error-metamask-unauthorized": "你拒絕了授權。", - "error-metamask-unsupported-method": "無效的請求方式。", - "error-metamask-disconnected": "已從區塊鏈斷開連接。", - "error-failed-to-connect-wallet": "無法連接到錢包。", "error-page-not-found": "找不到頁面", "error-page-not-found-action": "返回主頁", "error-app-not-found": "{host} a not valid project",