From 0e470f85ad46ec96cb73111119344ad8878021b3 Mon Sep 17 00:00:00 2001 From: barleendhaliwal <85155575+barleendhaliwal@users.noreply.github.com> Date: Fri, 23 Sep 2022 13:29:16 +0530 Subject: [PATCH] feat(middleware): add client and user authentication middleware (#90) GH-32 --- .cz-config.js | 1 + .vscode/launch.json | 17 +- README.md | 16 + dist/__tests__/fixtures/data/bearer-data.d.ts | 4 - dist/__tests__/fixtures/data/bearer-data.js | 15 - .../fixtures/data/bearer-data.js.map | 1 - .../providers/azuread-auth.provider.d.ts | 6 - .../providers/azuread-auth.provider.js | 18 - .../providers/azuread-auth.provider.js.map | 1 - .../providers/bearer-passport.provider.d.ts | 6 - .../providers/bearer-passport.provider.js | 20 - .../providers/bearer-passport.provider.js.map | 1 - .../providers/google-auth.provider.d.ts | 6 - .../providers/google-auth.provider.js | 18 - .../providers/google-auth.provider.js.map | 1 - .../providers/instagram-auth.provider.d.ts | 11 - .../providers/instagram-auth.provider.js | 18 - .../providers/instagram-auth.provider.js.map | 1 - .../providers/local-password.provider.d.ts | 6 - .../providers/local-password.provider.js | 24 - .../providers/local-password.provider.js.map | 1 - .../providers/passport-client.provider.d.ts | 7 - .../providers/passport-client.provider.js | 20 - .../providers/passport-client.provider.js.map | 1 - .../providers/resource-owner.provider.d.ts | 6 - .../providers/resource-owner.provider.js | 25 - .../providers/resource-owner.provider.js.map | 1 - .../sequences/authentication.sequence.d.ts | 14 - .../sequences/authentication.sequence.js | 53 -- .../sequences/authentication.sequence.js.map | 1 - .../integration/helpers/helpers.d.ts | 5 - dist/__tests__/integration/helpers/helpers.js | 17 - .../integration/helpers/helpers.js.map | 1 - .../apple-oauth2.integration.d.ts | 1 - .../apple-oauth2.integration.js | 67 -- .../apple-oauth2.integration.js.map | 1 - .../bearer-token-verify.integration.d.ts | 1 - .../bearer-token-verify.integration.js | 314 --------- .../bearer-token-verify.integration.js.map | 1 - .../client-password-verify.integration.d.ts | 1 - .../client-password-verify.integration.js | 198 ------ .../client-password-verify.integration.js.map | 1 - .../google-oauth2.integration.d.ts | 1 - .../google-oauth2.integration.js | 63 -- .../google-oauth2.integration.js.map | 1 - .../instagram-oauth2.integration.d.ts | 1 - .../instagram-oauth2.integration.js | 63 -- .../instagram-oauth2.integration.js.map | 1 - .../keycloak.integration.d.ts | 1 - .../passport-keycloak/keycloak.integration.js | 69 -- .../keycloak.integration.js.map | 1 - .../local-passport.integration.d.ts | 1 - .../local-passport.integration.js | 238 ------- .../local-passport.integration.js.map | 1 - .../resource-owner-password.integration.d.ts | 1 - .../resource-owner-password.integration.js | 242 ------- ...resource-owner-password.integration.js.map | 1 - .../apple-auth-strategy.unit.d.ts | 1 - .../apple-auth-strategy.unit.js | 57 -- .../apple-auth-strategy.unit.js.map | 1 - .../azuread-auth-strategy.unit.d.ts | 1 - .../azuread-auth-strategy.unit.js | 61 -- .../azuread-auth-strategy.unit.js.map | 1 - .../bearer-token-verify.unit.d.ts | 1 - .../bearer-token-verify.unit.js | 62 -- .../bearer-token-verify.unit.js.map | 1 - .../client-password-strategy.unit.d.ts | 1 - .../client-password-strategy.unit.js | 61 -- .../client-password-strategy.unit.js.map | 1 - .../google-auth-strategy.unit.d.ts | 1 - .../google-auth-strategy.unit.js | 53 -- .../google-auth-strategy.unit.js.map | 1 - .../instagram-auth-strategy.unit.d.ts | 1 - .../instagram-auth-strategy.unit.js | 53 -- .../instagram-auth-strategy.unit.js.map | 1 - .../keycloak-auth-strategy.unit.d.ts | 1 - .../keycloak-auth-strategy.unit.js | 43 -- .../keycloak-auth-strategy.unit.js.map | 1 - .../keycloak-user-profile.unit.d.ts | 1 - .../keycloak-user-profile.unit.js | 56 -- .../keycloak-user-profile.unit.js.map | 1 - .../passport-local/local-strategy.unit.d.ts | 1 - .../passport-local/local-strategy.unit.js | 55 -- .../passport-local/local-strategy.unit.js.map | 1 - .../resource-owner-password.unit.d.ts | 1 - .../resource-owner-password.unit.js | 59 -- .../resource-owner-password.unit.js.map | 1 - dist/component.d.ts | 5 - dist/component.js | 45 -- dist/component.js.map | 1 - .../authenticate-client.decorator.d.ts | 4 - .../authenticate-client.decorator.js | 17 - .../authenticate-client.decorator.js.map | 1 - .../authenticate-user.decorator.d.ts | 22 - .../decorators/authenticate-user.decorator.js | 34 - .../authenticate-user.decorator.js.map | 1 - dist/decorators/index.d.ts | 2 - dist/decorators/index.js | 6 - dist/decorators/index.js.map | 1 - dist/error-keys.d.ts | 16 - dist/error-keys.js | 3 - dist/error-keys.js.map | 1 - dist/index.d.ts | 7 - dist/index.js | 11 - dist/index.js.map | 1 - dist/keys.d.ts | 20 - dist/keys.js | 24 - dist/keys.js.map | 1 - dist/models/authuser.model.d.ts | 10 - dist/models/authuser.model.js | 32 - dist/models/authuser.model.js.map | 1 - dist/models/index.d.ts | 1 - dist/models/index.js | 5 - dist/models/index.js.map | 1 - .../client-auth-metadata.provider.d.ts | 8 - .../client-auth-metadata.provider.js | 25 - .../client-auth-metadata.provider.js.map | 1 - .../client-authentication.provider.d.ts | 12 - .../client-authentication.provider.js | 44 -- .../client-authentication.provider.js.map | 1 - dist/providers/index.d.ts | 4 - dist/providers/index.js | 8 - dist/providers/index.js.map | 1 - .../user-auth-metadata.provider.d.ts | 8 - dist/providers/user-auth-metadata.provider.js | 25 - .../user-auth-metadata.provider.js.map | 1 - .../user-authentication.provider.d.ts | 13 - .../providers/user-authentication.provider.js | 50 -- .../user-authentication.provider.js.map | 1 - .../client-auth-strategy.provider.d.ts | 10 - .../client-auth-strategy.provider.js | 32 - .../client-auth-strategy.provider.js.map | 1 - dist/strategies/index.d.ts | 4 - dist/strategies/index.js | 8 - dist/strategies/index.js.map | 1 - dist/strategies/keys.d.ts | 38 -- dist/strategies/keys.js | 43 -- dist/strategies/keys.js.map | 1 - dist/strategies/passport/index.d.ts | 11 - dist/strategies/passport/index.js | 15 - dist/strategies/passport/index.js.map | 1 - .../apple-auth-strategy-factory-provider.d.ts | 14 - .../apple-auth-strategy-factory-provider.js | 74 --- ...pple-auth-strategy-factory-provider.js.map | 1 - .../apple-auth-verify.provider.d.ts | 6 - .../apple-auth-verify.provider.js | 14 - .../apple-auth-verify.provider.js.map | 1 - .../passport/passport-apple-oauth2/index.d.ts | 3 - .../passport/passport-apple-oauth2/index.js | 7 - .../passport-apple-oauth2/index.js.map | 1 - .../passport-apple-oauth2/passport-apple.d.ts | 19 - .../passport-apple-oauth2/passport-apple.js | 5 - .../passport-apple.js.map | 1 - ...zuread-auth-strategy-factory-provider.d.ts | 12 - .../azuread-auth-strategy-factory-provider.js | 66 -- ...read-auth-strategy-factory-provider.js.map | 1 - .../azuread-auth-verify.provider.d.ts | 11 - .../azuread-auth-verify.provider.js | 19 - .../azuread-auth-verify.provider.js.map | 1 - .../passport/passport-azure-ad/index.d.ts | 2 - .../passport/passport-azure-ad/index.js | 6 - .../passport/passport-azure-ad/index.js.map | 1 - .../bearer-strategy-factory-provider.d.ts | 12 - .../bearer-strategy-factory-provider.js | 74 --- .../bearer-strategy-factory-provider.js.map | 1 - .../bearer-token-verify.provider.d.ts | 11 - .../bearer-token-verify.provider.js | 19 - .../bearer-token-verify.provider.js.map | 1 - .../passport/passport-bearer/index.d.ts | 2 - .../passport/passport-bearer/index.js | 6 - .../passport/passport-bearer/index.js.map | 1 - ...nt-password-strategy-factory-provider.d.ts | 12 - ...ient-password-strategy-factory-provider.js | 65 -- ...-password-strategy-factory-provider.js.map | 1 - .../client-password-verify.provider.d.ts | 11 - .../client-password-verify.provider.js | 19 - .../client-password-verify.provider.js.map | 1 - .../passport-client-password/index.d.ts | 2 - .../passport-client-password/index.js | 6 - .../passport-client-password/index.js.map | 1 - ...cebook-auth-strategy-factory-provider.d.ts | 17 - ...facebook-auth-strategy-factory-provider.js | 74 --- ...book-auth-strategy-factory-provider.js.map | 1 - .../facebook-auth-verify.provider.d.ts | 11 - .../facebook-auth-verify.provider.js | 19 - .../facebook-auth-verify.provider.js.map | 1 - .../passport-facebook-oauth2/index.d.ts | 2 - .../passport-facebook-oauth2/index.js | 6 - .../passport-facebook-oauth2/index.js.map | 1 - ...google-auth-strategy-factory-provider.d.ts | 13 - .../google-auth-strategy-factory-provider.js | 74 --- ...ogle-auth-strategy-factory-provider.js.map | 1 - .../google-auth-verify.provider.d.ts | 11 - .../google-auth-verify.provider.js | 19 - .../google-auth-verify.provider.js.map | 1 - .../passport-google-oauth2/index.d.ts | 2 - .../passport/passport-google-oauth2/index.js | 6 - .../passport-google-oauth2/index.js.map | 1 - .../passport/passport-insta-oauth2/index.d.ts | 2 - .../passport/passport-insta-oauth2/index.js | 6 - .../passport-insta-oauth2/index.js.map | 1 - .../insta-auth-strategy-factory-provider.d.ts | 13 - .../insta-auth-strategy-factory-provider.js | 74 --- ...nsta-auth-strategy-factory-provider.js.map | 1 - .../insta-auth-verify.provider.d.ts | 11 - .../insta-auth-verify.provider.js | 19 - .../insta-auth-verify.provider.js.map | 1 - .../passport/passport-keycloak/index.d.ts | 2 - .../passport/passport-keycloak/index.js | 6 - .../passport/passport-keycloak/index.js.map | 1 - .../keycloak-strategy-factory-provider.d.ts | 14 - .../keycloak-strategy-factory-provider.js | 98 --- .../keycloak-strategy-factory-provider.js.map | 1 - .../keycloak-verify.provider.d.ts | 11 - .../keycloak-verify.provider.js | 19 - .../keycloak-verify.provider.js.map | 1 - .../passport/passport-local/index.d.ts | 2 - .../passport/passport-local/index.js | 6 - .../passport/passport-local/index.js.map | 1 - ...al-password-strategy-factory-provider.d.ts | 12 - ...ocal-password-strategy-factory-provider.js | 74 --- ...-password-strategy-factory-provider.js.map | 1 - .../local-password-verify.provider.d.ts | 11 - .../local-password-verify.provider.js | 19 - .../local-password-verify.provider.js.map | 1 - .../passport/passport-otp/index.d.ts | 3 - .../strategies/passport/passport-otp/index.js | 7 - .../passport/passport-otp/index.js.map | 1 - .../passport/passport-otp/otp-auth.d.ts | 17 - .../passport/passport-otp/otp-auth.js | 40 -- .../passport/passport-otp/otp-auth.js.map | 1 - .../otp-strategy-factory.provider.d.ts | 12 - .../otp-strategy-factory.provider.js | 39 -- .../otp-strategy-factory.provider.js.map | 1 - .../passport-otp/otp-verify.provider.d.ts | 6 - .../passport-otp/otp-verify.provider.js | 14 - .../passport-otp/otp-verify.provider.js.map | 1 - .../index.d.ts | 3 - .../passport-resource-owner-password/index.js | 7 - .../index.js.map | 1 - .../oauth2-resource-owner-password-grant.d.ts | 20 - .../oauth2-resource-owner-password-grant.js | 59 -- ...auth2-resource-owner-password-grant.js.map | 1 - ...ource-owner-strategy-factory-provider.d.ts | 12 - ...esource-owner-strategy-factory-provider.js | 58 -- ...rce-owner-strategy-factory-provider.js.map | 1 - .../resource-owner-verify.provider.d.ts | 12 - .../resource-owner-verify.provider.js | 20 - .../resource-owner-verify.provider.js.map | 1 - dist/strategies/types/index.d.ts | 2 - dist/strategies/types/index.js | 6 - dist/strategies/types/index.js.map | 1 - dist/strategies/types/keycloak.types.d.ts | 24 - dist/strategies/types/keycloak.types.js | 3 - dist/strategies/types/keycloak.types.js.map | 1 - dist/strategies/types/types.d.ts | 54 -- dist/strategies/types/types.js | 3 - dist/strategies/types/types.js.map | 1 - .../user-auth-strategy.provider.d.ts | 25 - .../strategies/user-auth-strategy.provider.js | 85 --- .../user-auth-strategy.provider.js.map | 1 - dist/strategy-adapter.d.ts | 27 - dist/strategy-adapter.js | 66 -- dist/strategy-adapter.js.map | 1 - dist/strategy-name.enum.d.ts | 13 - dist/strategy-name.enum.js | 3 - dist/strategy-name.enum.js.map | 1 - dist/types.d.ts | 34 - dist/types.js | 9 - dist/types.js.map | 1 - package-lock.json | 614 +++++++++--------- .../authentication-middleware.sequence.ts | 3 + .../sequences/authentication.sequence.ts | 4 +- .../{ => action-sequence}/helpers/helpers.ts | 2 +- .../apple-oauth2.integration.ts | 16 +- .../bearer-token-verify.integration.ts | 14 +- .../client-password-verify.integration.ts | 14 +- .../google-oauth2.integration.ts | 16 +- .../instagram-oauth2.integration.ts | 16 +- .../passport-keycloak/keycloak.integration.ts | 18 +- .../local-passport.integration.ts | 16 +- .../resource-owner-password.integration.ts | 14 +- .../middleware-sequence/helpers/helpers.ts | 18 + .../apple-oauth2.integration.ts | 81 +++ .../bearer-token-verify.integration.ts | 295 +++++++++ .../client-password-verify.integration.ts | 201 ++++++ .../google-oauth2.integration.ts | 77 +++ .../instagram-oauth2.integration.ts | 77 +++ .../passport-keycloak/keycloak.integration.ts | 83 +++ .../local-passport.integration.ts | 221 +++++++ .../resource-owner-password.integration.ts | 268 ++++++++ src/component.ts | 25 +- src/keys.ts | 5 + .../client-authentication.middleware.ts | 70 ++ src/middlewares/index.ts | 2 + src/middlewares/middleware-groups.enum.ts | 4 + .../user-authentication.middleware.ts | 88 +++ src/types.ts | 5 + 298 files changed, 1924 insertions(+), 5052 deletions(-) delete mode 100644 dist/__tests__/fixtures/data/bearer-data.d.ts delete mode 100644 dist/__tests__/fixtures/data/bearer-data.js delete mode 100644 dist/__tests__/fixtures/data/bearer-data.js.map delete mode 100644 dist/__tests__/fixtures/providers/azuread-auth.provider.d.ts delete mode 100644 dist/__tests__/fixtures/providers/azuread-auth.provider.js delete mode 100644 dist/__tests__/fixtures/providers/azuread-auth.provider.js.map delete mode 100644 dist/__tests__/fixtures/providers/bearer-passport.provider.d.ts delete mode 100644 dist/__tests__/fixtures/providers/bearer-passport.provider.js delete mode 100644 dist/__tests__/fixtures/providers/bearer-passport.provider.js.map delete mode 100644 dist/__tests__/fixtures/providers/google-auth.provider.d.ts delete mode 100644 dist/__tests__/fixtures/providers/google-auth.provider.js delete mode 100644 dist/__tests__/fixtures/providers/google-auth.provider.js.map delete mode 100644 dist/__tests__/fixtures/providers/instagram-auth.provider.d.ts delete mode 100644 dist/__tests__/fixtures/providers/instagram-auth.provider.js delete mode 100644 dist/__tests__/fixtures/providers/instagram-auth.provider.js.map delete mode 100644 dist/__tests__/fixtures/providers/local-password.provider.d.ts delete mode 100644 dist/__tests__/fixtures/providers/local-password.provider.js delete mode 100644 dist/__tests__/fixtures/providers/local-password.provider.js.map delete mode 100644 dist/__tests__/fixtures/providers/passport-client.provider.d.ts delete mode 100644 dist/__tests__/fixtures/providers/passport-client.provider.js delete mode 100644 dist/__tests__/fixtures/providers/passport-client.provider.js.map delete mode 100644 dist/__tests__/fixtures/providers/resource-owner.provider.d.ts delete mode 100644 dist/__tests__/fixtures/providers/resource-owner.provider.js delete mode 100644 dist/__tests__/fixtures/providers/resource-owner.provider.js.map delete mode 100644 dist/__tests__/fixtures/sequences/authentication.sequence.d.ts delete mode 100644 dist/__tests__/fixtures/sequences/authentication.sequence.js delete mode 100644 dist/__tests__/fixtures/sequences/authentication.sequence.js.map delete mode 100644 dist/__tests__/integration/helpers/helpers.d.ts delete mode 100644 dist/__tests__/integration/helpers/helpers.js delete mode 100644 dist/__tests__/integration/helpers/helpers.js.map delete mode 100644 dist/__tests__/integration/passport-apple-oauth2/apple-oauth2.integration.d.ts delete mode 100644 dist/__tests__/integration/passport-apple-oauth2/apple-oauth2.integration.js delete mode 100644 dist/__tests__/integration/passport-apple-oauth2/apple-oauth2.integration.js.map delete mode 100644 dist/__tests__/integration/passport-bearer/bearer-token-verify.integration.d.ts delete mode 100644 dist/__tests__/integration/passport-bearer/bearer-token-verify.integration.js delete mode 100644 dist/__tests__/integration/passport-bearer/bearer-token-verify.integration.js.map delete mode 100644 dist/__tests__/integration/passport-client-password/client-password-verify.integration.d.ts delete mode 100644 dist/__tests__/integration/passport-client-password/client-password-verify.integration.js delete mode 100644 dist/__tests__/integration/passport-client-password/client-password-verify.integration.js.map delete mode 100644 dist/__tests__/integration/passport-google-oauth2/google-oauth2.integration.d.ts delete mode 100644 dist/__tests__/integration/passport-google-oauth2/google-oauth2.integration.js delete mode 100644 dist/__tests__/integration/passport-google-oauth2/google-oauth2.integration.js.map delete mode 100644 dist/__tests__/integration/passport-instagram-oauth2/instagram-oauth2.integration.d.ts delete mode 100644 dist/__tests__/integration/passport-instagram-oauth2/instagram-oauth2.integration.js delete mode 100644 dist/__tests__/integration/passport-instagram-oauth2/instagram-oauth2.integration.js.map delete mode 100644 dist/__tests__/integration/passport-keycloak/keycloak.integration.d.ts delete mode 100644 dist/__tests__/integration/passport-keycloak/keycloak.integration.js delete mode 100644 dist/__tests__/integration/passport-keycloak/keycloak.integration.js.map delete mode 100644 dist/__tests__/integration/passport-local/local-passport.integration.d.ts delete mode 100644 dist/__tests__/integration/passport-local/local-passport.integration.js delete mode 100644 dist/__tests__/integration/passport-local/local-passport.integration.js.map delete mode 100644 dist/__tests__/integration/passport-resource-owner-password/resource-owner-password.integration.d.ts delete mode 100644 dist/__tests__/integration/passport-resource-owner-password/resource-owner-password.integration.js delete mode 100644 dist/__tests__/integration/passport-resource-owner-password/resource-owner-password.integration.js.map delete mode 100644 dist/__tests__/unit/passport-apple-oauth2/apple-auth-strategy.unit.d.ts delete mode 100644 dist/__tests__/unit/passport-apple-oauth2/apple-auth-strategy.unit.js delete mode 100644 dist/__tests__/unit/passport-apple-oauth2/apple-auth-strategy.unit.js.map delete mode 100644 dist/__tests__/unit/passport-azure-ad/azuread-auth-strategy.unit.d.ts delete mode 100644 dist/__tests__/unit/passport-azure-ad/azuread-auth-strategy.unit.js delete mode 100644 dist/__tests__/unit/passport-azure-ad/azuread-auth-strategy.unit.js.map delete mode 100644 dist/__tests__/unit/passport-bearer/bearer-token-verify.unit.d.ts delete mode 100644 dist/__tests__/unit/passport-bearer/bearer-token-verify.unit.js delete mode 100644 dist/__tests__/unit/passport-bearer/bearer-token-verify.unit.js.map delete mode 100644 dist/__tests__/unit/passport-client-password/client-password-strategy.unit.d.ts delete mode 100644 dist/__tests__/unit/passport-client-password/client-password-strategy.unit.js delete mode 100644 dist/__tests__/unit/passport-client-password/client-password-strategy.unit.js.map delete mode 100644 dist/__tests__/unit/passport-google-oauth2/google-auth-strategy.unit.d.ts delete mode 100644 dist/__tests__/unit/passport-google-oauth2/google-auth-strategy.unit.js delete mode 100644 dist/__tests__/unit/passport-google-oauth2/google-auth-strategy.unit.js.map delete mode 100644 dist/__tests__/unit/passport-instagram-oauth2/instagram-auth-strategy.unit.d.ts delete mode 100644 dist/__tests__/unit/passport-instagram-oauth2/instagram-auth-strategy.unit.js delete mode 100644 dist/__tests__/unit/passport-instagram-oauth2/instagram-auth-strategy.unit.js.map delete mode 100644 dist/__tests__/unit/passport-keycloak-oauth2/keycloak-auth-strategy.unit.d.ts delete mode 100644 dist/__tests__/unit/passport-keycloak-oauth2/keycloak-auth-strategy.unit.js delete mode 100644 dist/__tests__/unit/passport-keycloak-oauth2/keycloak-auth-strategy.unit.js.map delete mode 100644 dist/__tests__/unit/passport-keycloak-oauth2/keycloak-user-profile.unit.d.ts delete mode 100644 dist/__tests__/unit/passport-keycloak-oauth2/keycloak-user-profile.unit.js delete mode 100644 dist/__tests__/unit/passport-keycloak-oauth2/keycloak-user-profile.unit.js.map delete mode 100644 dist/__tests__/unit/passport-local/local-strategy.unit.d.ts delete mode 100644 dist/__tests__/unit/passport-local/local-strategy.unit.js delete mode 100644 dist/__tests__/unit/passport-local/local-strategy.unit.js.map delete mode 100644 dist/__tests__/unit/passport-resource-owner-password/resource-owner-password.unit.d.ts delete mode 100644 dist/__tests__/unit/passport-resource-owner-password/resource-owner-password.unit.js delete mode 100644 dist/__tests__/unit/passport-resource-owner-password/resource-owner-password.unit.js.map delete mode 100644 dist/component.d.ts delete mode 100644 dist/component.js delete mode 100644 dist/component.js.map delete mode 100644 dist/decorators/authenticate-client.decorator.d.ts delete mode 100644 dist/decorators/authenticate-client.decorator.js delete mode 100644 dist/decorators/authenticate-client.decorator.js.map delete mode 100644 dist/decorators/authenticate-user.decorator.d.ts delete mode 100644 dist/decorators/authenticate-user.decorator.js delete mode 100644 dist/decorators/authenticate-user.decorator.js.map delete mode 100644 dist/decorators/index.d.ts delete mode 100644 dist/decorators/index.js delete mode 100644 dist/decorators/index.js.map delete mode 100644 dist/error-keys.d.ts delete mode 100644 dist/error-keys.js delete mode 100644 dist/error-keys.js.map delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 dist/keys.d.ts delete mode 100644 dist/keys.js delete mode 100644 dist/keys.js.map delete mode 100644 dist/models/authuser.model.d.ts delete mode 100644 dist/models/authuser.model.js delete mode 100644 dist/models/authuser.model.js.map delete mode 100644 dist/models/index.d.ts delete mode 100644 dist/models/index.js delete mode 100644 dist/models/index.js.map delete mode 100644 dist/providers/client-auth-metadata.provider.d.ts delete mode 100644 dist/providers/client-auth-metadata.provider.js delete mode 100644 dist/providers/client-auth-metadata.provider.js.map delete mode 100644 dist/providers/client-authentication.provider.d.ts delete mode 100644 dist/providers/client-authentication.provider.js delete mode 100644 dist/providers/client-authentication.provider.js.map delete mode 100644 dist/providers/index.d.ts delete mode 100644 dist/providers/index.js delete mode 100644 dist/providers/index.js.map delete mode 100644 dist/providers/user-auth-metadata.provider.d.ts delete mode 100644 dist/providers/user-auth-metadata.provider.js delete mode 100644 dist/providers/user-auth-metadata.provider.js.map delete mode 100644 dist/providers/user-authentication.provider.d.ts delete mode 100644 dist/providers/user-authentication.provider.js delete mode 100644 dist/providers/user-authentication.provider.js.map delete mode 100644 dist/strategies/client-auth-strategy.provider.d.ts delete mode 100644 dist/strategies/client-auth-strategy.provider.js delete mode 100644 dist/strategies/client-auth-strategy.provider.js.map delete mode 100644 dist/strategies/index.d.ts delete mode 100644 dist/strategies/index.js delete mode 100644 dist/strategies/index.js.map delete mode 100644 dist/strategies/keys.d.ts delete mode 100644 dist/strategies/keys.js delete mode 100644 dist/strategies/keys.js.map delete mode 100644 dist/strategies/passport/index.d.ts delete mode 100644 dist/strategies/passport/index.js delete mode 100644 dist/strategies/passport/index.js.map delete mode 100644 dist/strategies/passport/passport-apple-oauth2/apple-auth-strategy-factory-provider.d.ts delete mode 100644 dist/strategies/passport/passport-apple-oauth2/apple-auth-strategy-factory-provider.js delete mode 100644 dist/strategies/passport/passport-apple-oauth2/apple-auth-strategy-factory-provider.js.map delete mode 100644 dist/strategies/passport/passport-apple-oauth2/apple-auth-verify.provider.d.ts delete mode 100644 dist/strategies/passport/passport-apple-oauth2/apple-auth-verify.provider.js delete mode 100644 dist/strategies/passport/passport-apple-oauth2/apple-auth-verify.provider.js.map delete mode 100644 dist/strategies/passport/passport-apple-oauth2/index.d.ts delete mode 100644 dist/strategies/passport/passport-apple-oauth2/index.js delete mode 100644 dist/strategies/passport/passport-apple-oauth2/index.js.map delete mode 100644 dist/strategies/passport/passport-apple-oauth2/passport-apple.d.ts delete mode 100644 dist/strategies/passport/passport-apple-oauth2/passport-apple.js delete mode 100644 dist/strategies/passport/passport-apple-oauth2/passport-apple.js.map delete mode 100644 dist/strategies/passport/passport-azure-ad/azuread-auth-strategy-factory-provider.d.ts delete mode 100644 dist/strategies/passport/passport-azure-ad/azuread-auth-strategy-factory-provider.js delete mode 100644 dist/strategies/passport/passport-azure-ad/azuread-auth-strategy-factory-provider.js.map delete mode 100644 dist/strategies/passport/passport-azure-ad/azuread-auth-verify.provider.d.ts delete mode 100644 dist/strategies/passport/passport-azure-ad/azuread-auth-verify.provider.js delete mode 100644 dist/strategies/passport/passport-azure-ad/azuread-auth-verify.provider.js.map delete mode 100644 dist/strategies/passport/passport-azure-ad/index.d.ts delete mode 100644 dist/strategies/passport/passport-azure-ad/index.js delete mode 100644 dist/strategies/passport/passport-azure-ad/index.js.map delete mode 100644 dist/strategies/passport/passport-bearer/bearer-strategy-factory-provider.d.ts delete mode 100644 dist/strategies/passport/passport-bearer/bearer-strategy-factory-provider.js delete mode 100644 dist/strategies/passport/passport-bearer/bearer-strategy-factory-provider.js.map delete mode 100644 dist/strategies/passport/passport-bearer/bearer-token-verify.provider.d.ts delete mode 100644 dist/strategies/passport/passport-bearer/bearer-token-verify.provider.js delete mode 100644 dist/strategies/passport/passport-bearer/bearer-token-verify.provider.js.map delete mode 100644 dist/strategies/passport/passport-bearer/index.d.ts delete mode 100644 dist/strategies/passport/passport-bearer/index.js delete mode 100644 dist/strategies/passport/passport-bearer/index.js.map delete mode 100644 dist/strategies/passport/passport-client-password/client-password-strategy-factory-provider.d.ts delete mode 100644 dist/strategies/passport/passport-client-password/client-password-strategy-factory-provider.js delete mode 100644 dist/strategies/passport/passport-client-password/client-password-strategy-factory-provider.js.map delete mode 100644 dist/strategies/passport/passport-client-password/client-password-verify.provider.d.ts delete mode 100644 dist/strategies/passport/passport-client-password/client-password-verify.provider.js delete mode 100644 dist/strategies/passport/passport-client-password/client-password-verify.provider.js.map delete mode 100644 dist/strategies/passport/passport-client-password/index.d.ts delete mode 100644 dist/strategies/passport/passport-client-password/index.js delete mode 100644 dist/strategies/passport/passport-client-password/index.js.map delete mode 100644 dist/strategies/passport/passport-facebook-oauth2/facebook-auth-strategy-factory-provider.d.ts delete mode 100644 dist/strategies/passport/passport-facebook-oauth2/facebook-auth-strategy-factory-provider.js delete mode 100644 dist/strategies/passport/passport-facebook-oauth2/facebook-auth-strategy-factory-provider.js.map delete mode 100644 dist/strategies/passport/passport-facebook-oauth2/facebook-auth-verify.provider.d.ts delete mode 100644 dist/strategies/passport/passport-facebook-oauth2/facebook-auth-verify.provider.js delete mode 100644 dist/strategies/passport/passport-facebook-oauth2/facebook-auth-verify.provider.js.map delete mode 100644 dist/strategies/passport/passport-facebook-oauth2/index.d.ts delete mode 100644 dist/strategies/passport/passport-facebook-oauth2/index.js delete mode 100644 dist/strategies/passport/passport-facebook-oauth2/index.js.map delete mode 100644 dist/strategies/passport/passport-google-oauth2/google-auth-strategy-factory-provider.d.ts delete mode 100644 dist/strategies/passport/passport-google-oauth2/google-auth-strategy-factory-provider.js delete mode 100644 dist/strategies/passport/passport-google-oauth2/google-auth-strategy-factory-provider.js.map delete mode 100644 dist/strategies/passport/passport-google-oauth2/google-auth-verify.provider.d.ts delete mode 100644 dist/strategies/passport/passport-google-oauth2/google-auth-verify.provider.js delete mode 100644 dist/strategies/passport/passport-google-oauth2/google-auth-verify.provider.js.map delete mode 100644 dist/strategies/passport/passport-google-oauth2/index.d.ts delete mode 100644 dist/strategies/passport/passport-google-oauth2/index.js delete mode 100644 dist/strategies/passport/passport-google-oauth2/index.js.map delete mode 100644 dist/strategies/passport/passport-insta-oauth2/index.d.ts delete mode 100644 dist/strategies/passport/passport-insta-oauth2/index.js delete mode 100644 dist/strategies/passport/passport-insta-oauth2/index.js.map delete mode 100644 dist/strategies/passport/passport-insta-oauth2/insta-auth-strategy-factory-provider.d.ts delete mode 100644 dist/strategies/passport/passport-insta-oauth2/insta-auth-strategy-factory-provider.js delete mode 100644 dist/strategies/passport/passport-insta-oauth2/insta-auth-strategy-factory-provider.js.map delete mode 100644 dist/strategies/passport/passport-insta-oauth2/insta-auth-verify.provider.d.ts delete mode 100644 dist/strategies/passport/passport-insta-oauth2/insta-auth-verify.provider.js delete mode 100644 dist/strategies/passport/passport-insta-oauth2/insta-auth-verify.provider.js.map delete mode 100644 dist/strategies/passport/passport-keycloak/index.d.ts delete mode 100644 dist/strategies/passport/passport-keycloak/index.js delete mode 100644 dist/strategies/passport/passport-keycloak/index.js.map delete mode 100644 dist/strategies/passport/passport-keycloak/keycloak-strategy-factory-provider.d.ts delete mode 100644 dist/strategies/passport/passport-keycloak/keycloak-strategy-factory-provider.js delete mode 100644 dist/strategies/passport/passport-keycloak/keycloak-strategy-factory-provider.js.map delete mode 100644 dist/strategies/passport/passport-keycloak/keycloak-verify.provider.d.ts delete mode 100644 dist/strategies/passport/passport-keycloak/keycloak-verify.provider.js delete mode 100644 dist/strategies/passport/passport-keycloak/keycloak-verify.provider.js.map delete mode 100644 dist/strategies/passport/passport-local/index.d.ts delete mode 100644 dist/strategies/passport/passport-local/index.js delete mode 100644 dist/strategies/passport/passport-local/index.js.map delete mode 100644 dist/strategies/passport/passport-local/local-password-strategy-factory-provider.d.ts delete mode 100644 dist/strategies/passport/passport-local/local-password-strategy-factory-provider.js delete mode 100644 dist/strategies/passport/passport-local/local-password-strategy-factory-provider.js.map delete mode 100644 dist/strategies/passport/passport-local/local-password-verify.provider.d.ts delete mode 100644 dist/strategies/passport/passport-local/local-password-verify.provider.js delete mode 100644 dist/strategies/passport/passport-local/local-password-verify.provider.js.map delete mode 100644 dist/strategies/passport/passport-otp/index.d.ts delete mode 100644 dist/strategies/passport/passport-otp/index.js delete mode 100644 dist/strategies/passport/passport-otp/index.js.map delete mode 100644 dist/strategies/passport/passport-otp/otp-auth.d.ts delete mode 100644 dist/strategies/passport/passport-otp/otp-auth.js delete mode 100644 dist/strategies/passport/passport-otp/otp-auth.js.map delete mode 100644 dist/strategies/passport/passport-otp/otp-strategy-factory.provider.d.ts delete mode 100644 dist/strategies/passport/passport-otp/otp-strategy-factory.provider.js delete mode 100644 dist/strategies/passport/passport-otp/otp-strategy-factory.provider.js.map delete mode 100644 dist/strategies/passport/passport-otp/otp-verify.provider.d.ts delete mode 100644 dist/strategies/passport/passport-otp/otp-verify.provider.js delete mode 100644 dist/strategies/passport/passport-otp/otp-verify.provider.js.map delete mode 100644 dist/strategies/passport/passport-resource-owner-password/index.d.ts delete mode 100644 dist/strategies/passport/passport-resource-owner-password/index.js delete mode 100644 dist/strategies/passport/passport-resource-owner-password/index.js.map delete mode 100644 dist/strategies/passport/passport-resource-owner-password/oauth2-resource-owner-password-grant.d.ts delete mode 100644 dist/strategies/passport/passport-resource-owner-password/oauth2-resource-owner-password-grant.js delete mode 100644 dist/strategies/passport/passport-resource-owner-password/oauth2-resource-owner-password-grant.js.map delete mode 100644 dist/strategies/passport/passport-resource-owner-password/resource-owner-strategy-factory-provider.d.ts delete mode 100644 dist/strategies/passport/passport-resource-owner-password/resource-owner-strategy-factory-provider.js delete mode 100644 dist/strategies/passport/passport-resource-owner-password/resource-owner-strategy-factory-provider.js.map delete mode 100644 dist/strategies/passport/passport-resource-owner-password/resource-owner-verify.provider.d.ts delete mode 100644 dist/strategies/passport/passport-resource-owner-password/resource-owner-verify.provider.js delete mode 100644 dist/strategies/passport/passport-resource-owner-password/resource-owner-verify.provider.js.map delete mode 100644 dist/strategies/types/index.d.ts delete mode 100644 dist/strategies/types/index.js delete mode 100644 dist/strategies/types/index.js.map delete mode 100644 dist/strategies/types/keycloak.types.d.ts delete mode 100644 dist/strategies/types/keycloak.types.js delete mode 100644 dist/strategies/types/keycloak.types.js.map delete mode 100644 dist/strategies/types/types.d.ts delete mode 100644 dist/strategies/types/types.js delete mode 100644 dist/strategies/types/types.js.map delete mode 100644 dist/strategies/user-auth-strategy.provider.d.ts delete mode 100644 dist/strategies/user-auth-strategy.provider.js delete mode 100644 dist/strategies/user-auth-strategy.provider.js.map delete mode 100644 dist/strategy-adapter.d.ts delete mode 100644 dist/strategy-adapter.js delete mode 100644 dist/strategy-adapter.js.map delete mode 100644 dist/strategy-name.enum.d.ts delete mode 100644 dist/strategy-name.enum.js delete mode 100644 dist/strategy-name.enum.js.map delete mode 100644 dist/types.d.ts delete mode 100644 dist/types.js delete mode 100644 dist/types.js.map create mode 100644 src/__tests__/fixtures/sequences/authentication-middleware.sequence.ts rename src/__tests__/integration/{ => action-sequence}/helpers/helpers.ts (82%) rename src/__tests__/integration/{ => action-sequence}/passport-apple-oauth2/apple-oauth2.integration.ts (78%) rename src/__tests__/integration/{ => action-sequence}/passport-bearer/bearer-token-verify.integration.ts (94%) rename src/__tests__/integration/{ => action-sequence}/passport-client-password/client-password-verify.integration.ts (92%) rename src/__tests__/integration/{ => action-sequence}/passport-google-oauth2/google-oauth2.integration.ts (77%) rename src/__tests__/integration/{ => action-sequence}/passport-instagram-oauth2/instagram-oauth2.integration.ts (77%) rename src/__tests__/integration/{ => action-sequence}/passport-keycloak/keycloak.integration.ts (77%) rename src/__tests__/integration/{ => action-sequence}/passport-local/local-passport.integration.ts (92%) rename src/__tests__/integration/{ => action-sequence}/passport-resource-owner-password/resource-owner-password.integration.ts (94%) create mode 100644 src/__tests__/integration/middleware-sequence/helpers/helpers.ts create mode 100644 src/__tests__/integration/middleware-sequence/passport-apple-oauth2/apple-oauth2.integration.ts create mode 100644 src/__tests__/integration/middleware-sequence/passport-bearer/bearer-token-verify.integration.ts create mode 100644 src/__tests__/integration/middleware-sequence/passport-client-password/client-password-verify.integration.ts create mode 100644 src/__tests__/integration/middleware-sequence/passport-google-oauth2/google-oauth2.integration.ts create mode 100644 src/__tests__/integration/middleware-sequence/passport-instagram-oauth2/instagram-oauth2.integration.ts create mode 100644 src/__tests__/integration/middleware-sequence/passport-keycloak/keycloak.integration.ts create mode 100644 src/__tests__/integration/middleware-sequence/passport-local/local-passport.integration.ts create mode 100644 src/__tests__/integration/middleware-sequence/passport-resource-owner-password/resource-owner-password.integration.ts create mode 100644 src/middlewares/client-authentication.middleware.ts create mode 100644 src/middlewares/index.ts create mode 100644 src/middlewares/middleware-groups.enum.ts create mode 100644 src/middlewares/user-authentication.middleware.ts diff --git a/.cz-config.js b/.cz-config.js index 0a7973f..188c7e6 100644 --- a/.cz-config.js +++ b/.cz-config.js @@ -30,6 +30,7 @@ module.exports = { {name: 'component'}, {name: 'provider'}, {name: 'core'}, + {name: 'middleware'}, ], appendBranchNameToCommitMessage: true, diff --git a/.vscode/launch.json b/.vscode/launch.json index e8dadd3..82af1c5 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -11,7 +11,7 @@ "program": "${workspaceFolder}\\index.js", "outFiles": [ "${workspaceFolder}/**/*.js" - ] + ], }, { "type": "node", @@ -25,7 +25,20 @@ "${workspaceFolder}\\dist\\__tests__" ], "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen" + "internalConsoleOptions": "neverOpen", + }, + { + "name": "Run mocha", + // Type of configuration. Possible values: "node", "mono". + "type": "node", + // Workspace relative or absolute path to the program. + "program": "${workspaceRoot}/node_modules/.bin/lb-mocha", + // Automatically stop program after launch. + "stopOnEntry": false, + // Command line arguments passed to the program. + "args": ["--allow-console-logs","\"${workspaceRoot}/dist/__tests__\"","-g","\"should return 200 when client id is passed and passReqToCallback is set true\""], + // Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace. + "cwd": ".", } ] } diff --git a/README.md b/README.md index c8d2683..b690f15 100644 --- a/README.md +++ b/README.md @@ -2550,6 +2550,22 @@ this.bind(VerifyBindings.BEARER_SIGNUP_VERIFY_PROVIDER).toProvider( If a https proxy agent is needed for keycloak and google auth, just add an environment variable named `HTTPS_PROXY` or `https_proxy` with proxy url as value. It will add that proxy agent to the request. +## Middleware Sequence Support + +As action based sequence will be deprecated soon, we have provided support for middleware based sequences. If you are using middleware sequence you can add authentication to your application by enabling client or user authentication middleware. This can be done by binding the AuthenticationBindings.CONFIG : + +```ts +this.bind(AuthenticationBindings.CONFIG).to({ + useClientAuthenticationMiddleware: true, + useUserAuthenticationMiddleware: true, +}); + +this.component(AuthenticationComponent); +``` + +This binding needs to be done before adding the Authentication component to your application. +Apart from this all other steps for authentication for all strategies remain the same. + ## Feedback If you've noticed a bug or have a question or have a feature request, [search the issue tracker](https://github.com/sourcefuse/loopback4-authentication/issues) to see if someone else in the community has already created a ticket. diff --git a/dist/__tests__/fixtures/data/bearer-data.d.ts b/dist/__tests__/fixtures/data/bearer-data.d.ts deleted file mode 100644 index c0c7792..0000000 --- a/dist/__tests__/fixtures/data/bearer-data.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { IAuthUser } from '../../../types'; -export declare const userWithoutReqObj: IAuthUser; -export declare const userWhenReqObj: IAuthUser; -export declare const validToken = "validtoken"; diff --git a/dist/__tests__/fixtures/data/bearer-data.js b/dist/__tests__/fixtures/data/bearer-data.js deleted file mode 100644 index 5f0d1a1..0000000 --- a/dist/__tests__/fixtures/data/bearer-data.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.validToken = exports.userWhenReqObj = exports.userWithoutReqObj = void 0; -exports.userWithoutReqObj = { - id: 1, - username: 'xyz', - password: 'pass', -}; -exports.userWhenReqObj = { - id: 2, - username: 'abc', - password: 'test', -}; -exports.validToken = 'validtoken'; -//# sourceMappingURL=bearer-data.js.map \ No newline at end of file diff --git a/dist/__tests__/fixtures/data/bearer-data.js.map b/dist/__tests__/fixtures/data/bearer-data.js.map deleted file mode 100644 index 527d2c7..0000000 --- a/dist/__tests__/fixtures/data/bearer-data.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bearer-data.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/data/bearer-data.ts"],"names":[],"mappings":";;;AAEa,QAAA,iBAAiB,GAAc;IAC1C,EAAE,EAAE,CAAC;IACL,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,MAAM;CACjB,CAAC;AAEW,QAAA,cAAc,GAAc;IACvC,EAAE,EAAE,CAAC;IACL,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,MAAM;CACjB,CAAC;AAEW,QAAA,UAAU,GAAG,YAAY,CAAC"} \ No newline at end of file diff --git a/dist/__tests__/fixtures/providers/azuread-auth.provider.d.ts b/dist/__tests__/fixtures/providers/azuread-auth.provider.d.ts deleted file mode 100644 index bf23084..0000000 --- a/dist/__tests__/fixtures/providers/azuread-auth.provider.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Provider } from '@loopback/core'; -import { VerifyFunction } from '../../../strategies'; -export declare class BearerTokenVerifyProvider implements Provider { - constructor(); - value(): VerifyFunction.AzureADAuthFn; -} diff --git a/dist/__tests__/fixtures/providers/azuread-auth.provider.js b/dist/__tests__/fixtures/providers/azuread-auth.provider.js deleted file mode 100644 index aa9d6c8..0000000 --- a/dist/__tests__/fixtures/providers/azuread-auth.provider.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BearerTokenVerifyProvider = void 0; -class BearerTokenVerifyProvider { - constructor() { } - value() { - return async (profile, done, req) => { - const userToPass = { - id: 1, - username: 'xyz', - password: 'pass', - }; - return userToPass; - }; - } -} -exports.BearerTokenVerifyProvider = BearerTokenVerifyProvider; -//# sourceMappingURL=azuread-auth.provider.js.map \ No newline at end of file diff --git a/dist/__tests__/fixtures/providers/azuread-auth.provider.js.map b/dist/__tests__/fixtures/providers/azuread-auth.provider.js.map deleted file mode 100644 index 7d6e29a..0000000 --- a/dist/__tests__/fixtures/providers/azuread-auth.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"azuread-auth.provider.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/providers/azuread-auth.provider.ts"],"names":[],"mappings":";;;AAMA,MAAa,yBAAyB;IAGpC,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EACV,OAAqC,EACrC,IAAwC,EACxC,GAAa,EACb,EAAE;YACF,MAAM,UAAU,GAAc;gBAC5B,EAAE,EAAE,CAAC;gBACL,QAAQ,EAAE,KAAK;gBACf,QAAQ,EAAE,MAAM;aACjB,CAAC;YAEF,OAAO,UAAU,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC;CACF;AApBD,8DAoBC"} \ No newline at end of file diff --git a/dist/__tests__/fixtures/providers/bearer-passport.provider.d.ts b/dist/__tests__/fixtures/providers/bearer-passport.provider.d.ts deleted file mode 100644 index f543440..0000000 --- a/dist/__tests__/fixtures/providers/bearer-passport.provider.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Provider } from '@loopback/core'; -import { VerifyFunction } from '../../../strategies'; -export declare class BearerTokenVerifyProvider implements Provider { - constructor(); - value(): VerifyFunction.BearerFn; -} diff --git a/dist/__tests__/fixtures/providers/bearer-passport.provider.js b/dist/__tests__/fixtures/providers/bearer-passport.provider.js deleted file mode 100644 index 11b5e11..0000000 --- a/dist/__tests__/fixtures/providers/bearer-passport.provider.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BearerTokenVerifyProvider = void 0; -const bearer_data_1 = require("../data/bearer-data"); -class BearerTokenVerifyProvider { - constructor() { } - value() { - return async (token, req) => { - if (token !== bearer_data_1.validToken) { - return null; - } - if (req) { - return bearer_data_1.userWhenReqObj; - } - return bearer_data_1.userWithoutReqObj; - }; - } -} -exports.BearerTokenVerifyProvider = BearerTokenVerifyProvider; -//# sourceMappingURL=bearer-passport.provider.js.map \ No newline at end of file diff --git a/dist/__tests__/fixtures/providers/bearer-passport.provider.js.map b/dist/__tests__/fixtures/providers/bearer-passport.provider.js.map deleted file mode 100644 index b31ee21..0000000 --- a/dist/__tests__/fixtures/providers/bearer-passport.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bearer-passport.provider.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/providers/bearer-passport.provider.ts"],"names":[],"mappings":";;;AAIA,qDAI6B;AAE7B,MAAa,yBAAyB;IAGpC,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EAAE,KAAa,EAAE,GAAa,EAAE,EAAE;YAC5C,IAAI,KAAK,KAAK,wBAAU,EAAE;gBACxB,OAAO,IAAI,CAAC;aACb;YAED,IAAI,GAAG,EAAE;gBACP,OAAO,4BAAc,CAAC;aACvB;YAED,OAAO,+BAAiB,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC;CACF;AAlBD,8DAkBC"} \ No newline at end of file diff --git a/dist/__tests__/fixtures/providers/google-auth.provider.d.ts b/dist/__tests__/fixtures/providers/google-auth.provider.d.ts deleted file mode 100644 index e05d5f5..0000000 --- a/dist/__tests__/fixtures/providers/google-auth.provider.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Provider } from '@loopback/core'; -import { VerifyFunction } from '../../../strategies'; -export declare class BearerTokenVerifyProvider implements Provider { - constructor(); - value(): VerifyFunction.GoogleAuthFn; -} diff --git a/dist/__tests__/fixtures/providers/google-auth.provider.js b/dist/__tests__/fixtures/providers/google-auth.provider.js deleted file mode 100644 index c1c1f2e..0000000 --- a/dist/__tests__/fixtures/providers/google-auth.provider.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BearerTokenVerifyProvider = void 0; -class BearerTokenVerifyProvider { - constructor() { } - value() { - return async (accessToken, refreshToken, profile, cb, req) => { - const userToPass = { - id: 1, - username: 'xyz', - password: 'pass', - }; - return userToPass; - }; - } -} -exports.BearerTokenVerifyProvider = BearerTokenVerifyProvider; -//# sourceMappingURL=google-auth.provider.js.map \ No newline at end of file diff --git a/dist/__tests__/fixtures/providers/google-auth.provider.js.map b/dist/__tests__/fixtures/providers/google-auth.provider.js.map deleted file mode 100644 index 2e492dc..0000000 --- a/dist/__tests__/fixtures/providers/google-auth.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"google-auth.provider.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/providers/google-auth.provider.ts"],"names":[],"mappings":";;;AAMA,MAAa,yBAAyB;IAGpC,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EACV,WAAmB,EACnB,YAAoB,EACpB,OAA+B,EAC/B,EAAiC,EACjC,GAAa,EACb,EAAE;YACF,MAAM,UAAU,GAAc;gBAC5B,EAAE,EAAE,CAAC;gBACL,QAAQ,EAAE,KAAK;gBACf,QAAQ,EAAE,MAAM;aACjB,CAAC;YAEF,OAAO,UAAU,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC;CACF;AAtBD,8DAsBC"} \ No newline at end of file diff --git a/dist/__tests__/fixtures/providers/instagram-auth.provider.d.ts b/dist/__tests__/fixtures/providers/instagram-auth.provider.d.ts deleted file mode 100644 index fd2f071..0000000 --- a/dist/__tests__/fixtures/providers/instagram-auth.provider.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// -/// -import { Provider } from '@loopback/core'; -import { VerifyCallback, VerifyFunction } from '../../../strategies'; -import * as InstagramStrategy from 'passport-instagram'; -import { IAuthUser } from '../../../types'; -import { Request } from '@loopback/rest'; -export declare class BearerTokenVerifyProvider implements Provider { - constructor(); - value(): (accessToken: string, refreshToken: string, profile: InstagramStrategy.Profile, cb: VerifyCallback, req?: Request> | undefined) => Promise; -} diff --git a/dist/__tests__/fixtures/providers/instagram-auth.provider.js b/dist/__tests__/fixtures/providers/instagram-auth.provider.js deleted file mode 100644 index 48f676e..0000000 --- a/dist/__tests__/fixtures/providers/instagram-auth.provider.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BearerTokenVerifyProvider = void 0; -class BearerTokenVerifyProvider { - constructor() { } - value() { - return async (accessToken, refreshToken, profile, cb, req) => { - const userToPass = { - id: 1, - username: 'xyz', - password: 'pass', - }; - return userToPass; - }; - } -} -exports.BearerTokenVerifyProvider = BearerTokenVerifyProvider; -//# sourceMappingURL=instagram-auth.provider.js.map \ No newline at end of file diff --git a/dist/__tests__/fixtures/providers/instagram-auth.provider.js.map b/dist/__tests__/fixtures/providers/instagram-auth.provider.js.map deleted file mode 100644 index 12ddd65..0000000 --- a/dist/__tests__/fixtures/providers/instagram-auth.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"instagram-auth.provider.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/providers/instagram-auth.provider.ts"],"names":[],"mappings":";;;AAMA,MAAa,yBAAyB;IAGpC,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EACV,WAAmB,EACnB,YAAoB,EACpB,OAAkC,EAClC,EAAkB,EAClB,GAAa,EACb,EAAE;YACF,MAAM,UAAU,GAAc;gBAC5B,EAAE,EAAE,CAAC;gBACL,QAAQ,EAAE,KAAK;gBACf,QAAQ,EAAE,MAAM;aACjB,CAAC;YAEF,OAAO,UAAU,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC;CACF;AAtBD,8DAsBC"} \ No newline at end of file diff --git a/dist/__tests__/fixtures/providers/local-password.provider.d.ts b/dist/__tests__/fixtures/providers/local-password.provider.d.ts deleted file mode 100644 index 5b0da03..0000000 --- a/dist/__tests__/fixtures/providers/local-password.provider.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Provider } from '@loopback/core'; -import { VerifyFunction } from '../../../strategies'; -export declare class LocalVerifyProvider implements Provider { - constructor(); - value(): VerifyFunction.LocalPasswordFn; -} diff --git a/dist/__tests__/fixtures/providers/local-password.provider.js b/dist/__tests__/fixtures/providers/local-password.provider.js deleted file mode 100644 index 3579df6..0000000 --- a/dist/__tests__/fixtures/providers/local-password.provider.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LocalVerifyProvider = void 0; -class LocalVerifyProvider { - constructor() { } - value() { - return async (username, password, req) => { - if (!username || !password) { - return null; - } - if (username === '') { - return null; - } - const userToPass = { - id: 1, - username, - password, - }; - return userToPass; - }; - } -} -exports.LocalVerifyProvider = LocalVerifyProvider; -//# sourceMappingURL=local-password.provider.js.map \ No newline at end of file diff --git a/dist/__tests__/fixtures/providers/local-password.provider.js.map b/dist/__tests__/fixtures/providers/local-password.provider.js.map deleted file mode 100644 index 8ebf517..0000000 --- a/dist/__tests__/fixtures/providers/local-password.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"local-password.provider.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/providers/local-password.provider.ts"],"names":[],"mappings":";;;AAKA,MAAa,mBAAmB;IAG9B,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EAAE,QAAgB,EAAE,QAAgB,EAAE,GAAa,EAAE,EAAE;YACjE,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAAE;gBAC1B,OAAO,IAAI,CAAC;aACb;YAED,IAAI,QAAQ,KAAK,EAAE,EAAE;gBACnB,OAAO,IAAI,CAAC;aACb;YAED,MAAM,UAAU,GAAc;gBAC5B,EAAE,EAAE,CAAC;gBACL,QAAQ;gBACR,QAAQ;aACT,CAAC;YAEF,OAAO,UAAU,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC;CACF;AAxBD,kDAwBC"} \ No newline at end of file diff --git a/dist/__tests__/fixtures/providers/passport-client.provider.d.ts b/dist/__tests__/fixtures/providers/passport-client.provider.d.ts deleted file mode 100644 index 6c0c15a..0000000 --- a/dist/__tests__/fixtures/providers/passport-client.provider.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Provider } from '@loopback/core'; -import { VerifyFunction } from '../../../strategies'; -import { IAuthClient } from '../../../types'; -export declare class ClientPasswordVerifyProvider implements Provider { - constructor(); - value(): (clientId: string, clientSecret: string) => Promise; -} diff --git a/dist/__tests__/fixtures/providers/passport-client.provider.js b/dist/__tests__/fixtures/providers/passport-client.provider.js deleted file mode 100644 index 5f0d95e..0000000 --- a/dist/__tests__/fixtures/providers/passport-client.provider.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClientPasswordVerifyProvider = void 0; -class ClientPasswordVerifyProvider { - constructor() { } - value() { - return async (clientId, clientSecret) => { - if (clientId === '') { - return null; - } - const clientToPass = { - clientId: clientId || 'id', - clientSecret: clientSecret || 'secret', - }; - return clientToPass; - }; - } -} -exports.ClientPasswordVerifyProvider = ClientPasswordVerifyProvider; -//# sourceMappingURL=passport-client.provider.js.map \ No newline at end of file diff --git a/dist/__tests__/fixtures/providers/passport-client.provider.js.map b/dist/__tests__/fixtures/providers/passport-client.provider.js.map deleted file mode 100644 index ef04390..0000000 --- a/dist/__tests__/fixtures/providers/passport-client.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"passport-client.provider.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/providers/passport-client.provider.ts"],"names":[],"mappings":";;;AAIA,MAAa,4BAA4B;IAGvC,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EAAE,QAAgB,EAAE,YAAoB,EAAE,EAAE;YACtD,IAAI,QAAQ,KAAK,EAAE,EAAE;gBACnB,OAAO,IAAI,CAAC;aACb;YAED,MAAM,YAAY,GAAgB;gBAChC,QAAQ,EAAE,QAAQ,IAAI,IAAI;gBAC1B,YAAY,EAAE,YAAY,IAAI,QAAQ;aACvC,CAAC;YAEF,OAAO,YAAY,CAAC;QACtB,CAAC,CAAC;IACJ,CAAC;CACF;AAnBD,oEAmBC"} \ No newline at end of file diff --git a/dist/__tests__/fixtures/providers/resource-owner.provider.d.ts b/dist/__tests__/fixtures/providers/resource-owner.provider.d.ts deleted file mode 100644 index 601135c..0000000 --- a/dist/__tests__/fixtures/providers/resource-owner.provider.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Provider } from '@loopback/core'; -import { VerifyFunction } from '../../../strategies'; -export declare class ResourceOwnerVerifyProvider implements Provider { - constructor(); - value(): VerifyFunction.ResourceOwnerPasswordFn; -} diff --git a/dist/__tests__/fixtures/providers/resource-owner.provider.js b/dist/__tests__/fixtures/providers/resource-owner.provider.js deleted file mode 100644 index dae6d78..0000000 --- a/dist/__tests__/fixtures/providers/resource-owner.provider.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ResourceOwnerVerifyProvider = void 0; -class ResourceOwnerVerifyProvider { - constructor() { } - value() { - return async (clientId, clientSecret, username, password, req) => { - if (username === '' || clientId === '') { - return null; - } - const userToPass = { - id: 1, - username: username || 'xyz', - password: password || 'pass', - }; - const clientToPass = { - clientId: clientId || 'client id', - clientSecret: clientSecret || 'client secret', - }; - return { user: userToPass, client: clientToPass }; - }; - } -} -exports.ResourceOwnerVerifyProvider = ResourceOwnerVerifyProvider; -//# sourceMappingURL=resource-owner.provider.js.map \ No newline at end of file diff --git a/dist/__tests__/fixtures/providers/resource-owner.provider.js.map b/dist/__tests__/fixtures/providers/resource-owner.provider.js.map deleted file mode 100644 index d9b5c4f..0000000 --- a/dist/__tests__/fixtures/providers/resource-owner.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resource-owner.provider.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/providers/resource-owner.provider.ts"],"names":[],"mappings":";;;AAKA,MAAa,2BAA2B;IAGtC,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EACV,QAAgB,EAChB,YAAoB,EACpB,QAAgB,EAChB,QAAgB,EAChB,GAAa,EACb,EAAE;YACF,IAAI,QAAQ,KAAK,EAAE,IAAI,QAAQ,KAAK,EAAE,EAAE;gBACtC,OAAO,IAAI,CAAC;aACb;YAED,MAAM,UAAU,GAAc;gBAC5B,EAAE,EAAE,CAAC;gBACL,QAAQ,EAAE,QAAQ,IAAI,KAAK;gBAC3B,QAAQ,EAAE,QAAQ,IAAI,MAAM;aAC7B,CAAC;YAEF,MAAM,YAAY,GAAgB;gBAChC,QAAQ,EAAE,QAAQ,IAAI,WAAW;gBACjC,YAAY,EAAE,YAAY,IAAI,eAAe;aAC9C,CAAC;YAEF,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAC,CAAC;QAClD,CAAC,CAAC;IACJ,CAAC;CACF;AA/BD,kEA+BC"} \ No newline at end of file diff --git a/dist/__tests__/fixtures/sequences/authentication.sequence.d.ts b/dist/__tests__/fixtures/sequences/authentication.sequence.d.ts deleted file mode 100644 index bee851b..0000000 --- a/dist/__tests__/fixtures/sequences/authentication.sequence.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { FindRoute, InvokeMethod, ParseParams, Reject, RequestContext, Send, SequenceHandler } from '@loopback/rest'; -import { AuthenticateFn } from '../../../'; -import { IAuthUser, IAuthClient } from '../../../types'; -export declare class MyAuthenticationSequence implements SequenceHandler { - protected findRoute: FindRoute; - protected parseParams: ParseParams; - protected invoke: InvokeMethod; - protected send: Send; - protected reject: Reject; - protected authenticateClientRequest: AuthenticateFn; - protected authenticateRequest: AuthenticateFn; - constructor(findRoute: FindRoute, parseParams: ParseParams, invoke: InvokeMethod, send: Send, reject: Reject, authenticateClientRequest: AuthenticateFn, authenticateRequest: AuthenticateFn); - handle(context: RequestContext): Promise; -} diff --git a/dist/__tests__/fixtures/sequences/authentication.sequence.js b/dist/__tests__/fixtures/sequences/authentication.sequence.js deleted file mode 100644 index 25b6d56..0000000 --- a/dist/__tests__/fixtures/sequences/authentication.sequence.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MyAuthenticationSequence = void 0; -const tslib_1 = require("tslib"); -const context_1 = require("@loopback/context"); -const rest_1 = require("@loopback/rest"); -const __1 = require("../../../"); -const SequenceActions = rest_1.RestBindings.SequenceActions; -let MyAuthenticationSequence = class MyAuthenticationSequence { - constructor(findRoute, parseParams, invoke, send, reject, authenticateClientRequest, authenticateRequest) { - this.findRoute = findRoute; - this.parseParams = parseParams; - this.invoke = invoke; - this.send = send; - this.reject = reject; - this.authenticateClientRequest = authenticateClientRequest; - this.authenticateRequest = authenticateRequest; - } - async handle(context) { - try { - const { request, response } = context; - const route = this.findRoute(request); - const args = await this.parseParams(request, route); - request.body = args[args.length - 1]; - //call authentication action - await this.authenticateClientRequest(request); - await this.authenticateRequest(request); - // Authentication successful, proceed to invoke controller - const result = await this.invoke(route, args); - this.send(response, result); - } - catch (error) { - if (error.code === 'AUTHENTICATION_STRATEGY_NOT_FOUND' || - error.code === 'USER_PROFILE_NOT_FOUND') { - Object.assign(error, { statusCode: 401 /* Unauthorized */ }); - } - this.reject(context, error); - return; - } - } -}; -MyAuthenticationSequence = tslib_1.__decorate([ - tslib_1.__param(0, (0, context_1.inject)(SequenceActions.FIND_ROUTE)), - tslib_1.__param(1, (0, context_1.inject)(SequenceActions.PARSE_PARAMS)), - tslib_1.__param(2, (0, context_1.inject)(SequenceActions.INVOKE_METHOD)), - tslib_1.__param(3, (0, context_1.inject)(SequenceActions.SEND)), - tslib_1.__param(4, (0, context_1.inject)(SequenceActions.REJECT)), - tslib_1.__param(5, (0, context_1.inject)(__1.AuthenticationBindings.CLIENT_AUTH_ACTION)), - tslib_1.__param(6, (0, context_1.inject)(__1.AuthenticationBindings.USER_AUTH_ACTION)), - tslib_1.__metadata("design:paramtypes", [Function, Function, Function, Function, Function, Function, Function]) -], MyAuthenticationSequence); -exports.MyAuthenticationSequence = MyAuthenticationSequence; -//# sourceMappingURL=authentication.sequence.js.map \ No newline at end of file diff --git a/dist/__tests__/fixtures/sequences/authentication.sequence.js.map b/dist/__tests__/fixtures/sequences/authentication.sequence.js.map deleted file mode 100644 index 32dd737..0000000 --- a/dist/__tests__/fixtures/sequences/authentication.sequence.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"authentication.sequence.js","sourceRoot":"","sources":["../../../../src/__tests__/fixtures/sequences/authentication.sequence.ts"],"names":[],"mappings":";;;;AAAA,+CAAyC;AACzC,yCASwB;AACxB,iCAAiE;AAEjE,MAAM,eAAe,GAAG,mBAAY,CAAC,eAAe,CAAC;AAErD,IAAa,wBAAwB,GAArC,MAAa,wBAAwB;IACnC,YACgD,SAAoB,EAExD,WAAwB,EACe,MAAoB,EAC7B,IAAU,EACR,MAAc,EAE9C,yBAET,EAES,mBAA0D;QAXtB,cAAS,GAAT,SAAS,CAAW;QAExD,gBAAW,GAAX,WAAW,CAAa;QACe,WAAM,GAAN,MAAM,CAAc;QAC7B,SAAI,GAAJ,IAAI,CAAM;QACR,WAAM,GAAN,MAAM,CAAQ;QAE9C,8BAAyB,GAAzB,yBAAyB,CAElC;QAES,wBAAmB,GAAnB,mBAAmB,CAAuC;IACnE,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,OAAuB;QAClC,IAAI;YACF,MAAM,EAAC,OAAO,EAAE,QAAQ,EAAC,GAAG,OAAO,CAAC;YACpC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YACtC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YACpD,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAErC,4BAA4B;YAC5B,MAAM,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC;YAC9C,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;YAExC,0DAA0D;YAC1D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAC9C,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;SAC7B;QAAC,OAAO,KAAK,EAAE;YACd,IACE,KAAK,CAAC,IAAI,KAAK,mCAAmC;gBAClD,KAAK,CAAC,IAAI,KAAK,wBAAwB,EACvC;gBACA,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,EAAC,UAAU,EAAE,GAAG,CAAC,kBAAkB,EAAC,CAAC,CAAC;aAC5D;YACD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAC5B,OAAO;SACR;IACH,CAAC;CACF,CAAA;AAzCY,wBAAwB;IAEhC,mBAAA,IAAA,gBAAM,EAAC,eAAe,CAAC,UAAU,CAAC,CAAA;IAClC,mBAAA,IAAA,gBAAM,EAAC,eAAe,CAAC,YAAY,CAAC,CAAA;IAEpC,mBAAA,IAAA,gBAAM,EAAC,eAAe,CAAC,aAAa,CAAC,CAAA;IACrC,mBAAA,IAAA,gBAAM,EAAC,eAAe,CAAC,IAAI,CAAC,CAAA;IAC5B,mBAAA,IAAA,gBAAM,EAAC,eAAe,CAAC,MAAM,CAAC,CAAA;IAC9B,mBAAA,IAAA,gBAAM,EAAC,0BAAsB,CAAC,kBAAkB,CAAC,CAAA;IAIjD,mBAAA,IAAA,gBAAM,EAAC,0BAAsB,CAAC,gBAAgB,CAAC,CAAA;;GAZvC,wBAAwB,CAyCpC;AAzCY,4DAAwB"} \ No newline at end of file diff --git a/dist/__tests__/integration/helpers/helpers.d.ts b/dist/__tests__/integration/helpers/helpers.d.ts deleted file mode 100644 index c5546e9..0000000 --- a/dist/__tests__/integration/helpers/helpers.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Application } from '@loopback/core'; -/** - *Gives an instance of application - */ -export declare function getApp(): Application; diff --git a/dist/__tests__/integration/helpers/helpers.js b/dist/__tests__/integration/helpers/helpers.js deleted file mode 100644 index e61255c..0000000 --- a/dist/__tests__/integration/helpers/helpers.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getApp = void 0; -const core_1 = require("@loopback/core"); -const component_1 = require("../../../component"); -const rest_1 = require("@loopback/rest"); -/** - *Gives an instance of application - */ -function getApp() { - const app = new core_1.Application(); - app.component(component_1.AuthenticationComponent); - app.component(rest_1.RestComponent); - return app; -} -exports.getApp = getApp; -//# sourceMappingURL=helpers.js.map \ No newline at end of file diff --git a/dist/__tests__/integration/helpers/helpers.js.map b/dist/__tests__/integration/helpers/helpers.js.map deleted file mode 100644 index 66ecec9..0000000 --- a/dist/__tests__/integration/helpers/helpers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../src/__tests__/integration/helpers/helpers.ts"],"names":[],"mappings":";;;AAAA,yCAA2C;AAC3C,kDAA2D;AAC3D,yCAA6C;AAE7C;;GAEG;AACH,SAAgB,MAAM;IACpB,MAAM,GAAG,GAAG,IAAI,kBAAW,EAAE,CAAC;IAC9B,GAAG,CAAC,SAAS,CAAC,mCAAuB,CAAC,CAAC;IACvC,GAAG,CAAC,SAAS,CAAC,oBAAa,CAAC,CAAC;IAC7B,OAAO,GAAG,CAAC;AACb,CAAC;AALD,wBAKC"} \ No newline at end of file diff --git a/dist/__tests__/integration/passport-apple-oauth2/apple-oauth2.integration.d.ts b/dist/__tests__/integration/passport-apple-oauth2/apple-oauth2.integration.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/__tests__/integration/passport-apple-oauth2/apple-oauth2.integration.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/__tests__/integration/passport-apple-oauth2/apple-oauth2.integration.js b/dist/__tests__/integration/passport-apple-oauth2/apple-oauth2.integration.js deleted file mode 100644 index eda4877..0000000 --- a/dist/__tests__/integration/passport-apple-oauth2/apple-oauth2.integration.js +++ /dev/null @@ -1,67 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -const testlab_1 = require("@loopback/testlab"); -const rest_1 = require("@loopback/rest"); -const openapi_v3_1 = require("@loopback/openapi-v3"); -const decorators_1 = require("../../../decorators"); -const helpers_1 = require("../helpers/helpers"); -const authentication_sequence_1 = require("../../fixtures/sequences/authentication.sequence"); -const keys_1 = require("../../../strategies/keys"); -const bearer_data_1 = require("../../fixtures/data/bearer-data"); -describe('getting apple oauth2 strategy with options', () => { - let app; - let server; - beforeEach(givenAServer); - beforeEach(givenAuthenticatedSequence); - afterEach(closeServer); - it('should return 200 when client id is passed and passReqToCallback is set true', async () => { - getAuthVerifier(); - class TestController { - test() { - return 'test successful'; - } - } - tslib_1.__decorate([ - (0, openapi_v3_1.get)('/test'), - (0, decorators_1.authenticate)("Apple Oauth 2.0" /* APPLE_OAUTH2 */, { - clientID: 'string', - clientSecret: 'string', - passReqToCallback: true, - }), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", []), - tslib_1.__metadata("design:returntype", void 0) - ], TestController.prototype, "test", null); - app.controller(TestController); - await whenIMakeRequestTo(server).get('/test').expect(200); - }); - function whenIMakeRequestTo(restServer) { - return (0, testlab_1.createClientForHandler)(restServer.requestHandler); - } - async function givenAServer() { - app = (0, helpers_1.getApp)(); - server = await app.getServer(rest_1.RestServer); - } - function getAuthVerifier() { - app - .bind(keys_1.Strategies.Passport.APPLE_OAUTH2_VERIFIER) - .toProvider(AppleAuthVerifyProvider); - } - function closeServer() { - app.close(); - } - function givenAuthenticatedSequence() { - // bind user defined sequence - server.sequence(authentication_sequence_1.MyAuthenticationSequence); - } -}); -class AppleAuthVerifyProvider { - constructor() { } - value() { - return async (accessToken, refreshToken, decodedIdToken, profile, cd, req) => { - return bearer_data_1.userWithoutReqObj; - }; - } -} -//# sourceMappingURL=apple-oauth2.integration.js.map \ No newline at end of file diff --git a/dist/__tests__/integration/passport-apple-oauth2/apple-oauth2.integration.js.map b/dist/__tests__/integration/passport-apple-oauth2/apple-oauth2.integration.js.map deleted file mode 100644 index 6dfbd09..0000000 --- a/dist/__tests__/integration/passport-apple-oauth2/apple-oauth2.integration.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"apple-oauth2.integration.js","sourceRoot":"","sources":["../../../../src/__tests__/integration/passport-apple-oauth2/apple-oauth2.integration.ts"],"names":[],"mappings":";;;AAAA,+CAAiE;AACjE,yCAA0C;AAE1C,qDAAyC;AACzC,oDAAiD;AAEjD,gDAA0C;AAC1C,8FAA0F;AAC1F,mDAAoD;AAEpD,iEAAkE;AAIlE,QAAQ,CAAC,4CAA4C,EAAE,GAAG,EAAE;IAC1D,IAAI,GAAgB,CAAC;IACrB,IAAI,MAAkB,CAAC;IACvB,UAAU,CAAC,YAAY,CAAC,CAAC;IACzB,UAAU,CAAC,0BAA0B,CAAC,CAAC;IACvC,SAAS,CAAC,WAAW,CAAC,CAAC;IAEvB,EAAE,CAAC,8EAA8E,EAAE,KAAK,IAAI,EAAE;QAC5F,eAAe,EAAE,CAAC;QAClB,MAAM,cAAc;YAOlB,IAAI;gBACF,OAAO,iBAAiB,CAAC;YAC3B,CAAC;SACF;QAHC;YANC,IAAA,gBAAG,EAAC,OAAO,CAAC;YACZ,IAAA,yBAAY,wCAAwB;gBACnC,QAAQ,EAAE,QAAQ;gBAClB,YAAY,EAAE,QAAQ;gBACtB,iBAAiB,EAAE,IAAI;aACxB,CAAC;;;;kDAGD;QAGH,GAAG,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;QAE/B,MAAM,kBAAkB,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,SAAS,kBAAkB,CAAC,UAAsB;QAChD,OAAO,IAAA,gCAAsB,EAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,UAAU,YAAY;QACzB,GAAG,GAAG,IAAA,gBAAM,GAAE,CAAC;QACf,MAAM,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,iBAAU,CAAC,CAAC;IAC3C,CAAC;IAED,SAAS,eAAe;QACtB,GAAG;aACA,IAAI,CAAC,iBAAU,CAAC,QAAQ,CAAC,qBAAqB,CAAC;aAC/C,UAAU,CAAC,uBAAuB,CAAC,CAAC;IACzC,CAAC;IAED,SAAS,WAAW;QAClB,GAAG,CAAC,KAAK,EAAE,CAAC;IACd,CAAC;IAED,SAAS,0BAA0B;QACjC,6BAA6B;QAC7B,MAAM,CAAC,QAAQ,CAAC,kDAAwB,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,MAAM,uBAAuB;IAC3B,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EACV,WAAmB,EACnB,YAAoB,EACpB,cAA8B,EAC9B,OAA8B,EAC9B,EAAgC,EAChC,GAAa,EACb,EAAE;YACF,OAAO,+BAAiB,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/dist/__tests__/integration/passport-bearer/bearer-token-verify.integration.d.ts b/dist/__tests__/integration/passport-bearer/bearer-token-verify.integration.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/__tests__/integration/passport-bearer/bearer-token-verify.integration.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/__tests__/integration/passport-bearer/bearer-token-verify.integration.js b/dist/__tests__/integration/passport-bearer/bearer-token-verify.integration.js deleted file mode 100644 index 501392a..0000000 --- a/dist/__tests__/integration/passport-bearer/bearer-token-verify.integration.js +++ /dev/null @@ -1,314 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -const testlab_1 = require("@loopback/testlab"); -const rest_1 = require("@loopback/rest"); -const core_1 = require("@loopback/core"); -const openapi_v3_1 = require("@loopback/openapi-v3"); -const decorators_1 = require("../../../decorators"); -const helpers_1 = require("../helpers/helpers"); -const authentication_sequence_1 = require("../../fixtures/sequences/authentication.sequence"); -const keys_1 = require("../../../strategies/keys"); -const keys_2 = require("../../../keys"); -const bearer_passport_provider_1 = require("../../fixtures/providers/bearer-passport.provider"); -/** - * Testing overall flow of authentication with bearer strategy - */ -describe('Bearer-token strategy', () => { - let app; - let server; - beforeEach(givenAServer); - beforeEach(givenAuthenticatedSequence); - beforeEach(getAuthVerifier); - it('should return 401 when token is not passed', async () => { - class BearerNoTokenController { - test() { - return 'test successful'; - } - } - tslib_1.__decorate([ - (0, openapi_v3_1.get)('/auth/bearer/no-token'), - (0, decorators_1.authenticate)("bearer" /* BEARER */), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", []), - tslib_1.__metadata("design:returntype", void 0) - ], BearerNoTokenController.prototype, "test", null); - app.controller(BearerNoTokenController); - await whenIMakeRequestTo(server).get('/auth/bearer/no-token').expect(401); - }); - it('should return status 200 when token is passed', async () => { - class BearerTokenController { - test() { - return 'test successful'; - } - } - tslib_1.__decorate([ - (0, openapi_v3_1.get)('/auth/bearer/token'), - (0, decorators_1.authenticate)("bearer" /* BEARER */), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", []), - tslib_1.__metadata("design:returntype", void 0) - ], BearerTokenController.prototype, "test", null); - app.controller(BearerTokenController); - await whenIMakeRequestTo(server) - .get('/auth/bearer/token') - .set('Authorization', 'Bearer validtoken') - .expect(200); - }); - it('should return the user passed via verifier when no options are passed', async () => { - let BearerNoOptionsController = class BearerNoOptionsController { - constructor(user) { - this.user = user; - } - async test() { - return this.user; - } - }; - tslib_1.__decorate([ - (0, openapi_v3_1.get)('/auth/bearer/no-options'), - (0, decorators_1.authenticate)("bearer" /* BEARER */), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", []), - tslib_1.__metadata("design:returntype", Promise) - ], BearerNoOptionsController.prototype, "test", null); - BearerNoOptionsController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_USER)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], BearerNoOptionsController); - app.controller(BearerNoOptionsController); - const user = await whenIMakeRequestTo(server) - .get('/auth/bearer/no-options') - .set('Authorization', 'Bearer validtoken') - .expect(200); - (0, testlab_1.expect)(user.body).to.have.property('id'); - (0, testlab_1.expect)(user.body.id).to.equal(1); - }); - it('should return the user passed via verifier and options are passed with passRequestCallback true', async () => { - let BearerForCallbackController = class BearerForCallbackController { - constructor(user) { - this.user = user; - this.options = { - passRequestToCallback: false, - }; - } - async test() { - return this.user; - } - }; - tslib_1.__decorate([ - (0, openapi_v3_1.get)('/auth/bearer/callback'), - (0, decorators_1.authenticate)("bearer" /* BEARER */, { passReqToCallback: true }), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", []), - tslib_1.__metadata("design:returntype", Promise) - ], BearerForCallbackController.prototype, "test", null); - BearerForCallbackController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_USER)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], BearerForCallbackController); - app.controller(BearerForCallbackController); - const user = await whenIMakeRequestTo(server) - .get('/auth/bearer/callback') - .set('Authorization', 'Bearer validtoken') - .expect(200); - (0, testlab_1.expect)(user.body).to.have.property('id'); - (0, testlab_1.expect)(user.body.id).to.equal(2); - }); - it('should return the user passed via verifier and options are passed with passRequestCallback false', async () => { - let BearerNoCallbackController = class BearerNoCallbackController { - constructor(user) { - this.user = user; - this.options = { - passRequestToCallback: false, - }; - } - async test() { - return this.user; - } - }; - tslib_1.__decorate([ - (0, openapi_v3_1.get)('/auth/bearer/no-callback'), - (0, decorators_1.authenticate)("bearer" /* BEARER */, { passReqToCallback: false }), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", []), - tslib_1.__metadata("design:returntype", Promise) - ], BearerNoCallbackController.prototype, "test", null); - BearerNoCallbackController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_USER)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], BearerNoCallbackController); - app.controller(BearerNoCallbackController); - const user = await whenIMakeRequestTo(server) - .get('/auth/bearer/no-callback') - .set('Authorization', 'Bearer validtoken') - .expect(200); - (0, testlab_1.expect)(user.body).to.have.property('id'); - (0, testlab_1.expect)(user.body.id).to.equal(1); - }); - it('should return status 401 as Bearer is not sent in token', async () => { - class NoBearerInTokenController { - test() { - return 'test successful'; - } - } - tslib_1.__decorate([ - (0, openapi_v3_1.get)('/auth/bearer/no-bearer-in-token'), - (0, decorators_1.authenticate)("bearer" /* BEARER */), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", []), - tslib_1.__metadata("design:returntype", void 0) - ], NoBearerInTokenController.prototype, "test", null); - app.controller(NoBearerInTokenController); - await whenIMakeRequestTo(server) - .get('/auth/bearer/no-bearer-in-token') - .set('Authorization', 'sometoken') - .expect(401); - }); - it('should return error as no user was returned from provider', async () => { - let BearerNoUserController = class BearerNoUserController { - constructor(user) { - this.user = user; - } - async test() { - return this.user; - } - }; - tslib_1.__decorate([ - (0, openapi_v3_1.get)('/auth/bearer/no-user'), - (0, decorators_1.authenticate)("bearer" /* BEARER */), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", []), - tslib_1.__metadata("design:returntype", Promise) - ], BearerNoUserController.prototype, "test", null); - BearerNoUserController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_USER)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], BearerNoUserController); - app.controller(BearerNoUserController); - await whenIMakeRequestTo(server) - .get('/auth/bearer/no-user') - .set('Authorization', 'Bearer sometoken') - .expect(401); - }); - it('should return error when passRequestCallback is true and provider is not returning user', async () => { - let BearerNoUserFromCallbackController = class BearerNoUserFromCallbackController { - constructor(user) { - this.user = user; - this.options = { - passRequestToCallback: false, - }; - } - async test() { - return this.user; - } - }; - tslib_1.__decorate([ - (0, openapi_v3_1.get)('/auth/bearer/no-user-with-callback'), - (0, decorators_1.authenticate)("bearer" /* BEARER */, { passReqToCallback: true }), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", []), - tslib_1.__metadata("design:returntype", Promise) - ], BearerNoUserFromCallbackController.prototype, "test", null); - BearerNoUserFromCallbackController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_USER)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], BearerNoUserFromCallbackController); - app.controller(BearerNoUserFromCallbackController); - await whenIMakeRequestTo(server) - .get('/auth/bearer/no-user-with-callback') - .set('Authorization', 'Bearer sometoken') - .expect(401); - }); - it('should return error when options are passed with passRequestCallback false and provider does not return user', async () => { - let BearerCallbackFalseController = class BearerCallbackFalseController { - constructor(user) { - this.user = user; - this.options = { - passRequestToCallback: false, - }; - } - async test() { - return this.user; - } - }; - tslib_1.__decorate([ - (0, openapi_v3_1.get)('/auth/bearer/no-user-when-callback-false'), - (0, decorators_1.authenticate)("bearer" /* BEARER */, { passReqToCallback: false }), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", []), - tslib_1.__metadata("design:returntype", Promise) - ], BearerCallbackFalseController.prototype, "test", null); - BearerCallbackFalseController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_USER)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], BearerCallbackFalseController); - app.controller(BearerCallbackFalseController); - await whenIMakeRequestTo(server) - .get('/auth/bearer/no-user-when-callback-false') - .set('Authorization', 'Bearer sometoken') - .expect(401); - }); - function whenIMakeRequestTo(restServer) { - return (0, testlab_1.createClientForHandler)(restServer.requestHandler); - } - async function givenAServer() { - app = (0, helpers_1.getApp)(); - server = await app.getServer(rest_1.RestServer); - } - function getAuthVerifier() { - app - .bind(keys_1.Strategies.Passport.BEARER_TOKEN_VERIFIER) - .toProvider(bearer_passport_provider_1.BearerTokenVerifyProvider); - } - function givenAuthenticatedSequence() { - // bind user defined sequence - server.sequence(authentication_sequence_1.MyAuthenticationSequence); - } -}); -describe('integration test when no provider was implemented', () => { - let app; - let server; - beforeEach(givenAServer); - beforeEach(givenAuthenticatedSequence); - it('should return error as the verifier is not implemented', async () => { - let BearerNoVerifierController = class BearerNoVerifierController { - constructor(user) { - this.user = user; - this.options = { - passRequestToCallback: false, - }; - } - async test() { - return this.user; - } - }; - tslib_1.__decorate([ - (0, openapi_v3_1.get)('/auth/bearer/no-verifier'), - (0, decorators_1.authenticate)("bearer" /* BEARER */, { passReqToCallback: false }), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", []), - tslib_1.__metadata("design:returntype", Promise) - ], BearerNoVerifierController.prototype, "test", null); - BearerNoVerifierController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_USER)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], BearerNoVerifierController); - app.controller(BearerNoVerifierController); - await whenIMakeRequestTo(server) - .get('/auth/bearer/no-verifier') - .set('Authorization', 'Bearer sometoken') - .expect(401); - }); - function whenIMakeRequestTo(restServer) { - return (0, testlab_1.createClientForHandler)(restServer.requestHandler); - } - async function givenAServer() { - app = (0, helpers_1.getApp)(); - server = await app.getServer(rest_1.RestServer); - } - function givenAuthenticatedSequence() { - // bind user defined sequence - server.sequence(authentication_sequence_1.MyAuthenticationSequence); - } -}); -//# sourceMappingURL=bearer-token-verify.integration.js.map \ No newline at end of file diff --git a/dist/__tests__/integration/passport-bearer/bearer-token-verify.integration.js.map b/dist/__tests__/integration/passport-bearer/bearer-token-verify.integration.js.map deleted file mode 100644 index 340c02c..0000000 --- a/dist/__tests__/integration/passport-bearer/bearer-token-verify.integration.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bearer-token-verify.integration.js","sourceRoot":"","sources":["../../../../src/__tests__/integration/passport-bearer/bearer-token-verify.integration.ts"],"names":[],"mappings":";;;AACA,+CAAyE;AACzE,yCAA0C;AAC1C,yCAAmD;AACnD,qDAAyC;AACzC,oDAAiD;AAEjD,gDAA0C;AAC1C,8FAA0F;AAC1F,mDAAoD;AACpD,wCAAqD;AACrD,gGAA4F;AAE5F;;GAEG;AACH,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,IAAI,GAAgB,CAAC;IACrB,IAAI,MAAkB,CAAC;IACvB,UAAU,CAAC,YAAY,CAAC,CAAC;IACzB,UAAU,CAAC,0BAA0B,CAAC,CAAC;IACvC,UAAU,CAAC,eAAe,CAAC,CAAC;IAE5B,EAAE,CAAC,4CAA4C,EAAE,KAAK,IAAI,EAAE;QAC1D,MAAM,uBAAuB;YAG3B,IAAI;gBACF,OAAO,iBAAiB,CAAC;YAC3B,CAAC;SACF;QAHC;YAFC,IAAA,gBAAG,EAAC,uBAAuB,CAAC;YAC5B,IAAA,yBAAY,wBAAiB;;;;2DAG7B;QAGH,GAAG,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;QAExC,MAAM,kBAAkB,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,KAAK,IAAI,EAAE;QAC7D,MAAM,qBAAqB;YAGzB,IAAI;gBACF,OAAO,iBAAiB,CAAC;YAC3B,CAAC;SACF;QAHC;YAFC,IAAA,gBAAG,EAAC,oBAAoB,CAAC;YACzB,IAAA,yBAAY,wBAAiB;;;;yDAG7B;QAGH,GAAG,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;QAEtC,MAAM,kBAAkB,CAAC,MAAM,CAAC;aAC7B,GAAG,CAAC,oBAAoB,CAAC;aACzB,GAAG,CAAC,eAAe,EAAE,mBAAmB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CAAC;IAC5C,CAAC;AACH,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/__tests__/integration/passport-client-password/client-password-verify.integration.d.ts b/dist/__tests__/integration/passport-client-password/client-password-verify.integration.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/__tests__/integration/passport-client-password/client-password-verify.integration.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/__tests__/integration/passport-client-password/client-password-verify.integration.js b/dist/__tests__/integration/passport-client-password/client-password-verify.integration.js deleted file mode 100644 index 3b92f3a..0000000 --- a/dist/__tests__/integration/passport-client-password/client-password-verify.integration.js +++ /dev/null @@ -1,198 +0,0 @@ -"use strict"; -/* eslint-disable @typescript-eslint/naming-convention */ -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -const testlab_1 = require("@loopback/testlab"); -const rest_1 = require("@loopback/rest"); -const core_1 = require("@loopback/core"); -const openapi_v3_1 = require("@loopback/openapi-v3"); -const decorators_1 = require("../../../decorators"); -const helpers_1 = require("../helpers/helpers"); -const authentication_sequence_1 = require("../../fixtures/sequences/authentication.sequence"); -const keys_1 = require("../../../strategies/keys"); -const keys_2 = require("../../../keys"); -const passport_client_provider_1 = require("../../fixtures/providers/passport-client.provider"); -describe('Client-password strategy', () => { - let app; - let server; - beforeEach(givenAServer); - beforeEach(givenAuthenticatedSequence); - beforeEach(getAuthVerifier); - it('should return status 200 when options.passRequestToCallback is set true', async () => { - let TestController = class TestController { - constructor(client) { - this.client = client; - } - test(body) { - return this.client; - } - }; - tslib_1.__decorate([ - (0, decorators_1.authenticateClient)("client-password" /* CLIENT_PASSWORD */, { passReqToCallback: true }), - (0, openapi_v3_1.post)('/test'), - tslib_1.__param(0, (0, openapi_v3_1.requestBody)()), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Object]), - tslib_1.__metadata("design:returntype", void 0) - ], TestController.prototype, "test", null); - TestController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_CLIENT)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], TestController); - app.controller(TestController); - const client = await whenIMakeRequestTo(server) - .post('/test') - .send({ client_id: 'some id', client_secret: 'some secret' }) - .expect(200); - (0, testlab_1.expect)(client.body).to.have.property('clientId'); - (0, testlab_1.expect)(client.body).to.have.property('clientSecret'); - (0, testlab_1.expect)(client.body.clientId).to.equal('some id'); - (0, testlab_1.expect)(client.body.clientSecret).to.equal('some secret'); - }); - it('should return status 200 when options.passRequestToCallback is set false', async () => { - let TestController = class TestController { - constructor(client) { - this.client = client; - } - test(body) { - return this.client; - } - }; - tslib_1.__decorate([ - (0, openapi_v3_1.post)('/test'), - (0, decorators_1.authenticateClient)("client-password" /* CLIENT_PASSWORD */, { passReqToCallback: false }), - tslib_1.__param(0, (0, openapi_v3_1.requestBody)()), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Object]), - tslib_1.__metadata("design:returntype", void 0) - ], TestController.prototype, "test", null); - TestController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_CLIENT)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], TestController); - app.controller(TestController); - const client = await whenIMakeRequestTo(server) - .post('/test') - .send({ client_id: 'some id', client_secret: 'some secret' }) - .expect(200); - (0, testlab_1.expect)(client.body).to.have.property('clientId'); - (0, testlab_1.expect)(client.body).to.have.property('clientSecret'); - (0, testlab_1.expect)(client.body.clientId).to.equal('some id'); - (0, testlab_1.expect)(client.body.clientSecret).to.equal('some secret'); - }); - it('should return status 401 when options.passRequestToCallback is set true', async () => { - let TestController = class TestController { - constructor(client) { - this.client = client; - } - async test(body) { - return this.client; - } - }; - tslib_1.__decorate([ - (0, openapi_v3_1.post)('/test'), - (0, decorators_1.authenticateClient)("client-password" /* CLIENT_PASSWORD */, { passReqToCallback: true }), - tslib_1.__param(0, (0, openapi_v3_1.requestBody)()), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Object]), - tslib_1.__metadata("design:returntype", Promise) - ], TestController.prototype, "test", null); - TestController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_CLIENT)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], TestController); - app.controller(TestController); - await whenIMakeRequestTo(server) - .post('/test') - .send({ client_id: '', client_secret: 'some secret' }) - .expect(401); - }); - it('should return status 401 when options.passRequestToCallback is set false', async () => { - let TestController = class TestController { - constructor(client) { - this.client = client; - } - async test(body) { - return this.client; - } - }; - tslib_1.__decorate([ - (0, openapi_v3_1.post)('/test'), - (0, decorators_1.authenticateClient)("client-password" /* CLIENT_PASSWORD */, { passReqToCallback: false }), - tslib_1.__param(0, (0, openapi_v3_1.requestBody)()), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Object]), - tslib_1.__metadata("design:returntype", Promise) - ], TestController.prototype, "test", null); - TestController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_CLIENT)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], TestController); - app.controller(TestController); - await whenIMakeRequestTo(server) - .post('/test') - .send({ client_id: '', client_secret: 'some secret' }) - .expect(401); - }); - function whenIMakeRequestTo(restServer) { - return (0, testlab_1.createClientForHandler)(restServer.requestHandler); - } - async function givenAServer() { - app = (0, helpers_1.getApp)(); - server = await app.getServer(rest_1.RestServer); - } - function getAuthVerifier() { - app - .bind(keys_1.Strategies.Passport.OAUTH2_CLIENT_PASSWORD_VERIFIER) - .toProvider(passport_client_provider_1.ClientPasswordVerifyProvider); - } - function givenAuthenticatedSequence() { - // bind user defined sequence - server.sequence(authentication_sequence_1.MyAuthenticationSequence); - } -}); -describe('integration test for client-password and no verifier', () => { - let app; - let server; - beforeEach(givenAServer); - beforeEach(givenAuthenticatedSequence); - it('should return status 401 as this strategy is not implemented', async () => { - let TestController = class TestController { - constructor(client) { - this.client = client; - } - test(body) { - return this.client; - } - }; - tslib_1.__decorate([ - (0, openapi_v3_1.post)('/test'), - (0, decorators_1.authenticateClient)("client-password" /* CLIENT_PASSWORD */, { passReqToCallback: true }), - tslib_1.__param(0, (0, openapi_v3_1.requestBody)()), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Object]), - tslib_1.__metadata("design:returntype", void 0) - ], TestController.prototype, "test", null); - TestController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_CLIENT)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], TestController); - app.controller(TestController); - await whenIMakeRequestTo(server) - .post('/test') - .send({ client_id: 'some id', client_secret: 'some secret' }) - .expect(401); - }); - function whenIMakeRequestTo(restServer) { - return (0, testlab_1.createClientForHandler)(restServer.requestHandler); - } - async function givenAServer() { - app = (0, helpers_1.getApp)(); - server = await app.getServer(rest_1.RestServer); - } - function givenAuthenticatedSequence() { - // bind user defined sequence - server.sequence(authentication_sequence_1.MyAuthenticationSequence); - } -}); -//# sourceMappingURL=client-password-verify.integration.js.map \ No newline at end of file diff --git a/dist/__tests__/integration/passport-client-password/client-password-verify.integration.js.map b/dist/__tests__/integration/passport-client-password/client-password-verify.integration.js.map deleted file mode 100644 index ce483e8..0000000 --- a/dist/__tests__/integration/passport-client-password/client-password-verify.integration.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"client-password-verify.integration.js","sourceRoot":"","sources":["../../../../src/__tests__/integration/passport-client-password/client-password-verify.integration.ts"],"names":[],"mappings":";AAAA,0DAA0D;;;AAG1D,+CAAyE;AACzE,yCAA0C;AAC1C,yCAAmD;AACnD,qDAAuD;AACvD,oDAAuD;AAEvD,gDAA0C;AAC1C,8FAA0F;AAC1F,mDAAoD;AACpD,wCAAqD;AACrD,gGAA+F;AAE/F,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,IAAI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,CAAyB;YAC/C,CAAC;YAIJ,IAAI,CAEF,IAGC;gBAED,OAAO,IAAI,CAAC,MAAM,CAAC;YACrB,CAAC;SACF,CAAA;QATC;YAFC,IAAA,iBAAI,EAAC,OAAO,CAAC;YACb,IAAA,+BAAkB,2CAA2B,EAAC,iBAAiB,EAAE,IAAI,EAAC,CAAC;YAErE,mBAAA,IAAA,wBAAW,GAAE,CAAA;;;;kDAOf;QAhBG,cAAc;YAEf,mBAAA,IAAA,aAAM,EAAC,6BAAsB,CAAC,cAAc,CAAC,CAAA;;WAF5C,cAAc,CAiBnB;QAED,GAAG,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;QAE/B,MAAM,kBAAkB,CAAC,MAAM,CAAC;aAC7B,IAAI,CAAC,OAAO,CAAC;aACb,IAAI,CAAC,EAAC,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAC,CAAC;aAC1D,MAAM,CAAC,GAAG,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,SAAS,kBAAkB,CAAC,UAAsB;QAChD,OAAO,IAAA,gCAAsB,EAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,UAAU,YAAY;QACzB,GAAG,GAAG,IAAA,gBAAM,GAAE,CAAC;QACf,MAAM,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,iBAAU,CAAC,CAAC;IAC3C,CAAC;IAED,SAAS,0BAA0B;QACjC,6BAA6B;QAC7B,MAAM,CAAC,QAAQ,CAAC,kDAAwB,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/__tests__/integration/passport-google-oauth2/google-oauth2.integration.d.ts b/dist/__tests__/integration/passport-google-oauth2/google-oauth2.integration.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/__tests__/integration/passport-google-oauth2/google-oauth2.integration.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/__tests__/integration/passport-google-oauth2/google-oauth2.integration.js b/dist/__tests__/integration/passport-google-oauth2/google-oauth2.integration.js deleted file mode 100644 index 089bb61..0000000 --- a/dist/__tests__/integration/passport-google-oauth2/google-oauth2.integration.js +++ /dev/null @@ -1,63 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -const testlab_1 = require("@loopback/testlab"); -const rest_1 = require("@loopback/rest"); -const openapi_v3_1 = require("@loopback/openapi-v3"); -const decorators_1 = require("../../../decorators"); -const helpers_1 = require("../helpers/helpers"); -const authentication_sequence_1 = require("../../fixtures/sequences/authentication.sequence"); -const keys_1 = require("../../../strategies/keys"); -const bearer_data_1 = require("../../fixtures/data/bearer-data"); -describe('getting google oauth2 strategy with options', () => { - let app; - let server; - beforeEach(givenAServer); - beforeEach(givenAuthenticatedSequence); - beforeEach(getAuthVerifier); - it('should return 200 when client id is passed and passReqToCallback is set true', async () => { - class TestController { - test() { - return 'test successful'; - } - } - tslib_1.__decorate([ - (0, openapi_v3_1.get)('/test'), - (0, decorators_1.authenticate)("Google Oauth 2.0" /* GOOGLE_OAUTH2 */, { - clientID: 'string', - clientSecret: 'string', - passReqToCallback: true, - }), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", []), - tslib_1.__metadata("design:returntype", void 0) - ], TestController.prototype, "test", null); - app.controller(TestController); - await whenIMakeRequestTo(server).get('/test').expect(200); - }); - function whenIMakeRequestTo(restServer) { - return (0, testlab_1.createClientForHandler)(restServer.requestHandler); - } - async function givenAServer() { - app = (0, helpers_1.getApp)(); - server = await app.getServer(rest_1.RestServer); - } - function getAuthVerifier() { - app - .bind(keys_1.Strategies.Passport.GOOGLE_OAUTH2_VERIFIER) - .toProvider(GoogleAuthVerifyProvider); - } - function givenAuthenticatedSequence() { - // bind user defined sequence - server.sequence(authentication_sequence_1.MyAuthenticationSequence); - } -}); -class GoogleAuthVerifyProvider { - constructor() { } - value() { - return async (accessToken, refreshToken, profile, cd, req) => { - return bearer_data_1.userWithoutReqObj; - }; - } -} -//# sourceMappingURL=google-oauth2.integration.js.map \ No newline at end of file diff --git a/dist/__tests__/integration/passport-google-oauth2/google-oauth2.integration.js.map b/dist/__tests__/integration/passport-google-oauth2/google-oauth2.integration.js.map deleted file mode 100644 index b0c9553..0000000 --- a/dist/__tests__/integration/passport-google-oauth2/google-oauth2.integration.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"google-oauth2.integration.js","sourceRoot":"","sources":["../../../../src/__tests__/integration/passport-google-oauth2/google-oauth2.integration.ts"],"names":[],"mappings":";;;AAAA,+CAAiE;AACjE,yCAA0C;AAE1C,qDAAyC;AACzC,oDAAiD;AAEjD,gDAA0C;AAC1C,8FAA0F;AAC1F,mDAAoD;AAEpD,iEAAkE;AAIlE,QAAQ,CAAC,6CAA6C,EAAE,GAAG,EAAE;IAC3D,IAAI,GAAgB,CAAC;IACrB,IAAI,MAAkB,CAAC;IACvB,UAAU,CAAC,YAAY,CAAC,CAAC;IACzB,UAAU,CAAC,0BAA0B,CAAC,CAAC;IACvC,UAAU,CAAC,eAAe,CAAC,CAAC;IAE5B,EAAE,CAAC,8EAA8E,EAAE,KAAK,IAAI,EAAE;QAC5F,MAAM,cAAc;YAOlB,IAAI;gBACF,OAAO,iBAAiB,CAAC;YAC3B,CAAC;SACF;QAHC;YANC,IAAA,gBAAG,EAAC,OAAO,CAAC;YACZ,IAAA,yBAAY,0CAAyB;gBACpC,QAAQ,EAAE,QAAQ;gBAClB,YAAY,EAAE,QAAQ;gBACtB,iBAAiB,EAAE,IAAI;aACxB,CAAC;;;;kDAGD;QAGH,GAAG,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;QAE/B,MAAM,kBAAkB,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,SAAS,kBAAkB,CAAC,UAAsB;QAChD,OAAO,IAAA,gCAAsB,EAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,UAAU,YAAY;QACzB,GAAG,GAAG,IAAA,gBAAM,GAAE,CAAC;QACf,MAAM,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,iBAAU,CAAC,CAAC;IAC3C,CAAC;IAED,SAAS,eAAe;QACtB,GAAG;aACA,IAAI,CAAC,iBAAU,CAAC,QAAQ,CAAC,sBAAsB,CAAC;aAChD,UAAU,CAAC,wBAAwB,CAAC,CAAC;IAC1C,CAAC;IAED,SAAS,0BAA0B;QACjC,6BAA6B;QAC7B,MAAM,CAAC,QAAQ,CAAC,kDAAwB,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,MAAM,wBAAwB;IAG5B,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EACV,WAAmB,EACnB,YAAoB,EACpB,OAA+B,EAC/B,EAAiC,EACjC,GAAa,EACb,EAAE;YACF,OAAO,+BAAiB,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/dist/__tests__/integration/passport-instagram-oauth2/instagram-oauth2.integration.d.ts b/dist/__tests__/integration/passport-instagram-oauth2/instagram-oauth2.integration.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/__tests__/integration/passport-instagram-oauth2/instagram-oauth2.integration.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/__tests__/integration/passport-instagram-oauth2/instagram-oauth2.integration.js b/dist/__tests__/integration/passport-instagram-oauth2/instagram-oauth2.integration.js deleted file mode 100644 index d9d136c..0000000 --- a/dist/__tests__/integration/passport-instagram-oauth2/instagram-oauth2.integration.js +++ /dev/null @@ -1,63 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -const testlab_1 = require("@loopback/testlab"); -const rest_1 = require("@loopback/rest"); -const openapi_v3_1 = require("@loopback/openapi-v3"); -const decorators_1 = require("../../../decorators"); -const helpers_1 = require("../helpers/helpers"); -const authentication_sequence_1 = require("../../fixtures/sequences/authentication.sequence"); -const keys_1 = require("../../../strategies/keys"); -const bearer_data_1 = require("../../fixtures/data/bearer-data"); -describe('getting instagram oauth2 strategy with options', () => { - let app; - let server; - beforeEach(givenAServer); - beforeEach(givenAuthenticatedSequence); - beforeEach(getAuthVerifier); - it('should return 200 when client id is passed and passReqToCallback is set true', async () => { - class TestController { - test() { - return 'test successful'; - } - } - tslib_1.__decorate([ - (0, openapi_v3_1.get)('/test'), - (0, decorators_1.authenticate)("Instagram Oauth 2.0" /* INSTAGRAM_OAUTH2 */, { - clientID: 'string', - clientSecret: 'string', - passReqToCallback: true, - }), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", []), - tslib_1.__metadata("design:returntype", void 0) - ], TestController.prototype, "test", null); - app.controller(TestController); - await whenIMakeRequestTo(server).get('/test').expect(200); - }); - function whenIMakeRequestTo(restServer) { - return (0, testlab_1.createClientForHandler)(restServer.requestHandler); - } - async function givenAServer() { - app = (0, helpers_1.getApp)(); - server = await app.getServer(rest_1.RestServer); - } - function getAuthVerifier() { - app - .bind(keys_1.Strategies.Passport.INSTAGRAM_OAUTH2_VERIFIER) - .toProvider(InstagramAuthVerifyProvider); - } - function givenAuthenticatedSequence() { - // bind user defined sequence - server.sequence(authentication_sequence_1.MyAuthenticationSequence); - } -}); -class InstagramAuthVerifyProvider { - constructor() { } - value() { - return async (accessToken, refreshToken, profile, cd, req) => { - return bearer_data_1.userWithoutReqObj; - }; - } -} -//# sourceMappingURL=instagram-oauth2.integration.js.map \ No newline at end of file diff --git a/dist/__tests__/integration/passport-instagram-oauth2/instagram-oauth2.integration.js.map b/dist/__tests__/integration/passport-instagram-oauth2/instagram-oauth2.integration.js.map deleted file mode 100644 index aafd336..0000000 --- a/dist/__tests__/integration/passport-instagram-oauth2/instagram-oauth2.integration.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"instagram-oauth2.integration.js","sourceRoot":"","sources":["../../../../src/__tests__/integration/passport-instagram-oauth2/instagram-oauth2.integration.ts"],"names":[],"mappings":";;;AAAA,+CAAiE;AACjE,yCAA0C;AAE1C,qDAAyC;AACzC,oDAAiD;AAEjD,gDAA0C;AAC1C,8FAA0F;AAC1F,mDAAoD;AAEpD,iEAAkE;AAIlE,QAAQ,CAAC,gDAAgD,EAAE,GAAG,EAAE;IAC9D,IAAI,GAAgB,CAAC;IACrB,IAAI,MAAkB,CAAC;IACvB,UAAU,CAAC,YAAY,CAAC,CAAC;IACzB,UAAU,CAAC,0BAA0B,CAAC,CAAC;IACvC,UAAU,CAAC,eAAe,CAAC,CAAC;IAE5B,EAAE,CAAC,8EAA8E,EAAE,KAAK,IAAI,EAAE;QAC5F,MAAM,cAAc;YAOlB,IAAI;gBACF,OAAO,iBAAiB,CAAC;YAC3B,CAAC;SACF;QAHC;YANC,IAAA,gBAAG,EAAC,OAAO,CAAC;YACZ,IAAA,yBAAY,gDAA4B;gBACvC,QAAQ,EAAE,QAAQ;gBAClB,YAAY,EAAE,QAAQ;gBACtB,iBAAiB,EAAE,IAAI;aACxB,CAAC;;;;kDAGD;QAGH,GAAG,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;QAE/B,MAAM,kBAAkB,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,SAAS,kBAAkB,CAAC,UAAsB;QAChD,OAAO,IAAA,gCAAsB,EAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,UAAU,YAAY;QACzB,GAAG,GAAG,IAAA,gBAAM,GAAE,CAAC;QACf,MAAM,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,iBAAU,CAAC,CAAC;IAC3C,CAAC;IAED,SAAS,eAAe;QACtB,GAAG;aACA,IAAI,CAAC,iBAAU,CAAC,QAAQ,CAAC,yBAAyB,CAAC;aACnD,UAAU,CAAC,2BAA2B,CAAC,CAAC;IAC7C,CAAC;IAED,SAAS,0BAA0B;QACjC,6BAA6B;QAC7B,MAAM,CAAC,QAAQ,CAAC,kDAAwB,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,MAAM,2BAA2B;IAG/B,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EACV,WAAmB,EACnB,YAAoB,EACpB,OAAkC,EAClC,EAAkB,EAClB,GAAa,EACb,EAAE;YACF,OAAO,+BAAiB,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/dist/__tests__/integration/passport-keycloak/keycloak.integration.d.ts b/dist/__tests__/integration/passport-keycloak/keycloak.integration.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/__tests__/integration/passport-keycloak/keycloak.integration.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/__tests__/integration/passport-keycloak/keycloak.integration.js b/dist/__tests__/integration/passport-keycloak/keycloak.integration.js deleted file mode 100644 index 2cdb9c3..0000000 --- a/dist/__tests__/integration/passport-keycloak/keycloak.integration.js +++ /dev/null @@ -1,69 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -const testlab_1 = require("@loopback/testlab"); -const rest_1 = require("@loopback/rest"); -const openapi_v3_1 = require("@loopback/openapi-v3"); -const decorators_1 = require("../../../decorators"); -const helpers_1 = require("../helpers/helpers"); -const authentication_sequence_1 = require("../../fixtures/sequences/authentication.sequence"); -const keys_1 = require("../../../strategies/keys"); -const bearer_data_1 = require("../../fixtures/data/bearer-data"); -describe('getting keycloak oauth2 strategy with options', () => { - let app; - let server; - beforeEach(givenAServer); - beforeEach(givenAuthenticatedSequence); - beforeEach(getAuthVerifier); - it('should return 200 when host and client id is passed and passReqToCallback is set true', async () => { - class TestController { - test() { - return 'test successful'; - } - } - tslib_1.__decorate([ - (0, openapi_v3_1.get)('/test'), - (0, decorators_1.authenticate)("keycloak" /* KEYCLOAK */, { - host: 'localhost', - realm: 'localhost', - callbackURL: 'localhost', - authorizationURL: 'localhost', - tokenURL: 'localhost', - userInfoURL: 'localhost', - clientID: 'string', - clientSecret: 'string', - passReqToCallback: true, - }), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", []), - tslib_1.__metadata("design:returntype", void 0) - ], TestController.prototype, "test", null); - app.controller(TestController); - await whenIMakeRequestTo(server).get('/test').expect(200); - }); - function whenIMakeRequestTo(restServer) { - return (0, testlab_1.createClientForHandler)(restServer.requestHandler); - } - async function givenAServer() { - app = (0, helpers_1.getApp)(); - server = await app.getServer(rest_1.RestServer); - } - function getAuthVerifier() { - app - .bind(keys_1.Strategies.Passport.KEYCLOAK_VERIFIER) - .toProvider(KeycloakAuthVerifyProvider); - } - function givenAuthenticatedSequence() { - // bind user defined sequence - server.sequence(authentication_sequence_1.MyAuthenticationSequence); - } -}); -class KeycloakAuthVerifyProvider { - constructor() { } - value() { - return async (accessToken, refreshToken, profile, cd, req) => { - return bearer_data_1.userWithoutReqObj; - }; - } -} -//# sourceMappingURL=keycloak.integration.js.map \ No newline at end of file diff --git a/dist/__tests__/integration/passport-keycloak/keycloak.integration.js.map b/dist/__tests__/integration/passport-keycloak/keycloak.integration.js.map deleted file mode 100644 index 759eb23..0000000 --- a/dist/__tests__/integration/passport-keycloak/keycloak.integration.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keycloak.integration.js","sourceRoot":"","sources":["../../../../src/__tests__/integration/passport-keycloak/keycloak.integration.ts"],"names":[],"mappings":";;;AAAA,+CAAiE;AACjE,yCAA0C;AAE1C,qDAAyC;AACzC,oDAAiD;AAEjD,gDAA0C;AAC1C,8FAA0F;AAC1F,mDAAoD;AAEpD,iEAAkE;AAIlE,QAAQ,CAAC,+CAA+C,EAAE,GAAG,EAAE;IAC7D,IA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,CAAC,QAAQ,CAAC,kDAAwB,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,MAAM,0BAA0B;IAG9B,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EACV,WAAmB,EACnB,YAAoB,EACpB,OAAyB,EACzB,EAAoD,EACpD,GAAa,EACb,EAAE;YACF,OAAO,+BAAiB,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/dist/__tests__/integration/passport-local/local-passport.integration.d.ts b/dist/__tests__/integration/passport-local/local-passport.integration.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/__tests__/integration/passport-local/local-passport.integration.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/__tests__/integration/passport-local/local-passport.integration.js b/dist/__tests__/integration/passport-local/local-passport.integration.js deleted file mode 100644 index 2627b19..0000000 --- a/dist/__tests__/integration/passport-local/local-passport.integration.js +++ /dev/null @@ -1,238 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -const testlab_1 = require("@loopback/testlab"); -const rest_1 = require("@loopback/rest"); -const core_1 = require("@loopback/core"); -const openapi_v3_1 = require("@loopback/openapi-v3"); -const decorators_1 = require("../../../decorators"); -const helpers_1 = require("../helpers/helpers"); -const authentication_sequence_1 = require("../../fixtures/sequences/authentication.sequence"); -const keys_1 = require("../../../strategies/keys"); -const local_password_provider_1 = require("../../fixtures/providers/local-password.provider"); -const keys_2 = require("../../../keys"); -const models_1 = require("../../../models"); -/** - * Testing overall flow of authentication with bearer strategy - */ -describe('Local passport strategy', () => { - let app; - let server; - beforeEach(givenAServer); - beforeEach(givenAuthenticatedSequence); - beforeEach(getAuthVerifier); - it('should return 400 bad request when no user data is passed', async () => { - class TestController { - test(body) { - return 'test successful'; - } - } - tslib_1.__decorate([ - (0, openapi_v3_1.post)('/auth/local/no-user-data-passed'), - (0, decorators_1.authenticate)("local" /* LOCAL */), - tslib_1.__param(0, (0, openapi_v3_1.requestBody)({ required: true })), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [models_1.Authuser]), - tslib_1.__metadata("design:returntype", void 0) - ], TestController.prototype, "test", null); - app.controller(TestController); - await whenIMakeRequestTo(server) - .post('/auth/local/no-user-data-passed') - .expect(400); - }); - it('should return 422 bad request when invalid user data is passed', async () => { - class TestController { - test(body) { - return 'test successful'; - } - } - tslib_1.__decorate([ - (0, openapi_v3_1.post)('/auth/local/no-user-data-passed'), - (0, decorators_1.authenticate)("local" /* LOCAL */), - tslib_1.__param(0, (0, openapi_v3_1.requestBody)()), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [models_1.Authuser]), - tslib_1.__metadata("design:returntype", void 0) - ], TestController.prototype, "test", null); - app.controller(TestController); - await whenIMakeRequestTo(server) - .post('/auth/local/no-user-data-passed') - .send({}) - .expect(422); - }); - it('should return status 200 for no options', async () => { - let TestController = class TestController { - constructor(user) { - this.user = user; - } - test(body) { - return this.user; - } - }; - tslib_1.__decorate([ - (0, openapi_v3_1.post)('/auth/local/no-options'), - (0, decorators_1.authenticate)("local" /* LOCAL */), - tslib_1.__param(0, (0, openapi_v3_1.requestBody)()), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Object]), - tslib_1.__metadata("design:returntype", void 0) - ], TestController.prototype, "test", null); - TestController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_USER)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], TestController); - app.controller(TestController); - const user = await whenIMakeRequestTo(server) - .post('/auth/local/no-options') - .send({ username: 'user name', password: 'password' }) - .expect(200); - (0, testlab_1.expect)(user.body).to.have.property('username'); - (0, testlab_1.expect)(user.body.username).to.equal('user name'); - (0, testlab_1.expect)(user.body).to.have.property('password'); - (0, testlab_1.expect)(user.body.password).to.equal('password'); - }); - it('should return the user credentials are sent via body and options are passed with passRequestCallback true', async () => { - let TestController = class TestController { - constructor(user) { - this.user = user; - } - async test(body) { - return this.user; - } - }; - tslib_1.__decorate([ - (0, openapi_v3_1.post)('/auth/local/pass-req-callback-true'), - (0, decorators_1.authenticate)("local" /* LOCAL */, { passReqToCallback: true }), - tslib_1.__param(0, (0, openapi_v3_1.requestBody)()), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Object]), - tslib_1.__metadata("design:returntype", Promise) - ], TestController.prototype, "test", null); - TestController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_USER)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], TestController); - app.controller(TestController); - const user = await whenIMakeRequestTo(server) - .post('/auth/local/pass-req-callback-true') - .send({ username: 'name', password: 'password' }) - .expect(200); - (0, testlab_1.expect)(user.body).to.have.property('username'); - (0, testlab_1.expect)(user.body.username).to.equal('name'); - (0, testlab_1.expect)(user.body).to.have.property('password'); - (0, testlab_1.expect)(user.body.password).to.equal('password'); - }); - it('should return the user which was passed via body and options are passed with passRequestCallback false', async () => { - let TestController = class TestController { - constructor(user) { - this.user = user; - } - async test(body) { - return this.user; - } - }; - tslib_1.__decorate([ - (0, openapi_v3_1.post)('/auth/local/pass-req-callback-false'), - (0, decorators_1.authenticate)("local" /* LOCAL */, { passReqToCallback: false }), - tslib_1.__param(0, (0, openapi_v3_1.requestBody)()), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Object]), - tslib_1.__metadata("design:returntype", Promise) - ], TestController.prototype, "test", null); - TestController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_USER)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], TestController); - app.controller(TestController); - await whenIMakeRequestTo(server) - .post('/auth/local/pass-req-callback-false') - .send({ username: 'username', password: 'password' }) - .expect(200); - }); - it('should return 401 when provider returns null', async () => { - let TestController = class TestController { - constructor(user) { - this.user = user; - } - async test(body) { - return body; - } - }; - tslib_1.__decorate([ - (0, openapi_v3_1.post)('/auth/local/null-user'), - (0, decorators_1.authenticate)("local" /* LOCAL */), - tslib_1.__param(0, (0, openapi_v3_1.requestBody)()), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Object]), - tslib_1.__metadata("design:returntype", Promise) - ], TestController.prototype, "test", null); - TestController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_USER)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], TestController); - app.controller(TestController); - await whenIMakeRequestTo(server) - .post('/auth/local/null-user') - .send({ username: '', password: 'password' }) - .expect(401); - }); - function whenIMakeRequestTo(restServer) { - return (0, testlab_1.createClientForHandler)(restServer.requestHandler); - } - async function givenAServer() { - app = (0, helpers_1.getApp)(); - server = await app.getServer(rest_1.RestServer); - } - function getAuthVerifier() { - app - .bind(keys_1.Strategies.Passport.LOCAL_PASSWORD_VERIFIER) - .toProvider(local_password_provider_1.LocalVerifyProvider); - } - function givenAuthenticatedSequence() { - // bind user defined sequence - server.sequence(authentication_sequence_1.MyAuthenticationSequence); - } -}); -describe('Local strategy with no verifier', () => { - let app; - let server; - beforeEach(givenAServer); - beforeEach(givenAuthenticatedSequence); - it('should return 401 when option passRequestCallback is false', async () => { - class TestController { - constructor() { - this.options = { - passRequestToCallback: false, - }; - } - async test(body) { - return body; - } - } - tslib_1.__decorate([ - (0, openapi_v3_1.post)('/auth/local/no-verifier'), - (0, decorators_1.authenticate)("local" /* LOCAL */, { passReqToCallback: false }), - tslib_1.__param(0, (0, openapi_v3_1.requestBody)()), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Object]), - tslib_1.__metadata("design:returntype", Promise) - ], TestController.prototype, "test", null); - app.controller(TestController); - await whenIMakeRequestTo(server) - .post('/auth/local/no-verifier') - .send({ username: 'username', password: 'password' }) - .expect(401); - }); - function whenIMakeRequestTo(restServer) { - return (0, testlab_1.createClientForHandler)(restServer.requestHandler); - } - async function givenAServer() { - app = (0, helpers_1.getApp)(); - server = await app.getServer(rest_1.RestServer); - } - function givenAuthenticatedSequence() { - // bind user defined sequence - server.sequence(authentication_sequence_1.MyAuthenticationSequence); - } -}); -//# sourceMappingURL=local-passport.integration.js.map \ No newline at end of file diff --git a/dist/__tests__/integration/passport-local/local-passport.integration.js.map b/dist/__tests__/integration/passport-local/local-passport.integration.js.map deleted file mode 100644 index 525acdc..0000000 --- a/dist/__tests__/integration/passport-local/local-passport.integration.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"local-passport.integration.js","sourceRoot":"","sources":["../../../../src/__tests__/integration/passport-local/local-passport.integration.ts"],"names":[],"mappings":";;;AAAA,+CAAyE;AACzE,yCAA0C;AAC1C,yCAAmD;AACnD,qDAAuD;AACvD,oDAAiD;AAEjD,gDAA0C;AAC1C,8FAA0F;AAC1F,mDAAoD;AACpD,8FAAqF;AACrF,wCAAqD;AAErD,4CAAyC;AACzC;;GAEG;AACH,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,IAAI,GAAgB,CAAC;IACrB,IAAI,MAAkB,CAAC;IACvB,UAAU,CAAC,YAAY,CAAC,CAAC;IACzB,UAAU,CAAC,0BAA0B,CAAC,CAAC;IACvC,UAAU,CAAC,eAAe,CAAC,CAAC;IAE5B,EAAE,CAAC,2DAA2D,EAAE,KAAK,IAAI,EAAE;QACzE,MAAM,cAAc;YAGlB,IAAI,CAAgC,IAAc;gBAChD,OAAO,iBAAiB,CAAC;YAC3B,CAAC;SACF;QAHC;YAFC,IAAA,iBAAI,EAAC,iCAAiC,CAAC;YACvC,IAAA,yBAAY,sBAAgB;YACvB,mBAAA,IAAA,wBAAW,EAAC,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAA;;qDAAO,iBAAQ;;kDAEjD;QAGH,GAAG,CAAC,UAAU,CAAC,cAAc,CAAC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C,CAAC;IAED,SAAS,0BAA0B;QACjC,6BAA6B;QAC7B,MAAM,CAAC,QAAQ,CAAC,kDAAwB,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/__tests__/integration/passport-resource-owner-password/resource-owner-password.integration.d.ts b/dist/__tests__/integration/passport-resource-owner-password/resource-owner-password.integration.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/__tests__/integration/passport-resource-owner-password/resource-owner-password.integration.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/__tests__/integration/passport-resource-owner-password/resource-owner-password.integration.js b/dist/__tests__/integration/passport-resource-owner-password/resource-owner-password.integration.js deleted file mode 100644 index 76401a0..0000000 --- a/dist/__tests__/integration/passport-resource-owner-password/resource-owner-password.integration.js +++ /dev/null @@ -1,242 +0,0 @@ -"use strict"; -/* eslint-disable @typescript-eslint/naming-convention */ -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -const testlab_1 = require("@loopback/testlab"); -const rest_1 = require("@loopback/rest"); -const core_1 = require("@loopback/core"); -const openapi_v3_1 = require("@loopback/openapi-v3"); -const decorators_1 = require("../../../decorators"); -const helpers_1 = require("../helpers/helpers"); -const authentication_sequence_1 = require("../../fixtures/sequences/authentication.sequence"); -const keys_1 = require("../../../strategies/keys"); -const resource_owner_provider_1 = require("../../fixtures/providers/resource-owner.provider"); -const keys_2 = require("../../../keys"); -describe('Resource-owner-password strategy', () => { - let app; - let server; - beforeEach(givenAServer); - beforeEach(givenAuthenticatedSequence); - beforeEach(getAuthVerifier); - it('should return 422 bad request when no user data is sent', async () => { - class TestController { - test(body) { - return 'test successful'; - } - } - tslib_1.__decorate([ - (0, openapi_v3_1.post)('/auth/resource-owner-pass'), - (0, decorators_1.authenticate)("OAuth2 resource owner grant" /* OAUTH2_RESOURCE_OWNER_GRANT */), - tslib_1.__param(0, (0, openapi_v3_1.requestBody)()), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Object]), - tslib_1.__metadata("design:returntype", void 0) - ], TestController.prototype, "test", null); - app.controller(TestController); - await whenIMakeRequestTo(server) - .post('/auth/resource-owner-pass') - .send({}) - .expect(401); - }); - it('should return status 200 for no options', async () => { - let TestController = class TestController { - constructor(user) { - this.user = user; - } - test(body) { - return this.user; - } - }; - tslib_1.__decorate([ - (0, openapi_v3_1.post)('/auth/resource-owner-pass/no-options'), - (0, decorators_1.authenticate)("OAuth2 resource owner grant" /* OAUTH2_RESOURCE_OWNER_GRANT */), - tslib_1.__param(0, (0, openapi_v3_1.requestBody)()), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Object]), - tslib_1.__metadata("design:returntype", void 0) - ], TestController.prototype, "test", null); - TestController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_USER)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], TestController); - app.controller(TestController); - const res = await whenIMakeRequestTo(server) - .post('/auth/resource-owner-pass/no-options') - .send({ - username: 'username', - password: 'password', - client_id: 'client id', - client_secret: 'client secret', - }) - .expect(200); - (0, testlab_1.expect)(res.body).to.have.property('username'); - (0, testlab_1.expect)(res.body.username).to.equal('username'); - (0, testlab_1.expect)(res.body).to.have.property('password'); - (0, testlab_1.expect)(res.body.password).to.equal('password'); - }); - it('should return the user credentials are sent via body and options are passed with passRequestCallback true', async () => { - let TestController = class TestController { - constructor(user) { - this.user = user; - } - async test(body) { - return this.user; - } - }; - tslib_1.__decorate([ - (0, openapi_v3_1.post)('/auth/resource-owner/passReqToCallback'), - (0, decorators_1.authenticate)("OAuth2 resource owner grant" /* OAUTH2_RESOURCE_OWNER_GRANT */, { - passReqToCallback: true, - }), - tslib_1.__param(0, (0, openapi_v3_1.requestBody)()), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Object]), - tslib_1.__metadata("design:returntype", Promise) - ], TestController.prototype, "test", null); - TestController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_USER)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], TestController); - app.controller(TestController); - const res = await whenIMakeRequestTo(server) - .post('/auth/resource-owner/passReqToCallback') - .send({ - username: 'user name', - password: 'password', - client_id: 'client id', - client_secret: 'client secret', - }) - .expect(200); - (0, testlab_1.expect)(res.body).to.have.property('username'); - (0, testlab_1.expect)(res.body.username).to.equal('user name'); - (0, testlab_1.expect)(res.body).to.have.property('password'); - (0, testlab_1.expect)(res.body.password).to.equal('password'); - }); - it('should return the user which was passed via body and options are passed with passRequestCallback false', async () => { - let TestController = class TestController { - constructor(user) { - this.user = user; - } - async test(body) { - return this.user; - } - }; - tslib_1.__decorate([ - (0, openapi_v3_1.post)('/auth/resource-owner/passReqToCallback-false'), - (0, decorators_1.authenticate)("OAuth2 resource owner grant" /* OAUTH2_RESOURCE_OWNER_GRANT */, { - passReqToCallback: false, - }), - tslib_1.__param(0, (0, openapi_v3_1.requestBody)()), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Object]), - tslib_1.__metadata("design:returntype", Promise) - ], TestController.prototype, "test", null); - TestController = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_2.AuthenticationBindings.CURRENT_USER)), - tslib_1.__metadata("design:paramtypes", [Object]) - ], TestController); - app.controller(TestController); - const res = await whenIMakeRequestTo(server) - .post('/auth/resource-owner/passReqToCallback-false') - .send({ - username: 'name', - password: 'password', - client_id: 'client id', - client_secret: 'client secret', - }) - .expect(200); - (0, testlab_1.expect)(res.body).to.have.property('username'); - (0, testlab_1.expect)(res.body.username).to.equal('name'); - (0, testlab_1.expect)(res.body).to.have.property('password'); - (0, testlab_1.expect)(res.body.password).to.equal('password'); - }); - it('should return the user passed via verifier when no options are passed', async () => { - class TestController { - async test(body) { - return body; - } - } - tslib_1.__decorate([ - (0, openapi_v3_1.post)('/test'), - (0, decorators_1.authenticate)("OAuth2 resource owner grant" /* OAUTH2_RESOURCE_OWNER_GRANT */), - tslib_1.__param(0, (0, openapi_v3_1.requestBody)()), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Object]), - tslib_1.__metadata("design:returntype", Promise) - ], TestController.prototype, "test", null); - app.controller(TestController); - await whenIMakeRequestTo(server) - .post('/test') - .send({ - username: '', - password: 'password', - client_id: '', - client_secret: 'client secret', - }) - .expect(401); - }); - function whenIMakeRequestTo(restServer) { - return (0, testlab_1.createClientForHandler)(restServer.requestHandler); - } - async function givenAServer() { - app = (0, helpers_1.getApp)(); - server = await app.getServer(rest_1.RestServer); - } - function getAuthVerifier() { - app - .bind(keys_1.Strategies.Passport.RESOURCE_OWNER_PASSWORD_VERIFIER) - .toProvider(resource_owner_provider_1.ResourceOwnerVerifyProvider); - } - function givenAuthenticatedSequence() { - // bind user defined sequence - server.sequence(authentication_sequence_1.MyAuthenticationSequence); - } -}); -describe('Resource-owner strategy with no verifier', () => { - let app; - let server; - beforeEach(givenAServer); - beforeEach(givenAuthenticatedSequence); - it('should return the user passed via verifier and options are passed with passRequestCallback false', async () => { - class TestController { - constructor() { - this.options = { - passRequestToCallback: false, - }; - } - async test(body) { - return body; - } - } - tslib_1.__decorate([ - (0, openapi_v3_1.post)('/test'), - (0, decorators_1.authenticate)("OAuth2 resource owner grant" /* OAUTH2_RESOURCE_OWNER_GRANT */), - tslib_1.__param(0, (0, openapi_v3_1.requestBody)()), - tslib_1.__metadata("design:type", Function), - tslib_1.__metadata("design:paramtypes", [Object]), - tslib_1.__metadata("design:returntype", Promise) - ], TestController.prototype, "test", null); - app.controller(TestController); - await whenIMakeRequestTo(server) - .post('/test') - .send({ - username: 'username', - password: 'password', - client_id: 'client id', - client_secret: 'client secret', - }) - .expect(401); - }); - function whenIMakeRequestTo(restServer) { - return (0, testlab_1.createClientForHandler)(restServer.requestHandler); - } - async function givenAServer() { - app = (0, helpers_1.getApp)(); - server = await app.getServer(rest_1.RestServer); - } - function givenAuthenticatedSequence() { - // bind user defined sequence - server.sequence(authentication_sequence_1.MyAuthenticationSequence); - } -}); -//# sourceMappingURL=resource-owner-password.integration.js.map \ No newline at end of file diff --git a/dist/__tests__/integration/passport-resource-owner-password/resource-owner-password.integration.js.map b/dist/__tests__/integration/passport-resource-owner-password/resource-owner-password.integration.js.map deleted file mode 100644 index 57b67c3..0000000 --- a/dist/__tests__/integration/passport-resource-owner-password/resource-owner-password.integration.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resource-owner-password.integration.js","sourceRoot":"","sources":["../../../../src/__tests__/integration/passport-resource-owner-password/resource-owner-password.integration.ts"],"names":[],"mappings":";AAAA,0DAA0D;;;AAE1D,+CAAyE;AACzE,yCAA0C;AAC1C,yCAAmD;AACnD,qDAAuD;AACvD,oDAAiD;AAEjD,gDAA0C;AAC1C,8FAA0F;AAC1F,mDAAoD;AACpD,8FAA6F;AAC7F,wCAAqD;AAGrD,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAChD,IAAI,GAAgB,CAAC;IACrB,IAAI,MAAkB,CAAC;IACvB,UAAU,CAAC,YAAY,CAAC,CAAC;IACzB,UAAU,CAAC,0BAA0B,CAAC,CAAC;IACvC,UAAU,CAAC,eAAe,CAAC,CAAC;IAE5B,EAAE,CAAC,yDAAyD,EAAE,KAAK,IAAI,EAAE;QACvE,MAAM,cAAc;YAGlB,IAAI,CAAgB,IAA0C;gBAC5D,OAAO,iBAAiB,CAAC;YAC3B,CAAC;SACF;QAHC;YAFC,IAAA,iBAAI,EAAC,2BAA2B,CAAC;YACjC,IAAA,yBAAY,kEAAsC;YAC7C,mBAAA,IAAA,wBAAW,GAAE,CAAA;;;;kDAElB;QAGH,GAAG,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;QAE/B,MAAM,kBAAkB,CAAC,MAAM,CAAC;aAC7B,IAAI,CAAC,2BAA2B,CAAC;aACjC,IAAI,CAAC,EAAE,CAA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diff --git a/dist/__tests__/unit/passport-apple-oauth2/apple-auth-strategy.unit.d.ts b/dist/__tests__/unit/passport-apple-oauth2/apple-auth-strategy.unit.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/__tests__/unit/passport-apple-oauth2/apple-auth-strategy.unit.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/__tests__/unit/passport-apple-oauth2/apple-auth-strategy.unit.js b/dist/__tests__/unit/passport-apple-oauth2/apple-auth-strategy.unit.js deleted file mode 100644 index 7136497..0000000 --- a/dist/__tests__/unit/passport-apple-oauth2/apple-auth-strategy.unit.js +++ /dev/null @@ -1,57 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const testlab_1 = require("@loopback/testlab"); -const strategies_1 = require("../../../strategies"); -describe('getting apple-auth strategy with options', () => { - it('should return strategy by passing options and passReqToCallback as true', async () => { - const strategyVerifier = await getStrategy(); - const options = { - scope: '', - teamID: '', - keyID: '', - clientID: 'string', - clientSecret: 'string', - passReqToCallback: true, - }; - const appleAuthStrategyVerifier = strategyVerifier(options); - (0, testlab_1.expect)(appleAuthStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(appleAuthStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); - it('should return strategy by passing options and passReqToCallback as false', async () => { - const strategyVerifier = await getStrategy(); - const options = { - scope: '', - teamID: '', - keyID: '', - clientID: 'string', - clientSecret: 'string', - passReqToCallback: true, - }; - const appleAuthStrategyVerifier = strategyVerifier(options); - (0, testlab_1.expect)(appleAuthStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(appleAuthStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); -}); -async function getStrategy() { - const provider = new strategies_1.AppleAuthStrategyFactoryProvider(verifierBearer); - //this fuction will return a function which will then accept options. - return provider.value(); -} -//returning a user -function verifierBearer(accessToken, refreshToken, profile) { - const userToPass = { - id: 1, - username: 'xyz', - password: 'pass', - }; - return new Promise(function (resolve, reject) { - if (userToPass) { - resolve(userToPass); - } - }); -} -//# sourceMappingURL=apple-auth-strategy.unit.js.map \ No newline at end of file diff --git a/dist/__tests__/unit/passport-apple-oauth2/apple-auth-strategy.unit.js.map b/dist/__tests__/unit/passport-apple-oauth2/apple-auth-strategy.unit.js.map deleted file mode 100644 index 5e69705..0000000 --- a/dist/__tests__/unit/passport-apple-oauth2/apple-auth-strategy.unit.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"apple-auth-strategy.unit.js","sourceRoot":"","sources":["../../../../src/__tests__/unit/passport-apple-oauth2/apple-auth-strategy.unit.ts"],"names":[],"mappings":";;AACA,+CAAyC;AACzC,oDAG6B;AAM7B,QAAQ,CAAC,0CAA0C,EAAE,GAAG,EAAE;IACxD,EAAE,CAAC,yEAAyE,EAAE,KAAK,IAAI,EAAE;QACvF,MAAM,gBAAgB,GAA6B,MAAM,WAAW,EAAE,CAAC;QAEvE,MAAM,OAAO,GAAyD;YACpE,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,EAAE;YACT,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,QAAQ;YACtB,iBAAiB,EAAE,IAAI;SACxB,CAAC;QAEF,MAAM,yBAAyB,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAE5D,IAAA,gBAAM,EAAC,yBAAyB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC3D,IAAA,gBAAM,EAAC,yBAAyB,CAAC;aAC9B,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;aAChC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0EAA0E,EAAE,KAAK,IAAI,EAAE;QACxF,MAAM,gBAAgB,GAA6B,MAAM,WAAW,EAAE,CAAC;QAEvE,MAAM,OAAO,GAAyD;YACpE,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,EAAE;YACT,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,QAAQ;YACtB,iBAAiB,EAAE,IAAI;SACxB,CAAC;QAEF,MAAM,yBAAyB,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAE5D,IAAA,gBAAM,EAAC,yBAAyB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC3D,IAAA,gBAAM,EAAC,yBAAyB,CAAC;aAC9B,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;aAChC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,KAAK,UAAU,WAAW;IACxB,MAAM,QAAQ,GAAG,IAAI,6CAAgC,CAAC,cAAc,CAAC,CAAC;IAEtE,qEAAqE;IACrE,OAAO,QAAQ,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED,kBAAkB;AAClB,SAAS,cAAc,CACrB,WAAmB,EACnB,YAAoB,EACpB,OAA8B;IAE9B,MAAM,UAAU,GAAc;QAC5B,EAAE,EAAE,CAAC;QACL,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,MAAM;KACjB,CAAC;IAEF,OAAO,IAAI,OAAO,CAAC,UAAU,OAAO,EAAE,MAAM;QAC1C,IAAI,UAAU,EAAE;YACd,OAAO,CAAC,UAAU,CAAC,CAAC;SACrB;IACH,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/dist/__tests__/unit/passport-azure-ad/azuread-auth-strategy.unit.d.ts b/dist/__tests__/unit/passport-azure-ad/azuread-auth-strategy.unit.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/__tests__/unit/passport-azure-ad/azuread-auth-strategy.unit.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/__tests__/unit/passport-azure-ad/azuread-auth-strategy.unit.js b/dist/__tests__/unit/passport-azure-ad/azuread-auth-strategy.unit.js deleted file mode 100644 index 388daa5..0000000 --- a/dist/__tests__/unit/passport-azure-ad/azuread-auth-strategy.unit.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const testlab_1 = require("@loopback/testlab"); -const passport_azure_ad_1 = require("../../../strategies/passport/passport-azure-ad"); -describe('getting azuread auth strategy with options', () => { - it('should return strategy by passing options and passReqToCallback as true', async () => { - const strategyVerifier = await getStrategy(); - const options = { - scope: '', - responseType: 'code', - responseMode: 'query', - redirectUrl: 'https://www.example.com', - clientID: 'string', - clientSecret: 'string', - identityMetadata: 'https://login.microsoftonline.com/your_tenant_name.onmicrosoft.com/.well-known/openid-configuration', - passReqToCallback: true, - }; - const azureAdAuthStrategyVerifier = strategyVerifier(options); - (0, testlab_1.expect)(azureAdAuthStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(azureAdAuthStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); - it('should return strategy by passing options and passReqToCallback as false', async () => { - const strategyVerifier = await getStrategy(); - const options = { - scope: '', - responseType: 'code', - responseMode: 'query', - redirectUrl: 'https://www.example.com', - clientID: 'string', - clientSecret: 'string', - identityMetadata: 'https://login.microsoftonline.com/your_tenant_name.onmicrosoft.com/.well-known/openid-configuration', - passReqToCallback: false, - }; - const azureAdAuthStrategyVerifier = strategyVerifier(options); - (0, testlab_1.expect)(azureAdAuthStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(azureAdAuthStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); -}); -async function getStrategy() { - const provider = new passport_azure_ad_1.AzureADAuthStrategyFactoryProvider(verifierBearer); - //this fuction will return a function which will then accept options. - return provider.value(); -} -//returning a user -function verifierBearer(profile) { - const userToPass = { - id: 1, - username: 'xyz', - password: 'pass', - }; - return new Promise(function (resolve, reject) { - if (userToPass) { - resolve(userToPass); - } - }); -} -//# sourceMappingURL=azuread-auth-strategy.unit.js.map \ No newline at end of file diff --git a/dist/__tests__/unit/passport-azure-ad/azuread-auth-strategy.unit.js.map b/dist/__tests__/unit/passport-azure-ad/azuread-auth-strategy.unit.js.map deleted file mode 100644 index 4341fd8..0000000 --- a/dist/__tests__/unit/passport-azure-ad/azuread-auth-strategy.unit.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"azuread-auth-strategy.unit.js","sourceRoot":"","sources":["../../../../src/__tests__/unit/passport-azure-ad/azuread-auth-strategy.unit.ts"],"names":[],"mappings":";;AACA,+CAAyC;AAMzC,sFAGwD;AAExD,QAAQ,CAAC,4CAA4C,EAAE,GAAG,EAAE;IAC1D,EAAE,CAAC,yEAAyE,EAAE,KAAK,IAAI,EAAE;QACvF,MAAM,gBAAgB,GAA+B,MAAM,WAAW,EAAE,CAAC;QAEzE,MAAM,OAAO,GAEwB;YACnC,KAAK,EAAE,EAAE;YACT,YAAY,EAAE,MAAM;YACpB,YAAY,EAAE,OAAO;YACrB,WAAW,EAAE,yBAAyB;YACtC,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,QAAQ;YACtB,gBAAgB,EACd,qGAAqG;YACvG,iBAAiB,EAAE,IAAI;SACxB,CAAC;QAEF,MAAM,2BAA2B,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAE9D,IAAA,gBAAM,EAAC,2BAA2B,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC7D,IAAA,gBAAM,EAAC,2BAA2B,CAAC;aAChC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;aAChC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0EAA0E,EAAE,KAAK,IAAI,EAAE;QACxF,MAAM,gBAAgB,GAA+B,MAAM,WAAW,EAAE,CAAC;QAEzE,MAAM,OAAO,GAEwB;YACnC,KAAK,EAAE,EAAE;YACT,YAAY,EAAE,MAAM;YACpB,YAAY,EAAE,OAAO;YACrB,WAAW,EAAE,yBAAyB;YACtC,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,QAAQ;YACtB,gBAAgB,EACd,qGAAqG;YACvG,iBAAiB,EAAE,KAAK;SACzB,CAAC;QAEF,MAAM,2BAA2B,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAE9D,IAAA,gBAAM,EAAC,2BAA2B,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC7D,IAAA,gBAAM,EAAC,2BAA2B,CAAC;aAChC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;aAChC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,KAAK,UAAU,WAAW;IACxB,MAAM,QAAQ,GAAG,IAAI,sDAAkC,CAAC,cAAc,CAAC,CAAC;IAExE,qEAAqE;IACrE,OAAO,QAAQ,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED,kBAAkB;AAClB,SAAS,cAAc,CAAC,OAAiB;IACvC,MAAM,UAAU,GAAc;QAC5B,EAAE,EAAE,CAAC;QACL,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,MAAM;KACjB,CAAC;IAEF,OAAO,IAAI,OAAO,CAAC,UAAU,OAAO,EAAE,MAAM;QAC1C,IAAI,UAAU,EAAE;YACd,OAAO,CAAC,UAAU,CAAC,CAAC;SACrB;IACH,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/dist/__tests__/unit/passport-bearer/bearer-token-verify.unit.d.ts b/dist/__tests__/unit/passport-bearer/bearer-token-verify.unit.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/__tests__/unit/passport-bearer/bearer-token-verify.unit.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/__tests__/unit/passport-bearer/bearer-token-verify.unit.js b/dist/__tests__/unit/passport-bearer/bearer-token-verify.unit.js deleted file mode 100644 index 69382d2..0000000 --- a/dist/__tests__/unit/passport-bearer/bearer-token-verify.unit.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const strategies_1 = require("../../../strategies"); -const testlab_1 = require("@loopback/testlab"); -/** - * Testing to get bearer strategy from providers - */ -describe('getting bearer token strategy with options', () => { - it('should return strategy by passing options and passReqToCallback as true', async () => { - const strategyVerifier = await getStrategy(); - const options = { - scope: '', - realm: '', - passReqToCallback: true, - }; - const bearerStrategyVerifier = strategyVerifier(options); - (0, testlab_1.expect)(bearerStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(bearerStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); - it('should return strategy by passing options and passReqToCallback as false', async () => { - const strategyVerifier = await getStrategy(); - const options = { - scope: '', - realm: '', - passReqToCallback: false, - }; - const bearerStrategyVerifier = strategyVerifier(options); - (0, testlab_1.expect)(bearerStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(bearerStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); - it('should return strategy without options', async () => { - const strategyVerifier = await getStrategy(); - const bearerStrategyVerifier = strategyVerifier(); - (0, testlab_1.expect)(bearerStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(bearerStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); -}); -async function getStrategy() { - const provider = new strategies_1.BearerStrategyFactoryProvider(verifierBearer); - //this fuction will return a function which will then accept options. - return provider.value(); -} -//returning a user -function verifierBearer(token) { - const userToPass = { - id: 1, - username: 'xyz', - password: 'pass', - }; - return new Promise(function (resolve, reject) { - if (userToPass) { - resolve(userToPass); - } - }); -} -//# sourceMappingURL=bearer-token-verify.unit.js.map \ No newline at end of file diff --git a/dist/__tests__/unit/passport-bearer/bearer-token-verify.unit.js.map b/dist/__tests__/unit/passport-bearer/bearer-token-verify.unit.js.map deleted file mode 100644 index dc38321..0000000 --- a/dist/__tests__/unit/passport-bearer/bearer-token-verify.unit.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bearer-token-verify.unit.js","sourceRoot":"","sources":["../../../../src/__tests__/unit/passport-bearer/bearer-token-verify.unit.ts"],"names":[],"mappings":";;AACA,oDAG6B;AAE7B,+CAAyC;AAEzC;;GAEG;AACH,QAAQ,CAAC,4CAA4C,EAAE,GAAG,EAAE;IAC1D,EAAE,CAAC,yEAAyE,EAAE,KAAK,IAAI,EAAE;QACvF,MAAM,gBAAgB,GAA0B,MAAM,WAAW,EAAE,CAAC;QAEpE,MAAM,OAAO,GAAoC;YAC/C,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,EAAE;YACT,iBAAiB,EAAE,IAAI;SACxB,CAAC;QAEF,MAAM,sBAAsB,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAEzD,IAAA,gBAAM,EAAC,sBAAsB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACxD,IAAA,gBAAM,EAAC,sBAAsB,CAAC;aAC3B,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;aAChC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0EAA0E,EAAE,KAAK,IAAI,EAAE;QACxF,MAAM,gBAAgB,GAA0B,MAAM,WAAW,EAAE,CAAC;QAEpE,MAAM,OAAO,GAAoC;YAC/C,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,EAAE;YACT,iBAAiB,EAAE,KAAK;SACzB,CAAC;QAEF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H,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/dist/__tests__/unit/passport-client-password/client-password-strategy.unit.d.ts b/dist/__tests__/unit/passport-client-password/client-password-strategy.unit.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/__tests__/unit/passport-client-password/client-password-strategy.unit.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/__tests__/unit/passport-client-password/client-password-strategy.unit.js b/dist/__tests__/unit/passport-client-password/client-password-strategy.unit.js deleted file mode 100644 index bd5c683..0000000 --- a/dist/__tests__/unit/passport-client-password/client-password-strategy.unit.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const strategies_1 = require("../../../strategies"); -const testlab_1 = require("@loopback/testlab"); -/** - * Testing to get bearer strategy from providers - */ -describe('getting client-password strategy with options', () => { - it('should return strategy by passing options and passReqToCallback as true', async () => { - const strategyVerifier = await getStrategy(); - const options = { - scope: '', - realm: '', - passReqToCallback: true, - }; - const clientPasswordStrategyVerifier = strategyVerifier(options); - (0, testlab_1.expect)(clientPasswordStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(clientPasswordStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); - it('should return strategy by passing options and passReqToCallback as false', async () => { - const strategyVerifier = await getStrategy(); - const options = { - scope: '', - realm: '', - passReqToCallback: false, - }; - const clientPasswordStrategyVerifier = strategyVerifier(options); - (0, testlab_1.expect)(clientPasswordStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(clientPasswordStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); - it('should return strategy without options', async () => { - const strategyVerifier = await getStrategy(); - const clientPasswordStrategyVerifier = strategyVerifier(); - (0, testlab_1.expect)(clientPasswordStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(clientPasswordStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); -}); -async function getStrategy() { - const provider = new strategies_1.ClientPasswordStrategyFactoryProvider(verifierBearer); - //this fuction will return a function which will then accept options. - return provider.value(); -} -//returning a user -function verifierBearer(clientId, clientSecret) { - const clientToPass = { - clientId: clientId, - clientSecret: clientSecret, - }; - return new Promise(function (resolve, reject) { - if (clientToPass) { - resolve(clientToPass); - } - }); -} -//# sourceMappingURL=client-password-strategy.unit.js.map \ No newline at end of file diff --git a/dist/__tests__/unit/passport-client-password/client-password-strategy.unit.js.map b/dist/__tests__/unit/passport-client-password/client-password-strategy.unit.js.map deleted file mode 100644 index f26ddd2..0000000 --- a/dist/__tests__/unit/passport-client-password/client-password-strategy.unit.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"client-password-strategy.unit.js","sourceRoot":"","sources":["../../../../src/__tests__/unit/passport-client-password/client-password-strategy.unit.ts"],"names":[],"mappings":";;AACA,oDAG6B;AAC7B,+CAAyC;AAEzC;;GAEG;AACH,QAAQ,CAAC,+CAA+C,EAAE,GAAG,EAAE;IAC7D,EAAE,CAAC,yEAAyE,EAAE,KAAK,IAAI,EAAE;QACvF,MAAM,gBAAgB,GAAkC,MAAM,WAAW,EAAE,CAAC;QAE5E,MAAM,OAAO,GAAG;YACd,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,EAAE;YACT,iBAAiB,EAAE,IAAI;SACxB,CAAC;QAEF,MAAM,8BAA8B,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAEjE,IAAA,gBAAM,EAAC,8BAA8B,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAChE,IAAA,gBAAM,EAAC,8BAA8B,CAAC;aACnC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;aAChC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0EAA0E,EAAE,KAAK,IAAI,EAAE;QACxF,MAAM,g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AE,YAAY;KAC3B,CAAC;IAEF,OAAO,IAAI,OAAO,CAAC,UAAU,OAAO,EAAE,MAAM;QAC1C,IAAI,YAAY,EAAE;YAChB,OAAO,CAAC,YAAY,CAAC,CAAC;SACvB;IACH,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/dist/__tests__/unit/passport-google-oauth2/google-auth-strategy.unit.d.ts b/dist/__tests__/unit/passport-google-oauth2/google-auth-strategy.unit.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/__tests__/unit/passport-google-oauth2/google-auth-strategy.unit.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/__tests__/unit/passport-google-oauth2/google-auth-strategy.unit.js b/dist/__tests__/unit/passport-google-oauth2/google-auth-strategy.unit.js deleted file mode 100644 index 72cc4c7..0000000 --- a/dist/__tests__/unit/passport-google-oauth2/google-auth-strategy.unit.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const testlab_1 = require("@loopback/testlab"); -const passport_google_oauth2_1 = require("../../../strategies/passport/passport-google-oauth2"); -describe('getting google-auth strategy with options', () => { - it('should return strategy by passing options and passReqToCallback as true', async () => { - const strategyVerifier = await getStrategy(); - const options = { - scope: '', - clientID: 'string', - clientSecret: 'string', - passReqToCallback: true, - }; - const googleAuthStrategyVerifier = strategyVerifier(options); - (0, testlab_1.expect)(googleAuthStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(googleAuthStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); - it('should return strategy by passing options and passReqToCallback as false', async () => { - const strategyVerifier = await getStrategy(); - const options = { - scope: '', - clientID: 'string', - clientSecret: 'string', - passReqToCallback: false, - }; - const googleAuthStrategyVerifier = strategyVerifier(options); - (0, testlab_1.expect)(googleAuthStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(googleAuthStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); -}); -async function getStrategy() { - const provider = new passport_google_oauth2_1.GoogleAuthStrategyFactoryProvider(verifierBearer); - //this fuction will return a function which will then accept options. - return provider.value(); -} -//returning a user -function verifierBearer(accessToken, refreshToken, profile) { - const userToPass = { - id: 1, - username: 'xyz', - password: 'pass', - }; - return new Promise(function (resolve, reject) { - if (userToPass) { - resolve(userToPass); - } - }); -} -//# sourceMappingURL=google-auth-strategy.unit.js.map \ No newline at end of file diff --git a/dist/__tests__/unit/passport-google-oauth2/google-auth-strategy.unit.js.map b/dist/__tests__/unit/passport-google-oauth2/google-auth-strategy.unit.js.map deleted file mode 100644 index c5ceb2b..0000000 --- a/dist/__tests__/unit/passport-google-oauth2/google-auth-strategy.unit.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"google-auth-strategy.unit.js","sourceRoot":"","sources":["../../../../src/__tests__/unit/passport-google-oauth2/google-auth-strategy.unit.ts"],"names":[],"mappings":";;AACA,+CAAyC;AAEzC,gGAG6D;AAE7D,QAAQ,CAAC,2CAA2C,EAAE,GAAG,EAAE;IACzD,EAAE,CAAC,yEAAyE,EAAE,KAAK,IAAI,EAAE;QACvF,MAAM,gBAAgB,GAA8B,MAAM,WAAW,EAAE,CAAC;QAExE,MAAM,OAAO,GAEmC;YAC9C,KAAK,EAAE,EAAE;YACT,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,QAAQ;YACtB,iBAAiB,EAAE,IAAI;SACxB,CAAC;QAEF,MAAM,0BAA0B,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAE7D,IAAA,gBAAM,EAAC,0BAA0B,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC5D,IAAA,gBAAM,EAAC,0BAA0B,CAAC;aAC/B,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;aAChC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0EAA0E,EAAE,KAAK,IAAI,EAAE;QACxF,MAAM,gBAAgB,GAA8B,MAAM,WAAW,EAAE,CAAC;QAExE,MAAM,OAAO,GAEmC;YAC9C,KAAK,EAAE,EAAE;YACT,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,QAAQ;YACtB,iBAAiB,EAAE,KAAK;SACzB,CAAC;QAEF,MAAM,0BAA0B,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAE7D,IAAA,gBAAM,EAAC,0BAA0B,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC5D,IAAA,gBAAM,EAAC,0BAA0B,CAAC;aAC/B,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;aAChC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,KAAK,UAAU,WAAW;IACxB,MAAM,QAAQ,GAAG,IAAI,0DAAiC,CAAC,cAAc,CAAC,CAAC;IAEvE,qEAAqE;IACrE,OAAO,QAAQ,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED,kBAAkB;AAClB,SAAS,cAAc,CACrB,WAAmB,EACnB,YAAoB,EACpB,OAA+B;IAE/B,MAAM,UAAU,GAAc;QAC5B,EAAE,EAAE,CAAC;QACL,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,MAAM;KACjB,CAAC;IAEF,OAAO,IAAI,OAAO,CAAC,UAAU,OAAO,EAAE,MAAM;QAC1C,IAAI,UAAU,EAAE;YACd,OAAO,CAAC,UAAU,CAAC,CAAC;SACrB;IACH,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/dist/__tests__/unit/passport-instagram-oauth2/instagram-auth-strategy.unit.d.ts b/dist/__tests__/unit/passport-instagram-oauth2/instagram-auth-strategy.unit.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/__tests__/unit/passport-instagram-oauth2/instagram-auth-strategy.unit.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/__tests__/unit/passport-instagram-oauth2/instagram-auth-strategy.unit.js b/dist/__tests__/unit/passport-instagram-oauth2/instagram-auth-strategy.unit.js deleted file mode 100644 index 071766f..0000000 --- a/dist/__tests__/unit/passport-instagram-oauth2/instagram-auth-strategy.unit.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const testlab_1 = require("@loopback/testlab"); -const passport_insta_oauth2_1 = require("../../../strategies/passport/passport-insta-oauth2"); -describe('getting instagram-auth strategy with options', () => { - it('should return strategy by passing options and passReqToCallback as true', async () => { - const strategyVerifier = await getStrategy(); - const options = { - callbackURL: '', - clientID: 'string', - clientSecret: 'string', - passReqToCallback: true, - }; - const instagramAuthStrategyVerifier = strategyVerifier(options); - (0, testlab_1.expect)(instagramAuthStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(instagramAuthStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); - it('should return strategy by passing options and passReqToCallback as false', async () => { - const strategyVerifier = await getStrategy(); - const options = { - callbackURL: '', - clientID: 'string', - clientSecret: 'string', - passReqToCallback: false, - }; - const instagramAuthStrategyVerifier = strategyVerifier(options); - (0, testlab_1.expect)(instagramAuthStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(instagramAuthStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); -}); -async function getStrategy() { - const provider = new passport_insta_oauth2_1.InstagramAuthStrategyFactoryProvider(verifierBearer); - //this fuction will return a function which will then accept options. - return provider.value(); -} -//returning a user -function verifierBearer(accessToken, refreshToken, profile) { - const userToPass = { - id: 1, - username: 'xyz', - password: 'pass', - }; - return new Promise(function (resolve, reject) { - if (userToPass) { - resolve(userToPass); - } - }); -} -//# sourceMappingURL=instagram-auth-strategy.unit.js.map \ No newline at end of file diff --git a/dist/__tests__/unit/passport-instagram-oauth2/instagram-auth-strategy.unit.js.map b/dist/__tests__/unit/passport-instagram-oauth2/instagram-auth-strategy.unit.js.map deleted file mode 100644 index 11a2ed0..0000000 --- a/dist/__tests__/unit/passport-instagram-oauth2/instagram-auth-strategy.unit.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"instagram-auth-strategy.unit.js","sourceRoot":"","sources":["../../../../src/__tests__/unit/passport-instagram-oauth2/instagram-auth-strategy.unit.ts"],"names":[],"mappings":";;AACA,+CAAyC;AAEzC,8FAG4D;AAE5D,QAAQ,CAAC,8CAA8C,EAAE,GAAG,EAAE;IAC5D,EAAE,CAAC,yEAAyE,EAAE,KAAK,IAAI,EAAE;QACvF,MAAM,gBAAgB,GAAiC,MAAM,WAAW,EAAE,CAAC;QAE3E,MAAM,OAAO,GAEqC;YAChD,WAAW,EAAE,EAAE;YACf,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,QAAQ;YACtB,iBAAiB,EAAE,IAAI;SACxB,CAAC;QAEF,MAAM,6BAA6B,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAEhE,IAAA,gBAAM,EAAC,6BAA6B,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC/D,IAAA,gBAAM,EAAC,6BAA6B,CAAC;aAClC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;aAChC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0EAA0E,EAAE,KAAK,IAAI,EAAE;QACxF,MAAM,gBAAgB,GAAiC,MAAM,WAAW,EAAE,CAAC;QAE3E,MAAM,OAAO,GAEqC;YAChD,WAAW,EAAE,EAAE;YACf,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,QAAQ;YACtB,iBAAiB,EAAE,KAAK;SACzB,CAAC;QAEF,MAAM,6BAA6B,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAEhE,IAAA,gBAAM,EAAC,6BAA6B,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC/D,IAAA,gBAAM,EAAC,6BAA6B,CAAC;aAClC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;aAChC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,KAAK,UAAU,WAAW;IACxB,MAAM,QAAQ,GAAG,IAAI,4DAAoC,CAAC,cAAc,CAAC,CAAC;IAE1E,qEAAqE;IACrE,OAAO,QAAQ,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED,kBAAkB;AAClB,SAAS,cAAc,CACrB,WAAmB,EACnB,YAAoB,EACpB,OAAkC;IAElC,MAAM,UAAU,GAAc;QAC5B,EAAE,EAAE,CAAC;QACL,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,MAAM;KACjB,CAAC;IAEF,OAAO,IAAI,OAAO,CAAC,UAAU,OAAO,EAAE,MAAM;QAC1C,IAAI,UAAU,EAAE;YACd,OAAO,CAAC,UAAU,CAAC,CAAC;SACrB;IACH,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/dist/__tests__/unit/passport-keycloak-oauth2/keycloak-auth-strategy.unit.d.ts b/dist/__tests__/unit/passport-keycloak-oauth2/keycloak-auth-strategy.unit.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/__tests__/unit/passport-keycloak-oauth2/keycloak-auth-strategy.unit.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/__tests__/unit/passport-keycloak-oauth2/keycloak-auth-strategy.unit.js b/dist/__tests__/unit/passport-keycloak-oauth2/keycloak-auth-strategy.unit.js deleted file mode 100644 index b8d54c9..0000000 --- a/dist/__tests__/unit/passport-keycloak-oauth2/keycloak-auth-strategy.unit.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const testlab_1 = require("@loopback/testlab"); -const strategies_1 = require("../../../strategies"); -describe('getting keycloak-auth strategy with options', () => { - it('should return strategy by passing required options', async () => { - const strategyVerifier = await getStrategy(); - const options = { - host: 'localhost', - realm: '/', - clientID: 'string', - clientSecret: 'string', - callbackURL: 'localhost', - authorizationURL: 'localhost', - tokenURL: 'localhost', - userInfoURL: 'localhost', - }; - const keycloakAuthStrategyVerifier = strategyVerifier(options); - (0, testlab_1.expect)(keycloakAuthStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(keycloakAuthStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); -}); -async function getStrategy() { - const provider = new strategies_1.KeycloakStrategyFactoryProvider(verifierBearer); - //this fuction will return a function which will then accept options. - return provider.value(); -} -//returning a user -function verifierBearer(accessToken, refreshToken, profile) { - const userToPass = { - id: 1, - username: 'xyz', - password: 'pass', - }; - return new Promise(function (resolve, reject) { - if (userToPass) { - resolve(userToPass); - } - }); -} -//# sourceMappingURL=keycloak-auth-strategy.unit.js.map \ No newline at end of file diff --git a/dist/__tests__/unit/passport-keycloak-oauth2/keycloak-auth-strategy.unit.js.map b/dist/__tests__/unit/passport-keycloak-oauth2/keycloak-auth-strategy.unit.js.map deleted file mode 100644 index 89f0a0b..0000000 --- a/dist/__tests__/unit/passport-keycloak-oauth2/keycloak-auth-strategy.unit.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keycloak-auth-strategy.unit.js","sourceRoot":"","sources":["../../../../src/__tests__/unit/passport-keycloak-oauth2/keycloak-auth-strategy.unit.ts"],"names":[],"mappings":";;AACA,+CAAyC;AACzC,oDAI6B;AAE7B,QAAQ,CAAC,6CAA6C,EAAE,GAAG,EAAE;IAC3D,EAAE,CAAC,oD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loak-user-profile.unit.d.ts b/dist/__tests__/unit/passport-keycloak-oauth2/keycloak-user-profile.unit.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/__tests__/unit/passport-keycloak-oauth2/keycloak-user-profile.unit.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/__tests__/unit/passport-keycloak-oauth2/keycloak-user-profile.unit.js b/dist/__tests__/unit/passport-keycloak-oauth2/keycloak-user-profile.unit.js deleted file mode 100644 index 4a74d5d..0000000 --- a/dist/__tests__/unit/passport-keycloak-oauth2/keycloak-user-profile.unit.js +++ /dev/null @@ -1,56 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const testlab_1 = require("@loopback/testlab"); -const strategies_1 = require("../../../strategies"); -describe('Keycloak userProfileFn', () => { - it('should successfully resolve', async () => { - const strategyVerifier = await getStrategy(); - const options = { - host: 'localhost', - realm: '/', - clientID: 'string', - clientSecret: 'string', - callbackURL: 'localhost', - authorizationURL: 'localhost', - tokenURL: 'localhost', - userInfoURL: 'localhost', - }; - const keycloakAuthStrategyVerifier = strategyVerifier(options); - const profilePromise = new Promise((resolve, reject) => { - keycloakAuthStrategyVerifier._oauth2 = { - _useAuthorizationHeaderForGET: false, - get: testlab_1.sinon.stub().callsFake((url, token, cb) => { - cb(null, JSON.stringify({})); - }), - }; - keycloakAuthStrategyVerifier.userProfile('', (err, res) => { - if (err) { - reject(err); - } - else { - resolve(res); - } - }); - }); - await (0, testlab_1.expect)(profilePromise).to.be.fulfilled(); - }); -}); -async function getStrategy() { - const provider = new strategies_1.KeycloakStrategyFactoryProvider(verifierBearer); - //this fuction will return a function which will then accept options. - return provider.value(); -} -//returning a user -function verifierBearer(accessToken, refreshToken, profile) { - const userToPass = { - id: 1, - username: 'xyz', - password: 'pass', - }; - return new Promise(function (resolve, reject) { - if (userToPass) { - resolve(userToPass); - } - }); -} -//# sourceMappingURL=keycloak-user-profile.unit.js.map \ No newline at end of file diff --git a/dist/__tests__/unit/passport-keycloak-oauth2/keycloak-user-profile.unit.js.map b/dist/__tests__/unit/passport-keycloak-oauth2/keycloak-user-profile.unit.js.map deleted file mode 100644 index 9cca907..0000000 --- a/dist/__tests__/unit/passport-keycloak-oauth2/keycloak-user-profile.unit.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keycloak-user-profile.unit.js","sourceRoot":"","sources":["../../../../src/__tests__/unit/passport-keycloak-oauth2/keycloak-user-profile.unit.ts"],"names":[],"mappings":";;AAAA,+CAAgD;AAChD,oDAI6B;AAI7B,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,EAAE,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC3C,MAAM,gBAAgB,GAA4B,MAAM,WAAW,EAAE,CAAC;QAEtE,MAAM,OAAO,GAA6B;YACxC,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,GAAG;YACV,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,QAAQ;YACtB,WAAW,EAAE,WAAW;YACxB,gBAAgB,EAAE,WAAW;YAC7B,QAAQ,EAAE,WAAW;YACrB,WAAW,EAAE,WAAW;SACzB,CAAC;QAEF,MAAM,4BAA4B,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAE/D,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrD,4BAA4B,CAAC,OAAO,GAAG;gBACrC,6BAA6B,EAAE,KAAK;gBACpC,GAAG,EAAE,eAAK,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;oBAC7C,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC/B,CAAC,CAAC;aACH,CAAC;YACF,4BAA4B,CAAC,WAAW,CACtC,EAAE,EACF,CAAC,GAAc,EAAE,GAAc,EAAE,EAAE;gBACjC,IAAI,GAAG,EAAE;oBACP,MAAM,CAAC,GAAG,CAAC,CAAC;iBACb;qBAAM;oBACL,OAAO,CAAC,GAAG,CAAC,CAAC;iBACd;YACH,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,MAAM,IAAA,gBAAM,EAAC,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,KAAK,UAAU,WAAW;IACxB,MAAM,QAAQ,GAAG,IAAI,4CAA+B,CAAC,cAAc,CAAC,CAAC;IAErE,qEAAqE;IACrE,OAAO,QAAQ,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED,kBAAkB;AAClB,SAAS,cAAc,CACrB,WAAmB,EACnB,YAAoB,EACpB,OAAyB;IAEzB,MAAM,UAAU,GAAc;QAC5B,EAAE,EAAE,CAAC;QACL,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,MAAM;KACjB,CAAC;IAEF,OAAO,IAAI,OAAO,CAAC,UAAU,OAAO,EAAE,MAAM;QAC1C,IAAI,UAAU,EAAE;YACd,OAAO,CAAC,UAAU,CAAC,CAAC;SACrB;IACH,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/dist/__tests__/unit/passport-local/local-strategy.unit.d.ts b/dist/__tests__/unit/passport-local/local-strategy.unit.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/__tests__/unit/passport-local/local-strategy.unit.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/__tests__/unit/passport-local/local-strategy.unit.js b/dist/__tests__/unit/passport-local/local-strategy.unit.js deleted file mode 100644 index 6068c3a..0000000 --- a/dist/__tests__/unit/passport-local/local-strategy.unit.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const testlab_1 = require("@loopback/testlab"); -const strategies_1 = require("../../../strategies"); -describe('getting local strategy with options', () => { - it('should return strategy by passing options and passReqToCallback as true', async () => { - const strategyVerifier = await getStrategy(); - const options = { - passReqToCallback: true, - }; - const localStrategyVerifier = strategyVerifier(options); - (0, testlab_1.expect)(localStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(localStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); - it('should return strategy by passing options and passReqToCallback as false', async () => { - const strategyVerifier = await getStrategy(); - const options = { - passReqToCallback: false, - }; - const localStrategyVerifier = strategyVerifier(options); - (0, testlab_1.expect)(localStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(localStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); - it('should return strategy by not passing any options', async () => { - const strategyVerifier = await getStrategy(); - const localStrategyVerifier = strategyVerifier(); - (0, testlab_1.expect)(localStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(localStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); -}); -async function getStrategy() { - const provider = new strategies_1.LocalPasswordStrategyFactoryProvider(verifierLocal); - //this fuction will return a function which will then accept options. - return provider.value(); -} -//returning a user -function verifierLocal(username, password, req) { - const userToPass = { - id: 1, - username: 'xyz', - password: 'pass', - }; - return new Promise(function (resolve, reject) { - if (userToPass) { - resolve(userToPass); - } - }); -} -//# sourceMappingURL=local-strategy.unit.js.map \ No newline at end of file diff --git a/dist/__tests__/unit/passport-local/local-strategy.unit.js.map b/dist/__tests__/unit/passport-local/local-strategy.unit.js.map deleted file mode 100644 index 3680736..0000000 --- a/dist/__tests__/unit/passport-local/local-strategy.unit.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"local-strategy.unit.js","sourceRoot":"","sources":["../../../../src/__tests__/unit/passport-local/local-strategy.unit.ts"],"names":[],"mappings":";;AACA,+CAAyC;AACzC,oDAG6B;AAI7B,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;IACnD,EAAE,CAAC,yEAAyE,EAAE,KAAK,IAAI,E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vD,IAAA,gBAAM,EAAC,qBAAqB,CAAC;aAC1B,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;aAChC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,KAAK,UAAU,WAAW;IACxB,MAAM,QAAQ,GAAG,IAAI,iDAAoC,CAAC,aAAa,CAAC,CAAC;IAEzE,qEAAqE;IACrE,OAAO,QAAQ,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED,kBAAkB;AAClB,SAAS,aAAa,CACpB,QAAgB,EAChB,QAAgB,EAChB,GAAa;IAEb,MAAM,UAAU,GAAc;QAC5B,EAAE,EAAE,CAAC;QACL,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,MAAM;KACjB,CAAC;IAEF,OAAO,IAAI,OAAO,CAAC,UAAU,OAAO,EAAE,MAAM;QAC1C,IAAI,UAAU,EAAE;YACd,OAAO,CAAC,UAAU,CAAC,CAAC;SACrB;IACH,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/dist/__tests__/unit/passport-resource-owner-password/resource-owner-password.unit.d.ts b/dist/__tests__/unit/passport-resource-owner-password/resource-owner-password.unit.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/__tests__/unit/passport-resource-owner-password/resource-owner-password.unit.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/__tests__/unit/passport-resource-owner-password/resource-owner-password.unit.js b/dist/__tests__/unit/passport-resource-owner-password/resource-owner-password.unit.js deleted file mode 100644 index e0a6bc7..0000000 --- a/dist/__tests__/unit/passport-resource-owner-password/resource-owner-password.unit.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const testlab_1 = require("@loopback/testlab"); -const strategies_1 = require("../../../strategies"); -describe('getting resource-owner strategy with options', () => { - it('should return strategy by passing options and passReqToCallback as true', async () => { - const strategyVerifier = await getStrategy(); - const options = { - passReqToCallback: true, - }; - const resourceOwnerStrategyVerifier = strategyVerifier(options); - (0, testlab_1.expect)(resourceOwnerStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(resourceOwnerStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); - it('should return strategy by passing options and passReqToCallback as false', async () => { - const strategyVerifier = await getStrategy(); - const options = { - passReqToCallback: false, - }; - const resourceOwnerStrategyVerifier = strategyVerifier(options); - (0, testlab_1.expect)(resourceOwnerStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(resourceOwnerStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); - it('should return strategy by not passing any options', async () => { - const strategyVerifier = await getStrategy(); - const resourceOwnerStrategyVerifier = strategyVerifier(); - (0, testlab_1.expect)(resourceOwnerStrategyVerifier).to.have.property('name'); - (0, testlab_1.expect)(resourceOwnerStrategyVerifier) - .to.have.property('authenticate') - .which.is.a.Function(); - }); -}); -async function getStrategy() { - const provider = new strategies_1.ResourceOwnerPasswordStrategyFactoryProvider(verifierResourceOwner); - //this fuction will return a function which will then accept options. - return provider.value(); -} -//returning a user -function verifierResourceOwner(clientId, clientSecret, username, password, req) { - const userToPass = { - id: 1, - username: 'xyz', - password: 'pass', - }; - const clientToPass = { - clientId: 'id', - clientSecret: 'secret', - }; - return new Promise(function (resolve, reject) { - if (userToPass) { - resolve({ user: userToPass, client: clientToPass }); - } - }); -} -//# sourceMappingURL=resource-owner-password.unit.js.map \ No newline at end of file diff --git a/dist/__tests__/unit/passport-resource-owner-password/resource-owner-password.unit.js.map b/dist/__tests__/unit/passport-resource-owner-password/resource-owner-password.unit.js.map deleted file mode 100644 index 8a9bbe7..0000000 --- a/dist/__tests__/unit/passport-resource-owner-password/resource-owner-password.unit.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resource-owner-password.unit.js","sourceRoot":"","sources":["../../../../src/__tests__/unit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,CAAC;QAEtB,MAAM,6BAA6B,GAAG,gBAAgB,EAAE,CAAC;QAEzD,IAAA,gBAAM,EAAC,6BAA6B,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC/D,IAAA,gBAAM,EAAC,6BAA6B,CAAC;aAClC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;aAChC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,KAAK,UAAU,WAAW;IACxB,MAAM,QAAQ,GAAG,IAAI,yDAA4C,CAC/D,qBAAqB,CACtB,CAAC;IAEF,qEAAqE;IACrE,OAAO,QAAQ,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED,kBAAkB;AAClB,SAAS,qBAAqB,CAC5B,QAAgB,EAChB,YAAoB,EACpB,QAAgB,EAChB,QAAgB,EAChB,GAAa;IAEb,MAAM,UAAU,GAAc;QAC5B,EAAE,EAAE,CAAC;QACL,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,MAAM;KACjB,CAAC;IAEF,MAAM,YAAY,GAAgB;QAChC,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,QAAQ;KACvB,CAAC;IAEF,OAAO,IAAI,OAAO,CAAC,UAAU,OAAO,EAAE,MAAM;QAC1C,IAAI,UAAU,EAAE;YACd,OAAO,CAAC,EAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAC,CAAC,CAAC;SACnD;IACH,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/dist/component.d.ts b/dist/component.d.ts deleted file mode 100644 index f0075cc..0000000 --- a/dist/component.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Component, ProviderMap } from '@loopback/core'; -export declare class AuthenticationComponent implements Component { - constructor(); - providers?: ProviderMap; -} diff --git a/dist/component.js b/dist/component.js deleted file mode 100644 index 9b3b22e..0000000 --- a/dist/component.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AuthenticationComponent = void 0; -const keys_1 = require("./keys"); -const providers_1 = require("./providers"); -const strategies_1 = require("./strategies"); -const keys_2 = require("./strategies/keys"); -class AuthenticationComponent { - constructor() { - this.providers = { - [keys_1.AuthenticationBindings.USER_AUTH_ACTION.key]: providers_1.AuthenticateActionProvider, - [keys_1.AuthenticationBindings.CLIENT_AUTH_ACTION.key]: providers_1.ClientAuthenticateActionProvider, - [keys_1.AuthenticationBindings.USER_METADATA.key]: providers_1.AuthMetadataProvider, - [keys_1.AuthenticationBindings.CLIENT_METADATA.key]: providers_1.ClientAuthMetadataProvider, - [keys_1.AuthenticationBindings.USER_STRATEGY.key]: strategies_1.AuthStrategyProvider, - [keys_1.AuthenticationBindings.CLIENT_STRATEGY.key]: strategies_1.ClientAuthStrategyProvider, - // Strategy function factories - [keys_2.Strategies.Passport.LOCAL_STRATEGY_FACTORY.key]: strategies_1.LocalPasswordStrategyFactoryProvider, - [keys_2.Strategies.Passport.OTP_AUTH_STRATEGY_FACTORY.key]: strategies_1.PassportOtpStrategyFactoryProvider, - [keys_2.Strategies.Passport.CLIENT_PASSWORD_STRATEGY_FACTORY.key]: strategies_1.ClientPasswordStrategyFactoryProvider, - [keys_2.Strategies.Passport.BEARER_STRATEGY_FACTORY.key]: strategies_1.BearerStrategyFactoryProvider, - [keys_2.Strategies.Passport.RESOURCE_OWNER_STRATEGY_FACTORY.key]: strategies_1.ResourceOwnerPasswordStrategyFactoryProvider, - [keys_2.Strategies.Passport.GOOGLE_OAUTH2_STRATEGY_FACTORY.key]: strategies_1.GoogleAuthStrategyFactoryProvider, - [keys_2.Strategies.Passport.INSTAGRAM_OAUTH2_STRATEGY_FACTORY.key]: strategies_1.InstagramAuthStrategyFactoryProvider, - [keys_2.Strategies.Passport.FACEBOOK_OAUTH2_STRATEGY_FACTORY.key]: strategies_1.FacebookAuthStrategyFactoryProvider, - [keys_2.Strategies.Passport.APPLE_OAUTH2_STRATEGY_FACTORY.key]: strategies_1.AppleAuthStrategyFactoryProvider, - [keys_2.Strategies.Passport.AZURE_AD_STRATEGY_FACTORY.key]: strategies_1.AzureADAuthStrategyFactoryProvider, - [keys_2.Strategies.Passport.KEYCLOAK_STRATEGY_FACTORY.key]: strategies_1.KeycloakStrategyFactoryProvider, - // Verifier functions - [keys_2.Strategies.Passport.OAUTH2_CLIENT_PASSWORD_VERIFIER.key]: strategies_1.ClientPasswordVerifyProvider, - [keys_2.Strategies.Passport.LOCAL_PASSWORD_VERIFIER.key]: strategies_1.LocalPasswordVerifyProvider, - [keys_2.Strategies.Passport.OTP_VERIFIER.key]: strategies_1.OtpVerifyProvider, - [keys_2.Strategies.Passport.BEARER_TOKEN_VERIFIER.key]: strategies_1.BearerTokenVerifyProvider, - [keys_2.Strategies.Passport.RESOURCE_OWNER_PASSWORD_VERIFIER.key]: strategies_1.ResourceOwnerVerifyProvider, - [keys_2.Strategies.Passport.GOOGLE_OAUTH2_VERIFIER.key]: strategies_1.GoogleAuthVerifyProvider, - [keys_2.Strategies.Passport.INSTAGRAM_OAUTH2_VERIFIER.key]: strategies_1.InstagramAuthVerifyProvider, - [keys_2.Strategies.Passport.FACEBOOK_OAUTH2_VERIFIER.key]: strategies_1.FacebookAuthVerifyProvider, - [keys_2.Strategies.Passport.APPLE_OAUTH2_VERIFIER.key]: strategies_1.AppleAuthVerifyProvider, - [keys_2.Strategies.Passport.AZURE_AD_VERIFIER.key]: strategies_1.AzureADAuthVerifyProvider, - [keys_2.Strategies.Passport.KEYCLOAK_VERIFIER.key]: strategies_1.KeycloakVerifyProvider, - }; - } -} -exports.AuthenticationComponent = AuthenticationComponent; -//# sourceMappingURL=component.js.map \ No newline at end of file diff --git a/dist/component.js.map b/dist/component.js.map deleted file mode 100644 index 152d52c..0000000 --- a/dist/component.js.map +++ /dev/null @@ -1 +0,0 @@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ators/authenticate-client.decorator.d.ts deleted file mode 100644 index ae9b21d..0000000 --- a/dist/decorators/authenticate-client.decorator.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { Constructor } from '@loopback/context'; -import { AuthenticationMetadata } from '../types'; -export declare function authenticateClient(strategyName: string, options?: Object): MethodDecorator; -export declare function getClientAuthenticateMetadata(controllerClass: Constructor<{}>, methodName: string): AuthenticationMetadata | undefined; diff --git a/dist/decorators/authenticate-client.decorator.js b/dist/decorators/authenticate-client.decorator.js deleted file mode 100644 index fc0cf69..0000000 --- a/dist/decorators/authenticate-client.decorator.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getClientAuthenticateMetadata = exports.authenticateClient = void 0; -const context_1 = require("@loopback/context"); -const keys_1 = require("../keys"); -function authenticateClient(strategyName, options) { - return context_1.MethodDecoratorFactory.createDecorator(keys_1.CLIENT_AUTHENTICATION_METADATA_KEY, { - strategy: strategyName, - options: options !== null && options !== void 0 ? options : {}, - }); -} -exports.authenticateClient = authenticateClient; -function getClientAuthenticateMetadata(controllerClass, methodName) { - return context_1.MetadataInspector.getMethodMetadata(keys_1.CLIENT_AUTHENTICATION_METADATA_KEY, controllerClass.prototype, methodName); -} -exports.getClientAuthenticateMetadata = getClientAuthenticateMetadata; -//# sourceMappingURL=authenticate-client.decorator.js.map \ No newline at end of file diff --git a/dist/decorators/authenticate-client.decorator.js.map b/dist/decorators/authenticate-client.decorator.js.map deleted file mode 100644 index 29b058c..0000000 --- a/dist/decorators/authenticate-client.decorator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"authenticate-client.decorator.js","sourceRoot":"","sources":["../../src/decorators/authenticate-client.decorator.ts"],"names":[],"mappings":";;;AAAA,+CAI2B;AAE3B,kCAA2D;AAG3D,SAAgB,kBAAkB,CAAC,YAAoB,EAAE,OAAgB;IACvE,OAAO,gCAAsB,CAAC,eAAe,CAC3C,yCAAkC,EAClC;QACE,QAAQ,EAAE,YAAY;QACtB,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE;KACvB,CACF,CAAC;AACJ,CAAC;AARD,gDAQC;AAED,SAAgB,6BAA6B,CAC3C,eAAgC,EAChC,UAAkB;IAElB,OAAO,2BAAiB,CAAC,iBAAiB,CACxC,yCAAkC,EAClC,eAAe,CAAC,SAAS,EACzB,UAAU,CACX,CAAC;AACJ,CAAC;AATD,sEASC"} \ No newline at end of file diff --git a/dist/decorators/authenticate-user.decorator.d.ts b/dist/decorators/authenticate-user.decorator.d.ts deleted file mode 100644 index bb5710f..0000000 --- a/dist/decorators/authenticate-user.decorator.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// -import { BindingKey, Constructor } from '@loopback/context'; -import { Request } from '@loopback/rest'; -import { VerifyFunction } from '../strategies'; -import { AuthenticationMetadata } from '../types'; -/** - * `@authenticate` decorator for adding authentication to controller methods - * - * @param strategyName Name of the Strategy. Use Strategy enum - * like `Strategy.LOCAL` - * @param options Extra options to be passed on - * while instantiating strategy specific class - * @param verifier Binding key for a custom verifier - * @param authOptions Extra options to be passed on to `authenticate` method - * of the strategy. - * This is a creator function which should return an object with options. - * The request object is passed on as parameter to the method. - * It can be used to setup `state` parameters based on request for google-auth, - * for example. - */ -export declare function authenticate(strategyName: string, options?: Object, authOptions?: (req: Request) => Object, verifier?: BindingKey): MethodDecorator; -export declare function getAuthenticateMetadata(controllerClass: Constructor<{}>, methodName: string): AuthenticationMetadata | undefined; diff --git a/dist/decorators/authenticate-user.decorator.js b/dist/decorators/authenticate-user.decorator.js deleted file mode 100644 index b68af90..0000000 --- a/dist/decorators/authenticate-user.decorator.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getAuthenticateMetadata = exports.authenticate = void 0; -const context_1 = require("@loopback/context"); -const keys_1 = require("../keys"); -/** - * `@authenticate` decorator for adding authentication to controller methods - * - * @param strategyName Name of the Strategy. Use Strategy enum - * like `Strategy.LOCAL` - * @param options Extra options to be passed on - * while instantiating strategy specific class - * @param verifier Binding key for a custom verifier - * @param authOptions Extra options to be passed on to `authenticate` method - * of the strategy. - * This is a creator function which should return an object with options. - * The request object is passed on as parameter to the method. - * It can be used to setup `state` parameters based on request for google-auth, - * for example. - */ -function authenticate(strategyName, options, authOptions, verifier) { - return context_1.MethodDecoratorFactory.createDecorator(keys_1.USER_AUTHENTICATION_METADATA_KEY, { - strategy: strategyName, - options: options !== null && options !== void 0 ? options : {}, - authOptions: authOptions, - verifier, - }); -} -exports.authenticate = authenticate; -function getAuthenticateMetadata(controllerClass, methodName) { - return context_1.MetadataInspector.getMethodMetadata(keys_1.USER_AUTHENTICATION_METADATA_KEY, controllerClass.prototype, methodName); -} -exports.getAuthenticateMetadata = getAuthenticateMetadata; -//# sourceMappingURL=authenticate-user.decorator.js.map \ No newline at end of file diff --git a/dist/decorators/authenticate-user.decorator.js.map b/dist/decorators/authenticate-user.decorator.js.map deleted file mode 100644 index e6a0c9e..0000000 --- a/dist/decorators/authenticate-user.decorator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"authenticate-user.decorator.js","sourceRoot":"","sources":["../../src/decorators/authenticate-user.decorator.ts"],"names":[],"mappings":";;;AAAA,+CAK2B;AAG3B,kCAAyD;AAIzD;;;;;;;;;;;;;;GAcG;AACH,SAAgB,YAAY,CAC1B,YAAoB,EACpB,OAAgB,EAChB,WAAsC,EACtC,QAAmD;IAEnD,OAAO,gCAAsB,CAAC,eAAe,CAC3C,uCAAgC,EAChC;QACE,QAAQ,EAAE,YAAY;QACtB,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE;QACtB,WAAW,EAAE,WAAW;QACxB,QAAQ;KACT,CACF,CAAC;AACJ,CAAC;AAfD,oCAeC;AAED,SAAgB,uBAAuB,CACrC,eAAgC,EAChC,UAAkB;IAElB,OAAO,2BAAiB,CAAC,iBAAiB,CACxC,uCAAgC,EAChC,eAAe,CAAC,SAAS,EACzB,UAAU,CACX,CAAC;AACJ,CAAC;AATD,0DASC"} \ No newline at end of file diff --git a/dist/decorators/index.d.ts b/dist/decorators/index.d.ts deleted file mode 100644 index 7c2274f..0000000 --- a/dist/decorators/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './authenticate-user.decorator'; -export * from './authenticate-client.decorator'; diff --git a/dist/decorators/index.js b/dist/decorators/index.js deleted file mode 100644 index 404590e..0000000 --- a/dist/decorators/index.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./authenticate-user.decorator"), exports); -tslib_1.__exportStar(require("./authenticate-client.decorator"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/decorators/index.js.map b/dist/decorators/index.js.map deleted file mode 100644 index e24c6bc..0000000 --- a/dist/decorators/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":";;;AAAA,wEAA8C;AAC9C,0EAAgD"} \ No newline at end of file diff --git a/dist/error-keys.d.ts b/dist/error-keys.d.ts deleted file mode 100644 index 3c1911b..0000000 --- a/dist/error-keys.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -export declare const enum AuthErrorKeys { - CodeExpired = "Code Expired", - TokenExpired = "Token Expired", - TokenInvalid = "Token Invalid", - ClientInvalid = "Client Invalid", - ClientVerificationFailed = "Client Verification Failed", - ClientSecretMissing = "Client Secret Missing", - ClientUserMissing = "Client User Missing", - InvalidCredentials = "Invalid Credentials", - UserVerificationFailed = "User Verification Failed", - UnknownError = "Unknown Error", - WrongPassword = "Incorrect Password", - KeyInvalid = "Key Invalid", - OtpInvalid = "Otp Invalid", - OtpExpired = "Otp Token Incorrect or Expired" -} diff --git a/dist/error-keys.js b/dist/error-keys.js deleted file mode 100644 index 1dea632..0000000 --- a/dist/error-keys.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=error-keys.js.map \ No newline at end of file diff --git a/dist/error-keys.js.map b/dist/error-keys.js.map deleted file mode 100644 index 742d3ac..0000000 --- a/dist/error-keys.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"error-keys.js","sourceRoot":"","sources":["../src/error-keys.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 01f78f7..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from './component'; -export * from './types'; -export * from './decorators'; -export * from './keys'; -export * from './strategy-adapter'; -export * from './strategy-name.enum'; -export * from './error-keys'; diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index ef6b68c..0000000 --- a/dist/index.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./component"), exports); -tslib_1.__exportStar(require("./types"), exports); -tslib_1.__exportStar(require("./decorators"), exports); -tslib_1.__exportStar(require("./keys"), exports); -tslib_1.__exportStar(require("./strategy-adapter"), exports); -tslib_1.__exportStar(require("./strategy-name.enum"), exports); -tslib_1.__exportStar(require("./error-keys"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 1536d3a..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,kDAAwB;AACxB,uDAA6B;AAC7B,iDAAuB;AACvB,6DAAmC;AACnC,+DAAqC;AACrC,uDAA6B"} \ No newline at end of file diff --git a/dist/keys.d.ts b/dist/keys.d.ts deleted file mode 100644 index d75d4f3..0000000 --- a/dist/keys.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { BindingKey } from '@loopback/context'; -import { MetadataAccessor } from '@loopback/metadata'; -import { Strategy } from 'passport'; -import { AuthenticateFn, AuthenticationMetadata, IAuthClient, IAuthUser } from './types'; -export * from './strategies/keys'; -/** - * Binding keys used by this component. - */ -export declare namespace AuthenticationBindings { - const USER_STRATEGY: BindingKey; - const CLIENT_STRATEGY: BindingKey; - const USER_AUTH_ACTION: BindingKey>; - const CLIENT_AUTH_ACTION: BindingKey>; - const USER_METADATA: BindingKey | undefined>; - const CLIENT_METADATA: BindingKey | undefined>; - const CURRENT_USER: BindingKey; - const CURRENT_CLIENT: BindingKey; -} -export declare const USER_AUTHENTICATION_METADATA_KEY: MetadataAccessor, MethodDecorator>; -export declare const CLIENT_AUTHENTICATION_METADATA_KEY: MetadataAccessor, MethodDecorator>; diff --git a/dist/keys.js b/dist/keys.js deleted file mode 100644 index 1344708..0000000 --- a/dist/keys.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CLIENT_AUTHENTICATION_METADATA_KEY = exports.USER_AUTHENTICATION_METADATA_KEY = exports.AuthenticationBindings = void 0; -const tslib_1 = require("tslib"); -const context_1 = require("@loopback/context"); -const metadata_1 = require("@loopback/metadata"); -tslib_1.__exportStar(require("./strategies/keys"), exports); -/** - * Binding keys used by this component. - */ -var AuthenticationBindings; -(function (AuthenticationBindings) { - AuthenticationBindings.USER_STRATEGY = context_1.BindingKey.create('sf.userAuthentication.strategy'); - AuthenticationBindings.CLIENT_STRATEGY = context_1.BindingKey.create('sf.clientAuthentication.strategy'); - AuthenticationBindings.USER_AUTH_ACTION = context_1.BindingKey.create('sf.userAuthentication.actions.authenticate'); - AuthenticationBindings.CLIENT_AUTH_ACTION = context_1.BindingKey.create('sf.clientAuthentication.actions.authenticate'); - AuthenticationBindings.USER_METADATA = context_1.BindingKey.create('sf.userAuthentication.operationMetadata'); - AuthenticationBindings.CLIENT_METADATA = context_1.BindingKey.create('sf.clientAuthentication.operationMetadata'); - AuthenticationBindings.CURRENT_USER = context_1.BindingKey.create('sf.userAuthentication.currentUser'); - AuthenticationBindings.CURRENT_CLIENT = context_1.BindingKey.create('sf.clientAuthentication.currentClient'); -})(AuthenticationBindings = exports.AuthenticationBindings || (exports.AuthenticationBindings = {})); -exports.USER_AUTHENTICATION_METADATA_KEY = metadata_1.MetadataAccessor.create('userAuthentication.operationsMetadata'); -exports.CLIENT_AUTHENTICATION_METADATA_KEY = metadata_1.MetadataAccessor.create('clientAuthentication.operationsMetadata'); -//# sourceMappingURL=keys.js.map \ No newline at end of file diff --git a/dist/keys.js.map b/dist/keys.js.map deleted file mode 100644 index e40f382..0000000 --- a/dist/keys.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keys.js","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":";;;;AAAA,+CAA6C;AAC7C,iDAAoD;AAUpD,4DAAkC;AAElC;;GAEG;AACH,IAAiB,sBAAsB,CAgCtC;AAhCD,WAAiB,sBAAsB;IACxB,oCAAa,GAAG,oBAAU,CAAC,MAAM,CAC5C,gCAAgC,CACjC,CAAC;IAEW,sCAAe,GAAG,oBAAU,CAAC,MAAM,CAC9C,kCAAkC,CACnC,CAAC;IAEW,uCAAgB,GAAG,oBAAU,CAAC,MAAM,CAE/C,4CAA4C,CAAC,CAAC;IAEnC,yCAAkB,GAAG,oBAAU,CAAC,MAAM,CAEjD,8CAA8C,CAAC,CAAC;IAErC,oCAAa,GAAG,oBAAU,CAAC,MAAM,CAE5C,yCAAyC,CAAC,CAAC;IAEhC,sCAAe,GAAG,oBAAU,CAAC,MAAM,CAE9C,2CAA2C,CAAC,CAAC;IAElC,mCAAY,GAAG,oBAAU,CAAC,MAAM,CAC3C,mCAAmC,CACpC,CAAC;IAEW,qCAAc,GAAG,oBAAU,CAAC,MAAM,CAC7C,uCAAuC,CACxC,CAAC;AACJ,CAAC,EAhCgB,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAgCtC;AAEY,QAAA,gCAAgC,GAAG,2BAAgB,CAAC,MAAM,CAGrE,uCAAuC,CAAC,CAAC;AAE9B,QAAA,kCAAkC,GAAG,2BAAgB,CAAC,MAAM,CAGvE,yCAAyC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/models/authuser.model.d.ts b/dist/models/authuser.model.d.ts deleted file mode 100644 index ccafc5e..0000000 --- a/dist/models/authuser.model.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Entity } from '@loopback/repository'; -export declare class Authuser extends Entity { - username: string; - password: string; - [prop: string]: any; - constructor(data?: Partial); -} -export interface AuthuserRelations { -} -export declare type AuthuserWithRelations = Authuser & AuthuserRelations; diff --git a/dist/models/authuser.model.js b/dist/models/authuser.model.js deleted file mode 100644 index a0241b8..0000000 --- a/dist/models/authuser.model.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Authuser = void 0; -const tslib_1 = require("tslib"); -const repository_1 = require("@loopback/repository"); -let Authuser = class Authuser extends repository_1.Entity { - constructor(data) { - super(data); - } -}; -tslib_1.__decorate([ - (0, repository_1.property)({ - type: 'string', - id: true, - generated: false, - required: true, - }), - tslib_1.__metadata("design:type", String) -], Authuser.prototype, "username", void 0); -tslib_1.__decorate([ - (0, repository_1.property)({ - type: 'string', - required: true, - }), - tslib_1.__metadata("design:type", String) -], Authuser.prototype, "password", void 0); -Authuser = tslib_1.__decorate([ - (0, repository_1.model)({ settings: { strict: false } }), - tslib_1.__metadata("design:paramtypes", [Object]) -], Authuser); -exports.Authuser = Authuser; -//# sourceMappingURL=authuser.model.js.map \ No newline at end of file diff --git a/dist/models/authuser.model.js.map b/dist/models/authuser.model.js.map deleted file mode 100644 index 4f76bda..0000000 --- a/dist/models/authuser.model.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"authuser.model.js","sourceRoot":"","sources":["../../src/models/authuser.model.ts"],"names":[],"mappings":";;;;AAAA,qDAA6D;AAG7D,IAAa,QAAQ,GAArB,MAAa,QAAS,SAAQ,mBAAM;IAqBlC,YAAY,IAAwB;QAClC,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;CACF,CAAA;AAjBC;IANC,IAAA,qBAAQ,EAAC;QACR,IAAI,EAAE,QAAQ;QACd,EAAE,EAAE,IAAI;QACR,SAAS,EAAE,KAAK;QAChB,QAAQ,EAAE,IAAI;KACf,CAAC;;0CACe;AAMjB;IAJC,IAAA,qBAAQ,EAAC;QACR,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;KACf,CAAC;;0CACe;AAbN,QAAQ;IADpB,IAAA,kBAAK,EAAC,EAAC,QAAQ,EAAE,EAAC,MAAM,EAAE,KAAK,EAAC,EAAC,CAAC;;GACtB,QAAQ,CAwBpB;AAxBY,4BAAQ"} \ No newline at end of file diff --git a/dist/models/index.d.ts b/dist/models/index.d.ts deleted file mode 100644 index 7d06f2b..0000000 --- a/dist/models/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './authuser.model'; diff --git a/dist/models/index.js b/dist/models/index.js deleted file mode 100644 index 2b4cc4d..0000000 --- a/dist/models/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./authuser.model"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/models/index.js.map b/dist/models/index.js.map deleted file mode 100644 index 8d4816f..0000000 --- a/dist/models/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC"} \ No newline at end of file diff --git a/dist/providers/client-auth-metadata.provider.d.ts b/dist/providers/client-auth-metadata.provider.d.ts deleted file mode 100644 index 75a03ae..0000000 --- a/dist/providers/client-auth-metadata.provider.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Constructor, Provider } from '@loopback/context'; -import { AuthenticationMetadata } from '../types'; -export declare class ClientAuthMetadataProvider implements Provider { - private readonly controllerClass; - private readonly methodName; - constructor(controllerClass: Constructor<{}>, methodName: string); - value(): AuthenticationMetadata | undefined; -} diff --git a/dist/providers/client-auth-metadata.provider.js b/dist/providers/client-auth-metadata.provider.js deleted file mode 100644 index e5a9fe2..0000000 --- a/dist/providers/client-auth-metadata.provider.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClientAuthMetadataProvider = void 0; -const tslib_1 = require("tslib"); -const context_1 = require("@loopback/context"); -const core_1 = require("@loopback/core"); -const decorators_1 = require("../decorators"); -let ClientAuthMetadataProvider = class ClientAuthMetadataProvider { - constructor(controllerClass, methodName) { - this.controllerClass = controllerClass; - this.methodName = methodName; - } - value() { - if (!this.controllerClass || !this.methodName) - return; - return (0, decorators_1.getClientAuthenticateMetadata)(this.controllerClass, this.methodName); - } -}; -ClientAuthMetadataProvider = tslib_1.__decorate([ - tslib_1.__param(0, (0, context_1.inject)(core_1.CoreBindings.CONTROLLER_CLASS, { optional: true })), - tslib_1.__param(1, (0, context_1.inject)(core_1.CoreBindings.CONTROLLER_METHOD_NAME, { optional: true })), - tslib_1.__metadata("design:paramtypes", [Object, String]) -], ClientAuthMetadataProvider); -exports.ClientAuthMetadataProvider = ClientAuthMetadataProvider; -//# sourceMappingURL=client-auth-metadata.provider.js.map \ No newline at end of file diff --git a/dist/providers/client-auth-metadata.provider.js.map b/dist/providers/client-auth-metadata.provider.js.map deleted file mode 100644 index 9203a92..0000000 --- a/dist/providers/client-auth-metadata.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"client-auth-metadata.provider.js","sourceRoot":"","sources":["../../src/providers/client-auth-metadata.provider.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,yCAA4C;AAE5C,8CAA4D;AAG5D,IAAa,0BAA0B,GAAvC,MAAa,0BAA0B;IAGrC,YAEmB,eAAgC,EAEhC,UAAkB;QAFlB,oBAAe,GAAf,eAAe,CAAiB;QAEhC,eAAU,GAAV,UAAU,CAAQ;IAClC,CAAC;IAEJ,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,OAAO;QACtD,OAAO,IAAA,0CAA6B,EAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9E,CAAC;CACF,CAAA;AAdY,0BAA0B;IAIlC,mBAAA,IAAA,gBAAM,EAAC,mBAAY,CAAC,gBAAgB,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAA;IAEvD,mBAAA,IAAA,gBAAM,EAAC,mBAAY,CAAC,sBAAsB,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAA;;GANrD,0BAA0B,CActC;AAdY,gEAA0B"} \ No newline at end of file diff --git a/dist/providers/client-authentication.provider.d.ts b/dist/providers/client-authentication.provider.d.ts deleted file mode 100644 index 415ba94..0000000 --- a/dist/providers/client-authentication.provider.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// -import { Getter, Provider, Setter } from '@loopback/context'; -import { Request } from '@loopback/rest'; -import { Strategy } from 'passport'; -import { IAuthClient, AuthenticateFn } from '../types'; -export declare class ClientAuthenticateActionProvider implements Provider> { - readonly getStrategy: Getter; - readonly setCurrentClient: Setter; - constructor(getStrategy: Getter, setCurrentClient: Setter); - value(): AuthenticateFn; - action(request: Request): Promise; -} diff --git a/dist/providers/client-authentication.provider.js b/dist/providers/client-authentication.provider.js deleted file mode 100644 index 67dd41f..0000000 --- a/dist/providers/client-authentication.provider.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClientAuthenticateActionProvider = void 0; -const tslib_1 = require("tslib"); -const context_1 = require("@loopback/context"); -const keys_1 = require("../keys"); -const strategy_adapter_1 = require("../strategy-adapter"); -const lodash_1 = require("lodash"); -let ClientAuthenticateActionProvider = class ClientAuthenticateActionProvider { - constructor(getStrategy, setCurrentClient) { - this.getStrategy = getStrategy; - this.setCurrentClient = setCurrentClient; - } - value() { - return (request) => this.action(request); - } - async action(request) { - const strategy = await this.getStrategy(); - if (!strategy) { - this.setCurrentClient(undefined); - return undefined; - } - if (!strategy.authenticate) { - throw new Error('invalid strategy parameter'); - } - const strategyAdapter = new strategy_adapter_1.StrategyAdapter(strategy); - // Added for cases, where data is passed not in body but in query parameter - if (!request.body || !(0, lodash_1.isObjectLike)(request.body) || (0, lodash_1.isEmpty)(request.body)) { - request.body = request.query; - } - const client = await strategyAdapter.authenticate(request); - if (client) { - this.setCurrentClient(client); - return client; - } - } -}; -ClientAuthenticateActionProvider = tslib_1.__decorate([ - tslib_1.__param(0, context_1.inject.getter(keys_1.AuthenticationBindings.CLIENT_STRATEGY)), - tslib_1.__param(1, context_1.inject.setter(keys_1.AuthenticationBindings.CURRENT_CLIENT)), - tslib_1.__metadata("design:paramtypes", [Function, Function]) -], ClientAuthenticateActionProvider); -exports.ClientAuthenticateActionProvider = ClientAuthenticateActionProvider; -//# sourceMappingURL=client-authentication.provider.js.map \ No newline at end of file diff --git a/dist/providers/client-authentication.provider.js.map b/dist/providers/client-authentication.provider.js.map deleted file mode 100644 index 29fc1ff..0000000 --- a/dist/providers/client-authentication.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"client-authentication.provider.js","sourceRoot":"","sources":["../../src/providers/client-authentication.provider.ts"],"names":[],"mappings":";;;;AAAA,+CAAmE;AAInE,kCAA+C;AAC/C,0DAAoD;AAEpD,mCAA6C;AAE7C,IAAa,gCAAgC,GAA7C,MAAa,gCAAgC;IAG3C,YAEW,WAA6B,EAE7B,gBAAiD;QAFjD,gBAAW,GAAX,WAAW,CAAkB;QAE7B,qBAAgB,GAAhB,gBAAgB,CAAiC;IACzD,CAAC;IAEJ,KAAK;QACH,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAgB;QAC3B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1C,IAAI,CAAC,QAAQ,EAAE;YACb,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;YACjC,OAAO,SAAS,CAAC;SAClB;QACD,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;SAC/C;QACD,MAAM,eAAe,GAAG,IAAI,kCAAe,CAAc,QAAQ,CAAC,CAAC;QACnE,2EAA2E;QAC3E,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,IAAA,qBAAY,EAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAA,gBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACzE,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC;SAC9B;QACD,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC3D,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;YAC9B,OAAO,MAAM,CAAC;SACf;IACH,CAAC;CACF,CAAA;AAlCY,gCAAgC;IAIxC,mBAAA,gBAAM,CAAC,MAAM,CAAC,6BAAsB,CAAC,eAAe,CAAC,CAAA;IAErD,mBAAA,gBAAM,CAAC,MAAM,CAAC,6BAAsB,CAAC,cAAc,CAAC,CAAA;;GAN5C,gCAAgC,CAkC5C;AAlCY,4EAAgC"} \ No newline at end of file diff --git a/dist/providers/index.d.ts b/dist/providers/index.d.ts deleted file mode 100644 index eb44a72..0000000 --- a/dist/providers/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './user-auth-metadata.provider'; -export * from './client-auth-metadata.provider'; -export * from './user-authentication.provider'; -export * from './client-authentication.provider'; diff --git a/dist/providers/index.js b/dist/providers/index.js deleted file mode 100644 index 3b7e5bd..0000000 --- a/dist/providers/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./user-auth-metadata.provider"), exports); -tslib_1.__exportStar(require("./client-auth-metadata.provider"), exports); -tslib_1.__exportStar(require("./user-authentication.provider"), exports); -tslib_1.__exportStar(require("./client-authentication.provider"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/providers/index.js.map b/dist/providers/index.js.map deleted file mode 100644 index 6bed4ef..0000000 --- a/dist/providers/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":";;;AAAA,wEAA8C;AAC9C,0EAAgD;AAChD,yEAA+C;AAC/C,2EAAiD"} \ No newline at end of file diff --git a/dist/providers/user-auth-metadata.provider.d.ts b/dist/providers/user-auth-metadata.provider.d.ts deleted file mode 100644 index cee3390..0000000 --- a/dist/providers/user-auth-metadata.provider.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Constructor, Provider } from '@loopback/context'; -import { AuthenticationMetadata } from '../types'; -export declare class AuthMetadataProvider implements Provider { - private readonly controllerClass; - private readonly methodName; - constructor(controllerClass: Constructor<{}>, methodName: string); - value(): AuthenticationMetadata | undefined; -} diff --git a/dist/providers/user-auth-metadata.provider.js b/dist/providers/user-auth-metadata.provider.js deleted file mode 100644 index b04b993..0000000 --- a/dist/providers/user-auth-metadata.provider.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AuthMetadataProvider = void 0; -const tslib_1 = require("tslib"); -const context_1 = require("@loopback/context"); -const core_1 = require("@loopback/core"); -const decorators_1 = require("../decorators"); -let AuthMetadataProvider = class AuthMetadataProvider { - constructor(controllerClass, methodName) { - this.controllerClass = controllerClass; - this.methodName = methodName; - } - value() { - if (!this.controllerClass || !this.methodName) - return; - return (0, decorators_1.getAuthenticateMetadata)(this.controllerClass, this.methodName); - } -}; -AuthMetadataProvider = tslib_1.__decorate([ - tslib_1.__param(0, (0, context_1.inject)(core_1.CoreBindings.CONTROLLER_CLASS, { optional: true })), - tslib_1.__param(1, (0, context_1.inject)(core_1.CoreBindings.CONTROLLER_METHOD_NAME, { optional: true })), - tslib_1.__metadata("design:paramtypes", [Object, String]) -], AuthMetadataProvider); -exports.AuthMetadataProvider = AuthMetadataProvider; -//# sourceMappingURL=user-auth-metadata.provider.js.map \ No newline at end of file diff --git a/dist/providers/user-auth-metadata.provider.js.map b/dist/providers/user-auth-metadata.provider.js.map deleted file mode 100644 index a685936..0000000 --- a/dist/providers/user-auth-metadata.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"user-auth-metadata.provider.js","sourceRoot":"","sources":["../../src/providers/user-auth-metadata.provider.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,yCAA4C;AAE5C,8CAAsD;AAGtD,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;IAG/B,YAEmB,eAAgC,EAEhC,UAAkB;QAFlB,oBAAe,GAAf,eAAe,CAAiB;QAEhC,eAAU,GAAV,UAAU,CAAQ;IAClC,CAAC;IAEJ,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,OAAO;QACtD,OAAO,IAAA,oCAAuB,EAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACxE,CAAC;CACF,CAAA;AAdY,oBAAoB;IAI5B,mBAAA,IAAA,gBAAM,EAAC,mBAAY,CAAC,gBAAgB,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAA;IAEvD,mBAAA,IAAA,gBAAM,EAAC,mBAAY,CAAC,sBAAsB,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAA;;GANrD,oBAAoB,CAchC;AAdY,oDAAoB"} \ No newline at end of file diff --git a/dist/providers/user-authentication.provider.d.ts b/dist/providers/user-authentication.provider.d.ts deleted file mode 100644 index 9d5a726..0000000 --- a/dist/providers/user-authentication.provider.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// -import { Getter, Provider, Setter } from '@loopback/context'; -import { Request, Response } from '@loopback/rest'; -import { Strategy } from 'passport'; -import { AuthenticateFn, IAuthUser, AuthenticationMetadata } from '../types'; -export declare class AuthenticateActionProvider implements Provider> { - readonly getStrategy: Getter; - private readonly getMetadata; - readonly setCurrentUser: Setter; - constructor(getStrategy: Getter, getMetadata: Getter, setCurrentUser: Setter); - value(): AuthenticateFn; - action(request: Request, response?: Response): Promise; -} diff --git a/dist/providers/user-authentication.provider.js b/dist/providers/user-authentication.provider.js deleted file mode 100644 index 4aa0fba..0000000 --- a/dist/providers/user-authentication.provider.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AuthenticateActionProvider = void 0; -const tslib_1 = require("tslib"); -const context_1 = require("@loopback/context"); -const rest_1 = require("@loopback/rest"); -const keys_1 = require("../keys"); -const strategy_adapter_1 = require("../strategy-adapter"); -let AuthenticateActionProvider = class AuthenticateActionProvider { - constructor(getStrategy, getMetadata, setCurrentUser) { - this.getStrategy = getStrategy; - this.getMetadata = getMetadata; - this.setCurrentUser = setCurrentUser; - } - value() { - return (request, response) => this.action(request, response); - } - async action(request, response) { - const strategy = await this.getStrategy(); - if (!strategy) { - this.setCurrentUser(undefined); - return undefined; - } - if (!strategy.authenticate) { - throw new rest_1.HttpErrors.Unauthorized("Unknown Error" /* UnknownError */); - } - // Read decorator metadata to fetch options - // to be passed on to authenticate method of strategy - const metadata = await this.getMetadata(); - let authOpts; - if (metadata === null || metadata === void 0 ? void 0 : metadata.authOptions) { - // Fetch options using creator function added with decorator definition - authOpts = metadata.authOptions(request); - } - const strategyAdapter = new strategy_adapter_1.StrategyAdapter(strategy); - const user = await strategyAdapter.authenticate(request, response, authOpts); - if (user) { - this.setCurrentUser(user); - return user; - } - } -}; -AuthenticateActionProvider = tslib_1.__decorate([ - tslib_1.__param(0, context_1.inject.getter(keys_1.AuthenticationBindings.USER_STRATEGY)), - tslib_1.__param(1, context_1.inject.getter(keys_1.AuthenticationBindings.USER_METADATA)), - tslib_1.__param(2, context_1.inject.setter(keys_1.AuthenticationBindings.CURRENT_USER)), - tslib_1.__metadata("design:paramtypes", [Function, Function, Function]) -], AuthenticateActionProvider); -exports.AuthenticateActionProvider = AuthenticateActionProvider; -//# sourceMappingURL=user-authentication.provider.js.map \ No newline at end of file diff --git a/dist/providers/user-authentication.provider.js.map b/dist/providers/user-authentication.provider.js.map deleted file mode 100644 index f6339e9..0000000 --- a/dist/providers/user-authentication.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"user-authentication.provider.js","sourceRoot":"","sources":["../../src/providers/user-authentication.provider.ts"],"names":[],"mappings":";;;;AAAA,+CAAmE;AACnE,yCAA6D;AAI7D,kCAA+C;AAC/C,0DAAoD;AAGpD,IAAa,0BAA0B,GAAvC,MAAa,0BAA0B;IAGrC,YAEW,WAA6B,EAErB,WAA2C,EAEnD,cAA6C;QAJ7C,gBAAW,GAAX,WAAW,CAAkB;QAErB,gBAAW,GAAX,WAAW,CAAgC;QAEnD,mBAAc,GAAd,cAAc,CAA+B;IACrD,CAAC;IAEJ,KAAK;QACH,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC/D,CAAC;IAED,KAAK,CAAC,MAAM,CACV,OAAgB,EAChB,QAAmB;QAEnB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1C,IAAI,CAAC,QAAQ,EAAE;YACb,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;YAC/B,OAAO,SAAS,CAAC;SAClB;QACD,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE;YAC1B,MAAM,IAAI,iBAAU,CAAC,YAAY,oCAA4B,CAAC;SAC/D;QAED,2CAA2C;QAC3C,qDAAqD;QACrD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1C,IAAI,QAAQ,CAAC;QACb,IAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,WAAW,EAAE;YACzB,uEAAuE;YACvE,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;SAC1C;QACD,MAAM,eAAe,GAAG,IAAI,kCAAe,CAAY,QAAQ,CAAC,CAAC;QACjE,MAAM,IAAI,GAAG,MAAM,eAAe,CAAC,YAAY,CAC7C,OAAO,EACP,QAAQ,EACR,QAAQ,CACT,CAAC;QACF,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC1B,OAAO,IAAI,CAAC;SACb;IACH,CAAC;CACF,CAAA;AAhDY,0BAA0B;IAIlC,mBAAA,gBAAM,CAAC,MAAM,CAAC,6BAAsB,CAAC,aAAa,CAAC,CAAA;IAEnD,mBAAA,gBAAM,CAAC,MAAM,CAAC,6BAAsB,CAAC,aAAa,CAAC,CAAA;IAEnD,mBAAA,gBAAM,CAAC,MAAM,CAAC,6BAAsB,CAAC,YAAY,CAAC,CAAA;;GAR1C,0BAA0B,CAgDtC;AAhDY,gEAA0B"} \ No newline at end of file diff --git a/dist/strategies/client-auth-strategy.provider.d.ts b/dist/strategies/client-auth-strategy.provider.d.ts deleted file mode 100644 index 5c329d7..0000000 --- a/dist/strategies/client-auth-strategy.provider.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Provider, ValueOrPromise } from '@loopback/context'; -import { Strategy } from 'passport'; -import { AuthenticationMetadata } from '../types'; -import { ClientPasswordStrategyFactory } from './passport/passport-client-password'; -export declare class ClientAuthStrategyProvider implements Provider { - private readonly clientMetadata; - private readonly getClientPasswordVerifier; - constructor(clientMetadata: AuthenticationMetadata, getClientPasswordVerifier: ClientPasswordStrategyFactory); - value(): ValueOrPromise; -} diff --git a/dist/strategies/client-auth-strategy.provider.js b/dist/strategies/client-auth-strategy.provider.js deleted file mode 100644 index b259d3f..0000000 --- a/dist/strategies/client-auth-strategy.provider.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClientAuthStrategyProvider = void 0; -const tslib_1 = require("tslib"); -const context_1 = require("@loopback/context"); -const keys_1 = require("../keys"); -const keys_2 = require("./keys"); -let ClientAuthStrategyProvider = class ClientAuthStrategyProvider { - constructor(clientMetadata, getClientPasswordVerifier) { - this.clientMetadata = clientMetadata; - this.getClientPasswordVerifier = getClientPasswordVerifier; - } - value() { - if (!this.clientMetadata) { - return undefined; - } - const name = this.clientMetadata.strategy; - if (name === "client-password" /* CLIENT_PASSWORD */) { - return this.getClientPasswordVerifier(this.clientMetadata.options); - } - else { - return Promise.reject(`The strategy ${name} is not available.`); - } - } -}; -ClientAuthStrategyProvider = tslib_1.__decorate([ - tslib_1.__param(0, (0, context_1.inject)(keys_1.AuthenticationBindings.CLIENT_METADATA)), - tslib_1.__param(1, (0, context_1.inject)(keys_2.Strategies.Passport.CLIENT_PASSWORD_STRATEGY_FACTORY)), - tslib_1.__metadata("design:paramtypes", [Object, Function]) -], ClientAuthStrategyProvider); -exports.ClientAuthStrategyProvider = ClientAuthStrategyProvider; -//# sourceMappingURL=client-auth-strategy.provider.js.map \ No newline at end of file diff --git a/dist/strategies/client-auth-strategy.provider.js.map b/dist/strategies/client-auth-strategy.provider.js.map deleted file mode 100644 index 1bf2887..0000000 --- a/dist/strategies/client-auth-strategy.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"client-auth-strategy.provider.js","sourceRoot":"","sources":["../../src/strategies/client-auth-strategy.provider.ts"],"names":[],"mappings":";;;;AAAA,+CAAmE;AAInE,kCAA+C;AAG/C,iCAAkC;AAGlC,IAAa,0BAA0B,GAAvC,MAAa,0BAA0B;IAGrC,YAEmB,cAAsC,EAEtC,yBAAwD;QAFxD,mBAAc,GAAd,cAAc,CAAwB;QAEtC,8BAAyB,GAAzB,yBAAyB,CAA+B;IACxE,CAAC;IAEJ,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACxB,OAAO,SAAS,CAAC;SAClB;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC;QAC1C,IAAI,IAAI,4CAA6B,EAAE;YACrC,OAAO,IAAI,CAAC,yBAAyB,CACnC,IAAI,CAAC,cAAc,CAAC,OAA8C,CACnE,CAAC;SACH;aAAM;YACL,OAAO,OAAO,CAAC,MAAM,CAAC,gBAAgB,IAAI,oBAAoB,CAAC,CAAC;SACjE;IACH,CAAC;CACF,CAAA;AAxBY,0BAA0B;IAIlC,mBAAA,IAAA,gBAAM,EAAC,6BAAsB,CAAC,eAAe,CAAC,CAAA;IAE9C,mBAAA,IAAA,gBAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,gCAAgC,CAAC,CAAA;;GANpD,0BAA0B,CAwBtC;AAxBY,gEAA0B"} \ No newline at end of file diff --git a/dist/strategies/index.d.ts b/dist/strategies/index.d.ts deleted file mode 100644 index 6e98671..0000000 --- a/dist/strategies/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './client-auth-strategy.provider'; -export * from './user-auth-strategy.provider'; -export * from './passport'; -export * from './types'; diff --git a/dist/strategies/index.js b/dist/strategies/index.js deleted file mode 100644 index 5875be2..0000000 --- a/dist/strategies/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./client-auth-strategy.provider"), exports); -tslib_1.__exportStar(require("./user-auth-strategy.provider"), exports); -tslib_1.__exportStar(require("./passport"), exports); -tslib_1.__exportStar(require("./types"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/strategies/index.js.map b/dist/strategies/index.js.map deleted file mode 100644 index c9a477e..0000000 --- a/dist/strategies/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/strategies/index.ts"],"names":[],"mappings":";;;AAAA,0EAAgD;AAChD,wEAA8C;AAC9C,qDAA2B;AAC3B,kDAAwB"} \ No newline at end of file diff --git a/dist/strategies/keys.d.ts b/dist/strategies/keys.d.ts deleted file mode 100644 index 5dbd7f3..0000000 --- a/dist/strategies/keys.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { BindingKey } from '@loopback/core'; -import { LocalPasswordStrategyFactory } from './passport/passport-local'; -import { BearerStrategyFactory } from './passport/passport-bearer'; -import { ResourceOwnerPasswordStrategyFactory } from './passport/passport-resource-owner-password'; -import { ClientPasswordStrategyFactory } from './passport/passport-client-password/client-password-strategy-factory-provider'; -import { GoogleAuthStrategyFactoryProvider } from './passport/passport-google-oauth2'; -import { KeycloakStrategyFactoryProvider } from './passport/passport-keycloak'; -import { AzureADAuthStrategyFactoryProvider } from './passport/passport-azure-ad'; -import { VerifyFunction } from './types'; -import { InstagramAuthStrategyFactoryProvider } from './passport'; -import { AppleAuthStrategyFactoryProvider } from './passport/passport-apple-oauth2'; -import { FacebookAuthStrategyFactoryProvider } from './passport/passport-facebook-oauth2'; -export declare namespace Strategies { - namespace Passport { - const LOCAL_STRATEGY_FACTORY: BindingKey; - const LOCAL_PASSWORD_VERIFIER: BindingKey>; - const OTP_AUTH_STRATEGY_FACTORY: BindingKey; - const OTP_VERIFIER: BindingKey>; - const CLIENT_PASSWORD_STRATEGY_FACTORY: BindingKey; - const OAUTH2_CLIENT_PASSWORD_VERIFIER: BindingKey>; - const BEARER_STRATEGY_FACTORY: BindingKey; - const BEARER_TOKEN_VERIFIER: BindingKey>; - const RESOURCE_OWNER_STRATEGY_FACTORY: BindingKey; - const RESOURCE_OWNER_PASSWORD_VERIFIER: BindingKey>; - const GOOGLE_OAUTH2_STRATEGY_FACTORY: BindingKey; - const GOOGLE_OAUTH2_VERIFIER: BindingKey>; - const AZURE_AD_STRATEGY_FACTORY: BindingKey; - const AZURE_AD_VERIFIER: BindingKey>; - const KEYCLOAK_STRATEGY_FACTORY: BindingKey; - const KEYCLOAK_VERIFIER: BindingKey>; - const INSTAGRAM_OAUTH2_STRATEGY_FACTORY: BindingKey; - const INSTAGRAM_OAUTH2_VERIFIER: BindingKey>; - const FACEBOOK_OAUTH2_STRATEGY_FACTORY: BindingKey; - const FACEBOOK_OAUTH2_VERIFIER: BindingKey>; - const APPLE_OAUTH2_STRATEGY_FACTORY: BindingKey; - const APPLE_OAUTH2_VERIFIER: BindingKey>; - } -} diff --git a/dist/strategies/keys.js b/dist/strategies/keys.js deleted file mode 100644 index 01197b7..0000000 --- a/dist/strategies/keys.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Strategies = void 0; -const core_1 = require("@loopback/core"); -var Strategies; -(function (Strategies) { - let Passport; - (function (Passport) { - // Passport-local strategy - Passport.LOCAL_STRATEGY_FACTORY = core_1.BindingKey.create('sf.passport.strategyFactory.localPassword'); - Passport.LOCAL_PASSWORD_VERIFIER = core_1.BindingKey.create('sf.passport.verifier.localPassword'); - // Passport-local-with-otp startegy - Passport.OTP_AUTH_STRATEGY_FACTORY = core_1.BindingKey.create('sf.passport.strategyFactory.otpAuth'); - Passport.OTP_VERIFIER = core_1.BindingKey.create('sf.passport.verifier.otpAuth'); - // Passport-oauth2-client-password strategy - Passport.CLIENT_PASSWORD_STRATEGY_FACTORY = core_1.BindingKey.create('sf.passport.strategyFactory.clientPassword'); - Passport.OAUTH2_CLIENT_PASSWORD_VERIFIER = core_1.BindingKey.create('sf.passport.verifier.oauth2ClientPassword'); - // Passport-bearer strategy - Passport.BEARER_STRATEGY_FACTORY = core_1.BindingKey.create('sf.passport.strategyFactory.bearer'); - Passport.BEARER_TOKEN_VERIFIER = core_1.BindingKey.create('sf.passport.verifier.bearerToken'); - // Passport-oauth2-resource-owner-password strategy - Passport.RESOURCE_OWNER_STRATEGY_FACTORY = core_1.BindingKey.create('sf.passport.strategyFactory.resourceOwnerPassword'); - Passport.RESOURCE_OWNER_PASSWORD_VERIFIER = core_1.BindingKey.create('sf.passport.verifier.resourceOwnerPassword'); - // Passport-google-oauth2 strategy - Passport.GOOGLE_OAUTH2_STRATEGY_FACTORY = core_1.BindingKey.create('sf.passport.strategyFactory.googleOauth2'); - Passport.GOOGLE_OAUTH2_VERIFIER = core_1.BindingKey.create('sf.passport.verifier.googleOauth2'); - Passport.AZURE_AD_STRATEGY_FACTORY = core_1.BindingKey.create('sf.passport.strategyFactory.azureAd'); - Passport.AZURE_AD_VERIFIER = core_1.BindingKey.create('sf.passport.verifier.azureAd'); - // Passport-keycloak strategy - Passport.KEYCLOAK_STRATEGY_FACTORY = core_1.BindingKey.create('sf.passport.strategyFactory.keycloak'); - Passport.KEYCLOAK_VERIFIER = core_1.BindingKey.create('sf.passport.verifier.keycloak'); - // Passport-instagram startegy - Passport.INSTAGRAM_OAUTH2_STRATEGY_FACTORY = core_1.BindingKey.create('sf.passport.strategyFactory.instagramOauth2'); - Passport.INSTAGRAM_OAUTH2_VERIFIER = core_1.BindingKey.create('sf.passport.verifier.instagramOauth2'); - // Passport-facebook startegy - Passport.FACEBOOK_OAUTH2_STRATEGY_FACTORY = core_1.BindingKey.create('sf.passport.strategyFactory.facebookOauth2'); - Passport.FACEBOOK_OAUTH2_VERIFIER = core_1.BindingKey.create('sf.passport.verifier.facebookOauth2'); - // Passport-apple-oauth2 strategy - Passport.APPLE_OAUTH2_STRATEGY_FACTORY = core_1.BindingKey.create('sf.passport.strategyFactory.appleOauth2'); - Passport.APPLE_OAUTH2_VERIFIER = core_1.BindingKey.create('sf.passport.verifier.appleOauth2'); - })(Passport = Strategies.Passport || (Strategies.Passport = {})); -})(Strategies = exports.Strategies || (exports.Strategies = {})); -//# sourceMappingURL=keys.js.map \ No newline at end of file diff --git a/dist/strategies/keys.js.map b/dist/strategies/keys.js.map deleted file mode 100644 index 0d83a8d..0000000 --- a/dist/strategies/keys.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../src/strategies/keys.ts"],"names":[],"mappings":";;;AAAA,yCAA0C;AAa1C,IAAiB,UAAU,CA+G1B;AA/GD,WAAiB,UAAU;IACzB,IAAiB,QAAQ,CA6GxB;IA7GD,WAAiB,QAAQ;QACvB,0BAA0B;QACb,+BAAsB,GACjC,iBAAU,CAAC,MAAM,CACf,2CAA2C,CAC5C,CAAC;QACS,gCAAuB,GAClC,iBAAU,CAAC,MAAM,CACf,oCAAoC,CACrC,CAAC;QAEJ,mCAAmC;QACtB,kCAAyB,GACpC,iBAAU,CAAC,MAAM,CACf,qCAAqC,CACtC,CAAC;QACS,qBAAY,GACvB,iBAAU,CAAC,MAAM,CACf,8BAA8B,CAC/B,CAAC;QAEJ,2CAA2C;QAC9B,yCAAgC,GAC3C,iBAAU,CAAC,MAAM,CACf,4CAA4C,CAC7C,CAAC;QACS,wCAA+B,GAC1C,iBAAU,CAAC,MAAM,CACf,2CAA2C,CAC5C,CAAC;QAEJ,2BAA2B;QACd,gCAAuB,GAClC,iBAAU,CAAC,MAAM,CACf,oCAAoC,CACrC,CAAC;QACS,8BAAqB,GAChC,iBAAU,CAAC,MAAM,CACf,kCAAkC,CACnC,CAAC;QAEJ,mDAAmD;QACtC,wCAA+B,GAC1C,iBAAU,CAAC,MAAM,CACf,mDAAmD,CACpD,CAAC;QACS,yCAAgC,GAC3C,iBAAU,CAAC,MAAM,CACf,4CAA4C,CAC7C,CAAC;QAEJ,kCAAkC;QACrB,uCAA8B,GACzC,iBAAU,CAAC,MAAM,CACf,0CAA0C,CAC3C,CAAC;QACS,+BAAsB,GACjC,iBAAU,CAAC,MAAM,CACf,mCAAmC,CACpC,CAAC;QAES,kCAAyB,GACpC,iBAAU,CAAC,MAAM,CACf,qCAAqC,CACtC,CAAC;QACS,0BAAiB,GAC5B,iBAAU,CAAC,MAAM,CACf,8BAA8B,CAC/B,CAAC;QAEJ,6BAA6B;QAChB,kCAAyB,GACpC,iBAAU,CAAC,MAAM,CACf,sCAAsC,CACvC,CAAC;QACS,0BAAiB,GAC5B,iBAAU,CAAC,MAAM,CACf,+BAA+B,CAChC,CAAC;QAEJ,8BAA8B;QACjB,0CAAiC,GAC5C,iBAAU,CAAC,MAAM,CACf,6CAA6C,CAC9C,CAAC;QACS,kCAAyB,GACpC,iBAAU,CAAC,MAAM,CACf,sCAAsC,CACvC,CAAC;QAEJ,6BAA6B;QAChB,yCAAgC,GAC3C,iBAAU,CAAC,MAAM,CACf,4CAA4C,CAC7C,CAAC;QACS,iCAAwB,GACnC,iBAAU,CAAC,MAAM,CACf,qCAAqC,CACtC,CAAC;QAEJ,iCAAiC;QACpB,sCAA6B,GACxC,iBAAU,CAAC,MAAM,CACf,yCAAyC,CAC1C,CAAC;QACS,8BAAqB,GAChC,iBAAU,CAAC,MAAM,CACf,kCAAkC,CACnC,CAAC;IACN,CAAC,EA7GgB,QAAQ,GAAR,mBAAQ,KAAR,mBAAQ,QA6GxB;AACH,CAAC,EA/GgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QA+G1B"} \ No newline at end of file diff --git a/dist/strategies/passport/index.d.ts b/dist/strategies/passport/index.d.ts deleted file mode 100644 index 95e8c07..0000000 --- a/dist/strategies/passport/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -export * from './passport-bearer'; -export * from './passport-client-password'; -export * from './passport-local'; -export * from './passport-resource-owner-password'; -export * from './passport-keycloak'; -export * from './passport-google-oauth2'; -export * from './passport-azure-ad'; -export * from './passport-insta-oauth2'; -export * from './passport-apple-oauth2'; -export * from './passport-facebook-oauth2'; -export * from './passport-otp'; diff --git a/dist/strategies/passport/index.js b/dist/strategies/passport/index.js deleted file mode 100644 index 42c3faa..0000000 --- a/dist/strategies/passport/index.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./passport-bearer"), exports); -tslib_1.__exportStar(require("./passport-client-password"), exports); -tslib_1.__exportStar(require("./passport-local"), exports); -tslib_1.__exportStar(require("./passport-resource-owner-password"), exports); -tslib_1.__exportStar(require("./passport-keycloak"), exports); -tslib_1.__exportStar(require("./passport-google-oauth2"), exports); -tslib_1.__exportStar(require("./passport-azure-ad"), exports); -tslib_1.__exportStar(require("./passport-insta-oauth2"), exports); -tslib_1.__exportStar(require("./passport-apple-oauth2"), exports); -tslib_1.__exportStar(require("./passport-facebook-oauth2"), exports); -tslib_1.__exportStar(require("./passport-otp"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/strategies/passport/index.js.map b/dist/strategies/passport/index.js.map deleted file mode 100644 index c8f050c..0000000 --- a/dist/strategies/passport/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/strategies/passport/index.ts"],"names":[],"mappings":";;;AAAA,4DAAkC;AAClC,qEAA2C;AAC3C,2DAAiC;AACjC,6EAAmD;AACnD,8DAAoC;AACpC,mEAAyC;AACzC,8DAAoC;AACpC,kEAAwC;AACxC,kEAAwC;AACxC,qEAA2C;AAC3C,yDAA+B"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-apple-oauth2/apple-auth-strategy-factory-provider.d.ts b/dist/strategies/passport/passport-apple-oauth2/apple-auth-strategy-factory-provider.d.ts deleted file mode 100644 index ac334de..0000000 --- a/dist/strategies/passport/passport-apple-oauth2/apple-auth-strategy-factory-provider.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Provider } from '@loopback/core'; -import { AuthenticateOptions, AuthenticateOptionsWithRequest } from 'passport-apple'; -import { VerifyFunction } from '../../types'; -import Strategy from 'passport-apple'; -export interface AppleAuthStrategyFactory { - (options: AuthenticateOptions | AuthenticateOptionsWithRequest, verifierPassed?: VerifyFunction.AppleAuthFn): Strategy; -} -export declare class AppleAuthStrategyFactoryProvider implements Provider { - private readonly verifierAppleAuth; - constructor(verifierAppleAuth: VerifyFunction.AppleAuthFn); - value(): AppleAuthStrategyFactory; - getAppleAuthStrategyVerifier(options: AuthenticateOptions | AuthenticateOptionsWithRequest, verifierPassed?: VerifyFunction.AppleAuthFn): Strategy; - private _setupProxy; -} diff --git a/dist/strategies/passport/passport-apple-oauth2/apple-auth-strategy-factory-provider.js b/dist/strategies/passport/passport-apple-oauth2/apple-auth-strategy-factory-provider.js deleted file mode 100644 index 02705f0..0000000 --- a/dist/strategies/passport/passport-apple-oauth2/apple-auth-strategy-factory-provider.js +++ /dev/null @@ -1,74 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AppleAuthStrategyFactoryProvider = void 0; -const tslib_1 = require("tslib"); -const core_1 = require("@loopback/core"); -const rest_1 = require("@loopback/rest"); -const https_proxy_agent_1 = require("https-proxy-agent"); -const keys_1 = require("../../keys"); -const passport_apple_1 = tslib_1.__importDefault(require("passport-apple")); -let AppleAuthStrategyFactoryProvider = class AppleAuthStrategyFactoryProvider { - constructor(verifierAppleAuth) { - this.verifierAppleAuth = verifierAppleAuth; - } - value() { - return (options, verifier) => this.getAppleAuthStrategyVerifier(options, verifier); - } - getAppleAuthStrategyVerifier(options, verifierPassed) { - const verifyFn = verifierPassed !== null && verifierPassed !== void 0 ? verifierPassed : this.verifierAppleAuth; - let strategy; - if (options && options.passReqToCallback === true) { - strategy = new passport_apple_1.default(options, - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (req, accessToken, refreshToken, decodedIdToken, profile, cb) => { - try { - const user = await verifyFn(accessToken, refreshToken, decodedIdToken, profile, cb, req); - if (!user) { - throw new rest_1.HttpErrors.Unauthorized("Invalid Credentials" /* InvalidCredentials */); - } - cb(undefined, user); - } - catch (err) { - cb(err); - } - }); - } - else { - strategy = new passport_apple_1.default(options, - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (accessToken, refreshToken, decodedIdToken, profile, cb) => { - try { - const user = await verifyFn(accessToken, refreshToken, decodedIdToken, profile, cb); - if (!user) { - throw new rest_1.HttpErrors.Unauthorized("Invalid Credentials" /* InvalidCredentials */); - } - cb(undefined, user); - } - catch (err) { - cb(err); - } - }); - } - this._setupProxy(strategy); - return strategy; - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - _setupProxy(strategy) { - // Setup proxy if any - let httpsProxyAgent; - if (process.env['https_proxy']) { - httpsProxyAgent = new https_proxy_agent_1.HttpsProxyAgent(process.env['https_proxy']); - strategy._oauth2.setAgent(httpsProxyAgent); - } - else if (process.env['HTTPS_PROXY']) { - httpsProxyAgent = new https_proxy_agent_1.HttpsProxyAgent(process.env['HTTPS_PROXY']); - strategy._oauth2.setAgent(httpsProxyAgent); - } - } -}; -AppleAuthStrategyFactoryProvider = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_1.Strategies.Passport.APPLE_OAUTH2_VERIFIER)), - tslib_1.__metadata("design:paramtypes", [Function]) -], AppleAuthStrategyFactoryProvider); -exports.AppleAuthStrategyFactoryProvider = AppleAuthStrategyFactoryProvider; -//# sourceMappingURL=apple-auth-strategy-factory-provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-apple-oauth2/apple-auth-strategy-factory-provider.js.map b/dist/strategies/passport/passport-apple-oauth2/apple-auth-strategy-factory-provider.js.map deleted file mode 100644 index 5616859..0000000 --- a/dist/strategies/passport/passport-apple-oauth2/apple-auth-strategy-factory-provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"apple-auth-strategy-factory-provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-apple-oauth2/apple-auth-strategy-factory-provider.ts"],"names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kB,EAClB,EAAE;gBACF,IAAI;oBACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CACzB,WAAW,EACX,YAAY,EACZ,cAAc,EACd,OAAO,EACP,EAAE,CACH,CAAC;oBACF,IAAI,CAAC,IAAI,EAAE;wBACT,MAAM,IAAI,iBAAU,CAAC,YAAY,gDAEhC,CAAC;qBACH;oBACD,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;iBACrB;gBAAC,OAAO,GAAG,EAAE;oBACZ,EAAE,CAAC,GAAG,CAAC,CAAC;iBACT;YACH,CAAC,CACF,CAAC;SACH;QAED,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC3B,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,8DAA8D;IACtD,WAAW,CAAC,QAAa;QAC/B,qBAAqB;QACrB,IAAI,eAAe,CAAC;QACpB,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE;YAC9B,eAAe,GAAG,IAAI,mCAAe,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;YAClE,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;SAC5C;aAAM,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE;YACrC,eAAe,GAAG,IAAI,mCAAe,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;YAClE,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;SAC5C;IACH,CAAC;CACF,CAAA;AApGY,gCAAgC;IAIxC,mBAAA,IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAA;;GAJzC,gCAAgC,CAoG5C;AApGY,4EAAgC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-apple-oauth2/apple-auth-verify.provider.d.ts b/dist/strategies/passport/passport-apple-oauth2/apple-auth-verify.provider.d.ts deleted file mode 100644 index f695425..0000000 --- a/dist/strategies/passport/passport-apple-oauth2/apple-auth-verify.provider.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Provider } from '@loopback/context'; -import { VerifyFunction } from '../../types'; -export declare class AppleAuthVerifyProvider implements Provider { - constructor(); - value(): VerifyFunction.AppleAuthFn; -} diff --git a/dist/strategies/passport/passport-apple-oauth2/apple-auth-verify.provider.js b/dist/strategies/passport/passport-apple-oauth2/apple-auth-verify.provider.js deleted file mode 100644 index 375cf89..0000000 --- a/dist/strategies/passport/passport-apple-oauth2/apple-auth-verify.provider.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AppleAuthVerifyProvider = void 0; -const rest_1 = require("@loopback/rest"); -class AppleAuthVerifyProvider { - constructor() { } - value() { - return async (accessToken, refreshToken, decodedIdToken, profile, cb, req) => { - throw new rest_1.HttpErrors.NotImplemented(`VerifyFunction.AppleAuthFn is not implemented`); - }; - } -} -exports.AppleAuthVerifyProvider = AppleAuthVerifyProvider; -//# sourceMappingURL=apple-auth-verify.provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-apple-oauth2/apple-auth-verify.provider.js.map b/dist/strategies/passport/passport-apple-oauth2/apple-auth-verify.provider.js.map deleted file mode 100644 index c1a9260..0000000 --- a/dist/strategies/passport/passport-apple-oauth2/apple-auth-verify.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"apple-auth-verify.provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-apple-oauth2/apple-auth-verify.provider.ts"],"names":[],"mappings":";;;AACA,yCAAmD;AAOnD,MAAa,uBAAuB;IAGlC,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EACV,WAAmB,EACnB,YAAoB,EACpB,cAA8B,EAC9B,OAA8B,EAC9B,EAAgC,EAChC,GAAa,EACb,EAAE;YACF,MAAM,IAAI,iBAAU,CAAC,cAAc,CACjC,+CAA+C,CAChD,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF;AAnBD,0DAmBC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-apple-oauth2/index.d.ts b/dist/strategies/passport/passport-apple-oauth2/index.d.ts deleted file mode 100644 index 099aed3..0000000 --- a/dist/strategies/passport/passport-apple-oauth2/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './apple-auth-strategy-factory-provider'; -export * from './apple-auth-verify.provider'; -export * from './passport-apple'; diff --git a/dist/strategies/passport/passport-apple-oauth2/index.js b/dist/strategies/passport/passport-apple-oauth2/index.js deleted file mode 100644 index 1165a68..0000000 --- a/dist/strategies/passport/passport-apple-oauth2/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./apple-auth-strategy-factory-provider"), exports); -tslib_1.__exportStar(require("./apple-auth-verify.provider"), exports); -tslib_1.__exportStar(require("./passport-apple"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-apple-oauth2/index.js.map b/dist/strategies/passport/passport-apple-oauth2/index.js.map deleted file mode 100644 index 594631c..0000000 --- a/dist/strategies/passport/passport-apple-oauth2/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-apple-oauth2/index.ts"],"names":[],"mappings":";;;AAAA,iFAAuD;AACvD,uEAA6C;AAC7C,2DAAiC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-apple-oauth2/passport-apple.d.ts b/dist/strategies/passport/passport-apple-oauth2/passport-apple.d.ts deleted file mode 100644 index 5282c3c..0000000 --- a/dist/strategies/passport/passport-apple-oauth2/passport-apple.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import * as express from 'express'; -import * as oauth2 from 'passport-oauth2'; -import * as AppleStrategy from 'passport-apple'; -declare module 'passport-apple' { - interface AppleCallbackParameters { - access_token: string; - refresh_token?: string; - id_token?: string; - expires_in: number; - scope: string; - token_type: string; - } - class Strategy extends oauth2.Strategy { - constructor(options: AppleStrategy.AuthenticateOptions, verify: (accessToken: string, refreshToken: string, idToken: string, profile: AppleStrategy.Profile, done: AppleStrategy.VerifyCallback) => void); - constructor(options: AppleStrategy.AuthenticateOptions, verify: (accessToken: string, refreshToken: string, idToken: string, params: AppleCallbackParameters, profile: AppleStrategy.Profile, done: AppleStrategy.VerifyCallback) => void); - constructor(options: AppleStrategy.AuthenticateOptionsWithRequest, verify: (req: express.Request, accessToken: string, refreshToken: string, idToken: string, profile: AppleStrategy.Profile, done: AppleStrategy.VerifyCallback) => void); - constructor(options: AppleStrategy.AuthenticateOptionsWithRequest, verify: (req: express.Request, accessToken: string, refreshToken: string, idToken: string, params: AppleCallbackParameters, profile: AppleStrategy.Profile, done: AppleStrategy.VerifyCallback) => void); - } -} diff --git a/dist/strategies/passport/passport-apple-oauth2/passport-apple.js b/dist/strategies/passport/passport-apple-oauth2/passport-apple.js deleted file mode 100644 index 2c64cfd..0000000 --- a/dist/strategies/passport/passport-apple-oauth2/passport-apple.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -const oauth2 = tslib_1.__importStar(require("passport-oauth2")); -//# sourceMappingURL=passport-apple.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-apple-oauth2/passport-apple.js.map b/dist/strategies/passport/passport-apple-oauth2/passport-apple.js.map deleted file mode 100644 index 38b7edb..0000000 --- a/dist/strategies/passport/passport-apple-oauth2/passport-apple.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"passport-apple.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-apple-oauth2/passport-apple.ts"],"names":[],"mappings":";;;AAEA,gEAA0C"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-azure-ad/azuread-auth-strategy-factory-provider.d.ts b/dist/strategies/passport/passport-azure-ad/azuread-auth-strategy-factory-provider.d.ts deleted file mode 100644 index 0eae539..0000000 --- a/dist/strategies/passport/passport-azure-ad/azuread-auth-strategy-factory-provider.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Provider } from '@loopback/core'; -import { VerifyFunction } from '../../types'; -import { OIDCStrategy, IOIDCStrategyOptionWithRequest, IOIDCStrategyOptionWithoutRequest } from 'passport-azure-ad'; -export interface AzureADAuthStrategyFactory { - (options: IOIDCStrategyOptionWithoutRequest | IOIDCStrategyOptionWithRequest, verifierPassed?: VerifyFunction.AzureADAuthFn): OIDCStrategy; -} -export declare class AzureADAuthStrategyFactoryProvider implements Provider { - private readonly verifierAzureADAuth; - constructor(verifierAzureADAuth: VerifyFunction.AzureADAuthFn); - value(): AzureADAuthStrategyFactory; - getAzureADAuthStrategyVerifier(options: IOIDCStrategyOptionWithoutRequest | IOIDCStrategyOptionWithRequest, verifierPassed?: VerifyFunction.AzureADAuthFn): OIDCStrategy; -} diff --git a/dist/strategies/passport/passport-azure-ad/azuread-auth-strategy-factory-provider.js b/dist/strategies/passport/passport-azure-ad/azuread-auth-strategy-factory-provider.js deleted file mode 100644 index d938939..0000000 --- a/dist/strategies/passport/passport-azure-ad/azuread-auth-strategy-factory-provider.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AzureADAuthStrategyFactoryProvider = void 0; -const tslib_1 = require("tslib"); -const core_1 = require("@loopback/core"); -const rest_1 = require("@loopback/rest"); -const keys_1 = require("../../keys"); -const passport_azure_ad_1 = require("passport-azure-ad"); -let AzureADAuthStrategyFactoryProvider = class AzureADAuthStrategyFactoryProvider { - constructor(verifierAzureADAuth) { - this.verifierAzureADAuth = verifierAzureADAuth; - } - value() { - return (options, verifier) => this.getAzureADAuthStrategyVerifier(options, verifier); - } - getAzureADAuthStrategyVerifier(options, verifierPassed) { - const verifyFn = verifierPassed !== null && verifierPassed !== void 0 ? verifierPassed : this.verifierAzureADAuth; - if (options && options.passReqToCallback === true) { - return new passport_azure_ad_1.OIDCStrategy(options, - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (req, profile, done) => { - if (!profile.oid) { - return done(new Error('No oid found'), null); - } - try { - const user = await verifyFn(profile, done, req); - if (!user) { - throw new rest_1.HttpErrors.Unauthorized("Invalid Credentials" /* InvalidCredentials */); - } - done(null, user); - } - catch (err) { - done(err); - } - }); - } - else if (options && options.passReqToCallback === false) { - return new passport_azure_ad_1.OIDCStrategy(options, - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (profile, done) => { - if (!profile.oid) { - return done(new Error('No oid found'), null); - } - try { - const user = await verifyFn(profile, done); - if (!user) { - throw new rest_1.HttpErrors.Unauthorized("Invalid Credentials" /* InvalidCredentials */); - } - done(null, user); - } - catch (err) { - done(err); - } - }); - } - else { - throw new Error('Invalid value for passReqToCallback'); - } - } -}; -AzureADAuthStrategyFactoryProvider = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_1.Strategies.Passport.AZURE_AD_VERIFIER)), - tslib_1.__metadata("design:paramtypes", [Function]) -], AzureADAuthStrategyFactoryProvider); -exports.AzureADAuthStrategyFactoryProvider = AzureADAuthStrategyFactoryProvider; -//# sourceMappingURL=azuread-auth-strategy-factory-provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-azure-ad/azuread-auth-strategy-factory-provider.js.map b/dist/strategies/passport/passport-azure-ad/azuread-auth-strategy-factory-provider.js.map deleted file mode 100644 index 58b6723..0000000 --- a/dist/strategies/passport/passport-azure-ad/azuread-auth-strategy-factory-provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"azuread-auth-strategy-factory-provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-azure-ad/azuread-auth-strategy-factory-provider.ts"],"names":[],"mappings":";;;;AAAA,yCAAgD;AAChD,yCAAmD;AAGnD,qCAAsC;AAEtC,yDAM2B;AAS3B,IAAa,kCAAkC,GAA/C,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,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC,CAAC;iBAC9C;gBAED,IAAI;oBACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;oBAC3C,IAAI,CAAC,IAAI,EAAE;wBACT,MAAM,IAAI,iBAAU,CAAC,YAAY,gDAEhC,CAAC;qBACH;oBACD,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;iBAClB;gBAAC,OAAO,GAAG,EAAE;oBACZ,IAAI,CAAC,GAAG,CAAC,CAAC;iBACX;YACH,CAAC,CACF,CAAC;SACH;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;SACxD;IACH,CAAC;CACF,CAAA;AApEY,kCAAkC;IAI1C,mBAAA,IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAA;;GAJrC,kCAAkC,CAoE9C;AApEY,gFAAkC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-azure-ad/azuread-auth-verify.provider.d.ts b/dist/strategies/passport/passport-azure-ad/azuread-auth-verify.provider.d.ts deleted file mode 100644 index 9b84cdd..0000000 --- a/dist/strategies/passport/passport-azure-ad/azuread-auth-verify.provider.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Provider } from '@loopback/context'; -import { VerifyFunction } from '../../types'; -/** - * A provider for default implementation of VerifyFunction.LocalPasswordFn - * - * It will just throw an error saying Not Implemented - */ -export declare class AzureADAuthVerifyProvider implements Provider { - constructor(); - value(): VerifyFunction.AzureADAuthFn; -} diff --git a/dist/strategies/passport/passport-azure-ad/azuread-auth-verify.provider.js b/dist/strategies/passport/passport-azure-ad/azuread-auth-verify.provider.js deleted file mode 100644 index c26de31..0000000 --- a/dist/strategies/passport/passport-azure-ad/azuread-auth-verify.provider.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AzureADAuthVerifyProvider = void 0; -const rest_1 = require("@loopback/rest"); -/** - * A provider for default implementation of VerifyFunction.LocalPasswordFn - * - * It will just throw an error saying Not Implemented - */ -class AzureADAuthVerifyProvider { - constructor() { } - value() { - return async (profile, done, req) => { - throw new rest_1.HttpErrors.NotImplemented(`VerifyFunction.AzureADAuthFn is not implemented`); - }; - } -} -exports.AzureADAuthVerifyProvider = AzureADAuthVerifyProvider; -//# sourceMappingURL=azuread-auth-verify.provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-azure-ad/azuread-auth-verify.provider.js.map b/dist/strategies/passport/passport-azure-ad/azuread-auth-verify.provider.js.map deleted file mode 100644 index ab8ae3e..0000000 --- a/dist/strategies/passport/passport-azure-ad/azuread-auth-verify.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"azuread-auth-verify.provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-azure-ad/azuread-auth-verify.provider.ts"],"names":[],"mappings":";;;AACA,yCAAmD;AAKnD;;;;GAIG;AACH,MAAa,yBAAyB;IAGpC,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EACV,OAAiC,EACjC,IAAoC,EACpC,GAAa,EACb,EAAE;YACF,MAAM,IAAI,iBAAU,CAAC,cAAc,CACjC,iDAAiD,CAClD,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF;AAhBD,8DAgBC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-azure-ad/index.d.ts b/dist/strategies/passport/passport-azure-ad/index.d.ts deleted file mode 100644 index 753477d..0000000 --- a/dist/strategies/passport/passport-azure-ad/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './azuread-auth-strategy-factory-provider'; -export * from './azuread-auth-verify.provider'; diff --git a/dist/strategies/passport/passport-azure-ad/index.js b/dist/strategies/passport/passport-azure-ad/index.js deleted file mode 100644 index a4c4eff..0000000 --- a/dist/strategies/passport/passport-azure-ad/index.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./azuread-auth-strategy-factory-provider"), exports); -tslib_1.__exportStar(require("./azuread-auth-verify.provider"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-azure-ad/index.js.map b/dist/strategies/passport/passport-azure-ad/index.js.map deleted file mode 100644 index 08363a1..0000000 --- a/dist/strategies/passport/passport-azure-ad/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-azure-ad/index.ts"],"names":[],"mappings":";;;AAAA,mFAAyD;AACzD,yEAA+C"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-bearer/bearer-strategy-factory-provider.d.ts b/dist/strategies/passport/passport-bearer/bearer-strategy-factory-provider.d.ts deleted file mode 100644 index f8eacd7..0000000 --- a/dist/strategies/passport/passport-bearer/bearer-strategy-factory-provider.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Provider } from '@loopback/core'; -import * as PassportBearer from 'passport-http-bearer'; -import { VerifyFunction } from '../../types'; -export interface BearerStrategyFactory { - (options?: PassportBearer.IStrategyOptions, verifierPassed?: VerifyFunction.BearerFn): PassportBearer.Strategy; -} -export declare class BearerStrategyFactoryProvider implements Provider { - private readonly verifierBearer; - constructor(verifierBearer: VerifyFunction.BearerFn); - value(): BearerStrategyFactory; - getBearerStrategyVerifier(options?: PassportBearer.IStrategyOptions, verifierPassed?: VerifyFunction.BearerFn): PassportBearer.Strategy; -} diff --git a/dist/strategies/passport/passport-bearer/bearer-strategy-factory-provider.js b/dist/strategies/passport/passport-bearer/bearer-strategy-factory-provider.js deleted file mode 100644 index c698d3e..0000000 --- a/dist/strategies/passport/passport-bearer/bearer-strategy-factory-provider.js +++ /dev/null @@ -1,74 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BearerStrategyFactoryProvider = void 0; -const tslib_1 = require("tslib"); -const core_1 = require("@loopback/core"); -const rest_1 = require("@loopback/rest"); -const PassportBearer = tslib_1.__importStar(require("passport-http-bearer")); -const keys_1 = require("../../keys"); -const lodash_1 = require("lodash"); -let BearerStrategyFactoryProvider = class BearerStrategyFactoryProvider { - constructor(verifierBearer) { - this.verifierBearer = verifierBearer; - } - value() { - return (options, verifier) => this.getBearerStrategyVerifier(options, verifier); - } - getBearerStrategyVerifier(options, verifierPassed) { - const verifyFn = verifierPassed !== null && verifierPassed !== void 0 ? verifierPassed : this.verifierBearer; - if (options === null || options === void 0 ? void 0 : options.passReqToCallback) { - return new PassportBearer.Strategy(options, - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (req, token, cb) => { - try { - const user = await verifyFn(token, req); - if (!user) { - throw new rest_1.HttpErrors.Unauthorized("Token Invalid" /* TokenInvalid */); - } - cb(null, user); - } - catch (err) { - cb(err); - } - }); - } - else if (!!options && !(0, lodash_1.isEmpty)(options)) { - return new PassportBearer.Strategy(options, - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (token, cb) => { - try { - const user = await verifyFn(token); - if (!user) { - throw new rest_1.HttpErrors.Unauthorized("Token Invalid" /* TokenInvalid */); - } - cb(null, user); - } - catch (err) { - cb(err); - } - }); - } - else { - return new PassportBearer.Strategy( - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (token, cb) => { - try { - const user = await verifyFn(token); - if (!user) { - throw new rest_1.HttpErrors.Unauthorized("Invalid Credentials" /* InvalidCredentials */); - } - cb(null, user); - } - catch (err) { - cb(err); - } - }); - } - } -}; -BearerStrategyFactoryProvider = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_1.Strategies.Passport.BEARER_TOKEN_VERIFIER)), - tslib_1.__metadata("design:paramtypes", [Function]) -], BearerStrategyFactoryProvider); -exports.BearerStrategyFactoryProvider = BearerStrategyFactoryProvider; -//# sourceMappingURL=bearer-strategy-factory-provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-bearer/bearer-strategy-factory-provider.js.map b/dist/strategies/passport/passport-bearer/bearer-strategy-factory-provider.js.map deleted file mode 100644 index 0aa2116..0000000 --- a/dist/strategies/passport/passport-bearer/bearer-strategy-factory-provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bearer-strategy-factory-provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-bearer/bearer-strategy-factory-provider.ts"],"names":[],"mappings":";;;;AAAA,yCAAgD;AAChD,yCAAmD;AACnD,6EAAuD;AAIvD,qCAAsC;AAEtC,mCAA+B;AAS/B,IAAa,6BAA6B,GAA1C,MAAa,6BAA6B;IAGxC,YAEmB,cAAuC;QAAvC,mBAAc,GAAd,cAAc,CAAyB;IACvD,CAAC;IAEJ,KAAK;QACH,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAC3B,IAAI,CAAC,yBAAyB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED,yBAAyB,CACvB,OAAyC,EACzC,cAAwC;QAExC,MAAM,QAAQ,GAAG,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,IAAI,CAAC,cAAc,CAAC;QACvD,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,iBAAiB,EAAE;YAC9B,OAAO,IAAI,cAAc,CAAC,QAAQ,CAChC,OAAO;YACP,kEAAkE;YAClE,KAAK,EACH,GAAY,EACZ,KAAa,EACb,EAAyD,EACzD,EAAE;gBACF,IAAI;oBACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;oBACxC,IAAI,CAAC,IAAI,EAAE;wBACT,MAAM,IAAI,iBAAU,CAAC,YAAY,oCAA4B,CAAC;qBAC/D;oBACD,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;iBAChB;gBAAC,OAAO,GAAG,EAAE;oBACZ,EAAE,CAAC,GAAG,CAAC,CAAC;iBACT;YACH,CAAC,CACF,CAAC;SACH;aAAM,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,IAAA,gBAAO,EAAC,OAAO,CAAC,EAAE;YACzC,OAAO,IAAI,cAAc,CAAC,QAAQ,CAChC,OAAO;YAEP,kEAAkE;YAClE,KAAK,EACH,KAAa,EACb,EAAyD,EACzD,EAAE;gBACF,IAAI;oBACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC;oBACnC,IAAI,CAAC,IAAI,EAAE;wBACT,MAAM,IAAI,iBAAU,CAAC,YAAY,oCAA4B,CAAC;qBAC/D;oBACD,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;iBAChB;gBAAC,OAAO,GAAG,EAAE;oBACZ,EAAE,CAAC,GAAG,CAAC,CAAC;iBACT;YACH,CAAC,CACF,CAAC;SACH;aAAM;YACL,OAAO,IAAI,cAAc,CAAC,QAAQ;YAChC,kEAAkE;YAClE,KAAK,EACH,KAAa,EACb,EAAyD,EACzD,EAAE;gBACF,IAAI;oBACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC;oBACnC,IAAI,CAAC,IAAI,EAAE;wBACT,MAAM,IAAI,iBAAU,CAAC,YAAY,gDAEhC,CAAC;qBACH;oBACD,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;iBAChB;gBAAC,OAAO,GAAG,EAAE;oBACZ,EAAE,CAAC,GAAG,CAAC,CAAC;iBACT;YACH,CAAC,CACF,CAAC;SACH;IACH,CAAC;CACF,CAAA;AAhFY,6BAA6B;IAIrC,mBAAA,IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAA;;GAJzC,6BAA6B,CAgFzC;AAhFY,sEAA6B"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-bearer/bearer-token-verify.provider.d.ts b/dist/strategies/passport/passport-bearer/bearer-token-verify.provider.d.ts deleted file mode 100644 index 682b4a7..0000000 --- a/dist/strategies/passport/passport-bearer/bearer-token-verify.provider.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Provider } from '@loopback/context'; -import { VerifyFunction } from '../../types'; -/** - * A provider for default implementation of VerifyFunction.BearerFn - * - * It will just throw an error saying Not Implemented - */ -export declare class BearerTokenVerifyProvider implements Provider { - constructor(); - value(): VerifyFunction.BearerFn; -} diff --git a/dist/strategies/passport/passport-bearer/bearer-token-verify.provider.js b/dist/strategies/passport/passport-bearer/bearer-token-verify.provider.js deleted file mode 100644 index 15de862..0000000 --- a/dist/strategies/passport/passport-bearer/bearer-token-verify.provider.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BearerTokenVerifyProvider = void 0; -const rest_1 = require("@loopback/rest"); -/** - * A provider for default implementation of VerifyFunction.BearerFn - * - * It will just throw an error saying Not Implemented - */ -class BearerTokenVerifyProvider { - constructor() { } - value() { - return async (token) => { - throw new rest_1.HttpErrors.NotImplemented(`VerifyFunction.BearerFn is not implemented`); - }; - } -} -exports.BearerTokenVerifyProvider = BearerTokenVerifyProvider; -//# sourceMappingURL=bearer-token-verify.provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-bearer/bearer-token-verify.provider.js.map b/dist/strategies/passport/passport-bearer/bearer-token-verify.provider.js.map deleted file mode 100644 index 562249c..0000000 --- a/dist/strategies/passport/passport-bearer/bearer-token-verify.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bearer-token-verify.provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-bearer/bearer-token-verify.provider.ts"],"names":[],"mappings":";;;AACA,yCAA0C;AAI1C;;;;GAIG;AACH,MAAa,yBAAyB;IAGpC,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EAAE,KAAa,EAAE,EAAE;YAC7B,MAAM,IAAI,iBAAU,CAAC,cAAc,CACjC,4CAA4C,CAC7C,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF;AAZD,8DAYC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-bearer/index.d.ts b/dist/strategies/passport/passport-bearer/index.d.ts deleted file mode 100644 index 3f8143d..0000000 --- a/dist/strategies/passport/passport-bearer/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './bearer-token-verify.provider'; -export * from './bearer-strategy-factory-provider'; diff --git a/dist/strategies/passport/passport-bearer/index.js b/dist/strategies/passport/passport-bearer/index.js deleted file mode 100644 index 5cd59af..0000000 --- a/dist/strategies/passport/passport-bearer/index.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./bearer-token-verify.provider"), exports); -tslib_1.__exportStar(require("./bearer-strategy-factory-provider"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-bearer/index.js.map b/dist/strategies/passport/passport-bearer/index.js.map deleted file mode 100644 index 7ef2261..0000000 --- a/dist/strategies/passport/passport-bearer/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-bearer/index.ts"],"names":[],"mappings":";;;AAAA,yEAA+C;AAC/C,6EAAmD"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-client-password/client-password-strategy-factory-provider.d.ts b/dist/strategies/passport/passport-client-password/client-password-strategy-factory-provider.d.ts deleted file mode 100644 index d07209d..0000000 --- a/dist/strategies/passport/passport-client-password/client-password-strategy-factory-provider.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Provider } from '@loopback/core'; -import * as ClientPasswordStrategy from 'passport-oauth2-client-password'; -import { VerifyFunction } from '../../types'; -export interface ClientPasswordStrategyFactory { - (options?: ClientPasswordStrategy.StrategyOptionsWithRequestInterface, verifierPassed?: VerifyFunction.OauthClientPasswordFn): ClientPasswordStrategy.Strategy; -} -export declare class ClientPasswordStrategyFactoryProvider implements Provider { - private readonly verifier; - constructor(verifier: VerifyFunction.OauthClientPasswordFn); - value(): ClientPasswordStrategyFactory; - getClientPasswordVerifier(options?: ClientPasswordStrategy.StrategyOptionsWithRequestInterface, verifierPassed?: VerifyFunction.OauthClientPasswordFn): ClientPasswordStrategy.Strategy; -} diff --git a/dist/strategies/passport/passport-client-password/client-password-strategy-factory-provider.js b/dist/strategies/passport/passport-client-password/client-password-strategy-factory-provider.js deleted file mode 100644 index 29ea6d9..0000000 --- a/dist/strategies/passport/passport-client-password/client-password-strategy-factory-provider.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClientPasswordStrategyFactoryProvider = void 0; -const tslib_1 = require("tslib"); -const core_1 = require("@loopback/core"); -const rest_1 = require("@loopback/rest"); -const ClientPasswordStrategy = tslib_1.__importStar(require("passport-oauth2-client-password")); -const keys_1 = require("../../keys"); -let ClientPasswordStrategyFactoryProvider = class ClientPasswordStrategyFactoryProvider { - constructor(verifier) { - this.verifier = verifier; - } - value() { - return (options, verifier) => this.getClientPasswordVerifier(options, verifier); - } - getClientPasswordVerifier(options, verifierPassed) { - const verifyFn = verifierPassed !== null && verifierPassed !== void 0 ? verifierPassed : this.verifier; - if (options === null || options === void 0 ? void 0 : options.passReqToCallback) { - return new ClientPasswordStrategy.Strategy(options, - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (req, clientId, clientSecret, cb) => { - try { - const client = await verifyFn(clientId, clientSecret, req); - if (!client) { - throw new rest_1.HttpErrors.Unauthorized("Client Invalid" /* ClientInvalid */); - } - else if (!client.clientSecret || - client.clientSecret !== clientSecret) { - throw new rest_1.HttpErrors.Unauthorized("Client Verification Failed" /* ClientVerificationFailed */); - } - cb(null, client); - } - catch (err) { - cb(err); - } - }); - } - else { - return new ClientPasswordStrategy.Strategy( - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (clientId, clientSecret, cb) => { - try { - const client = await verifyFn(clientId, clientSecret); - if (!client) { - throw new rest_1.HttpErrors.Unauthorized("Client Invalid" /* ClientInvalid */); - } - else if (!client.clientSecret || - client.clientSecret !== clientSecret) { - throw new rest_1.HttpErrors.Unauthorized("Client Verification Failed" /* ClientVerificationFailed */); - } - cb(null, client); - } - catch (err) { - cb(err); - } - }); - } - } -}; -ClientPasswordStrategyFactoryProvider = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_1.Strategies.Passport.OAUTH2_CLIENT_PASSWORD_VERIFIER)), - tslib_1.__metadata("design:paramtypes", [Function]) -], ClientPasswordStrategyFactoryProvider); -exports.ClientPasswordStrategyFactoryProvider = ClientPasswordStrategyFactoryProvider; -//# sourceMappingURL=client-password-strategy-factory-provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-client-password/client-password-strategy-factory-provider.js.map b/dist/strategies/passport/passport-client-password/client-password-strategy-factory-provider.js.map deleted file mode 100644 index bc82f4a..0000000 --- a/dist/strategies/passport/passport-client-password/client-password-strategy-factory-provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"client-password-strategy-factory-provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-client-password/client-password-strategy-factory-provider.ts"],"names":[],"mappings":";;;;AAAA,yCAAgD;AAChD,yCAAmD;AACnD,gGAA0E;AAI1E,qCAAsC;AAUtC,IAAa,qCAAqC,GAAlD,MAAa,qCAAqC;IAGhD,YAEmB,QAA8C;QAA9C,aAAQ,GAAR,QAAQ,CAAsC;IAC9D,CAAC;IAEJ,KAAK;QACH,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAC3B,IAAI,CAAC,yBAAyB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED,yBAAyB,CACvB,OAAoE,EACpE,cAAqD;QAErD,MAAM,QAAQ,GAAG,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,IAAI,CAAC,QAAQ,CAAC;QACjD,IAAI,OAAO,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CAAC,CACF,CAAC;SACH;IACH,CAAC;CACF,CAAA;AA3EY,qCAAqC;IAI7C,mBAAA,IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,+BAA+B,CAAC,CAAA;;GAJnD,qCAAqC,CA2EjD;AA3EY,sFAAqC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-client-password/client-password-verify.provider.d.ts b/dist/strategies/passport/passport-client-password/client-password-verify.provider.d.ts deleted file mode 100644 index 1e58a7d..0000000 --- a/dist/strategies/passport/passport-client-password/client-password-verify.provider.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Provider } from '@loopback/context'; -import { VerifyFunction } from '../../types'; -/** - * A provider for default implementation of VerifyFunction.OauthClientPasswordFn - * - * It will just throw an error saying Not Implemented - */ -export declare class ClientPasswordVerifyProvider implements Provider { - constructor(); - value(): VerifyFunction.OauthClientPasswordFn; -} diff --git a/dist/strategies/passport/passport-client-password/client-password-verify.provider.js b/dist/strategies/passport/passport-client-password/client-password-verify.provider.js deleted file mode 100644 index bc7a17a..0000000 --- a/dist/strategies/passport/passport-client-password/client-password-verify.provider.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClientPasswordVerifyProvider = void 0; -const rest_1 = require("@loopback/rest"); -/** - * A provider for default implementation of VerifyFunction.OauthClientPasswordFn - * - * It will just throw an error saying Not Implemented - */ -class ClientPasswordVerifyProvider { - constructor() { } - value() { - return async (clientId, clientSecret) => { - throw new rest_1.HttpErrors.NotImplemented(`VerifyFunction.OauthClientPasswordFn is not implemented`); - }; - } -} -exports.ClientPasswordVerifyProvider = ClientPasswordVerifyProvider; -//# sourceMappingURL=client-password-verify.provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-client-password/client-password-verify.provider.js.map b/dist/strategies/passport/passport-client-password/client-password-verify.provider.js.map deleted file mode 100644 index d0a2c00..0000000 --- a/dist/strategies/passport/passport-client-password/client-password-verify.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"client-password-verify.provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-client-password/client-password-verify.provider.ts"],"names":[],"mappings":";;;AACA,yCAA0C;AAI1C;;;;GAIG;AACH,MAAa,4BAA4B;IAGvC,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EAAE,QAAgB,EAAE,YAAoB,EAAE,EAAE;YACtD,MAAM,IAAI,iBAAU,CAAC,cAAc,CACjC,yDAAyD,CAC1D,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF;AAZD,oEAYC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-client-password/index.d.ts b/dist/strategies/passport/passport-client-password/index.d.ts deleted file mode 100644 index 9e23b38..0000000 --- a/dist/strategies/passport/passport-client-password/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './client-password-verify.provider'; -export * from './client-password-strategy-factory-provider'; diff --git a/dist/strategies/passport/passport-client-password/index.js b/dist/strategies/passport/passport-client-password/index.js deleted file mode 100644 index de6010d..0000000 --- a/dist/strategies/passport/passport-client-password/index.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./client-password-verify.provider"), exports); -tslib_1.__exportStar(require("./client-password-strategy-factory-provider"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-client-password/index.js.map b/dist/strategies/passport/passport-client-password/index.js.map deleted file mode 100644 index 8eda3de..0000000 --- a/dist/strategies/passport/passport-client-password/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-client-password/index.ts"],"names":[],"mappings":";;;AAAA,4EAAkD;AAClD,sFAA4D"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-facebook-oauth2/facebook-auth-strategy-factory-provider.d.ts b/dist/strategies/passport/passport-facebook-oauth2/facebook-auth-strategy-factory-provider.d.ts deleted file mode 100644 index 73ae0e6..0000000 --- a/dist/strategies/passport/passport-facebook-oauth2/facebook-auth-strategy-factory-provider.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Provider } from '@loopback/core'; -import { Strategy, StrategyOption, StrategyOptionWithRequest } from 'passport-facebook'; -import { VerifyFunction } from '../../types'; -interface ExtendedStrategyOption extends StrategyOption { - passReqToCallback?: false; -} -export interface FacebookAuthStrategyFactory { - (options: ExtendedStrategyOption | StrategyOptionWithRequest, verifierPassed?: VerifyFunction.FacebookAuthFn): Strategy; -} -export declare class FacebookAuthStrategyFactoryProvider implements Provider { - private readonly verifierFacebookAuth; - constructor(verifierFacebookAuth: VerifyFunction.FacebookAuthFn); - value(): FacebookAuthStrategyFactory; - getFacebookAuthStrategyVerifier(options: ExtendedStrategyOption | StrategyOptionWithRequest, verifierPassed?: VerifyFunction.FacebookAuthFn): Strategy; - private _setupProxy; -} -export {}; diff --git a/dist/strategies/passport/passport-facebook-oauth2/facebook-auth-strategy-factory-provider.js b/dist/strategies/passport/passport-facebook-oauth2/facebook-auth-strategy-factory-provider.js deleted file mode 100644 index 9f102fe..0000000 --- a/dist/strategies/passport/passport-facebook-oauth2/facebook-auth-strategy-factory-provider.js +++ /dev/null @@ -1,74 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FacebookAuthStrategyFactoryProvider = void 0; -const tslib_1 = require("tslib"); -const core_1 = require("@loopback/core"); -const rest_1 = require("@loopback/rest"); -const https_proxy_agent_1 = require("https-proxy-agent"); -const passport_facebook_1 = require("passport-facebook"); -const keys_1 = require("../../keys"); -let FacebookAuthStrategyFactoryProvider = class FacebookAuthStrategyFactoryProvider { - constructor(verifierFacebookAuth) { - this.verifierFacebookAuth = verifierFacebookAuth; - } - value() { - return (options, verifier) => this.getFacebookAuthStrategyVerifier(options, verifier); - } - getFacebookAuthStrategyVerifier(options, verifierPassed) { - const verifyFn = verifierPassed !== null && verifierPassed !== void 0 ? verifierPassed : this.verifierFacebookAuth; - let strategy; - if (options && options.passReqToCallback === true) { - strategy = new passport_facebook_1.Strategy(options, - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (req, accessToken, refreshToken, profile, cb) => { - try { - const user = await verifyFn(accessToken, refreshToken, profile, cb, req); - if (!user) { - throw new rest_1.HttpErrors.Unauthorized("Invalid Credentials" /* InvalidCredentials */); - } - cb(undefined, user); - } - catch (err) { - cb(err); - } - }); - } - else { - strategy = new passport_facebook_1.Strategy(options, - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (accessToken, refreshToken, profile, cb) => { - try { - const user = await verifyFn(accessToken, refreshToken, profile, cb); - if (!user) { - throw new rest_1.HttpErrors.Unauthorized("Invalid Credentials" /* InvalidCredentials */); - } - cb(undefined, user); - } - catch (err) { - cb(err); - } - }); - } - this._setupProxy(strategy); - return strategy; - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - _setupProxy(strategy) { - // Setup proxy if any - let httpsProxyAgent; - if (process.env['https_proxy']) { - httpsProxyAgent = new https_proxy_agent_1.HttpsProxyAgent(process.env['https_proxy']); - strategy._oauth2.setAgent(httpsProxyAgent); - } - else if (process.env['HTTPS_PROXY']) { - httpsProxyAgent = new https_proxy_agent_1.HttpsProxyAgent(process.env['HTTPS_PROXY']); - strategy._oauth2.setAgent(httpsProxyAgent); - } - } -}; -FacebookAuthStrategyFactoryProvider = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_1.Strategies.Passport.FACEBOOK_OAUTH2_VERIFIER)), - tslib_1.__metadata("design:paramtypes", [Function]) -], FacebookAuthStrategyFactoryProvider); -exports.FacebookAuthStrategyFactoryProvider = FacebookAuthStrategyFactoryProvider; -//# sourceMappingURL=facebook-auth-strategy-factory-provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-facebook-oauth2/facebook-auth-strategy-factory-provider.js.map b/dist/strategies/passport/passport-facebook-oauth2/facebook-auth-strategy-factory-provider.js.map deleted file mode 100644 index 7c36de3..0000000 --- a/dist/strategies/passport/passport-facebook-oauth2/facebook-auth-strategy-factory-provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"facebook-auth-strategy-factory-provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-facebook-oauth2/facebook-auth-strategy-factory-provider.ts"],"names":[],"mappings":";;;;AAAA,yCAAgD;AAChD,yCAAmD;AACnD,yDAAkD;AAClD,yDAK2B;AAG3B,qCAAsC;AActC,IAAa,mCAAmC,GAAhD,MAAa,mCAAmC;IAG9C,YAEmB,oBAAmD;QAAnD,yBAAoB,GAApB,oBAAoB,CAA+B;IACnE,CAAC;IAEJ,KAAK;QACH,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAC3B,IAAI,CAAC,+BAA+B,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;IAED,+BAA+B,CAC7B,OAA2D,EAC3D,cAA8C;QAE9C,MAAM,QAAQ,GAAG,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,IAAI,CAAC,oBAAoB,CAAC;QAC7D,IAAI,QAAQ,CAAC;QACb,IAAI,OAAO,IAAI,OAAO,CAAC,iBAAiB,KAAK,IAAI,EAAE;YACjD,QAAQ,GAAG,IAAI,4BAAQ,CACrB,OAAO;YACP,kEAAkE;YAClE,KAAK,EACH,GAAY,EACZ,WAAmB,EACnB,YAAoB,EACpB,OAAgB,EAChB,EAAkB,EAClB,EAAE;gBACF,IAAI;oBACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CACzB,WAAW,EACX,YAAY,EACZ,OAAO,EACP,EAAE,EACF,GAAG,CACJ,CAAC;oBACF,IAAI,CAAC,IAAI,EAAE;wBACT,MAAM,IAAI,iBAAU,CAAC,YAAY,gDAEhC,CAAC;qBACH;oBACD,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;iBACrB;gBAAC,OAAO,GAAG,EAAE;oBACZ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C,wBAAwB,CAAC,CAAA;;GAJ5C,mCAAmC,CA0F/C;AA1FY,kFAAmC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-facebook-oauth2/facebook-auth-verify.provider.d.ts b/dist/strategies/passport/passport-facebook-oauth2/facebook-auth-verify.provider.d.ts deleted file mode 100644 index c480574..0000000 --- a/dist/strategies/passport/passport-facebook-oauth2/facebook-auth-verify.provider.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Provider } from '@loopback/context'; -import { VerifyFunction } from '../../types'; -/** - * A provider for default implementation of VerifyFunction.LocalPasswordFn - * - * It will just throw an error saying Not Implemented - */ -export declare class FacebookAuthVerifyProvider implements Provider { - constructor(); - value(): VerifyFunction.FacebookAuthFn; -} diff --git a/dist/strategies/passport/passport-facebook-oauth2/facebook-auth-verify.provider.js b/dist/strategies/passport/passport-facebook-oauth2/facebook-auth-verify.provider.js deleted file mode 100644 index d6d3b3f..0000000 --- a/dist/strategies/passport/passport-facebook-oauth2/facebook-auth-verify.provider.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FacebookAuthVerifyProvider = void 0; -const rest_1 = require("@loopback/rest"); -/** - * A provider for default implementation of VerifyFunction.LocalPasswordFn - * - * It will just throw an error saying Not Implemented - */ -class FacebookAuthVerifyProvider { - constructor() { } - value() { - return async (accessToken, refreshToken, profile, cb, req) => { - throw new rest_1.HttpErrors.NotImplemented(`VerifyFunction.FacebookAuthFn is not implemented`); - }; - } -} -exports.FacebookAuthVerifyProvider = FacebookAuthVerifyProvider; -//# sourceMappingURL=facebook-auth-verify.provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-facebook-oauth2/facebook-auth-verify.provider.js.map b/dist/strategies/passport/passport-facebook-oauth2/facebook-auth-verify.provider.js.map deleted file mode 100644 index 9477f22..0000000 --- a/dist/strategies/passport/passport-facebook-oauth2/facebook-auth-verify.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"facebook-auth-verify.provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-facebook-oauth2/facebook-auth-verify.provider.ts"],"names":[],"mappings":";;;AACA,yCAAmD;AAGnD;;;;GAIG;AACH,MAAa,0BAA0B;IAGrC,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EACV,WAAmB,EACnB,YAAoB,EACpB,OAAiC,EACjC,EAAkB,EAClB,GAAa,EACb,EAAE;YACF,MAAM,IAAI,iBAAU,CAAC,cAAc,CACjC,kDAAkD,CACnD,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF;AAlBD,gEAkBC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-facebook-oauth2/index.d.ts b/dist/strategies/passport/passport-facebook-oauth2/index.d.ts deleted file mode 100644 index 00d071a..0000000 --- a/dist/strategies/passport/passport-facebook-oauth2/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './facebook-auth-strategy-factory-provider'; -export * from './facebook-auth-verify.provider'; diff --git a/dist/strategies/passport/passport-facebook-oauth2/index.js b/dist/strategies/passport/passport-facebook-oauth2/index.js deleted file mode 100644 index 5acf58c..0000000 --- a/dist/strategies/passport/passport-facebook-oauth2/index.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./facebook-auth-strategy-factory-provider"), exports); -tslib_1.__exportStar(require("./facebook-auth-verify.provider"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-facebook-oauth2/index.js.map b/dist/strategies/passport/passport-facebook-oauth2/index.js.map deleted file mode 100644 index 40d0d64..0000000 --- a/dist/strategies/passport/passport-facebook-oauth2/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-facebook-oauth2/index.ts"],"names":[],"mappings":";;;AAAA,oFAA0D;AAC1D,0EAAgD"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-google-oauth2/google-auth-strategy-factory-provider.d.ts b/dist/strategies/passport/passport-google-oauth2/google-auth-strategy-factory-provider.d.ts deleted file mode 100644 index e0449d7..0000000 --- a/dist/strategies/passport/passport-google-oauth2/google-auth-strategy-factory-provider.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Provider } from '@loopback/core'; -import { Strategy, StrategyOptions, StrategyOptionsWithRequest } from 'passport-google-oauth20'; -import { VerifyFunction } from '../../types'; -export interface GoogleAuthStrategyFactory { - (options: StrategyOptions | StrategyOptionsWithRequest, verifierPassed?: VerifyFunction.GoogleAuthFn): Strategy; -} -export declare class GoogleAuthStrategyFactoryProvider implements Provider { - private readonly verifierGoogleAuth; - constructor(verifierGoogleAuth: VerifyFunction.GoogleAuthFn); - value(): GoogleAuthStrategyFactory; - getGoogleAuthStrategyVerifier(options: StrategyOptions | StrategyOptionsWithRequest, verifierPassed?: VerifyFunction.GoogleAuthFn): Strategy; - private _setupProxy; -} diff --git a/dist/strategies/passport/passport-google-oauth2/google-auth-strategy-factory-provider.js b/dist/strategies/passport/passport-google-oauth2/google-auth-strategy-factory-provider.js deleted file mode 100644 index b783ec3..0000000 --- a/dist/strategies/passport/passport-google-oauth2/google-auth-strategy-factory-provider.js +++ /dev/null @@ -1,74 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GoogleAuthStrategyFactoryProvider = void 0; -const tslib_1 = require("tslib"); -const core_1 = require("@loopback/core"); -const rest_1 = require("@loopback/rest"); -const https_proxy_agent_1 = require("https-proxy-agent"); -const passport_google_oauth20_1 = require("passport-google-oauth20"); -const keys_1 = require("../../keys"); -let GoogleAuthStrategyFactoryProvider = class GoogleAuthStrategyFactoryProvider { - constructor(verifierGoogleAuth) { - this.verifierGoogleAuth = verifierGoogleAuth; - } - value() { - return (options, verifier) => this.getGoogleAuthStrategyVerifier(options, verifier); - } - getGoogleAuthStrategyVerifier(options, verifierPassed) { - const verifyFn = verifierPassed !== null && verifierPassed !== void 0 ? verifierPassed : this.verifierGoogleAuth; - let strategy; - if (options && options.passReqToCallback === true) { - strategy = new passport_google_oauth20_1.Strategy(options, - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (req, accessToken, refreshToken, profile, cb) => { - try { - const user = await verifyFn(accessToken, refreshToken, profile, cb, req); - if (!user) { - throw new rest_1.HttpErrors.Unauthorized("Invalid Credentials" /* InvalidCredentials */); - } - cb(undefined, user); - } - catch (err) { - cb(err); - } - }); - } - else { - strategy = new passport_google_oauth20_1.Strategy(options, - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (accessToken, refreshToken, profile, cb) => { - try { - const user = await verifyFn(accessToken, refreshToken, profile, cb); - if (!user) { - throw new rest_1.HttpErrors.Unauthorized("Invalid Credentials" /* InvalidCredentials */); - } - cb(undefined, user); - } - catch (err) { - cb(err); - } - }); - } - this._setupProxy(strategy); - return strategy; - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - _setupProxy(strategy) { - // Setup proxy if any - let httpsProxyAgent; - if (process.env['https_proxy']) { - httpsProxyAgent = new https_proxy_agent_1.HttpsProxyAgent(process.env['https_proxy']); - strategy._oauth2.setAgent(httpsProxyAgent); - } - else if (process.env['HTTPS_PROXY']) { - httpsProxyAgent = new https_proxy_agent_1.HttpsProxyAgent(process.env['HTTPS_PROXY']); - strategy._oauth2.setAgent(httpsProxyAgent); - } - } -}; -GoogleAuthStrategyFactoryProvider = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_1.Strategies.Passport.GOOGLE_OAUTH2_VERIFIER)), - tslib_1.__metadata("design:paramtypes", [Function]) -], GoogleAuthStrategyFactoryProvider); -exports.GoogleAuthStrategyFactoryProvider = GoogleAuthStrategyFactoryProvider; -//# sourceMappingURL=google-auth-strategy-factory-provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-google-oauth2/google-auth-strategy-factory-provider.js.map b/dist/strategies/passport/passport-google-oauth2/google-auth-strategy-factory-provider.js.map deleted file mode 100644 index aa1f92a..0000000 --- a/dist/strategies/passport/passport-google-oauth2/google-auth-strategy-factory-provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"google-auth-strategy-factory-provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-google-oauth2/google-auth-strategy-factory-provider.ts"],"names":[],"mappings":";;;;AAAA,yCAAgD;AAChD,yCAAmD;AACnD,yDAAkD;AAClD,qEAMiC;AAGjC,qCAAsC;AAWtC,IAAa,iCAAiC,GAA9C,MAAa,iCAAiC;IAG5C,YAEmB,kBAA+C;QAA/C,uBAAkB,GAAlB,kBAAkB,CAA6B;IAC/D,CAAC;IAEJ,KAAK;QACH,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAC3B,IAAI,CAAC,6BAA6B,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC1D,CAAC;IAED,6BAA6B,CAC3B,OAAqD,EACrD,cAA4C;QAE5C,MAAM,QAAQ,GAAG,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,IAAI,CAAC,kBAAkB,CAAC;QAC3D,IAAI,QAAQ,CAAC;QACb,IAAI,OAAO,IAAI,OAAO,CAAC,iBAAiB,KAAK,IAAI,EAAE;YACjD,QAAQ,GAAG,IAAI,kCAAQ,CACrB,OAAO;YAEP,kEAAkE;YAClE,KAAK,EACH,GAAY,EACZ,WAAmB,EACnB,YAAoB,EACpB,OAAgB,EAChB,EAAkB,EAClB,EAAE;gBACF,IAAI;oBACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CACzB,WAAW,EACX,YAAY,EACZ,OAAO,EACP,EAAE,EACF,GAAG,CACJ,CAAC;oBACF,IAAI,CAAC,IAAI,EAAE;wBACT,MAAM,IAAI,iBAAU,CAAC,YAAY,gDAEhC,CAAC;qBACH;oBACD,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;iBACrB;gBAAC,OAAO,GAAG,EAA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,CAAC,sBAAsB,CAAC,CAAA;;GAJ1C,iCAAiC,CA2F7C;AA3FY,8EAAiC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-google-oauth2/google-auth-verify.provider.d.ts b/dist/strategies/passport/passport-google-oauth2/google-auth-verify.provider.d.ts deleted file mode 100644 index c9a85c5..0000000 --- a/dist/strategies/passport/passport-google-oauth2/google-auth-verify.provider.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Provider } from '@loopback/context'; -import { VerifyFunction } from '../../types'; -/** - * A provider for default implementation of VerifyFunction.LocalPasswordFn - * - * It will just throw an error saying Not Implemented - */ -export declare class GoogleAuthVerifyProvider implements Provider { - constructor(); - value(): VerifyFunction.GoogleAuthFn; -} diff --git a/dist/strategies/passport/passport-google-oauth2/google-auth-verify.provider.js b/dist/strategies/passport/passport-google-oauth2/google-auth-verify.provider.js deleted file mode 100644 index 68ecf3a..0000000 --- a/dist/strategies/passport/passport-google-oauth2/google-auth-verify.provider.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GoogleAuthVerifyProvider = void 0; -const rest_1 = require("@loopback/rest"); -/** - * A provider for default implementation of VerifyFunction.LocalPasswordFn - * - * It will just throw an error saying Not Implemented - */ -class GoogleAuthVerifyProvider { - constructor() { } - value() { - return async (accessToken, refreshToken, profile, cb, req) => { - throw new rest_1.HttpErrors.NotImplemented(`VerifyFunction.GoogleAuthFn is not implemented`); - }; - } -} -exports.GoogleAuthVerifyProvider = GoogleAuthVerifyProvider; -//# sourceMappingURL=google-auth-verify.provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-google-oauth2/google-auth-verify.provider.js.map b/dist/strategies/passport/passport-google-oauth2/google-auth-verify.provider.js.map deleted file mode 100644 index 5f91af2..0000000 --- a/dist/strategies/passport/passport-google-oauth2/google-auth-verify.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"google-auth-verify.provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-google-oauth2/google-auth-verify.provider.ts"],"names":[],"mappings":";;;AACA,yCAAmD;AAKnD;;;;GAIG;AACH,MAAa,wBAAwB;IAGnC,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EACV,WAAmB,EACnB,YAAoB,EACpB,OAA+B,EAC/B,EAAiC,EACjC,GAAa,EACb,EAAE;YACF,MAAM,IAAI,iBAAU,CAAC,cAAc,CACjC,gDAAgD,CACjD,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF;AAlBD,4DAkBC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-google-oauth2/index.d.ts b/dist/strategies/passport/passport-google-oauth2/index.d.ts deleted file mode 100644 index f9fb599..0000000 --- a/dist/strategies/passport/passport-google-oauth2/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './google-auth-strategy-factory-provider'; -export * from './google-auth-verify.provider'; diff --git a/dist/strategies/passport/passport-google-oauth2/index.js b/dist/strategies/passport/passport-google-oauth2/index.js deleted file mode 100644 index daf1224..0000000 --- a/dist/strategies/passport/passport-google-oauth2/index.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./google-auth-strategy-factory-provider"), exports); -tslib_1.__exportStar(require("./google-auth-verify.provider"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-google-oauth2/index.js.map b/dist/strategies/passport/passport-google-oauth2/index.js.map deleted file mode 100644 index 5bfe836..0000000 --- a/dist/strategies/passport/passport-google-oauth2/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-google-oauth2/index.ts"],"names":[],"mappings":";;;AAAA,kFAAwD;AACxD,wEAA8C"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-insta-oauth2/index.d.ts b/dist/strategies/passport/passport-insta-oauth2/index.d.ts deleted file mode 100644 index 87672fa..0000000 --- a/dist/strategies/passport/passport-insta-oauth2/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './insta-auth-strategy-factory-provider'; -export * from './insta-auth-verify.provider'; diff --git a/dist/strategies/passport/passport-insta-oauth2/index.js b/dist/strategies/passport/passport-insta-oauth2/index.js deleted file mode 100644 index 804c78d..0000000 --- a/dist/strategies/passport/passport-insta-oauth2/index.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./insta-auth-strategy-factory-provider"), exports); -tslib_1.__exportStar(require("./insta-auth-verify.provider"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-insta-oauth2/index.js.map b/dist/strategies/passport/passport-insta-oauth2/index.js.map deleted file mode 100644 index e4bdcf3..0000000 --- a/dist/strategies/passport/passport-insta-oauth2/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-insta-oauth2/index.ts"],"names":[],"mappings":";;;AAAA,iFAAuD;AACvD,uEAA6C"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-insta-oauth2/insta-auth-strategy-factory-provider.d.ts b/dist/strategies/passport/passport-insta-oauth2/insta-auth-strategy-factory-provider.d.ts deleted file mode 100644 index 21a93d2..0000000 --- a/dist/strategies/passport/passport-insta-oauth2/insta-auth-strategy-factory-provider.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Provider } from '@loopback/core'; -import { Strategy, StrategyOption, StrategyOptionWithRequest } from 'passport-instagram'; -import { VerifyFunction } from '../../types'; -export interface InstagramAuthStrategyFactory { - (options: StrategyOption | StrategyOptionWithRequest, verifierPassed?: VerifyFunction.InstagramAuthFn): Strategy; -} -export declare class InstagramAuthStrategyFactoryProvider implements Provider { - private readonly verifierInstagramAuth; - constructor(verifierInstagramAuth: VerifyFunction.InstagramAuthFn); - value(): InstagramAuthStrategyFactory; - getInstagramAuthStrategyVerifier(options: StrategyOption | StrategyOptionWithRequest, verifierPassed?: VerifyFunction.InstagramAuthFn): Strategy; - private _setupProxy; -} diff --git a/dist/strategies/passport/passport-insta-oauth2/insta-auth-strategy-factory-provider.js b/dist/strategies/passport/passport-insta-oauth2/insta-auth-strategy-factory-provider.js deleted file mode 100644 index a0095ec..0000000 --- a/dist/strategies/passport/passport-insta-oauth2/insta-auth-strategy-factory-provider.js +++ /dev/null @@ -1,74 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.InstagramAuthStrategyFactoryProvider = void 0; -const tslib_1 = require("tslib"); -const core_1 = require("@loopback/core"); -const rest_1 = require("@loopback/rest"); -const https_proxy_agent_1 = require("https-proxy-agent"); -const passport_instagram_1 = require("passport-instagram"); -const keys_1 = require("../../keys"); -let InstagramAuthStrategyFactoryProvider = class InstagramAuthStrategyFactoryProvider { - constructor(verifierInstagramAuth) { - this.verifierInstagramAuth = verifierInstagramAuth; - } - value() { - return (options, verifier) => this.getInstagramAuthStrategyVerifier(options, verifier); - } - getInstagramAuthStrategyVerifier(options, verifierPassed) { - const verifyFn = verifierPassed !== null && verifierPassed !== void 0 ? verifierPassed : this.verifierInstagramAuth; - let strategy; - if (options && options.passReqToCallback === true) { - strategy = new passport_instagram_1.Strategy(options, - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (req, accessToken, refreshToken, profile, cb) => { - try { - const user = await verifyFn(accessToken, refreshToken, profile, cb, req); - if (!user) { - throw new rest_1.HttpErrors.Unauthorized("Invalid Credentials" /* InvalidCredentials */); - } - cb(undefined, user); - } - catch (err) { - cb(err); - } - }); - } - else { - strategy = new passport_instagram_1.Strategy(options, - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (accessToken, refreshToken, profile, cb) => { - try { - const user = await verifyFn(accessToken, refreshToken, profile, cb); - if (!user) { - throw new rest_1.HttpErrors.Unauthorized("Invalid Credentials" /* InvalidCredentials */); - } - cb(undefined, user); - } - catch (err) { - cb(err); - } - }); - } - this._setupProxy(strategy); - return strategy; - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - _setupProxy(strategy) { - // Setup proxy if any - let httpsProxyAgent; - if (process.env['https_proxy']) { - httpsProxyAgent = new https_proxy_agent_1.HttpsProxyAgent(process.env['https_proxy']); - strategy._oauth2.setAgent(httpsProxyAgent); - } - else if (process.env['HTTPS_PROXY']) { - httpsProxyAgent = new https_proxy_agent_1.HttpsProxyAgent(process.env['HTTPS_PROXY']); - strategy._oauth2.setAgent(httpsProxyAgent); - } - } -}; -InstagramAuthStrategyFactoryProvider = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_1.Strategies.Passport.INSTAGRAM_OAUTH2_VERIFIER)), - tslib_1.__metadata("design:paramtypes", [Function]) -], InstagramAuthStrategyFactoryProvider); -exports.InstagramAuthStrategyFactoryProvider = InstagramAuthStrategyFactoryProvider; -//# sourceMappingURL=insta-auth-strategy-factory-provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-insta-oauth2/insta-auth-strategy-factory-provider.js.map b/dist/strategies/passport/passport-insta-oauth2/insta-auth-strategy-factory-provider.js.map deleted file mode 100644 index 6090fb1..0000000 --- a/dist/strategies/passport/passport-insta-oauth2/insta-auth-strategy-factory-provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"insta-auth-strategy-factory-provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-insta-oauth2/insta-auth-strategy-factory-provider.ts"],"names":[],"mappings":";;;;AAAA,yCAAgD;AAChD,yCAAmD;AACnD,yDAAkD;AAClD,2DAK4B;AAG5B,qCAAsC;AAUtC,IAAa,oCAAoC,GAAjD,MAAa,oCAAoC;IAG/C,YAEmB,qBAAqD;QAArD,0BAAqB,GAArB,qBAAqB,CAAgC;IACrE,CAAC;IAEJ,KAAK;QACH,OAAO,CAAC,OAAO,E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GAAG,EAAE;oBACZ,EAAE,CAAC,GAAG,CAAC,CAAC;iBACT;YACH,CAAC,CACF,CAAC;SACH;QAED,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC3B,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,8DAA8D;IACtD,WAAW,CAAC,QAAa;QAC/B,qBAAqB;QACrB,IAAI,eAAe,CAAC;QACpB,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE;YAC9B,eAAe,GAAG,IAAI,mCAAe,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;YAClE,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;SAC5C;aAAM,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE;YACrC,eAAe,GAAG,IAAI,mCAAe,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;YAClE,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;SAC5C;IACH,CAAC;CACF,CAAA;AA1FY,oCAAoC;IAI5C,mBAAA,IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAA;;GAJ7C,oCAAoC,CA0FhD;AA1FY,oFAAoC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-insta-oauth2/insta-auth-verify.provider.d.ts b/dist/strategies/passport/passport-insta-oauth2/insta-auth-verify.provider.d.ts deleted file mode 100644 index 0f0beb5..0000000 --- a/dist/strategies/passport/passport-insta-oauth2/insta-auth-verify.provider.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Provider } from '@loopback/context'; -import { VerifyFunction } from '../../types'; -/** - * A provider for default implementation of VerifyFunction.LocalPasswordFn - * - * It will just throw an error saying Not Implemented - */ -export declare class InstagramAuthVerifyProvider implements Provider { - constructor(); - value(): VerifyFunction.InstagramAuthFn; -} diff --git a/dist/strategies/passport/passport-insta-oauth2/insta-auth-verify.provider.js b/dist/strategies/passport/passport-insta-oauth2/insta-auth-verify.provider.js deleted file mode 100644 index 3caca00..0000000 --- a/dist/strategies/passport/passport-insta-oauth2/insta-auth-verify.provider.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.InstagramAuthVerifyProvider = void 0; -const rest_1 = require("@loopback/rest"); -/** - * A provider for default implementation of VerifyFunction.LocalPasswordFn - * - * It will just throw an error saying Not Implemented - */ -class InstagramAuthVerifyProvider { - constructor() { } - value() { - return async (accessToken, refreshToken, profile, cb, req) => { - throw new rest_1.HttpErrors.NotImplemented(`VerifyFunction.InstagramAuthFn is not implemented`); - }; - } -} -exports.InstagramAuthVerifyProvider = InstagramAuthVerifyProvider; -//# sourceMappingURL=insta-auth-verify.provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-insta-oauth2/insta-auth-verify.provider.js.map b/dist/strategies/passport/passport-insta-oauth2/insta-auth-verify.provider.js.map deleted file mode 100644 index 7e19b7d..0000000 --- a/dist/strategies/passport/passport-insta-oauth2/insta-auth-verify.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"insta-auth-verify.provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-insta-oauth2/insta-auth-verify.provider.ts"],"names":[],"mappings":";;;AACA,yCAAmD;AAGnD;;;;GAIG;AACH,MAAa,2BAA2B;IAGtC,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EACV,WAAmB,EACnB,YAAoB,EACpB,OAAkC,EAClC,EAAkB,EAClB,GAAa,EACb,EAAE;YACF,MAAM,IAAI,iBAAU,CAAC,cAAc,CACjC,mDAAmD,CACpD,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF;AAlBD,kEAkBC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-keycloak/index.d.ts b/dist/strategies/passport/passport-keycloak/index.d.ts deleted file mode 100644 index 713b572..0000000 --- a/dist/strategies/passport/passport-keycloak/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './keycloak-strategy-factory-provider'; -export * from './keycloak-verify.provider'; diff --git a/dist/strategies/passport/passport-keycloak/index.js b/dist/strategies/passport/passport-keycloak/index.js deleted file mode 100644 index d4f854d..0000000 --- a/dist/strategies/passport/passport-keycloak/index.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./keycloak-strategy-factory-provider"), exports); -tslib_1.__exportStar(require("./keycloak-verify.provider"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-keycloak/index.js.map b/dist/strategies/passport/passport-keycloak/index.js.map deleted file mode 100644 index 998111a..0000000 --- a/dist/strategies/passport/passport-keycloak/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-keycloak/index.ts"],"names":[],"mappings":";;;AAAA,+EAAqD;AACrD,qEAA2C"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-keycloak/keycloak-strategy-factory-provider.d.ts b/dist/strategies/passport/passport-keycloak/keycloak-strategy-factory-provider.d.ts deleted file mode 100644 index f3954d8..0000000 --- a/dist/strategies/passport/passport-keycloak/keycloak-strategy-factory-provider.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Provider } from '@loopback/core'; -import { Keycloak, VerifyFunction } from '../../types'; -export declare const KeycloakStrategy: any; -export interface KeycloakStrategyFactory { - (options: Keycloak.StrategyOptions, verifierPassed?: VerifyFunction.KeycloakAuthFn): typeof KeycloakStrategy; -} -export declare class KeycloakStrategyFactoryProvider implements Provider { - private readonly verifierKeycloak; - constructor(verifierKeycloak: VerifyFunction.KeycloakAuthFn); - value(): KeycloakStrategyFactory; - getKeycloakAuthStrategyVerifier(options: Keycloak.StrategyOptions, verifierPassed?: VerifyFunction.KeycloakAuthFn): typeof KeycloakStrategy; - private _userProfileFn; - private _setupProxy; -} diff --git a/dist/strategies/passport/passport-keycloak/keycloak-strategy-factory-provider.js b/dist/strategies/passport/passport-keycloak/keycloak-strategy-factory-provider.js deleted file mode 100644 index 1fc5697..0000000 --- a/dist/strategies/passport/passport-keycloak/keycloak-strategy-factory-provider.js +++ /dev/null @@ -1,98 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.KeycloakStrategyFactoryProvider = exports.KeycloakStrategy = void 0; -const tslib_1 = require("tslib"); -const core_1 = require("@loopback/core"); -const rest_1 = require("@loopback/rest"); -const https_proxy_agent_1 = require("https-proxy-agent"); -const keys_1 = require("../../keys"); -exports.KeycloakStrategy = require('@exlinc/keycloak-passport'); -let KeycloakStrategyFactoryProvider = class KeycloakStrategyFactoryProvider { - constructor(verifierKeycloak) { - this.verifierKeycloak = verifierKeycloak; - } - value() { - return (options, verifier) => this.getKeycloakAuthStrategyVerifier(options, verifier); - } - getKeycloakAuthStrategyVerifier(options, verifierPassed) { - const verifyFn = verifierPassed !== null && verifierPassed !== void 0 ? verifierPassed : this.verifierKeycloak; - const strategy = new exports.KeycloakStrategy(options, async (accessToken, refreshToken, profile, cb) => { - try { - const user = await verifyFn(accessToken, refreshToken, profile, cb); - if (!user) { - throw new rest_1.HttpErrors.Unauthorized("Invalid Credentials" /* InvalidCredentials */); - } - cb(undefined, user); - } - catch (err) { - cb(err); - } - }); - // Override user profile fn of underlying library - strategy.userProfile = (accessToken, done) => { - this._userProfileFn(strategy, accessToken, done); - }; - this._setupProxy(strategy); - return strategy; - } - _userProfileFn(strategy, accessToken, done) { - // Credits - https://github.com/exlinc/keycloak-passport/blob/eaa3859f83619d8e349e87193fdf8acc3a3d0ba9/index.js#L28 - strategy._oauth2._useAuthorizationHeaderForGET = true; - strategy._oauth2.get(strategy.options.userInfoURL, accessToken, (err, body) => { - if (err) { - return done(err); - } - try { - const json = JSON.parse(body); - const email = json.email; - const userInfo = { - keycloakId: json.sub, - fullName: json.name, - firstName: json.given_name, - lastName: json.family_name, - middleName: json.middle_name, - username: json.preferred_username, - email, - avatar: json.avatar, - realm: strategy.options.realm, - // add all attributes to userInfo - // overridden stuff - ...json, - }; - // Remove duplicate keys - for (const key of [ - 'sub', - 'name', - 'given_name', - 'family_name', - 'middle_name', - 'preferred_username', - ]) { - delete userInfo[key]; - } - done(null, userInfo); - } - catch (e) { - done(e); - } - }); - } - _setupProxy(strategy) { - // Setup proxy if any - let httpsProxyAgent; - if (process.env['https_proxy']) { - httpsProxyAgent = new https_proxy_agent_1.HttpsProxyAgent(process.env['https_proxy']); - strategy._oauth2.setAgent(httpsProxyAgent); - } - else if (process.env['HTTPS_PROXY']) { - httpsProxyAgent = new https_proxy_agent_1.HttpsProxyAgent(process.env['HTTPS_PROXY']); - strategy._oauth2.setAgent(httpsProxyAgent); - } - } -}; -KeycloakStrategyFactoryProvider = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_1.Strategies.Passport.KEYCLOAK_VERIFIER)), - tslib_1.__metadata("design:paramtypes", [Function]) -], KeycloakStrategyFactoryProvider); -exports.KeycloakStrategyFactoryProvider = KeycloakStrategyFactoryProvider; -//# sourceMappingURL=keycloak-strategy-factory-provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-keycloak/keycloak-strategy-factory-provider.js.map b/dist/strategies/passport/passport-keycloak/keycloak-strategy-factory-provider.js.map deleted file mode 100644 index a0839b7..0000000 --- a/dist/strategies/passport/passport-keycloak/keycloak-strategy-factory-provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keycloak-strategy-factory-provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-keycloak/keycloak-strategy-factory-provider.ts"],"names":[],"mappings":";;;;AAAA,yCAAgD;AAChD,yCAA0C;AAC1C,yDAAkD;AAGlD,qCAAsC;AAGzB,QAAA,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;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AAe,GAAG,IAAI,mCAAe,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;YAClE,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;SAC5C;aAAM,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE;YACrC,eAAe,GAAG,IAAI,mCAAe,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;YAClE,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;SAC5C;IACH,CAAC;CACF,CAAA;AAlHY,+BAA+B;IAIvC,mBAAA,IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAA;;GAJrC,+BAA+B,CAkH3C;AAlHY,0EAA+B"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-keycloak/keycloak-verify.provider.d.ts b/dist/strategies/passport/passport-keycloak/keycloak-verify.provider.d.ts deleted file mode 100644 index de9d4b1..0000000 --- a/dist/strategies/passport/passport-keycloak/keycloak-verify.provider.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Provider } from '@loopback/context'; -import { VerifyFunction } from '../../types'; -/** - * A provider for default implementation of VerifyFunction.LocalPasswordFn - * - * It will just throw an error saying Not Implemented - */ -export declare class KeycloakVerifyProvider implements Provider { - constructor(); - value(): VerifyFunction.KeycloakAuthFn; -} diff --git a/dist/strategies/passport/passport-keycloak/keycloak-verify.provider.js b/dist/strategies/passport/passport-keycloak/keycloak-verify.provider.js deleted file mode 100644 index 445498d..0000000 --- a/dist/strategies/passport/passport-keycloak/keycloak-verify.provider.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.KeycloakVerifyProvider = void 0; -const rest_1 = require("@loopback/rest"); -/** - * A provider for default implementation of VerifyFunction.LocalPasswordFn - * - * It will just throw an error saying Not Implemented - */ -class KeycloakVerifyProvider { - constructor() { } - value() { - return async (accessToken, refreshToken, profile, cb) => { - throw new rest_1.HttpErrors.NotImplemented(`VerifyFunction.KeycloakAuthFn is not implemented`); - }; - } -} -exports.KeycloakVerifyProvider = KeycloakVerifyProvider; -//# sourceMappingURL=keycloak-verify.provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-keycloak/keycloak-verify.provider.js.map b/dist/strategies/passport/passport-keycloak/keycloak-verify.provider.js.map deleted file mode 100644 index f73b75c..0000000 --- a/dist/strategies/passport/passport-keycloak/keycloak-verify.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keycloak-verify.provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-keycloak/keycloak-verify.provider.ts"],"names":[],"mappings":";;;AACA,yCAA0C;AAI1C;;;;GAIG;AACH,MAAa,sBAAsB;IAGjC,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EACV,WAAmB,EACnB,YAAoB,EACpB,OAAyB,EACzB,EAA2B,EAC3B,EAAE;YACF,MAAM,IAAI,iBAAU,CAAC,cAAc,CACjC,kDAAkD,CACnD,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF;AAjBD,wDAiBC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-local/index.d.ts b/dist/strategies/passport/passport-local/index.d.ts deleted file mode 100644 index 5c9b2e5..0000000 --- a/dist/strategies/passport/passport-local/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './local-password-verify.provider'; -export * from './local-password-strategy-factory-provider'; diff --git a/dist/strategies/passport/passport-local/index.js b/dist/strategies/passport/passport-local/index.js deleted file mode 100644 index c9abb44..0000000 --- a/dist/strategies/passport/passport-local/index.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./local-password-verify.provider"), exports); -tslib_1.__exportStar(require("./local-password-strategy-factory-provider"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-local/index.js.map b/dist/strategies/passport/passport-local/index.js.map deleted file mode 100644 index 8a84d95..0000000 --- a/dist/strategies/passport/passport-local/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-local/index.ts"],"names":[],"mappings":";;;AAAA,2EAAiD;AACjD,qFAA2D"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-local/local-password-strategy-factory-provider.d.ts b/dist/strategies/passport/passport-local/local-password-strategy-factory-provider.d.ts deleted file mode 100644 index 79069fe..0000000 --- a/dist/strategies/passport/passport-local/local-password-strategy-factory-provider.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Provider } from '@loopback/core'; -import * as PassportLocal from 'passport-local'; -import { VerifyFunction } from '../../types'; -export interface LocalPasswordStrategyFactory { - (options?: PassportLocal.IStrategyOptions | PassportLocal.IStrategyOptionsWithRequest, verifierPassed?: VerifyFunction.LocalPasswordFn): PassportLocal.Strategy; -} -export declare class LocalPasswordStrategyFactoryProvider implements Provider { - private readonly verifierLocal; - constructor(verifierLocal: VerifyFunction.LocalPasswordFn); - value(): LocalPasswordStrategyFactory; - getLocalStrategyVerifier(options?: PassportLocal.IStrategyOptions | PassportLocal.IStrategyOptionsWithRequest, verifierPassed?: VerifyFunction.LocalPasswordFn): PassportLocal.Strategy; -} diff --git a/dist/strategies/passport/passport-local/local-password-strategy-factory-provider.js b/dist/strategies/passport/passport-local/local-password-strategy-factory-provider.js deleted file mode 100644 index 7b8b05a..0000000 --- a/dist/strategies/passport/passport-local/local-password-strategy-factory-provider.js +++ /dev/null @@ -1,74 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LocalPasswordStrategyFactoryProvider = void 0; -const tslib_1 = require("tslib"); -const core_1 = require("@loopback/core"); -const rest_1 = require("@loopback/rest"); -const PassportLocal = tslib_1.__importStar(require("passport-local")); -const keys_1 = require("../../keys"); -const lodash_1 = require("lodash"); -let LocalPasswordStrategyFactoryProvider = class LocalPasswordStrategyFactoryProvider { - constructor(verifierLocal) { - this.verifierLocal = verifierLocal; - } - value() { - return (options, verifier) => this.getLocalStrategyVerifier(options, verifier); - } - getLocalStrategyVerifier(options, verifierPassed) { - const verifyFn = verifierPassed !== null && verifierPassed !== void 0 ? verifierPassed : this.verifierLocal; - if (options === null || options === void 0 ? void 0 : options.passReqToCallback) { - return new PassportLocal.Strategy(options, - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (req, username, password, cb) => { - try { - const user = await verifyFn(username, password, req); - if (!user) { - throw new rest_1.HttpErrors.Unauthorized("Invalid Credentials" /* InvalidCredentials */); - } - cb(null, user); - } - catch (err) { - cb(err); - } - }); - } - else if (!!options && !(0, lodash_1.isEmpty)(options)) { - return new PassportLocal.Strategy(options, - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (username, password, cb) => { - try { - const user = await verifyFn(username, password); - if (!user) { - throw new rest_1.HttpErrors.Unauthorized("Invalid Credentials" /* InvalidCredentials */); - } - cb(null, user); - } - catch (err) { - cb(err); - } - }); - } - else { - return new PassportLocal.Strategy( - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (username, password, cb) => { - try { - const user = await verifyFn(username, password, undefined); - if (!user) { - throw new rest_1.HttpErrors.Unauthorized("Invalid Credentials" /* InvalidCredentials */); - } - cb(null, user); - } - catch (err) { - cb(err); - } - }); - } - } -}; -LocalPasswordStrategyFactoryProvider = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_1.Strategies.Passport.LOCAL_PASSWORD_VERIFIER)), - tslib_1.__metadata("design:paramtypes", [Function]) -], LocalPasswordStrategyFactoryProvider); -exports.LocalPasswordStrategyFactoryProvider = LocalPasswordStrategyFactoryProvider; -//# sourceMappingURL=local-password-strategy-factory-provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-local/local-password-strategy-factory-provider.js.map b/dist/strategies/passport/passport-local/local-password-strategy-factory-provider.js.map deleted file mode 100644 index 5e2753c..0000000 --- a/dist/strategies/passport/passport-local/local-password-strategy-factory-provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"local-password-strategy-factory-provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-local/local-password-strategy-factory-provider.ts"],"names":[],"mappings":";;;;AAAA,yCAAgD;AAChD,yCAAmD;AACnD,sEAAgD;AAIhD,qCAAsC;AAEtC,mCAA+B;AAW/B,IAAa,oCAAoC,GAAjD,MAAa,oCAAoC;IAG/C,YAEmB,aAA6C;QAA7C,kBAAa,GAAb,aAAa,CAAgC;IAC7D,CAAC;IAEJ,KAAK;QACH,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAC3B,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACrD,CAAC;IAED,wBAAwB,CACtB,OAE6C,EAC7C,cAA+C;QAE/C,MAAM,QAAQ,GAAG,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,IAAI,CAAC,aAAa,CAAC;QACtD,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,iBAAiB,EAAE;YAC9B,OAAO,IAAI,aAAa,CAAC,QAAQ,CAC/B,OAAO;YACP,kEAAkE;YAClE,KAAK,EACH,GAAY,EACZ,QAAgB,EAChB,QAAgB,EAChB,EAAyD,EACzD,EAAE;gBACF,IAAI;oBACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;oBACrD,IAAI,CAAC,IAAI,EAAE;wBACT,MAAM,IAAI,iBAAU,CAAC,YAAY,gDAEhC,CAAC;qBACH;oBACD,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;iBAChB;gBAAC,OAAO,GAAG,EAAE;oBACZ,EAAE,CAAC,GAAG,CAAC,CAAC;iBACT;YACH,CAAC,CACF,CAAC;SACH;aAAM,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,IAAA,gBAAO,EAAC,OAAO,CAAC,EAAE;YACzC,OAAO,IAAI,aAAa,CAAC,QAAQ,CAC/B,OAAO;YACP,kEAAkE;YAClE,KAAK,EACH,QAAgB,EAChB,QAAgB,EAChB,EAAyD,EACzD,EAAE;gBACF,IAAI;oBACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;oBAChD,IAAI,CAAC,IAAI,EAAE;wBACT,MAAM,IAAI,iBAAU,CAAC,YAAY,gDAEhC,CAAC;qBACH;oBACD,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;iBAChB;gBAAC,OAAO,GAAG,EAAE;oBACZ,EAAE,CAAC,GAAG,CAAC,CAAC;iBACT;YACH,CAAC,CACF,CAAC;SACH;aAAM;YACL,OAAO,IAAI,aAAa,CAAC,QAAQ;YAC/B,kEAAkE;YAClE,KAAK,EACH,QAAgB,EAChB,QAAgB,EAChB,EAAyD,EACzD,EAAE;gBACF,IAAI;oBACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;oBAC3D,IAAI,CAAC,IAAI,EAAE;wBACT,MAAM,IAAI,iBAAU,CAAC,YAAY,gDAEhC,CAAC;qBACH;oBACD,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;iBAChB;gBAAC,OAAO,GAAG,EAAE;oBACZ,EAAE,CAAC,GAAG,CAAC,CAAC;iBACT;YACH,CAAC,CACF,CAAC;SACH;IACH,CAAC;CACF,CAAA;AAxFY,oCAAoC;IAI5C,mBAAA,IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAA;;GAJ3C,oCAAoC,CAwFhD;AAxFY,oFAAoC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-local/local-password-verify.provider.d.ts b/dist/strategies/passport/passport-local/local-password-verify.provider.d.ts deleted file mode 100644 index 06bf9fb..0000000 --- a/dist/strategies/passport/passport-local/local-password-verify.provider.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Provider } from '@loopback/context'; -import { VerifyFunction } from '../../types'; -/** - * A provider for default implementation of VerifyFunction.LocalPasswordFn - * - * It will just throw an error saying Not Implemented - */ -export declare class LocalPasswordVerifyProvider implements Provider { - constructor(); - value(): VerifyFunction.LocalPasswordFn; -} diff --git a/dist/strategies/passport/passport-local/local-password-verify.provider.js b/dist/strategies/passport/passport-local/local-password-verify.provider.js deleted file mode 100644 index 022dd52..0000000 --- a/dist/strategies/passport/passport-local/local-password-verify.provider.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LocalPasswordVerifyProvider = void 0; -const rest_1 = require("@loopback/rest"); -/** - * A provider for default implementation of VerifyFunction.LocalPasswordFn - * - * It will just throw an error saying Not Implemented - */ -class LocalPasswordVerifyProvider { - constructor() { } - value() { - return async (username, password) => { - throw new rest_1.HttpErrors.NotImplemented(`VerifyFunction.LocalPasswordFn is not implemented`); - }; - } -} -exports.LocalPasswordVerifyProvider = LocalPasswordVerifyProvider; -//# sourceMappingURL=local-password-verify.provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-local/local-password-verify.provider.js.map b/dist/strategies/passport/passport-local/local-password-verify.provider.js.map deleted file mode 100644 index 33ce60a..0000000 --- a/dist/strategies/passport/passport-local/local-password-verify.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"local-password-verify.provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-local/local-password-verify.provider.ts"],"names":[],"mappings":";;;AACA,yCAA0C;AAI1C;;;;GAIG;AACH,MAAa,2BAA2B;IAGtC,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EAAE,QAAgB,EAAE,QAAgB,EAAE,EAAE;YAClD,MAAM,IAAI,iBAAU,CAAC,cAAc,CACjC,mDAAmD,CACpD,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF;AAZD,kEAYC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-otp/index.d.ts b/dist/strategies/passport/passport-otp/index.d.ts deleted file mode 100644 index 06a59eb..0000000 --- a/dist/strategies/passport/passport-otp/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './otp-auth'; -export * from './otp-strategy-factory.provider'; -export * from './otp-verify.provider'; diff --git a/dist/strategies/passport/passport-otp/index.js b/dist/strategies/passport/passport-otp/index.js deleted file mode 100644 index a2f39a5..0000000 --- a/dist/strategies/passport/passport-otp/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./otp-auth"), exports); -tslib_1.__exportStar(require("./otp-strategy-factory.provider"), exports); -tslib_1.__exportStar(require("./otp-verify.provider"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-otp/index.js.map b/dist/strategies/passport/passport-otp/index.js.map deleted file mode 100644 index f42238c..0000000 --- a/dist/strategies/passport/passport-otp/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-otp/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,0EAAgD;AAChD,gEAAsC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-otp/otp-auth.d.ts b/dist/strategies/passport/passport-otp/otp-auth.d.ts deleted file mode 100644 index 3bbc378..0000000 --- a/dist/strategies/passport/passport-otp/otp-auth.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import * as passport from 'passport'; -export declare namespace Otp { - interface VerifyFunction { - (key: string, otp: string, done: (error: any, user?: any, info?: any) => void): void; - } - interface StrategyOptions { - key?: string; - otp?: string; - } - type VerifyCallback = (err?: string | Error | null, user?: any, info?: any) => void; - class Strategy extends passport.Strategy { - constructor(_options?: StrategyOptions, verify?: VerifyFunction); - name: string; - private readonly verify; - authenticate(req: any, options?: StrategyOptions): void; - } -} diff --git a/dist/strategies/passport/passport-otp/otp-auth.js b/dist/strategies/passport/passport-otp/otp-auth.js deleted file mode 100644 index 623353d..0000000 --- a/dist/strategies/passport/passport-otp/otp-auth.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Otp = void 0; -const tslib_1 = require("tslib"); -/* eslint-disable @typescript-eslint/no-explicit-any */ -const passport = tslib_1.__importStar(require("passport")); -var Otp; -(function (Otp) { - class Strategy extends passport.Strategy { - constructor(_options, verify) { - super(); - this.name = 'otp'; - if (verify) { - this.verify = verify; - } - } - authenticate(req, options) { - const key = req.body.key || (options === null || options === void 0 ? void 0 : options.key); - const otp = req.body.otp || (options === null || options === void 0 ? void 0 : options.otp); - if (!key) { - this.fail(); - return; - } - const verified = (err, user, _info) => { - if (err) { - this.error(err); - return; - } - if (!user) { - this.fail(); - return; - } - this.success(user); - }; - this.verify(key, otp, verified); - } - } - Otp.Strategy = Strategy; -})(Otp = exports.Otp || (exports.Otp = {})); -//# sourceMappingURL=otp-auth.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-otp/otp-auth.js.map b/dist/strategies/passport/passport-otp/otp-auth.js.map deleted file mode 100644 index 2c156dd..0000000 --- a/dist/strategies/passport/passport-otp/otp-auth.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"otp-auth.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-otp/otp-auth.ts"],"names":[],"mappings":";;;;AAAA,uDAAuD;AACvD,2DAAqC;AAErC,IAAiB,GAAG,CAwDnB;AAxDD,WAAiB,GAAG;IAoBlB,MAAa,QAAS,SAAQ,QAAQ,CAAC,QAAQ;QAC7C,YAAY,QAA0B,EAAE,MAAuB;YAC7D,KAAK,EAAE,CAAC;YACR,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;YAClB,IAAI,MAAM,EAAE;gBACV,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;aACtB;QACH,CAAC;QAKD,YAAY,CAAC,GAAQ,EAAE,OAAyB;YAC9C,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,KAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAA,CAAC;YACzC,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,KAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAA,CAAC;YAEzC,IAAI,CAAC,GAAG,EAAE;gBACR,IAAI,CAAC,IAAI,EAAE,CAAC;gBACZ,OAAO;aACR;YAED,MAAM,QAAQ,GAAG,CAAC,GAAS,EAAE,IAAU,EAAE,KAAW,EAAE,EAAE;gBACtD,IAAI,GAAG,EAAE;oBACP,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBAChB,OAAO;iBACR;gBACD,IAAI,CAAC,IAAI,EAAE;oBACT,IAAI,CAAC,IAAI,EAAE,CAAC;oBACZ,OAAO;iBACR;gBACD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC,CAAC;YAEF,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;QAClC,CAAC;KACF;IAnCY,YAAQ,WAmCpB,CAAA;AACH,CAAC,EAxDgB,GAAG,GAAH,WAAG,KAAH,WAAG,QAwDnB"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-otp/otp-strategy-factory.provider.d.ts b/dist/strategies/passport/passport-otp/otp-strategy-factory.provider.d.ts deleted file mode 100644 index 93346df..0000000 --- a/dist/strategies/passport/passport-otp/otp-strategy-factory.provider.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Provider } from '@loopback/core'; -import { VerifyFunction } from '../../types'; -import { Otp } from './otp-auth'; -export interface PassportOtpStrategyFactory { - (options: Otp.StrategyOptions, verifierPassed?: VerifyFunction.OtpAuthFn): Otp.Strategy; -} -export declare class PassportOtpStrategyFactoryProvider implements Provider { - private readonly verifierOtp; - constructor(verifierOtp: VerifyFunction.OtpAuthFn); - value(): PassportOtpStrategyFactory; - getPassportOtpStrategyVerifier(options?: Otp.StrategyOptions, verifierPassed?: VerifyFunction.OtpAuthFn): Otp.Strategy; -} diff --git a/dist/strategies/passport/passport-otp/otp-strategy-factory.provider.js b/dist/strategies/passport/passport-otp/otp-strategy-factory.provider.js deleted file mode 100644 index 261ad1a..0000000 --- a/dist/strategies/passport/passport-otp/otp-strategy-factory.provider.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PassportOtpStrategyFactoryProvider = void 0; -const tslib_1 = require("tslib"); -const core_1 = require("@loopback/core"); -const rest_1 = require("@loopback/rest"); -const keys_1 = require("../../keys"); -const otp_auth_1 = require("./otp-auth"); -let PassportOtpStrategyFactoryProvider = class PassportOtpStrategyFactoryProvider { - constructor(verifierOtp) { - this.verifierOtp = verifierOtp; - } - value() { - return (options, verifier) => this.getPassportOtpStrategyVerifier(options, verifier); - } - getPassportOtpStrategyVerifier(options, verifierPassed) { - const verifyFn = verifierPassed !== null && verifierPassed !== void 0 ? verifierPassed : this.verifierOtp; - return new otp_auth_1.Otp.Strategy(options, - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (key, otp, cb) => { - try { - const user = await verifyFn(key, otp); - if (!user) { - throw new rest_1.HttpErrors.Unauthorized("Invalid Credentials" /* InvalidCredentials */); - } - cb(null, user); - } - catch (err) { - cb(err); - } - }); - } -}; -PassportOtpStrategyFactoryProvider = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_1.Strategies.Passport.OTP_VERIFIER)), - tslib_1.__metadata("design:paramtypes", [Function]) -], PassportOtpStrategyFactoryProvider); -exports.PassportOtpStrategyFactoryProvider = PassportOtpStrategyFactoryProvider; -//# sourceMappingURL=otp-strategy-factory.provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-otp/otp-strategy-factory.provider.js.map b/dist/strategies/passport/passport-otp/otp-strategy-factory.provider.js.map deleted file mode 100644 index 859b1ba..0000000 --- a/dist/strategies/passport/passport-otp/otp-strategy-factory.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"otp-strategy-factory.provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-otp/otp-strategy-factory.provider.ts"],"names":[],"mappings":";;;;AAAA,yCAAgD;AAChD,yCAA0C;AAE1C,qCAAsC;AAEtC,yCAA+B;AAS/B,IAAa,kCAAkC,GAA/C,MAAa,kCAAkC;IAG7C,YAEmB,WAAqC;QAArC,gBAAW,GAAX,WAAW,CAA0B;IACrD,CAAC;IAEJ,KAAK;QACH,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAC3B,IAAI,CAAC,8BAA8B,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC3D,CAAC;IAED,8BAA8B,CAC5B,OAA6B,EAC7B,cAAyC;QAEzC,MAAM,QAAQ,GAAG,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,IAAI,CAAC,WAAW,CAAC;QACpD,OAAO,IAAI,cAAG,CAAC,QAAQ,CACrB,OAAO;QACP,kEAAkE;QAClE,KAAK,EAAE,GAAW,EAAE,GAAW,EAAE,EAAsB,EAAE,EAAE;YACzD,IAAI;gBACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBACtC,IAAI,CAAC,IAAI,EAAE;oBACT,MAAM,IAAI,iBAAU,CAAC,YAAY,gDAAkC,CAAC;iBACrE;gBACD,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;aAChB;YAAC,OAAO,GAAG,EAAE;gBACZ,EAAE,CAAC,GAAG,CAAC,CAAC;aACT;QACH,CAAC,CACF,CAAC;IACJ,CAAC;CACF,CAAA;AAlCY,kCAAkC;IAI1C,mBAAA,IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;;GAJhC,kCAAkC,CAkC9C;AAlCY,gFAAkC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-otp/otp-verify.provider.d.ts b/dist/strategies/passport/passport-otp/otp-verify.provider.d.ts deleted file mode 100644 index 156b46c..0000000 --- a/dist/strategies/passport/passport-otp/otp-verify.provider.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Provider } from '@loopback/context'; -import { VerifyFunction } from '../../types'; -export declare class OtpVerifyProvider implements Provider { - constructor(); - value(): VerifyFunction.OtpAuthFn; -} diff --git a/dist/strategies/passport/passport-otp/otp-verify.provider.js b/dist/strategies/passport/passport-otp/otp-verify.provider.js deleted file mode 100644 index cded32e..0000000 --- a/dist/strategies/passport/passport-otp/otp-verify.provider.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.OtpVerifyProvider = void 0; -const rest_1 = require("@loopback/rest"); -class OtpVerifyProvider { - constructor() { } - value() { - return async (_key, _otp) => { - throw new rest_1.HttpErrors.NotImplemented(`VerifyFunction.OtpAuthFn is not implemented`); - }; - } -} -exports.OtpVerifyProvider = OtpVerifyProvider; -//# sourceMappingURL=otp-verify.provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-otp/otp-verify.provider.js.map b/dist/strategies/passport/passport-otp/otp-verify.provider.js.map deleted file mode 100644 index bf389e3..0000000 --- a/dist/strategies/passport/passport-otp/otp-verify.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"otp-verify.provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-otp/otp-verify.provider.ts"],"names":[],"mappings":";;;AACA,yCAA0C;AAI1C,MAAa,iBAAiB;IAC5B,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EAAE,IAAY,EAAE,IAAY,EAAE,EAAE;YAC1C,MAAM,IAAI,iBAAU,CAAC,cAAc,CACjC,6CAA6C,CAC9C,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF;AAVD,8CAUC"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-resource-owner-password/index.d.ts b/dist/strategies/passport/passport-resource-owner-password/index.d.ts deleted file mode 100644 index 64a940f..0000000 --- a/dist/strategies/passport/passport-resource-owner-password/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './resource-owner-verify.provider'; -export * from './oauth2-resource-owner-password-grant'; -export * from './resource-owner-strategy-factory-provider'; diff --git a/dist/strategies/passport/passport-resource-owner-password/index.js b/dist/strategies/passport/passport-resource-owner-password/index.js deleted file mode 100644 index 45f1e7c..0000000 --- a/dist/strategies/passport/passport-resource-owner-password/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./resource-owner-verify.provider"), exports); -tslib_1.__exportStar(require("./oauth2-resource-owner-password-grant"), exports); -tslib_1.__exportStar(require("./resource-owner-strategy-factory-provider"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-resource-owner-password/index.js.map b/dist/strategies/passport/passport-resource-owner-password/index.js.map deleted file mode 100644 index 7ba7b67..0000000 --- a/dist/strategies/passport/passport-resource-owner-password/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-resource-owner-password/index.ts"],"names":[],"mappings":";;;AAAA,2EAAiD;AACjD,iFAAuD;AACvD,qFAA2D"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-resource-owner-password/oauth2-resource-owner-password-grant.d.ts b/dist/strategies/passport/passport-resource-owner-password/oauth2-resource-owner-password-grant.d.ts deleted file mode 100644 index f622e39..0000000 --- a/dist/strategies/passport/passport-resource-owner-password/oauth2-resource-owner-password-grant.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import * as passport from 'passport'; -export declare namespace Oauth2ResourceOwnerPassword { - interface StrategyOptionsWithRequestInterface { - passReqToCallback: boolean; - } - interface VerifyFunctionWithRequest { - (req: any, clientId: string, clientSecret: string, username: string, password: string, done: (error: any, client?: any, info?: any) => void): void; - } - interface VerifyFunction { - (clientId: string, clientSecret: string, username: string, password: string, done: (error: any, client?: any, info?: any) => void): void; - } - class Strategy extends passport.Strategy { - constructor(verify: VerifyFunction); - constructor(options: StrategyOptionsWithRequestInterface | VerifyFunction, verify?: VerifyFunctionWithRequest | VerifyFunction); - name: string; - private readonly verify; - private readonly passReqToCallback; - authenticate(req: any, options?: {}): void; - } -} diff --git a/dist/strategies/passport/passport-resource-owner-password/oauth2-resource-owner-password-grant.js b/dist/strategies/passport/passport-resource-owner-password/oauth2-resource-owner-password-grant.js deleted file mode 100644 index 9a13be6..0000000 --- a/dist/strategies/passport/passport-resource-owner-password/oauth2-resource-owner-password-grant.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Oauth2ResourceOwnerPassword = void 0; -const tslib_1 = require("tslib"); -/* eslint-disable @typescript-eslint/no-explicit-any */ -const passport = tslib_1.__importStar(require("passport")); -var Oauth2ResourceOwnerPassword; -(function (Oauth2ResourceOwnerPassword) { - class Strategy extends passport.Strategy { - constructor(options, verify) { - super(); - if (verify) { - this.passReqToCallback = options.passReqToCallback; - this.verify = verify; - } - else { - this.passReqToCallback = false; - this.verify = options; - } - this.name = 'oauth2-resource-owner-password'; - } - authenticate(req, options) { - if (!req.body || - !req.body['client_id'] || - !req.body['username'] || - !req.body['password']) { - this.fail(); - return; - } - const clientId = req.body['client_id']; - const clientSecret = req.body['client_secret']; - const username = req.body['username']; - const password = req.body['password']; - const verified = (err, client, user) => { - if (err) { - this.error(err); - return; - } - if (!client) { - this.fail(); - return; - } - if (!user) { - this.fail(); - return; - } - this.success(user); - }; - if (this.passReqToCallback) { - this.verify(req, clientId, clientSecret, username, password, verified); - } - else { - this.verify(clientId, clientSecret, username, password, verified); - } - } - } - Oauth2ResourceOwnerPassword.Strategy = Strategy; -})(Oauth2ResourceOwnerPassword = exports.Oauth2ResourceOwnerPassword || (exports.Oauth2ResourceOwnerPassword = {})); -//# sourceMappingURL=oauth2-resource-owner-password-grant.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-resource-owner-password/oauth2-resource-owner-password-grant.js.map b/dist/strategies/passport/passport-resource-owner-password/oauth2-resource-owner-password-grant.js.map deleted file mode 100644 index 6979365..0000000 --- a/dist/strategies/passport/passport-resource-owner-password/oauth2-resource-owner-password-grant.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"oauth2-resource-owner-password-grant.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-resource-owner-password/oauth2-resource-owner-password-grant.ts"],"names":[],"mappings":";;;;AAAA,uDAAuD;AACvD,2DAAqC;AAErC,IAAiB,2BAA2B,CAyG3C;AAzGD,WAAiB,2BAA2B;IA0B1C,MAAa,QAAS,SAAQ,QAAQ,CAAC,QAAQ;QAM7C,YACE,OAA6D,EAC7D,MAAmD;YAEnD,KAAK,EAAE,CAAC;YACR,IAAI,MAAM,EAAE;gBACV,IAAI,CAAC,iBAAiB,GACpB,OACD,CAAC,iBAAiB,CAAC;gBACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;aACtB;iBAAM;gBACL,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;gBAC/B,IAAI,CAAC,MAAM,GAAG,OAAyB,CAAC;aACzC;YACD,IAAI,CAAC,IAAI,GAAG,gCAAgC,CAAC;QAC/C,CAAC;QAMD,YAAY,CAAC,GAAQ,EAAE,OAAY;YACjC,IACE,CAAC,GAAG,CAAC,IAAI;gBACT,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC;gBACtB,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC;gBACrB,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,EACrB;gBACA,IAAI,CAAC,IAAI,EAAE,CAAC;gBACZ,OAAO;aACR;YAED,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACvC,MAAM,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YAC/C,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACtC,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAEtC,MAAM,QAAQ,GAAG,CAAC,GAAQ,EAAE,MAAW,EAAE,IAAS,EAAE,EAAE;gBACpD,IAAI,GAAG,EAAE;oBACP,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBAChB,OAAO;iBACR;gBACD,IAAI,CAAC,MAAM,EAAE;oBACX,IAAI,CAAC,IAAI,EAAE,CAAC;oBACZ,OAAO;iBACR;gBACD,IAAI,CAAC,IAAI,EAAE;oBACT,IAAI,CAAC,IAAI,EAAE,CAAC;oBACZ,OAAO;iBACR;gBACD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC,CAAC;YAEF,IAAI,IAAI,CAAC,iBAAiB,EAAE;gBACzB,IAAI,CAAC,MAAoC,CACxC,GAAG,EACH,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,QAAQ,CACT,CAAC;aACH;iBAAM;gBACJ,IAAI,CAAC,MAAyB,CAC7B,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,QAAQ,CACT,CAAC;aACH;QACH,CAAC;KACF;IA9EY,oCAAQ,WA8EpB,CAAA;AACH,CAAC,EAzGgB,2BAA2B,GAA3B,mCAA2B,KAA3B,mCAA2B,QAyG3C"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-resource-owner-password/resource-owner-strategy-factory-provider.d.ts b/dist/strategies/passport/passport-resource-owner-password/resource-owner-strategy-factory-provider.d.ts deleted file mode 100644 index 365a6f2..0000000 --- a/dist/strategies/passport/passport-resource-owner-password/resource-owner-strategy-factory-provider.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Provider } from '@loopback/core'; -import { VerifyFunction } from '../../types'; -import { Oauth2ResourceOwnerPassword } from './oauth2-resource-owner-password-grant'; -export interface ResourceOwnerPasswordStrategyFactory { - (options?: Oauth2ResourceOwnerPassword.StrategyOptionsWithRequestInterface, verifierPassed?: VerifyFunction.ResourceOwnerPasswordFn): Oauth2ResourceOwnerPassword.Strategy; -} -export declare class ResourceOwnerPasswordStrategyFactoryProvider implements Provider { - private readonly verifierResourceOwner; - constructor(verifierResourceOwner: VerifyFunction.ResourceOwnerPasswordFn); - value(): ResourceOwnerPasswordStrategyFactory; - getResourceOwnerVerifier(options?: Oauth2ResourceOwnerPassword.StrategyOptionsWithRequestInterface, verifierPassed?: VerifyFunction.ResourceOwnerPasswordFn): Oauth2ResourceOwnerPassword.Strategy; -} diff --git a/dist/strategies/passport/passport-resource-owner-password/resource-owner-strategy-factory-provider.js b/dist/strategies/passport/passport-resource-owner-password/resource-owner-strategy-factory-provider.js deleted file mode 100644 index 2ce0507..0000000 --- a/dist/strategies/passport/passport-resource-owner-password/resource-owner-strategy-factory-provider.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ResourceOwnerPasswordStrategyFactoryProvider = void 0; -const tslib_1 = require("tslib"); -const core_1 = require("@loopback/core"); -const rest_1 = require("@loopback/rest"); -const keys_1 = require("../../keys"); -const oauth2_resource_owner_password_grant_1 = require("./oauth2-resource-owner-password-grant"); -const lodash_1 = require("lodash"); -let ResourceOwnerPasswordStrategyFactoryProvider = class ResourceOwnerPasswordStrategyFactoryProvider { - constructor(verifierResourceOwner) { - this.verifierResourceOwner = verifierResourceOwner; - } - value() { - return (options, verifier) => this.getResourceOwnerVerifier(options, verifier); - } - getResourceOwnerVerifier(options, verifierPassed) { - const verifyFn = verifierPassed !== null && verifierPassed !== void 0 ? verifierPassed : this.verifierResourceOwner; - if (options === null || options === void 0 ? void 0 : options.passReqToCallback) { - return new oauth2_resource_owner_password_grant_1.Oauth2ResourceOwnerPassword.Strategy(options, - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (req, clientId, clientSecret, username, password, cb) => { - try { - const userInfo = await verifyFn(clientId, clientSecret, username, password, req); - if (!userInfo || (0, lodash_1.isEmpty)(userInfo)) { - throw new rest_1.HttpErrors.Unauthorized("Invalid Credentials" /* InvalidCredentials */); - } - cb(null, userInfo.client, userInfo.user); - } - catch (err) { - cb(err); - } - }); - } - else { - return new oauth2_resource_owner_password_grant_1.Oauth2ResourceOwnerPassword.Strategy( - // eslint-disable-next-line @typescript-eslint/no-misused-promises - async (clientId, clientSecret, username, password, cb) => { - try { - const userInfo = await verifyFn(clientId, clientSecret, username, password); - if (!userInfo || (0, lodash_1.isEmpty)(userInfo)) { - throw new rest_1.HttpErrors.Unauthorized("Invalid Credentials" /* InvalidCredentials */); - } - cb(null, userInfo.client, userInfo.user); - } - catch (err) { - cb(err); - } - }); - } - } -}; -ResourceOwnerPasswordStrategyFactoryProvider = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_1.Strategies.Passport.RESOURCE_OWNER_PASSWORD_VERIFIER)), - tslib_1.__metadata("design:paramtypes", [Function]) -], ResourceOwnerPasswordStrategyFactoryProvider); -exports.ResourceOwnerPasswordStrategyFactoryProvider = ResourceOwnerPasswordStrategyFactoryProvider; -//# sourceMappingURL=resource-owner-strategy-factory-provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-resource-owner-password/resource-owner-strategy-factory-provider.js.map b/dist/strategies/passport/passport-resource-owner-password/resource-owner-strategy-factory-provider.js.map deleted file mode 100644 index 49c843d..0000000 --- a/dist/strategies/passport/passport-resource-owner-password/resource-owner-strategy-factory-provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resource-owner-strategy-factory-provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-resource-owner-password/resource-owner-strategy-factory-provider.ts"],"names":[],"mappings":";;;;AAAA,yCAAgD;AAChD,yCAAmD;AAInD,qCAAsC;AAEtC,iGAAmF;AACnF,mCAA+B;AAS/B,IAAa,4CAA4C,GAAzD,MAAa,4CAA4C;IAGvD,YAEmB,qBAA6D;QAA7D,0BAAqB,GAArB,qBAAqB,CAAwC;IAC7E,CAAC;IAEJ,KAAK;QACH,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAC3B,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACrD,CAAC;IAED,wBAAwB,CACtB,OAAyE,EACzE,cAAuD;QAEvD,MAAM,QAAQ,GAAG,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,IAAI,CAAC,qBAAqB,CAAC;QAC9D,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,iBAAiB,EAAE;YAC9B,OAAO,IAAI,kEAA2B,CAAC,QAAQ,CAC7C,OAAO;YACP,kEAAkE;YAClE,KAAK,EACH,GAAY,EACZ,QAAgB,EAChB,YAAoB,EACpB,QAAgB,EAChB,QAAgB,EAChB,EAIS,EACT,EAAE;gBACF,IAAI;oBACF,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAC7B,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,GAAG,CACJ,CAAC;oBACF,IAAI,CAAC,QAAQ,IAAI,IAAA,gBAAO,EAAC,QAAQ,CAAC,EAAE;wBAClC,MAAM,IAAI,iBAAU,CAAC,YAAY,gDAEhC,CAAC;qBACH;oBACD,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;iBAC1C;gBAAC,OAAO,GAAG,EAAE;oBACZ,EAAE,CAAC,GAAG,CAAC,CAAC;iBACT;YACH,CAAC,CACF,CAAC;SACH;aAAM;YACL,OAAO,IAAI,kEAA2B,CAAC,QAAQ;YAC7C,kEAAkE;YAClE,KAAK,EACH,QAAgB,EAChB,YAAoB,EACpB,QAAgB,EAChB,QAAgB,EAChB,EAIS,EACT,EAAE;gBACF,IAAI;oBACF,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAC7B,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,QAAQ,CACT,CAAC;oBACF,IAAI,CAAC,QAAQ,IAAI,IAAA,gBAAO,EAAC,QAAQ,CAAC,EAAE;wBAClC,MAAM,IAAI,iBAAU,CAAC,YAAY,gDAEhC,CAAC;qBACH;oBACD,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;iBAC1C;gBAAC,OAAO,GAAG,EAAE;oBACZ,EAAE,CAAC,GAAG,CAAC,CAAC;iBACT;YACH,CAAC,CACF,CAAC;SACH;IACH,CAAC;CACF,CAAA;AAvFY,4CAA4C;IAIpD,mBAAA,IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,gCAAgC,CAAC,CAAA;;GAJpD,4CAA4C,CAuFxD;AAvFY,oGAA4C"} \ No newline at end of file diff --git a/dist/strategies/passport/passport-resource-owner-password/resource-owner-verify.provider.d.ts b/dist/strategies/passport/passport-resource-owner-password/resource-owner-verify.provider.d.ts deleted file mode 100644 index 1f410c3..0000000 --- a/dist/strategies/passport/passport-resource-owner-password/resource-owner-verify.provider.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Provider } from '@loopback/context'; -import { VerifyFunction } from '../../types'; -/** - * A provider for default implementation of - * VerifyFunction.ResourceOwnerPasswordFn - * - * It will just throw an error saying Not Implemented - */ -export declare class ResourceOwnerVerifyProvider implements Provider { - constructor(); - value(): VerifyFunction.ResourceOwnerPasswordFn; -} diff --git a/dist/strategies/passport/passport-resource-owner-password/resource-owner-verify.provider.js b/dist/strategies/passport/passport-resource-owner-password/resource-owner-verify.provider.js deleted file mode 100644 index d8c78b1..0000000 --- a/dist/strategies/passport/passport-resource-owner-password/resource-owner-verify.provider.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ResourceOwnerVerifyProvider = void 0; -const rest_1 = require("@loopback/rest"); -/** - * A provider for default implementation of - * VerifyFunction.ResourceOwnerPasswordFn - * - * It will just throw an error saying Not Implemented - */ -class ResourceOwnerVerifyProvider { - constructor() { } - value() { - return async (clientId, clientSecret, username, password) => { - throw new rest_1.HttpErrors.NotImplemented(`VerifyFunction.ResourceOwnerPasswordFn is not implemented`); - }; - } -} -exports.ResourceOwnerVerifyProvider = ResourceOwnerVerifyProvider; -//# sourceMappingURL=resource-owner-verify.provider.js.map \ No newline at end of file diff --git a/dist/strategies/passport/passport-resource-owner-password/resource-owner-verify.provider.js.map b/dist/strategies/passport/passport-resource-owner-password/resource-owner-verify.provider.js.map deleted file mode 100644 index d02bf9b..0000000 --- a/dist/strategies/passport/passport-resource-owner-password/resource-owner-verify.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resource-owner-verify.provider.js","sourceRoot":"","sources":["../../../../src/strategies/passport/passport-resource-owner-password/resource-owner-verify.provider.ts"],"names":[],"mappings":";;;AACA,yCAA0C;AAI1C;;;;;GAKG;AACH,MAAa,2BAA2B;IAGtC,gBAAe,CAAC;IAEhB,KAAK;QACH,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE;YAC1D,MAAM,IAAI,iBAAU,CAAC,cAAc,CACjC,2DAA2D,CAC5D,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF;AAZD,kEAYC"} \ No newline at end of file diff --git a/dist/strategies/types/index.d.ts b/dist/strategies/types/index.d.ts deleted file mode 100644 index 45284cf..0000000 --- a/dist/strategies/types/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './types'; -export * from './keycloak.types'; diff --git a/dist/strategies/types/index.js b/dist/strategies/types/index.js deleted file mode 100644 index 5bca28f..0000000 --- a/dist/strategies/types/index.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./types"), exports); -tslib_1.__exportStar(require("./keycloak.types"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/strategies/types/index.js.map b/dist/strategies/types/index.js.map deleted file mode 100644 index f676914..0000000 --- a/dist/strategies/types/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/strategies/types/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,2DAAiC"} \ No newline at end of file diff --git a/dist/strategies/types/keycloak.types.d.ts b/dist/strategies/types/keycloak.types.d.ts deleted file mode 100644 index 2a7c3ff..0000000 --- a/dist/strategies/types/keycloak.types.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -export declare namespace Keycloak { - interface StrategyOptions { - host: string; - realm: string; - clientID: string; - clientSecret: string; - callbackURL: string; - authorizationURL: string; - tokenURL: string; - userInfoURL: string; - } - interface Profile { - keycloakId: string; - fullName: string; - firstName: string; - lastName: string; - username: string; - email: string; - avatar: string; - realm: string; - [key: string]: any; - } - type VerifyCallback = (err?: string | Error, user?: any, info?: any) => void; -} diff --git a/dist/strategies/types/keycloak.types.js b/dist/strategies/types/keycloak.types.js deleted file mode 100644 index 66bf796..0000000 --- a/dist/strategies/types/keycloak.types.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=keycloak.types.js.map \ No newline at end of file diff --git a/dist/strategies/types/keycloak.types.js.map b/dist/strategies/types/keycloak.types.js.map deleted file mode 100644 index 4adb9b4..0000000 --- a/dist/strategies/types/keycloak.types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"keycloak.types.js","sourceRoot":"","sources":["../../../src/strategies/types/keycloak.types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/strategies/types/types.d.ts b/dist/strategies/types/types.d.ts deleted file mode 100644 index 9661291..0000000 --- a/dist/strategies/types/types.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/// -/// -import { Request } from '@loopback/rest'; -import * as GoogleStrategy from 'passport-google-oauth20'; -import * as AzureADStrategy from 'passport-azure-ad'; -import * as InstagramStrategy from 'passport-instagram'; -import * as FacebookStrategy from 'passport-facebook'; -import * as AppleStrategy from 'passport-apple'; -import { DecodedIdToken } from 'passport-apple'; -import { IAuthClient, IAuthUser } from '../../types'; -import { Keycloak } from './keycloak.types'; -import { Otp } from '../passport'; -export declare type VerifyCallback = (err?: string | Error | null, user?: Express.User, info?: any) => void; -export declare namespace VerifyFunction { - interface OauthClientPasswordFn extends GenericAuthFn { - (clientId: string, clientSecret: string, req?: Request): Promise; - } - interface LocalPasswordFn extends GenericAuthFn { - (username: string, password: string, req?: Request): Promise; - } - interface OtpAuthFn extends GenericAuthFn { - (key: string, otp: string, cb: Otp.VerifyCallback): Promise; - } - interface BearerFn extends GenericAuthFn { - (token: string, req?: Request): Promise; - } - interface ResourceOwnerPasswordFn { - (clientId: string, clientSecret: string, username: string, password: string, req?: Request): Promise<{ - client: T; - user: S; - } | null>; - } - interface GoogleAuthFn extends GenericAuthFn { - (accessToken: string, refreshToken: string, profile: GoogleStrategy.Profile, cb: GoogleStrategy.VerifyCallback, req?: Request): Promise; - } - interface AzureADAuthFn extends GenericAuthFn { - (profile: AzureADStrategy.IProfile, done: AzureADStrategy.VerifyCallback, req?: Request): Promise; - } - interface KeycloakAuthFn extends GenericAuthFn { - (accessToken: string, refreshToken: string, profile: Keycloak.Profile, cb: (err?: string | Error, user?: IAuthUser) => void): Promise; - } - interface InstagramAuthFn extends VerifyFunction.GenericAuthFn { - (accessToken: string, refreshToken: string, profile: InstagramStrategy.Profile, cb: VerifyCallback, req?: Request): Promise; - } - interface FacebookAuthFn extends VerifyFunction.GenericAuthFn { - (accessToken: string, refreshToken: string, profile: FacebookStrategy.Profile, cb: VerifyCallback, req?: Request): Promise; - } - interface AppleAuthFn extends GenericAuthFn { - (accessToken: string, refreshToken: string, decodedIdToken: DecodedIdToken, profile: AppleStrategy.Profile, cb: AppleStrategy.VerifyCallback, req?: Request): Promise; - } - interface GenericAuthFn { - (...params: any): Promise; - } -} diff --git a/dist/strategies/types/types.js b/dist/strategies/types/types.js deleted file mode 100644 index 11e638d..0000000 --- a/dist/strategies/types/types.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/dist/strategies/types/types.js.map b/dist/strategies/types/types.js.map deleted file mode 100644 index 4764bb9..0000000 --- a/dist/strategies/types/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/strategies/types/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/strategies/user-auth-strategy.provider.d.ts b/dist/strategies/user-auth-strategy.provider.d.ts deleted file mode 100644 index 89b8b30..0000000 --- a/dist/strategies/user-auth-strategy.provider.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Context, Provider } from '@loopback/core'; -import { Strategy } from 'passport'; -import { AuthenticationMetadata } from '../types'; -import { BearerStrategyFactory } from './passport/passport-bearer'; -import { GoogleAuthStrategyFactory } from './passport/passport-google-oauth2'; -import { LocalPasswordStrategyFactory } from './passport/passport-local'; -import { ResourceOwnerPasswordStrategyFactory } from './passport/passport-resource-owner-password'; -import { AzureADAuthStrategyFactory } from './passport/passport-azure-ad'; -import { AppleAuthStrategyFactory, InstagramAuthStrategyFactory, KeycloakStrategyFactory, FacebookAuthStrategyFactory, PassportOtpStrategyFactory } from './passport'; -export declare class AuthStrategyProvider implements Provider { - private readonly metadata; - private readonly getLocalStrategyVerifier; - private readonly getOtpVerifier; - private readonly getBearerStrategyVerifier; - private readonly getResourceOwnerVerifier; - private readonly getGoogleAuthVerifier; - private readonly getAzureADAuthVerifier; - private readonly getKeycloakVerifier; - private readonly ctx; - private readonly getInstagramAuthVerifier; - private readonly getFacebookAuthVerifier; - private readonly getAppleAuthVerifier; - constructor(metadata: AuthenticationMetadata, getLocalStrategyVerifier: LocalPasswordStrategyFactory, getOtpVerifier: PassportOtpStrategyFactory, getBearerStrategyVerifier: BearerStrategyFactory, getResourceOwnerVerifier: ResourceOwnerPasswordStrategyFactory, getGoogleAuthVerifier: GoogleAuthStrategyFactory, getAzureADAuthVerifier: AzureADAuthStrategyFactory, getKeycloakVerifier: KeycloakStrategyFactory, ctx: Context, getInstagramAuthVerifier: InstagramAuthStrategyFactory, getFacebookAuthVerifier: FacebookAuthStrategyFactory, getAppleAuthVerifier: AppleAuthStrategyFactory); - value(): Promise; -} diff --git a/dist/strategies/user-auth-strategy.provider.js b/dist/strategies/user-auth-strategy.provider.js deleted file mode 100644 index 96d974f..0000000 --- a/dist/strategies/user-auth-strategy.provider.js +++ /dev/null @@ -1,85 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AuthStrategyProvider = void 0; -const tslib_1 = require("tslib"); -const core_1 = require("@loopback/core"); -const keys_1 = require("../keys"); -const keys_2 = require("./keys"); -let AuthStrategyProvider = class AuthStrategyProvider { - constructor(metadata, getLocalStrategyVerifier, getOtpVerifier, getBearerStrategyVerifier, getResourceOwnerVerifier, getGoogleAuthVerifier, getAzureADAuthVerifier, getKeycloakVerifier, ctx, getInstagramAuthVerifier, getFacebookAuthVerifier, getAppleAuthVerifier) { - this.metadata = metadata; - this.getLocalStrategyVerifier = getLocalStrategyVerifier; - this.getOtpVerifier = getOtpVerifier; - this.getBearerStrategyVerifier = getBearerStrategyVerifier; - this.getResourceOwnerVerifier = getResourceOwnerVerifier; - this.getGoogleAuthVerifier = getGoogleAuthVerifier; - this.getAzureADAuthVerifier = getAzureADAuthVerifier; - this.getKeycloakVerifier = getKeycloakVerifier; - this.ctx = ctx; - this.getInstagramAuthVerifier = getInstagramAuthVerifier; - this.getFacebookAuthVerifier = getFacebookAuthVerifier; - this.getAppleAuthVerifier = getAppleAuthVerifier; - } - async value() { - if (!this.metadata) { - return undefined; - } - //check if custom verifier binding is provided in the metadata - let verifier; - if (this.metadata.verifier) { - verifier = await this.ctx.get(this.metadata.verifier); - } - const name = this.metadata.strategy; - if (name === "local" /* LOCAL */) { - return this.getLocalStrategyVerifier(this.metadata.options, verifier); - } - else if (name === "bearer" /* BEARER */) { - return this.getBearerStrategyVerifier(this.metadata.options, verifier); - } - else if (name === "OAuth2 resource owner grant" /* OAUTH2_RESOURCE_OWNER_GRANT */) { - return this.getResourceOwnerVerifier(this.metadata - .options, verifier); - } - else if (name === "Google Oauth 2.0" /* GOOGLE_OAUTH2 */) { - return this.getGoogleAuthVerifier(this.metadata.options, verifier); - } - else if (name === "Azure AD" /* AZURE_AD */) { - return this.getAzureADAuthVerifier(this.metadata.options, verifier); - } - else if (name === "keycloak" /* KEYCLOAK */) { - return this.getKeycloakVerifier(this.metadata.options, verifier); - } - else if (name === "Instagram Oauth 2.0" /* INSTAGRAM_OAUTH2 */) { - return this.getInstagramAuthVerifier(this.metadata.options, verifier); - } - else if (name === "Apple Oauth 2.0" /* APPLE_OAUTH2 */) { - return this.getAppleAuthVerifier(this.metadata.options, verifier); - } - else if (name === "Facebook Oauth 2.0" /* FACEBOOK_OAUTH2 */) { - return this.getFacebookAuthVerifier(this.metadata.options, verifier); - } - else if (name === "otp" /* OTP */) { - return this.getOtpVerifier(this.metadata.options, verifier); - } - else { - return Promise.reject(`The strategy ${name} is not available.`); - } - } -}; -AuthStrategyProvider = tslib_1.__decorate([ - tslib_1.__param(0, (0, core_1.inject)(keys_1.AuthenticationBindings.USER_METADATA)), - tslib_1.__param(1, (0, core_1.inject)(keys_2.Strategies.Passport.LOCAL_STRATEGY_FACTORY)), - tslib_1.__param(2, (0, core_1.inject)(keys_2.Strategies.Passport.OTP_AUTH_STRATEGY_FACTORY)), - tslib_1.__param(3, (0, core_1.inject)(keys_2.Strategies.Passport.BEARER_STRATEGY_FACTORY)), - tslib_1.__param(4, (0, core_1.inject)(keys_2.Strategies.Passport.RESOURCE_OWNER_STRATEGY_FACTORY)), - tslib_1.__param(5, (0, core_1.inject)(keys_2.Strategies.Passport.GOOGLE_OAUTH2_STRATEGY_FACTORY)), - tslib_1.__param(6, (0, core_1.inject)(keys_2.Strategies.Passport.AZURE_AD_STRATEGY_FACTORY)), - tslib_1.__param(7, (0, core_1.inject)(keys_2.Strategies.Passport.KEYCLOAK_STRATEGY_FACTORY)), - tslib_1.__param(8, core_1.inject.context()), - tslib_1.__param(9, (0, core_1.inject)(keys_2.Strategies.Passport.INSTAGRAM_OAUTH2_STRATEGY_FACTORY)), - tslib_1.__param(10, (0, core_1.inject)(keys_2.Strategies.Passport.FACEBOOK_OAUTH2_STRATEGY_FACTORY)), - tslib_1.__param(11, (0, core_1.inject)(keys_2.Strategies.Passport.APPLE_OAUTH2_STRATEGY_FACTORY)), - tslib_1.__metadata("design:paramtypes", [Object, Function, Function, Function, Function, Function, Function, Function, core_1.Context, Function, Function, Function]) -], AuthStrategyProvider); -exports.AuthStrategyProvider = AuthStrategyProvider; -//# sourceMappingURL=user-auth-strategy.provider.js.map \ No newline at end of file diff --git a/dist/strategies/user-auth-strategy.provider.js.map b/dist/strategies/user-auth-strategy.provider.js.map deleted file mode 100644 index a204c0f..0000000 --- a/dist/strategies/user-auth-strategy.provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"user-auth-strategy.provider.js","sourceRoot":"","sources":["../../src/strategies/user-auth-strategy.provider.ts"],"names":[],"mappings":";;;;AAAA,yCAAyD;AAUzD,kCAA+C;AAG/C,iCAAkC;AAuBlC,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;IAC/B,YAEmB,QAAgC,EAEhC,wBAAsD,EAEtD,cAA0C,EAE1C,yBAAgD,EAEhD,wBAA8D,EAE9D,qB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IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAA;IAElD,mBAAA,IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAA;IAErD,mBAAA,IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAA;IAEnD,mBAAA,IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,+BAA+B,CAAC,CAAA;IAE3D,mBAAA,IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CAAA;IAE1D,mBAAA,IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAA;IAErD,mBAAA,IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAA;IAErD,mBAAA,aAAM,CAAC,OAAO,EAAE,CAAA;IAChB,mBAAA,IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,iCAAiC,CAAC,CAAA;IAE7D,oBAAA,IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,gCAAgC,CAAC,CAAA;IAE5D,oBAAA,IAAA,aAAM,EAAC,iBAAU,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAA;2HALlB,cAAO;GAlBtC,oBAAoB,CA4GhC;AA5GY,oDAAoB"} \ No newline at end of file diff --git a/dist/strategy-adapter.d.ts b/dist/strategy-adapter.d.ts deleted file mode 100644 index c7adb93..0000000 --- a/dist/strategy-adapter.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/// -import { Request, Response } from '@loopback/rest'; -import { Strategy } from 'passport'; -/** - * Adapter class to invoke passport-strategy - * 1. provides express dependencies to the passport strategies - * 2. provides shimming of requests for passport authentication - * 3. provides lifecycle similar to express to the passport-strategy - * 3. provides state methods to the strategy instance - * see: https://github.com/jaredhanson/passport - */ -export declare class StrategyAdapter { - private readonly strategy; - /** - * @param strategy instance of a class which implements a passport-strategy; - * @description http://passportjs.org/ - */ - constructor(strategy: Strategy); - /** - * The function to invoke the contained passport strategy. - * 1. Create an instance of the strategy - * 2. add success and failure state handlers - * 3. authenticate using the strategy - * @param request The incoming request. - */ - authenticate(request: Request, response?: Response, options?: Object): Promise; -} diff --git a/dist/strategy-adapter.js b/dist/strategy-adapter.js deleted file mode 100644 index a1f2e1e..0000000 --- a/dist/strategy-adapter.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.StrategyAdapter = void 0; -// Copyright IBM Corp. 2017,2018. All Rights Reserved. -// Node module: @loopback/authentication -// This file is licensed under the MIT License. -// License text available at https://opensource.org/licenses/MIT -const rest_1 = require("@loopback/rest"); -const passportRequestMixin = require('passport/lib/http/request'); -/** - * Adapter class to invoke passport-strategy - * 1. provides express dependencies to the passport strategies - * 2. provides shimming of requests for passport authentication - * 3. provides lifecycle similar to express to the passport-strategy - * 3. provides state methods to the strategy instance - * see: https://github.com/jaredhanson/passport - */ -class StrategyAdapter { - /** - * @param strategy instance of a class which implements a passport-strategy; - * @description http://passportjs.org/ - */ - constructor(strategy) { - this.strategy = strategy; - } - /** - * The function to invoke the contained passport strategy. - * 1. Create an instance of the strategy - * 2. add success and failure state handlers - * 3. authenticate using the strategy - * @param request The incoming request. - */ - authenticate(request, response, options) { - return new Promise((resolve, reject) => { - // mix-in passport additions like req.logIn and req.logOut - for (const key in passportRequestMixin) { - /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ - request[key] = passportRequestMixin[key]; - } - // create a prototype chain of an instance of a passport strategy - const strategy = Object.create(this.strategy); - // add success state handler to strategy instance - strategy.success = (t) => { - resolve(t); - }; - // add failure state handler to strategy instance - strategy.fail = (challenge) => { - reject(new rest_1.HttpErrors.Unauthorized(challenge)); - }; - // add error state handler to strategy instance - strategy.error = (error) => { - reject(new rest_1.HttpErrors.Unauthorized(error)); - }; - strategy.redirect = (url) => { - if (response) { - response.redirect(url, 302); - } - resolve(); - }; - // authenticate - strategy.authenticate(request, options); - }); - } -} -exports.StrategyAdapter = StrategyAdapter; -//# sourceMappingURL=strategy-adapter.js.map \ No newline at end of file diff --git a/dist/strategy-adapter.js.map b/dist/strategy-adapter.js.map deleted file mode 100644 index d8f705b..0000000 --- a/dist/strategy-adapter.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"strategy-adapter.js","sourceRoot":"","sources":["../src/strategy-adapter.ts"],"names":[],"mappings":";;;AAAA,sDAAsD;AACtD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE;AAChE,yCAA6D;AAG7D,MAAM,oBAAoB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAElE;;;;;;;GAOG;AACH,MAAa,eAAe;IAC1B;;;OAGG;IACH,YAA6B,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;IAAG,CAAC;IAEnD;;;;;;OAMG;IACH,YAAY,CACV,OAAgB,EAChB,QAAmB,EACnB,OAAgB;QAEhB,OAAO,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC/C,0DAA0D;YAC1D,KAAK,MAAM,GAAG,IAAI,oBAAoB,EAAE;gBACtC,iEAAiE;gBAChE,OAAe,CAAC,GAAG,CAAC,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;aACnD;YAED,iEAAiE;YACjE,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAE9C,iDAAiD;YACjD,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAI,EAAE,EAAE;gBAC1B,OAAO,CAAC,CAAC,CAAC,CAAC;YACb,CAAC,CAAC;YAEF,iDAAiD;YACjD,QAAQ,CAAC,IAAI,GAAG,CAAC,SAAiB,EAAE,EAAE;gBACpC,MAAM,CAAC,IAAI,iBAAU,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;YACjD,CAAC,CAAC;YAEF,+CAA+C;YAC/C,QAAQ,CAAC,KAAK,GAAG,CAAC,KAAa,EAAE,EAAE;gBACjC,MAAM,CAAC,IAAI,iBAAU,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;YAC7C,CAAC,CAAC;YAEF,QAAQ,CAAC,QAAQ,GAAG,CAAC,GAAW,EAAE,EAAE;gBAClC,IAAI,QAAQ,EAAE;oBACZ,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;iBAC7B;gBACD,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC;YAEF,eAAe;YACf,QAAQ,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAvDD,0CAuDC"} \ No newline at end of file diff --git a/dist/strategy-name.enum.d.ts b/dist/strategy-name.enum.d.ts deleted file mode 100644 index 32519b5..0000000 --- a/dist/strategy-name.enum.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export declare const enum STRATEGY { - CLIENT_PASSWORD = "client-password", - LOCAL = "local", - BEARER = "bearer", - OAUTH2_RESOURCE_OWNER_GRANT = "OAuth2 resource owner grant", - GOOGLE_OAUTH2 = "Google Oauth 2.0", - INSTAGRAM_OAUTH2 = "Instagram Oauth 2.0", - APPLE_OAUTH2 = "Apple Oauth 2.0", - FACEBOOK_OAUTH2 = "Facebook Oauth 2.0", - AZURE_AD = "Azure AD", - KEYCLOAK = "keycloak", - OTP = "otp" -} diff --git a/dist/strategy-name.enum.js b/dist/strategy-name.enum.js deleted file mode 100644 index 1a91c1a..0000000 --- a/dist/strategy-name.enum.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=strategy-name.enum.js.map \ No newline at end of file diff --git a/dist/strategy-name.enum.js.map b/dist/strategy-name.enum.js.map deleted file mode 100644 index e317aef..0000000 --- a/dist/strategy-name.enum.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"strategy-name.enum.js","sourceRoot":"","sources":["../src/strategy-name.enum.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/types.d.ts b/dist/types.d.ts deleted file mode 100644 index 68f0c72..0000000 --- a/dist/types.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/// -import { BindingKey } from '@loopback/core'; -import { Request, Response } from '@loopback/rest'; -import { VerifyFunction } from './strategies'; -export * from './strategies/types'; -export interface IAuthClient { - clientId: string; - clientSecret: string; - redirectUrl?: string; -} -export interface IAuthUser { - id?: number | string; - username: string; - password?: string; -} -export interface AuthenticationMetadata { - strategy: string; - options?: Object; - verifier?: BindingKey>; - authOptions?: (req: Request) => Object; -} -/** - * interface definition of a function which accepts a request - * and returns an authenticated user - */ -export interface AuthenticateFn { - (request: Request, response?: Response): Promise; -} -export interface ClientAuthCode { - clientId: string; - mfa?: boolean; - userId?: ID; - user?: T; -} diff --git a/dist/types.js b/dist/types.js deleted file mode 100644 index a5c6a65..0000000 --- a/dist/types.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -// Copyright IBM Corp. 2018. All Rights Reserved. -// Node module: @loopback/authentication -// This file is licensed under the MIT License. -// License text available at https://opensource.org/licenses/MIT -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); -tslib_1.__exportStar(require("./strategies/types"), exports); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/dist/types.js.map b/dist/types.js.map deleted file mode 100644 index f2e8104..0000000 --- a/dist/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,wCAAwC;AACxC,+CAA+C;AAC/C,gEAAgE;;;AAKhE,6DAAmC"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index d73c347..1982ab7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "loopback4-authentication", - "version": "7.0.0", + "version": "7.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "loopback4-authentication", - "version": "7.0.0", + "version": "7.0.1", "license": "MIT", "dependencies": { "@exlinc/keycloak-passport": "^1.0.2", @@ -100,29 +100,29 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.19.0.tgz", - "integrity": "sha512-y5rqgTTPTmaF5e2nVhOxw+Ur9HDJLsWb6U/KpgUzRZEdPfE6VOubXBKLdbcUTijzRptednSBDQbYZBOSqJxpJw==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.19.1.tgz", + "integrity": "sha512-72a9ghR0gnESIa7jBN53U32FOVCEoztyIlKaNoU05zRhEecduGK9L9c3ww7Mp06JiR+0ls0GBPFJQwwtjn9ksg==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.19.0.tgz", - "integrity": "sha512-reM4+U7B9ss148rh2n1Qs9ASS+w94irYXga7c2jaQv9RVzpS7Mv1a9rnYYwuDa45G+DkORt9g6An2k/V4d9LbQ==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.19.1.tgz", + "integrity": "sha512-1H8VgqXme4UXCRv7/Wa1bq7RVymKOzC7znjyFM8KiEzwFqcKUKYNoQef4GhdklgNvoBXyW4gYhuBNCM5o1zImw==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.1.0", "@babel/code-frame": "^7.18.6", "@babel/generator": "^7.19.0", - "@babel/helper-compilation-targets": "^7.19.0", + "@babel/helper-compilation-targets": "^7.19.1", "@babel/helper-module-transforms": "^7.19.0", "@babel/helpers": "^7.19.0", - "@babel/parser": "^7.19.0", + "@babel/parser": "^7.19.1", "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.0", + "@babel/traverse": "^7.19.1", "@babel/types": "^7.19.0", "convert-source-map": "^1.7.0", "debug": "^4.1.0", @@ -176,14 +176,14 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.0.tgz", - "integrity": "sha512-Ai5bNWXIvwDvWM7njqsG3feMlL9hCVQsPYXodsZyLwshYkZVJt59Gftau4VrE8S9IT9asd2uSP1hG6wCNw+sXA==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.1.tgz", + "integrity": "sha512-LlLkkqhCMyz2lkQPvJNdIYU7O5YjWRgC2R4omjCTpZd8u8KMQzZvX4qce+/BluN1rcQiV7BoGUpmQ0LeHerbhg==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.19.0", + "@babel/compat-data": "^7.19.1", "@babel/helper-validator-option": "^7.18.6", - "browserslist": "^4.20.2", + "browserslist": "^4.21.3", "semver": "^6.3.0" }, "engines": { @@ -301,9 +301,9 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz", - "integrity": "sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", "dev": true, "engines": { "node": ">=6.9.0" @@ -418,9 +418,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.0.tgz", - "integrity": "sha512-74bEXKX2h+8rrfQUfsBfuZZHzsEs6Eql4pqy/T4Nn6Y9wNPggQOqD6z6pn5Bl8ZfysKouFZT/UXEH94ummEeQw==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.1.tgz", + "integrity": "sha512-h7RCSorm1DdTVGJf3P2Mhj3kdnkmF/EiysUkzS2TdgAYqyjFdMQJbVuXOBej2SBJaXan/lIVtT6KkGbyyq753A==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -444,9 +444,9 @@ } }, "node_modules/@babel/traverse": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.19.0.tgz", - "integrity": "sha512-4pKpFRDh+utd2mbRC8JLnlsMUii3PMHjpL6a0SZ4NMZy7YFP9aXORxEhdMVOc9CpWtDF09IkciQLEhK7Ml7gRA==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.19.1.tgz", + "integrity": "sha512-0j/ZfZMxKukDaag2PtOPDbwuELqIar6lLskVPPJDjXMXjfLb1Obo/1yjxIGqqAJrmfaTIY3z2wFLAQ7qSkLsuA==", "dev": true, "dependencies": { "@babel/code-frame": "^7.18.6", @@ -455,7 +455,7 @@ "@babel/helper-function-name": "^7.19.0", "@babel/helper-hoist-variables": "^7.18.6", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.19.0", + "@babel/parser": "^7.19.1", "@babel/types": "^7.19.0", "debug": "^4.1.0", "globals": "^11.1.0" @@ -779,9 +779,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.1.tgz", - "integrity": "sha512-OhSY22oQQdw3zgPOOwdoj01l/Dzl1Z+xyUP33tkSN+aqyEhymJCcPHyXt+ylW8FSe0TfRC2VG+ROQOapD0aZSQ==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.2.tgz", + "integrity": "sha512-AXYd23w1S/bv3fTs3Lz0vjiYemS08jWkI3hYyS9I1ry+0f+Yjs1wm+sU0BS8qDOPrBIkp4qHYC16I8uVtpLajQ==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -873,9 +873,9 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.4.tgz", - "integrity": "sha512-mXAIHxZT3Vcpg83opl1wGlVZ9xydbfZO3r5YfRSH6Gpp2J/PfdBP0wbDa2sO6/qRbcalpoevVyW6A/fI6LfeMw==", + "version": "0.10.5", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.5.tgz", + "integrity": "sha512-XVVDtp+dVvRxMoxSiSfasYaG02VEe1qH5cKgMQJWhol6HwzbcqoCMJi8dAGoYAO57jhUyhI6cWuRiTcRaDaYug==", "dev": true, "dependencies": { "@humanwhocodes/object-schema": "^1.2.1", @@ -1502,18 +1502,18 @@ } }, "node_modules/@octokit/openapi-types": { - "version": "13.9.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-13.9.0.tgz", - "integrity": "sha512-MOYjRyLIM0zzNb9RfEwVK6HLIc2nIF2OMVtMqiNOGbX0SHrQvQbI6X1K16ktmaHr8WUBv+eeul8cD9mz4rNiWQ==", + "version": "13.12.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-13.12.0.tgz", + "integrity": "sha512-1QYzZrwnn3rTQE7ZoSxXrO8lhu0aIbac1c+qIPOPEaVXBWSaUyLV1x9yt4uDQOwmu6u5ywVS8OJgs+ErDLf6vQ==", "dev": true }, "node_modules/@octokit/plugin-paginate-rest": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-4.2.2.tgz", - "integrity": "sha512-oslJFmdcWeB3Q8dzn2WNFBzEAvqCH+cvrjBUhS7uwQxAt5yH91w1eo2flWiR0Rqxh+EijQS5ImoB0iQ3hz7P2Q==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-4.3.1.tgz", + "integrity": "sha512-h8KKxESmSFTcXX409CAxlaOYscEDvN2KGQRsLCGT1NSqRW+D6EXLVQ8vuHhFznS9MuH9QYw1GfsUN30bg8hjVA==", "dev": true, "dependencies": { - "@octokit/types": "^7.3.0" + "@octokit/types": "^7.5.0" }, "engines": { "node": ">= 14" @@ -1532,12 +1532,12 @@ } }, "node_modules/@octokit/plugin-rest-endpoint-methods": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-6.5.0.tgz", - "integrity": "sha512-+r/tWwc7hI3vYDb+d0hAqbr04Kle6pL+MmGxMDTUn7wIwry5qFXnUA8RCa5CO8EcuHbZLywnqIVRLdM08qV8Ew==", + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-6.6.2.tgz", + "integrity": "sha512-n9dL5KMpz9qVFSNdcVWC8ZPbl68QbTk7+CMPXCXqaMZOLn1n1YuoSFFCy84Ge0fx333fUqpnBHv8BFjwGtUQkA==", "dev": true, "dependencies": { - "@octokit/types": "^7.3.0", + "@octokit/types": "^7.5.0", "deprecation": "^2.3.1" }, "engines": { @@ -1594,12 +1594,12 @@ } }, "node_modules/@octokit/types": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-7.3.0.tgz", - "integrity": "sha512-7Ar22AVxsJBYZuPkGQwFQybGt2YjuP6j6Z36bPntIYy3R9qSowB55mXOsb16hc0UqtJkYBrRMVXKlaX1OHsh1g==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-7.5.0.tgz", + "integrity": "sha512-aHm+olfIZjQpzoODpl+RCZzchKOrdSLJs+yfI7pMMcmB19Li6vidgx0DwUDO/Ic4Q3fq/lOjJORVCcLZefcrJw==", "dev": true, "dependencies": { - "@octokit/openapi-types": "^13.9.0" + "@octokit/openapi-types": "^13.11.0" } }, "node_modules/@openapi-contrib/openapi-schema-to-json-schema": { @@ -1912,9 +1912,9 @@ } }, "node_modules/@types/express": { - "version": "4.17.13", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", - "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", + "version": "4.17.14", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.14.tgz", + "integrity": "sha512-TEbt+vaPFQ+xpxFLFssxUDXj5cWCxZJjIcB7Yg0k0GMHGtgtQgpvx/MUQUeAkNbA9AAGrwkAsoeItdTgS7FMyg==", "dev": true, "dependencies": { "@types/body-parser": "*", @@ -1924,9 +1924,9 @@ } }, "node_modules/@types/express-serve-static-core": { - "version": "4.17.30", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.30.tgz", - "integrity": "sha512-gstzbTWro2/nFed1WXtf+TtrpwxH7Ggs4RLYTLbeVgIkUQOI3WG/JKjgeOU1zXDvezllupjrf8OPIdvTbIaVOQ==", + "version": "4.17.31", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.31.tgz", + "integrity": "sha512-DxMhY+NAsTwMMFHBTtJFNp5qiHKJ7TeqOo23zVEM9alT1Ml27Q3xcTH0xwxn7Q0BbMcVEJOs/7aQtUWupUQN3Q==", "dev": true, "dependencies": { "@types/node": "*", @@ -2003,9 +2003,9 @@ } }, "node_modules/@types/lodash": { - "version": "4.14.184", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.184.tgz", - "integrity": "sha512-RoZphVtHbxPZizt4IcILciSWiC6dcn+eZ8oX9IWEYfDMcocdd42f7NPI6fQj+6zI8y4E0L7gu2pcZKLGTRaV9Q==", + "version": "4.14.185", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.185.tgz", + "integrity": "sha512-evMDG1bC4rgQg4ku9tKpuMh5iBNEwNa3tf9zRHdP1qlv+1WUg44xat4IxCE14gIpZRGUUWAx2VhItCZc25NfMA==", "dev": true }, "node_modules/@types/mime": { @@ -2038,9 +2038,9 @@ "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==" }, "node_modules/@types/node": { - "version": "14.18.28", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.28.tgz", - "integrity": "sha512-CK2fnrQlIgKlCV3N2kM+Gznb5USlwA1KFX3rJVHmgVk6NJxFPuQ86pAcvKnu37IA4BGlSRz7sEE1lHL1aLZ/eQ==", + "version": "14.18.29", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.29.tgz", + "integrity": "sha512-LhF+9fbIX4iPzhsRLpK5H7iPdvW8L4IwGciXQIOEcuF62+9nw/VQVsOViAOOGxY3OlOKGLFv0sWwJXdwQeTn6A==", "dev": true }, "node_modules/@types/normalize-package-data": { @@ -2074,9 +2074,9 @@ "dev": true }, "node_modules/@types/passport": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/@types/passport/-/passport-1.0.10.tgz", - "integrity": "sha512-IZamnXuN7mY+2/v8bAW6nuTcKiay7gXBBcMBZ8n7YHB4u5DwsWoJaNrHdAQ8PZEODRjCv3oHOg76CYJ40j9RqA==", + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@types/passport/-/passport-1.0.11.tgz", + "integrity": "sha512-pz1cx9ptZvozyGKKKIPLcVDVHwae4hrH5d6g5J+DkMRRjR3cVETb4jMabhXAUbg3Ov7T22nFHEgaK2jj+5CBpw==", "dev": true, "dependencies": { "@types/express": "*" @@ -2268,16 +2268,15 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.36.2.tgz", - "integrity": "sha512-OwwR8LRwSnI98tdc2z7mJYgY60gf7I9ZfGjN5EjCwwns9bdTuQfAXcsjSB2wSQ/TVNYSGKf4kzVXbNGaZvwiXw==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.38.0.tgz", + "integrity": "sha512-GgHi/GNuUbTOeoJiEANi0oI6fF3gBQc3bGFYj40nnAPCbhrtEDf2rjBmefFadweBmO1Du1YovHeDP2h5JLhtTQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.36.2", - "@typescript-eslint/type-utils": "5.36.2", - "@typescript-eslint/utils": "5.36.2", + "@typescript-eslint/scope-manager": "5.38.0", + "@typescript-eslint/type-utils": "5.38.0", + "@typescript-eslint/utils": "5.38.0", "debug": "^4.3.4", - "functional-red-black-tree": "^1.0.1", "ignore": "^5.2.0", "regexpp": "^3.2.0", "semver": "^7.3.7", @@ -2301,14 +2300,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.36.2.tgz", - "integrity": "sha512-qS/Kb0yzy8sR0idFspI9Z6+t7mqk/oRjnAYfewG+VN73opAUvmYL3oPIMmgOX6CnQS6gmVIXGshlb5RY/R22pA==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.38.0.tgz", + "integrity": "sha512-/F63giJGLDr0ms1Cr8utDAxP2SPiglaD6V+pCOcG35P2jCqdfR7uuEhz1GIC3oy4hkUF8xA1XSXmd9hOh/a5EA==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.36.2", - "@typescript-eslint/types": "5.36.2", - "@typescript-eslint/typescript-estree": "5.36.2", + "@typescript-eslint/scope-manager": "5.38.0", + "@typescript-eslint/types": "5.38.0", + "@typescript-eslint/typescript-estree": "5.38.0", "debug": "^4.3.4" }, "engines": { @@ -2328,13 +2327,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.36.2.tgz", - "integrity": "sha512-cNNP51L8SkIFSfce8B1NSUBTJTu2Ts4nWeWbFrdaqjmn9yKrAaJUBHkyTZc0cL06OFHpb+JZq5AUHROS398Orw==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.38.0.tgz", + "integrity": "sha512-ByhHIuNyKD9giwkkLqzezZ9y5bALW8VNY6xXcP+VxoH4JBDKjU5WNnsiD4HJdglHECdV+lyaxhvQjTUbRboiTA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.36.2", - "@typescript-eslint/visitor-keys": "5.36.2" + "@typescript-eslint/types": "5.38.0", + "@typescript-eslint/visitor-keys": "5.38.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -2345,13 +2344,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.36.2.tgz", - "integrity": "sha512-rPQtS5rfijUWLouhy6UmyNquKDPhQjKsaKH0WnY6hl/07lasj8gPaH2UD8xWkePn6SC+jW2i9c2DZVDnL+Dokw==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.38.0.tgz", + "integrity": "sha512-iZq5USgybUcj/lfnbuelJ0j3K9dbs1I3RICAJY9NZZpDgBYXmuUlYQGzftpQA9wC8cKgtS6DASTvF3HrXwwozA==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.36.2", - "@typescript-eslint/utils": "5.36.2", + "@typescript-eslint/typescript-estree": "5.38.0", + "@typescript-eslint/utils": "5.38.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, @@ -2372,9 +2371,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.36.2.tgz", - "integrity": "sha512-9OJSvvwuF1L5eS2EQgFUbECb99F0mwq501w0H0EkYULkhFa19Qq7WFbycdw1PexAc929asupbZcgjVIe6OK/XQ==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.38.0.tgz", + "integrity": "sha512-HHu4yMjJ7i3Cb+8NUuRCdOGu2VMkfmKyIJsOr9PfkBVYLYrtMCK/Ap50Rpov+iKpxDTfnqvDbuPLgBE5FwUNfA==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -2385,13 +2384,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.36.2.tgz", - "integrity": "sha512-8fyH+RfbKc0mTspfuEjlfqA4YywcwQK2Amcf6TDOwaRLg7Vwdu4bZzyvBZp4bjt1RRjQ5MDnOZahxMrt2l5v9w==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.38.0.tgz", + "integrity": "sha512-6P0RuphkR+UuV7Avv7MU3hFoWaGcrgOdi8eTe1NwhMp2/GjUJoODBTRWzlHpZh6lFOaPmSvgxGlROa0Sg5Zbyg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.36.2", - "@typescript-eslint/visitor-keys": "5.36.2", + "@typescript-eslint/types": "5.38.0", + "@typescript-eslint/visitor-keys": "5.38.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -2412,15 +2411,15 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.36.2.tgz", - "integrity": "sha512-uNcopWonEITX96v9pefk9DC1bWMdkweeSsewJ6GeC7L6j2t0SJywisgkr9wUTtXk90fi2Eljj90HSHm3OGdGRg==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.38.0.tgz", + "integrity": "sha512-6sdeYaBgk9Fh7N2unEXGz+D+som2QCQGPAf1SxrkEr+Z32gMreQ0rparXTNGRRfYUWk/JzbGdcM8NSSd6oqnTA==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.36.2", - "@typescript-eslint/types": "5.36.2", - "@typescript-eslint/typescript-estree": "5.36.2", + "@typescript-eslint/scope-manager": "5.38.0", + "@typescript-eslint/types": "5.38.0", + "@typescript-eslint/typescript-estree": "5.38.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, @@ -2436,12 +2435,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.36.2.tgz", - "integrity": "sha512-BtRvSR6dEdrNt7Net2/XDjbYKU5Ml6GqJgVfXT0CxTCJlnIqK7rAGreuWKMT2t8cFUT2Msv5oxw0GMRD7T5J7A==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.38.0.tgz", + "integrity": "sha512-MxnrdIyArnTi+XyFLR+kt/uNAcdOnmT+879os7qDRI+EYySR4crXJq9BXPfRzzLGq0wgxkwidrCJ9WCAoacm1w==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.36.2", + "@typescript-eslint/types": "5.38.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -2921,9 +2920,9 @@ "dev": true }, "node_modules/browserslist": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.3.tgz", - "integrity": "sha512-898rgRXLAyRkM1GryrrBHGkqA5hlpkV5MhtZwg9QXeiyLUYs2k00Un05aX5l2/yJIOObYKOpS2JNo8nJDE7fWQ==", + "version": "4.21.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.4.tgz", + "integrity": "sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==", "dev": true, "funding": [ { @@ -2936,10 +2935,10 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001370", - "electron-to-chromium": "^1.4.202", + "caniuse-lite": "^1.0.30001400", + "electron-to-chromium": "^1.4.251", "node-releases": "^2.0.6", - "update-browserslist-db": "^1.0.5" + "update-browserslist-db": "^1.0.9" }, "bin": { "browserslist": "cli.js" @@ -3133,9 +3132,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001393", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001393.tgz", - "integrity": "sha512-N/od11RX+Gsk+1qY/jbPa0R6zJupEa0lxeBG598EbrtblxVCTJsQwbRBm6+V+rxpc5lHKdsXb9RY83cZIPLseA==", + "version": "1.0.30001410", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001410.tgz", + "integrity": "sha512-QoblBnuE+rG0lc3Ur9ltP5q47lbguipa/ncNMyyGuqPk44FxbScWAeEO+k5fSQ8WekdAK4mWqNs1rADDAiN5xQ==", "dev": true, "funding": [ { @@ -3302,9 +3301,9 @@ } }, "node_modules/cli-table3": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.2.tgz", - "integrity": "sha512-QyavHCaIC80cMivimWu4aWHilIpiDpfm3hGmqAmXVL1UsnbLuBSMd21hTX6VY4ZSDSM73ESLeF8TOYId3rBTbw==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.3.tgz", + "integrity": "sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==", "dev": true, "dependencies": { "string-width": "^4.2.0" @@ -4450,9 +4449,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.244", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.244.tgz", - "integrity": "sha512-E21saXLt2eTDaTxgUtiJtBUqanF9A32wZasAwDZ8gvrqXoxrBrbwtDCx7c/PQTLp81wj4X0OLDeoGQg7eMo3+w==", + "version": "1.4.258", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.258.tgz", + "integrity": "sha512-vutF4q0dTUXoAFI7Vbtdwen/BJVwPgj8GRg/SElOodfH7VTX+svUe62A5BG41QRQGk5HsZPB0M++KH1lAlOt0A==", "dev": true }, "node_modules/emoji-regex": { @@ -4541,12 +4540,12 @@ } }, "node_modules/eslint": { - "version": "8.23.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.23.0.tgz", - "integrity": "sha512-pBG/XOn0MsJcKcTRLr27S5HpzQo4kLr+HjLQIyK4EiCsijDl/TB+h5uEuJU6bQ8Edvwz1XWOjpaP2qgnXGpTcA==", + "version": "8.23.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.23.1.tgz", + "integrity": "sha512-w7C1IXCc6fNqjpuYd0yPlcTKKmHlHHktRkzmBPZ+7cvNBQuiNjx0xaMTjAJGCafJhQkrFJooREv0CtrVzmHwqg==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^1.3.1", + "@eslint/eslintrc": "^1.3.2", "@humanwhocodes/config-array": "^0.10.4", "@humanwhocodes/gitignore-to-minimatch": "^1.0.2", "@humanwhocodes/module-importer": "^1.0.1", @@ -4565,7 +4564,6 @@ "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", - "functional-red-black-tree": "^1.0.1", "glob-parent": "^6.0.1", "globals": "^13.15.0", "globby": "^11.1.0", @@ -4574,6 +4572,7 @@ "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", + "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", @@ -4947,9 +4946,9 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "node_modules/fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -5373,12 +5372,6 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, - "node_modules/functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", - "dev": true - }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -5398,9 +5391,9 @@ } }, "node_modules/get-intrinsic": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz", - "integrity": "sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", "dev": true, "dependencies": { "function-bind": "^1.1.1", @@ -5987,9 +5980,9 @@ } }, "node_modules/inflection": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/inflection/-/inflection-1.13.2.tgz", - "integrity": "sha512-cmZlljCRTBFouT8UzMzrGcVEvkv6D/wBdcdKG7J1QH5cXjtU75Dm+P27v9EKu/Y43UYyCJd1WC4zLebRrC8NBw==", + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/inflection/-/inflection-1.13.4.tgz", + "integrity": "sha512-6I/HUDeYFfuNCVS3td055BaXBwKYuzw7K3ExVMStBowKo9oOAMJIXIHvdyR3iboTCp1b+1i5DSkIZTcwIktuDw==", "dev": true, "engines": [ "node >= 0.4.0" @@ -6424,6 +6417,12 @@ "node": ">= 0.6.0" } }, + "node_modules/js-sdsl": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.4.tgz", + "integrity": "sha512-Y2/yD55y5jteOAmY50JbUZYwk3CP3wnLPEZnlR1w9oKhITrBEtAxwuWKebFf8hMrPMgbYwFoWK/lH2sBkErELw==", + "dev": true + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -7687,9 +7686,9 @@ } }, "node_modules/npm": { - "version": "8.19.1", - "resolved": "https://registry.npmjs.org/npm/-/npm-8.19.1.tgz", - "integrity": "sha512-FtWzipzng+NmtTQDXSCvA9D7H4d7vkA7ciahmY89fGK/Eo95pbnKn0hatEUfomj1jUDEXvAEi/tKiQ2nrAc7Jg==", + "version": "8.19.2", + "resolved": "https://registry.npmjs.org/npm/-/npm-8.19.2.tgz", + "integrity": "sha512-MWkISVv5f7iZbfNkry5/5YBqSYJEDAKSJdL+uzSQuyLg+hgLQUyZynu3SH6bOZlvR9ZvJYk2EiJO6B1r+ynwHg==", "bundleDependencies": [ "@isaacs/string-locale-compare", "@npmcli/arborist", @@ -7769,7 +7768,7 @@ "dev": true, "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", - "@npmcli/arborist": "^5.6.1", + "@npmcli/arborist": "^5.6.2", "@npmcli/ci-detect": "^2.0.0", "@npmcli/config": "^4.2.1", "@npmcli/fs": "^2.1.0", @@ -7796,8 +7795,8 @@ "json-parse-even-better-errors": "^2.3.1", "libnpmaccess": "^6.0.4", "libnpmdiff": "^4.0.5", - "libnpmexec": "^4.0.12", - "libnpmfund": "^3.0.3", + "libnpmexec": "^4.0.13", + "libnpmfund": "^3.0.4", "libnpmhook": "^8.0.4", "libnpmorg": "^4.0.4", "libnpmpack": "^4.1.3", @@ -7886,7 +7885,7 @@ "license": "ISC" }, "node_modules/npm/node_modules/@npmcli/arborist": { - "version": "5.6.1", + "version": "5.6.2", "dev": true, "inBundle": true, "license": "ISC", @@ -8991,12 +8990,12 @@ } }, "node_modules/npm/node_modules/libnpmexec": { - "version": "4.0.12", + "version": "4.0.13", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/arborist": "^5.6.1", + "@npmcli/arborist": "^5.6.2", "@npmcli/ci-detect": "^2.0.0", "@npmcli/fs": "^2.1.1", "@npmcli/run-script": "^4.2.0", @@ -9016,12 +9015,12 @@ } }, "node_modules/npm/node_modules/libnpmfund": { - "version": "3.0.3", + "version": "3.0.4", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "@npmcli/arborist": "^5.6.1" + "@npmcli/arborist": "^5.6.2" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16.0.0" @@ -13411,9 +13410,9 @@ } }, "node_modules/uglify-js": { - "version": "3.17.0", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.0.tgz", - "integrity": "sha512-aTeNPVmgIMPpm1cxXr2Q/nEbvkmV8yq66F3om7X3P/cvOXQ0TMQ64Wk63iyT1gPlmdmGzjGpyLh1f3y8MZWXGg==", + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.1.tgz", + "integrity": "sha512-+juFBsLLw7AqMaqJ0GFvlsGZwdQfI2ooKQB39PSBgMnMakcFosi9O8jCwE+2/2nMNcc0z63r9mwjoDG8zr+q0Q==", "dev": true, "optional": true, "bin": { @@ -13465,9 +13464,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.7.tgz", - "integrity": "sha512-iN/XYesmZ2RmmWAiI4Z5rq0YqSiv0brj9Ce9CfhNE4xIW2h+MFxcgkxIzZ+ShkFPUkjU3gQ+3oypadD3RAMtrg==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.9.tgz", + "integrity": "sha512-/xsqn21EGVdXI3EXSum1Yckj3ZVZugqyOZQ/CxYPBD/R+ko9NSUScf8tFF4dOKY+2pvSSJA/S+5B8s4Zr4kyvg==", "dev": true, "funding": [ { @@ -13910,26 +13909,26 @@ } }, "@babel/compat-data": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.19.0.tgz", - "integrity": "sha512-y5rqgTTPTmaF5e2nVhOxw+Ur9HDJLsWb6U/KpgUzRZEdPfE6VOubXBKLdbcUTijzRptednSBDQbYZBOSqJxpJw==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.19.1.tgz", + "integrity": "sha512-72a9ghR0gnESIa7jBN53U32FOVCEoztyIlKaNoU05zRhEecduGK9L9c3ww7Mp06JiR+0ls0GBPFJQwwtjn9ksg==", "dev": true }, "@babel/core": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.19.0.tgz", - "integrity": "sha512-reM4+U7B9ss148rh2n1Qs9ASS+w94irYXga7c2jaQv9RVzpS7Mv1a9rnYYwuDa45G+DkORt9g6An2k/V4d9LbQ==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.19.1.tgz", + "integrity": "sha512-1H8VgqXme4UXCRv7/Wa1bq7RVymKOzC7znjyFM8KiEzwFqcKUKYNoQef4GhdklgNvoBXyW4gYhuBNCM5o1zImw==", "dev": true, "requires": { "@ampproject/remapping": "^2.1.0", "@babel/code-frame": "^7.18.6", "@babel/generator": "^7.19.0", - "@babel/helper-compilation-targets": "^7.19.0", + "@babel/helper-compilation-targets": "^7.19.1", "@babel/helper-module-transforms": "^7.19.0", "@babel/helpers": "^7.19.0", - "@babel/parser": "^7.19.0", + "@babel/parser": "^7.19.1", "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.0", + "@babel/traverse": "^7.19.1", "@babel/types": "^7.19.0", "convert-source-map": "^1.7.0", "debug": "^4.1.0", @@ -13971,14 +13970,14 @@ } }, "@babel/helper-compilation-targets": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.0.tgz", - "integrity": "sha512-Ai5bNWXIvwDvWM7njqsG3feMlL9hCVQsPYXodsZyLwshYkZVJt59Gftau4VrE8S9IT9asd2uSP1hG6wCNw+sXA==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.1.tgz", + "integrity": "sha512-LlLkkqhCMyz2lkQPvJNdIYU7O5YjWRgC2R4omjCTpZd8u8KMQzZvX4qce+/BluN1rcQiV7BoGUpmQ0LeHerbhg==", "dev": true, "requires": { - "@babel/compat-data": "^7.19.0", + "@babel/compat-data": "^7.19.1", "@babel/helper-validator-option": "^7.18.6", - "browserslist": "^4.20.2", + "browserslist": "^4.21.3", "semver": "^6.3.0" }, "dependencies": { @@ -14065,9 +14064,9 @@ "dev": true }, "@babel/helper-validator-identifier": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz", - "integrity": "sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", "dev": true }, "@babel/helper-validator-option": { @@ -14157,9 +14156,9 @@ } }, "@babel/parser": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.0.tgz", - "integrity": "sha512-74bEXKX2h+8rrfQUfsBfuZZHzsEs6Eql4pqy/T4Nn6Y9wNPggQOqD6z6pn5Bl8ZfysKouFZT/UXEH94ummEeQw==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.1.tgz", + "integrity": "sha512-h7RCSorm1DdTVGJf3P2Mhj3kdnkmF/EiysUkzS2TdgAYqyjFdMQJbVuXOBej2SBJaXan/lIVtT6KkGbyyq753A==", "dev": true }, "@babel/template": { @@ -14174,9 +14173,9 @@ } }, "@babel/traverse": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.19.0.tgz", - "integrity": "sha512-4pKpFRDh+utd2mbRC8JLnlsMUii3PMHjpL6a0SZ4NMZy7YFP9aXORxEhdMVOc9CpWtDF09IkciQLEhK7Ml7gRA==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.19.1.tgz", + "integrity": "sha512-0j/ZfZMxKukDaag2PtOPDbwuELqIar6lLskVPPJDjXMXjfLb1Obo/1yjxIGqqAJrmfaTIY3z2wFLAQ7qSkLsuA==", "dev": true, "requires": { "@babel/code-frame": "^7.18.6", @@ -14185,7 +14184,7 @@ "@babel/helper-function-name": "^7.19.0", "@babel/helper-hoist-variables": "^7.18.6", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.19.0", + "@babel/parser": "^7.19.1", "@babel/types": "^7.19.0", "debug": "^4.1.0", "globals": "^11.1.0" @@ -14442,9 +14441,9 @@ } }, "@eslint/eslintrc": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.1.tgz", - "integrity": "sha512-OhSY22oQQdw3zgPOOwdoj01l/Dzl1Z+xyUP33tkSN+aqyEhymJCcPHyXt+ylW8FSe0TfRC2VG+ROQOapD0aZSQ==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.2.tgz", + "integrity": "sha512-AXYd23w1S/bv3fTs3Lz0vjiYemS08jWkI3hYyS9I1ry+0f+Yjs1wm+sU0BS8qDOPrBIkp4qHYC16I8uVtpLajQ==", "dev": true, "requires": { "ajv": "^6.12.4", @@ -14528,9 +14527,9 @@ } }, "@humanwhocodes/config-array": { - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.4.tgz", - "integrity": "sha512-mXAIHxZT3Vcpg83opl1wGlVZ9xydbfZO3r5YfRSH6Gpp2J/PfdBP0wbDa2sO6/qRbcalpoevVyW6A/fI6LfeMw==", + "version": "0.10.5", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.5.tgz", + "integrity": "sha512-XVVDtp+dVvRxMoxSiSfasYaG02VEe1qH5cKgMQJWhol6HwzbcqoCMJi8dAGoYAO57jhUyhI6cWuRiTcRaDaYug==", "dev": true, "requires": { "@humanwhocodes/object-schema": "^1.2.1", @@ -14999,18 +14998,18 @@ } }, "@octokit/openapi-types": { - "version": "13.9.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-13.9.0.tgz", - "integrity": "sha512-MOYjRyLIM0zzNb9RfEwVK6HLIc2nIF2OMVtMqiNOGbX0SHrQvQbI6X1K16ktmaHr8WUBv+eeul8cD9mz4rNiWQ==", + "version": "13.12.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-13.12.0.tgz", + "integrity": "sha512-1QYzZrwnn3rTQE7ZoSxXrO8lhu0aIbac1c+qIPOPEaVXBWSaUyLV1x9yt4uDQOwmu6u5ywVS8OJgs+ErDLf6vQ==", "dev": true }, "@octokit/plugin-paginate-rest": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-4.2.2.tgz", - "integrity": "sha512-oslJFmdcWeB3Q8dzn2WNFBzEAvqCH+cvrjBUhS7uwQxAt5yH91w1eo2flWiR0Rqxh+EijQS5ImoB0iQ3hz7P2Q==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-4.3.1.tgz", + "integrity": "sha512-h8KKxESmSFTcXX409CAxlaOYscEDvN2KGQRsLCGT1NSqRW+D6EXLVQ8vuHhFznS9MuH9QYw1GfsUN30bg8hjVA==", "dev": true, "requires": { - "@octokit/types": "^7.3.0" + "@octokit/types": "^7.5.0" } }, "@octokit/plugin-request-log": { @@ -15021,12 +15020,12 @@ "requires": {} }, "@octokit/plugin-rest-endpoint-methods": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-6.5.0.tgz", - "integrity": "sha512-+r/tWwc7hI3vYDb+d0hAqbr04Kle6pL+MmGxMDTUn7wIwry5qFXnUA8RCa5CO8EcuHbZLywnqIVRLdM08qV8Ew==", + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-6.6.2.tgz", + "integrity": "sha512-n9dL5KMpz9qVFSNdcVWC8ZPbl68QbTk7+CMPXCXqaMZOLn1n1YuoSFFCy84Ge0fx333fUqpnBHv8BFjwGtUQkA==", "dev": true, "requires": { - "@octokit/types": "^7.3.0", + "@octokit/types": "^7.5.0", "deprecation": "^2.3.1" } }, @@ -15068,12 +15067,12 @@ } }, "@octokit/types": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-7.3.0.tgz", - "integrity": "sha512-7Ar22AVxsJBYZuPkGQwFQybGt2YjuP6j6Z36bPntIYy3R9qSowB55mXOsb16hc0UqtJkYBrRMVXKlaX1OHsh1g==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-7.5.0.tgz", + "integrity": "sha512-aHm+olfIZjQpzoODpl+RCZzchKOrdSLJs+yfI7pMMcmB19Li6vidgx0DwUDO/Ic4Q3fq/lOjJORVCcLZefcrJw==", "dev": true, "requires": { - "@octokit/openapi-types": "^13.9.0" + "@octokit/openapi-types": "^13.11.0" } }, "@openapi-contrib/openapi-schema-to-json-schema": { @@ -15343,9 +15342,9 @@ } }, "@types/express": { - "version": "4.17.13", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.13.tgz", - "integrity": "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA==", + "version": "4.17.14", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.14.tgz", + "integrity": "sha512-TEbt+vaPFQ+xpxFLFssxUDXj5cWCxZJjIcB7Yg0k0GMHGtgtQgpvx/MUQUeAkNbA9AAGrwkAsoeItdTgS7FMyg==", "dev": true, "requires": { "@types/body-parser": "*", @@ -15355,9 +15354,9 @@ } }, "@types/express-serve-static-core": { - "version": "4.17.30", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.30.tgz", - "integrity": "sha512-gstzbTWro2/nFed1WXtf+TtrpwxH7Ggs4RLYTLbeVgIkUQOI3WG/JKjgeOU1zXDvezllupjrf8OPIdvTbIaVOQ==", + "version": "4.17.31", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.31.tgz", + "integrity": "sha512-DxMhY+NAsTwMMFHBTtJFNp5qiHKJ7TeqOo23zVEM9alT1Ml27Q3xcTH0xwxn7Q0BbMcVEJOs/7aQtUWupUQN3Q==", "dev": true, "requires": { "@types/node": "*", @@ -15434,9 +15433,9 @@ } }, "@types/lodash": { - "version": "4.14.184", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.184.tgz", - "integrity": "sha512-RoZphVtHbxPZizt4IcILciSWiC6dcn+eZ8oX9IWEYfDMcocdd42f7NPI6fQj+6zI8y4E0L7gu2pcZKLGTRaV9Q==", + "version": "4.14.185", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.185.tgz", + "integrity": "sha512-evMDG1bC4rgQg4ku9tKpuMh5iBNEwNa3tf9zRHdP1qlv+1WUg44xat4IxCE14gIpZRGUUWAx2VhItCZc25NfMA==", "dev": true }, "@types/mime": { @@ -15469,9 +15468,9 @@ "integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==" }, "@types/node": { - "version": "14.18.28", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.28.tgz", - "integrity": "sha512-CK2fnrQlIgKlCV3N2kM+Gznb5USlwA1KFX3rJVHmgVk6NJxFPuQ86pAcvKnu37IA4BGlSRz7sEE1lHL1aLZ/eQ==", + "version": "14.18.29", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.29.tgz", + "integrity": "sha512-LhF+9fbIX4iPzhsRLpK5H7iPdvW8L4IwGciXQIOEcuF62+9nw/VQVsOViAOOGxY3OlOKGLFv0sWwJXdwQeTn6A==", "dev": true }, "@types/normalize-package-data": { @@ -15505,9 +15504,9 @@ "dev": true }, "@types/passport": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/@types/passport/-/passport-1.0.10.tgz", - "integrity": "sha512-IZamnXuN7mY+2/v8bAW6nuTcKiay7gXBBcMBZ8n7YHB4u5DwsWoJaNrHdAQ8PZEODRjCv3oHOg76CYJ40j9RqA==", + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@types/passport/-/passport-1.0.11.tgz", + "integrity": "sha512-pz1cx9ptZvozyGKKKIPLcVDVHwae4hrH5d6g5J+DkMRRjR3cVETb4jMabhXAUbg3Ov7T22nFHEgaK2jj+5CBpw==", "dev": true, "requires": { "@types/express": "*" @@ -15699,16 +15698,15 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.36.2.tgz", - "integrity": "sha512-OwwR8LRwSnI98tdc2z7mJYgY60gf7I9ZfGjN5EjCwwns9bdTuQfAXcsjSB2wSQ/TVNYSGKf4kzVXbNGaZvwiXw==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.38.0.tgz", + "integrity": "sha512-GgHi/GNuUbTOeoJiEANi0oI6fF3gBQc3bGFYj40nnAPCbhrtEDf2rjBmefFadweBmO1Du1YovHeDP2h5JLhtTQ==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.36.2", - "@typescript-eslint/type-utils": "5.36.2", - "@typescript-eslint/utils": "5.36.2", + "@typescript-eslint/scope-manager": "5.38.0", + "@typescript-eslint/type-utils": "5.38.0", + "@typescript-eslint/utils": "5.38.0", "debug": "^4.3.4", - "functional-red-black-tree": "^1.0.1", "ignore": "^5.2.0", "regexpp": "^3.2.0", "semver": "^7.3.7", @@ -15716,53 +15714,53 @@ } }, "@typescript-eslint/parser": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.36.2.tgz", - "integrity": "sha512-qS/Kb0yzy8sR0idFspI9Z6+t7mqk/oRjnAYfewG+VN73opAUvmYL3oPIMmgOX6CnQS6gmVIXGshlb5RY/R22pA==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.38.0.tgz", + "integrity": "sha512-/F63giJGLDr0ms1Cr8utDAxP2SPiglaD6V+pCOcG35P2jCqdfR7uuEhz1GIC3oy4hkUF8xA1XSXmd9hOh/a5EA==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.36.2", - "@typescript-eslint/types": "5.36.2", - "@typescript-eslint/typescript-estree": "5.36.2", + "@typescript-eslint/scope-manager": "5.38.0", + "@typescript-eslint/types": "5.38.0", + "@typescript-eslint/typescript-estree": "5.38.0", "debug": "^4.3.4" } }, "@typescript-eslint/scope-manager": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.36.2.tgz", - "integrity": "sha512-cNNP51L8SkIFSfce8B1NSUBTJTu2Ts4nWeWbFrdaqjmn9yKrAaJUBHkyTZc0cL06OFHpb+JZq5AUHROS398Orw==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.38.0.tgz", + "integrity": "sha512-ByhHIuNyKD9giwkkLqzezZ9y5bALW8VNY6xXcP+VxoH4JBDKjU5WNnsiD4HJdglHECdV+lyaxhvQjTUbRboiTA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.36.2", - "@typescript-eslint/visitor-keys": "5.36.2" + "@typescript-eslint/types": "5.38.0", + "@typescript-eslint/visitor-keys": "5.38.0" } }, "@typescript-eslint/type-utils": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.36.2.tgz", - "integrity": "sha512-rPQtS5rfijUWLouhy6UmyNquKDPhQjKsaKH0WnY6hl/07lasj8gPaH2UD8xWkePn6SC+jW2i9c2DZVDnL+Dokw==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.38.0.tgz", + "integrity": "sha512-iZq5USgybUcj/lfnbuelJ0j3K9dbs1I3RICAJY9NZZpDgBYXmuUlYQGzftpQA9wC8cKgtS6DASTvF3HrXwwozA==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "5.36.2", - "@typescript-eslint/utils": "5.36.2", + "@typescript-eslint/typescript-estree": "5.38.0", + "@typescript-eslint/utils": "5.38.0", "debug": "^4.3.4", "tsutils": "^3.21.0" } }, "@typescript-eslint/types": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.36.2.tgz", - "integrity": "sha512-9OJSvvwuF1L5eS2EQgFUbECb99F0mwq501w0H0EkYULkhFa19Qq7WFbycdw1PexAc929asupbZcgjVIe6OK/XQ==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.38.0.tgz", + "integrity": "sha512-HHu4yMjJ7i3Cb+8NUuRCdOGu2VMkfmKyIJsOr9PfkBVYLYrtMCK/Ap50Rpov+iKpxDTfnqvDbuPLgBE5FwUNfA==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.36.2.tgz", - "integrity": "sha512-8fyH+RfbKc0mTspfuEjlfqA4YywcwQK2Amcf6TDOwaRLg7Vwdu4bZzyvBZp4bjt1RRjQ5MDnOZahxMrt2l5v9w==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.38.0.tgz", + "integrity": "sha512-6P0RuphkR+UuV7Avv7MU3hFoWaGcrgOdi8eTe1NwhMp2/GjUJoODBTRWzlHpZh6lFOaPmSvgxGlROa0Sg5Zbyg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.36.2", - "@typescript-eslint/visitor-keys": "5.36.2", + "@typescript-eslint/types": "5.38.0", + "@typescript-eslint/visitor-keys": "5.38.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -15771,26 +15769,26 @@ } }, "@typescript-eslint/utils": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.36.2.tgz", - "integrity": "sha512-uNcopWonEITX96v9pefk9DC1bWMdkweeSsewJ6GeC7L6j2t0SJywisgkr9wUTtXk90fi2Eljj90HSHm3OGdGRg==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.38.0.tgz", + "integrity": "sha512-6sdeYaBgk9Fh7N2unEXGz+D+som2QCQGPAf1SxrkEr+Z32gMreQ0rparXTNGRRfYUWk/JzbGdcM8NSSd6oqnTA==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.36.2", - "@typescript-eslint/types": "5.36.2", - "@typescript-eslint/typescript-estree": "5.36.2", + "@typescript-eslint/scope-manager": "5.38.0", + "@typescript-eslint/types": "5.38.0", + "@typescript-eslint/typescript-estree": "5.38.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" } }, "@typescript-eslint/visitor-keys": { - "version": "5.36.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.36.2.tgz", - "integrity": "sha512-BtRvSR6dEdrNt7Net2/XDjbYKU5Ml6GqJgVfXT0CxTCJlnIqK7rAGreuWKMT2t8cFUT2Msv5oxw0GMRD7T5J7A==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.38.0.tgz", + "integrity": "sha512-MxnrdIyArnTi+XyFLR+kt/uNAcdOnmT+879os7qDRI+EYySR4crXJq9BXPfRzzLGq0wgxkwidrCJ9WCAoacm1w==", "dev": true, "requires": { - "@typescript-eslint/types": "5.36.2", + "@typescript-eslint/types": "5.38.0", "eslint-visitor-keys": "^3.3.0" } }, @@ -16155,15 +16153,15 @@ "dev": true }, "browserslist": { - "version": "4.21.3", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.3.tgz", - "integrity": "sha512-898rgRXLAyRkM1GryrrBHGkqA5hlpkV5MhtZwg9QXeiyLUYs2k00Un05aX5l2/yJIOObYKOpS2JNo8nJDE7fWQ==", + "version": "4.21.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.4.tgz", + "integrity": "sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001370", - "electron-to-chromium": "^1.4.202", + "caniuse-lite": "^1.0.30001400", + "electron-to-chromium": "^1.4.251", "node-releases": "^2.0.6", - "update-browserslist-db": "^1.0.5" + "update-browserslist-db": "^1.0.9" } }, "bs-logger": { @@ -16303,9 +16301,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001393", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001393.tgz", - "integrity": "sha512-N/od11RX+Gsk+1qY/jbPa0R6zJupEa0lxeBG598EbrtblxVCTJsQwbRBm6+V+rxpc5lHKdsXb9RY83cZIPLseA==", + "version": "1.0.30001410", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001410.tgz", + "integrity": "sha512-QoblBnuE+rG0lc3Ur9ltP5q47lbguipa/ncNMyyGuqPk44FxbScWAeEO+k5fSQ8WekdAK4mWqNs1rADDAiN5xQ==", "dev": true }, "capital-case": { @@ -16426,9 +16424,9 @@ "dev": true }, "cli-table3": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.2.tgz", - "integrity": "sha512-QyavHCaIC80cMivimWu4aWHilIpiDpfm3hGmqAmXVL1UsnbLuBSMd21hTX6VY4ZSDSM73ESLeF8TOYId3rBTbw==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.3.tgz", + "integrity": "sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==", "dev": true, "requires": { "@colors/colors": "1.5.0", @@ -17328,9 +17326,9 @@ } }, "electron-to-chromium": { - "version": "1.4.244", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.244.tgz", - "integrity": "sha512-E21saXLt2eTDaTxgUtiJtBUqanF9A32wZasAwDZ8gvrqXoxrBrbwtDCx7c/PQTLp81wj4X0OLDeoGQg7eMo3+w==", + "version": "1.4.258", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.258.tgz", + "integrity": "sha512-vutF4q0dTUXoAFI7Vbtdwen/BJVwPgj8GRg/SElOodfH7VTX+svUe62A5BG41QRQGk5HsZPB0M++KH1lAlOt0A==", "dev": true }, "emoji-regex": { @@ -17404,12 +17402,12 @@ "dev": true }, "eslint": { - "version": "8.23.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.23.0.tgz", - "integrity": "sha512-pBG/XOn0MsJcKcTRLr27S5HpzQo4kLr+HjLQIyK4EiCsijDl/TB+h5uEuJU6bQ8Edvwz1XWOjpaP2qgnXGpTcA==", + "version": "8.23.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.23.1.tgz", + "integrity": "sha512-w7C1IXCc6fNqjpuYd0yPlcTKKmHlHHktRkzmBPZ+7cvNBQuiNjx0xaMTjAJGCafJhQkrFJooREv0CtrVzmHwqg==", "dev": true, "requires": { - "@eslint/eslintrc": "^1.3.1", + "@eslint/eslintrc": "^1.3.2", "@humanwhocodes/config-array": "^0.10.4", "@humanwhocodes/gitignore-to-minimatch": "^1.0.2", "@humanwhocodes/module-importer": "^1.0.1", @@ -17428,7 +17426,6 @@ "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", - "functional-red-black-tree": "^1.0.1", "glob-parent": "^6.0.1", "globals": "^13.15.0", "globby": "^11.1.0", @@ -17437,6 +17434,7 @@ "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", + "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", @@ -17715,9 +17713,9 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -18049,12 +18047,6 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", - "dev": true - }, "gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -18068,9 +18060,9 @@ "dev": true }, "get-intrinsic": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz", - "integrity": "sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", "dev": true, "requires": { "function-bind": "^1.1.1", @@ -18501,9 +18493,9 @@ "dev": true }, "inflection": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/inflection/-/inflection-1.13.2.tgz", - "integrity": "sha512-cmZlljCRTBFouT8UzMzrGcVEvkv6D/wBdcdKG7J1QH5cXjtU75Dm+P27v9EKu/Y43UYyCJd1WC4zLebRrC8NBw==", + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/inflection/-/inflection-1.13.4.tgz", + "integrity": "sha512-6I/HUDeYFfuNCVS3td055BaXBwKYuzw7K3ExVMStBowKo9oOAMJIXIHvdyR3iboTCp1b+1i5DSkIZTcwIktuDw==", "dev": true }, "inflight": { @@ -18829,6 +18821,12 @@ "integrity": "sha512-qjdpeo2yKlYTH7nFdK0vbZWuTCesk4o63v5iVOlhMQPfuIZQfW/HI35SjfhA+4qpg36rnFSvUK5b1m+ckIblQQ==", "dev": true }, + "js-sdsl": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.4.tgz", + "integrity": "sha512-Y2/yD55y5jteOAmY50JbUZYwk3CP3wnLPEZnlR1w9oKhITrBEtAxwuWKebFf8hMrPMgbYwFoWK/lH2sBkErELw==", + "dev": true + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -19834,13 +19832,13 @@ "dev": true }, "npm": { - "version": "8.19.1", - "resolved": "https://registry.npmjs.org/npm/-/npm-8.19.1.tgz", - "integrity": "sha512-FtWzipzng+NmtTQDXSCvA9D7H4d7vkA7ciahmY89fGK/Eo95pbnKn0hatEUfomj1jUDEXvAEi/tKiQ2nrAc7Jg==", + "version": "8.19.2", + "resolved": "https://registry.npmjs.org/npm/-/npm-8.19.2.tgz", + "integrity": "sha512-MWkISVv5f7iZbfNkry5/5YBqSYJEDAKSJdL+uzSQuyLg+hgLQUyZynu3SH6bOZlvR9ZvJYk2EiJO6B1r+ynwHg==", "dev": true, "requires": { "@isaacs/string-locale-compare": "^1.1.0", - "@npmcli/arborist": "^5.6.1", + "@npmcli/arborist": "^5.6.2", "@npmcli/ci-detect": "^2.0.0", "@npmcli/config": "^4.2.1", "@npmcli/fs": "^2.1.0", @@ -19867,8 +19865,8 @@ "json-parse-even-better-errors": "^2.3.1", "libnpmaccess": "^6.0.4", "libnpmdiff": "^4.0.5", - "libnpmexec": "^4.0.12", - "libnpmfund": "^3.0.3", + "libnpmexec": "^4.0.13", + "libnpmfund": "^3.0.4", "libnpmhook": "^8.0.4", "libnpmorg": "^4.0.4", "libnpmpack": "^4.1.3", @@ -19932,7 +19930,7 @@ "dev": true }, "@npmcli/arborist": { - "version": "5.6.1", + "version": "5.6.2", "bundled": true, "dev": true, "requires": { @@ -20722,11 +20720,11 @@ } }, "libnpmexec": { - "version": "4.0.12", + "version": "4.0.13", "bundled": true, "dev": true, "requires": { - "@npmcli/arborist": "^5.6.1", + "@npmcli/arborist": "^5.6.2", "@npmcli/ci-detect": "^2.0.0", "@npmcli/fs": "^2.1.1", "@npmcli/run-script": "^4.2.0", @@ -20743,11 +20741,11 @@ } }, "libnpmfund": { - "version": "3.0.3", + "version": "3.0.4", "bundled": true, "dev": true, "requires": { - "@npmcli/arborist": "^5.6.1" + "@npmcli/arborist": "^5.6.2" } }, "libnpmhook": { @@ -24036,9 +24034,9 @@ "dev": true }, "uglify-js": { - "version": "3.17.0", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.0.tgz", - "integrity": "sha512-aTeNPVmgIMPpm1cxXr2Q/nEbvkmV8yq66F3om7X3P/cvOXQ0TMQ64Wk63iyT1gPlmdmGzjGpyLh1f3y8MZWXGg==", + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.1.tgz", + "integrity": "sha512-+juFBsLLw7AqMaqJ0GFvlsGZwdQfI2ooKQB39PSBgMnMakcFosi9O8jCwE+2/2nMNcc0z63r9mwjoDG8zr+q0Q==", "dev": true, "optional": true }, @@ -24075,9 +24073,9 @@ "dev": true }, "update-browserslist-db": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.7.tgz", - "integrity": "sha512-iN/XYesmZ2RmmWAiI4Z5rq0YqSiv0brj9Ce9CfhNE4xIW2h+MFxcgkxIzZ+ShkFPUkjU3gQ+3oypadD3RAMtrg==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.9.tgz", + "integrity": "sha512-/xsqn21EGVdXI3EXSum1Yckj3ZVZugqyOZQ/CxYPBD/R+ko9NSUScf8tFF4dOKY+2pvSSJA/S+5B8s4Zr4kyvg==", "dev": true, "requires": { "escalade": "^3.1.1", diff --git a/src/__tests__/fixtures/sequences/authentication-middleware.sequence.ts b/src/__tests__/fixtures/sequences/authentication-middleware.sequence.ts new file mode 100644 index 0000000..9089f1b --- /dev/null +++ b/src/__tests__/fixtures/sequences/authentication-middleware.sequence.ts @@ -0,0 +1,3 @@ +import {MiddlewareSequence} from '@loopback/rest'; + +export class MyAuthenticationMiddlewareSequence extends MiddlewareSequence {} diff --git a/src/__tests__/fixtures/sequences/authentication.sequence.ts b/src/__tests__/fixtures/sequences/authentication.sequence.ts index 206432f..7989827 100644 --- a/src/__tests__/fixtures/sequences/authentication.sequence.ts +++ b/src/__tests__/fixtures/sequences/authentication.sequence.ts @@ -37,8 +37,8 @@ export class MyAuthenticationSequence implements SequenceHandler { request.body = args[args.length - 1]; //call authentication action - await this.authenticateClientRequest(request); - await this.authenticateRequest(request); + await this.authenticateClientRequest(request, response); + await this.authenticateRequest(request, response); // Authentication successful, proceed to invoke controller const result = await this.invoke(route, args); diff --git a/src/__tests__/integration/helpers/helpers.ts b/src/__tests__/integration/action-sequence/helpers/helpers.ts similarity index 82% rename from src/__tests__/integration/helpers/helpers.ts rename to src/__tests__/integration/action-sequence/helpers/helpers.ts index 5df4533..a0341a0 100644 --- a/src/__tests__/integration/helpers/helpers.ts +++ b/src/__tests__/integration/action-sequence/helpers/helpers.ts @@ -1,5 +1,5 @@ import {Application} from '@loopback/core'; -import {AuthenticationComponent} from '../../../component'; +import {AuthenticationComponent} from '../../../../component'; import {RestComponent} from '@loopback/rest'; /** diff --git a/src/__tests__/integration/passport-apple-oauth2/apple-oauth2.integration.ts b/src/__tests__/integration/action-sequence/passport-apple-oauth2/apple-oauth2.integration.ts similarity index 78% rename from src/__tests__/integration/passport-apple-oauth2/apple-oauth2.integration.ts rename to src/__tests__/integration/action-sequence/passport-apple-oauth2/apple-oauth2.integration.ts index 4b6531d..4e798f7 100644 --- a/src/__tests__/integration/passport-apple-oauth2/apple-oauth2.integration.ts +++ b/src/__tests__/integration/action-sequence/passport-apple-oauth2/apple-oauth2.integration.ts @@ -2,13 +2,13 @@ import {Client, createClientForHandler} from '@loopback/testlab'; import {RestServer} from '@loopback/rest'; import {Application, Provider} from '@loopback/core'; import {get} from '@loopback/openapi-v3'; -import {authenticate} from '../../../decorators'; -import {STRATEGY} from '../../../strategy-name.enum'; +import {authenticate} from '../../../../decorators'; +import {STRATEGY} from '../../../../strategy-name.enum'; import {getApp} from '../helpers/helpers'; -import {MyAuthenticationSequence} from '../../fixtures/sequences/authentication.sequence'; -import {Strategies} from '../../../strategies/keys'; -import {VerifyFunction} from '../../../strategies'; -import {userWithoutReqObj} from '../../fixtures/data/bearer-data'; +import {MyAuthenticationSequence} from '../../../fixtures/sequences/authentication.sequence'; +import {Strategies} from '../../../../strategies/keys'; +import {VerifyFunction} from '../../../../strategies'; +import {userWithoutReqObj} from '../../../fixtures/data/bearer-data'; import {Request} from '@loopback/rest'; import AppleStrategy, {DecodedIdToken} from 'passport-apple'; @@ -19,7 +19,7 @@ describe('getting apple oauth2 strategy with options', () => { beforeEach(givenAuthenticatedSequence); afterEach(closeServer); - it('should return 200 when client id is passed and passReqToCallback is set true', async () => { + it('should return 302 when client id is passed and passReqToCallback is set true', async () => { getAuthVerifier(); class TestController { @get('/test') @@ -35,7 +35,7 @@ describe('getting apple oauth2 strategy with options', () => { app.controller(TestController); - await whenIMakeRequestTo(server).get('/test').expect(200); + await whenIMakeRequestTo(server).get('/test').expect(302); }); function whenIMakeRequestTo(restServer: RestServer): Client { diff --git a/src/__tests__/integration/passport-bearer/bearer-token-verify.integration.ts b/src/__tests__/integration/action-sequence/passport-bearer/bearer-token-verify.integration.ts similarity index 94% rename from src/__tests__/integration/passport-bearer/bearer-token-verify.integration.ts rename to src/__tests__/integration/action-sequence/passport-bearer/bearer-token-verify.integration.ts index d056f39..50aa824 100644 --- a/src/__tests__/integration/passport-bearer/bearer-token-verify.integration.ts +++ b/src/__tests__/integration/action-sequence/passport-bearer/bearer-token-verify.integration.ts @@ -1,15 +1,15 @@ -import {IAuthUser} from '../../../types'; +import {IAuthUser} from '../../../../types'; import {expect, Client, createClientForHandler} from '@loopback/testlab'; import {RestServer} from '@loopback/rest'; import {Application, inject} from '@loopback/core'; import {get} from '@loopback/openapi-v3'; -import {authenticate} from '../../../decorators'; -import {STRATEGY} from '../../../strategy-name.enum'; +import {authenticate} from '../../../../decorators'; +import {STRATEGY} from '../../../../strategy-name.enum'; import {getApp} from '../helpers/helpers'; -import {MyAuthenticationSequence} from '../../fixtures/sequences/authentication.sequence'; -import {Strategies} from '../../../strategies/keys'; -import {AuthenticationBindings} from '../../../keys'; -import {BearerTokenVerifyProvider} from '../../fixtures/providers/bearer-passport.provider'; +import {MyAuthenticationSequence} from '../../../fixtures/sequences/authentication.sequence'; +import {Strategies} from '../../../../strategies/keys'; +import {AuthenticationBindings} from '../../../../keys'; +import {BearerTokenVerifyProvider} from '../../../fixtures/providers/bearer-passport.provider'; /** * Testing overall flow of authentication with bearer strategy diff --git a/src/__tests__/integration/passport-client-password/client-password-verify.integration.ts b/src/__tests__/integration/action-sequence/passport-client-password/client-password-verify.integration.ts similarity index 92% rename from src/__tests__/integration/passport-client-password/client-password-verify.integration.ts rename to src/__tests__/integration/action-sequence/passport-client-password/client-password-verify.integration.ts index 48370ef..4781ca9 100644 --- a/src/__tests__/integration/passport-client-password/client-password-verify.integration.ts +++ b/src/__tests__/integration/action-sequence/passport-client-password/client-password-verify.integration.ts @@ -1,17 +1,17 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import {IAuthClient} from '../../../types'; +import {IAuthClient} from '../../../../types'; import {Client, createClientForHandler, expect} from '@loopback/testlab'; import {RestServer} from '@loopback/rest'; import {Application, inject} from '@loopback/core'; import {post, requestBody} from '@loopback/openapi-v3'; -import {authenticateClient} from '../../../decorators'; -import {STRATEGY} from '../../../strategy-name.enum'; +import {authenticateClient} from '../../../../decorators'; +import {STRATEGY} from '../../../../strategy-name.enum'; import {getApp} from '../helpers/helpers'; -import {MyAuthenticationSequence} from '../../fixtures/sequences/authentication.sequence'; -import {Strategies} from '../../../strategies/keys'; -import {AuthenticationBindings} from '../../../keys'; -import {ClientPasswordVerifyProvider} from '../../fixtures/providers/passport-client.provider'; +import {MyAuthenticationSequence} from '../../../fixtures/sequences/authentication.sequence'; +import {Strategies} from '../../../../strategies/keys'; +import {AuthenticationBindings} from '../../../../keys'; +import {ClientPasswordVerifyProvider} from '../../../fixtures/providers/passport-client.provider'; describe('Client-password strategy', () => { let app: Application; diff --git a/src/__tests__/integration/passport-google-oauth2/google-oauth2.integration.ts b/src/__tests__/integration/action-sequence/passport-google-oauth2/google-oauth2.integration.ts similarity index 77% rename from src/__tests__/integration/passport-google-oauth2/google-oauth2.integration.ts rename to src/__tests__/integration/action-sequence/passport-google-oauth2/google-oauth2.integration.ts index d9e46e1..740e9ea 100644 --- a/src/__tests__/integration/passport-google-oauth2/google-oauth2.integration.ts +++ b/src/__tests__/integration/action-sequence/passport-google-oauth2/google-oauth2.integration.ts @@ -2,13 +2,13 @@ import {Client, createClientForHandler} from '@loopback/testlab'; import {RestServer} from '@loopback/rest'; import {Application, Provider} from '@loopback/core'; import {get} from '@loopback/openapi-v3'; -import {authenticate} from '../../../decorators'; -import {STRATEGY} from '../../../strategy-name.enum'; +import {authenticate} from '../../../../decorators'; +import {STRATEGY} from '../../../../strategy-name.enum'; import {getApp} from '../helpers/helpers'; -import {MyAuthenticationSequence} from '../../fixtures/sequences/authentication.sequence'; -import {Strategies} from '../../../strategies/keys'; -import {VerifyFunction} from '../../../strategies'; -import {userWithoutReqObj} from '../../fixtures/data/bearer-data'; +import {MyAuthenticationSequence} from '../../../fixtures/sequences/authentication.sequence'; +import {Strategies} from '../../../../strategies/keys'; +import {VerifyFunction} from '../../../../strategies'; +import {userWithoutReqObj} from '../../../fixtures/data/bearer-data'; import * as GoogleStrategy from 'passport-google-oauth20'; import {Request} from '@loopback/rest'; @@ -19,7 +19,7 @@ describe('getting google oauth2 strategy with options', () => { beforeEach(givenAuthenticatedSequence); beforeEach(getAuthVerifier); - it('should return 200 when client id is passed and passReqToCallback is set true', async () => { + it('should return 302 when client id is passed and passReqToCallback is set true', async () => { class TestController { @get('/test') @authenticate(STRATEGY.GOOGLE_OAUTH2, { @@ -34,7 +34,7 @@ describe('getting google oauth2 strategy with options', () => { app.controller(TestController); - await whenIMakeRequestTo(server).get('/test').expect(200); + await whenIMakeRequestTo(server).get('/test').expect(302); }); function whenIMakeRequestTo(restServer: RestServer): Client { diff --git a/src/__tests__/integration/passport-instagram-oauth2/instagram-oauth2.integration.ts b/src/__tests__/integration/action-sequence/passport-instagram-oauth2/instagram-oauth2.integration.ts similarity index 77% rename from src/__tests__/integration/passport-instagram-oauth2/instagram-oauth2.integration.ts rename to src/__tests__/integration/action-sequence/passport-instagram-oauth2/instagram-oauth2.integration.ts index d717056..b580282 100644 --- a/src/__tests__/integration/passport-instagram-oauth2/instagram-oauth2.integration.ts +++ b/src/__tests__/integration/action-sequence/passport-instagram-oauth2/instagram-oauth2.integration.ts @@ -2,13 +2,13 @@ import {Client, createClientForHandler} from '@loopback/testlab'; import {RestServer} from '@loopback/rest'; import {Application, Provider} from '@loopback/core'; import {get} from '@loopback/openapi-v3'; -import {authenticate} from '../../../decorators'; -import {STRATEGY} from '../../../strategy-name.enum'; +import {authenticate} from '../../../../decorators'; +import {STRATEGY} from '../../../../strategy-name.enum'; import {getApp} from '../helpers/helpers'; -import {MyAuthenticationSequence} from '../../fixtures/sequences/authentication.sequence'; -import {Strategies} from '../../../strategies/keys'; -import {VerifyCallback, VerifyFunction} from '../../../strategies'; -import {userWithoutReqObj} from '../../fixtures/data/bearer-data'; +import {MyAuthenticationSequence} from '../../../fixtures/sequences/authentication.sequence'; +import {Strategies} from '../../../../strategies/keys'; +import {VerifyCallback, VerifyFunction} from '../../../../strategies'; +import {userWithoutReqObj} from '../../../fixtures/data/bearer-data'; import * as InstagramStrategy from 'passport-instagram'; import {Request} from '@loopback/rest'; @@ -19,7 +19,7 @@ describe('getting instagram oauth2 strategy with options', () => { beforeEach(givenAuthenticatedSequence); beforeEach(getAuthVerifier); - it('should return 200 when client id is passed and passReqToCallback is set true', async () => { + it('should return 302 when client id is passed and passReqToCallback is set true', async () => { class TestController { @get('/test') @authenticate(STRATEGY.INSTAGRAM_OAUTH2, { @@ -34,7 +34,7 @@ describe('getting instagram oauth2 strategy with options', () => { app.controller(TestController); - await whenIMakeRequestTo(server).get('/test').expect(200); + await whenIMakeRequestTo(server).get('/test').expect(302); }); function whenIMakeRequestTo(restServer: RestServer): Client { diff --git a/src/__tests__/integration/passport-keycloak/keycloak.integration.ts b/src/__tests__/integration/action-sequence/passport-keycloak/keycloak.integration.ts similarity index 77% rename from src/__tests__/integration/passport-keycloak/keycloak.integration.ts rename to src/__tests__/integration/action-sequence/passport-keycloak/keycloak.integration.ts index 68f522a..de5f1e2 100644 --- a/src/__tests__/integration/passport-keycloak/keycloak.integration.ts +++ b/src/__tests__/integration/action-sequence/passport-keycloak/keycloak.integration.ts @@ -2,15 +2,15 @@ import {Client, createClientForHandler} from '@loopback/testlab'; import {RestServer} from '@loopback/rest'; import {Application, Provider} from '@loopback/core'; import {get} from '@loopback/openapi-v3'; -import {authenticate} from '../../../decorators'; -import {STRATEGY} from '../../../strategy-name.enum'; +import {authenticate} from '../../../../decorators'; +import {STRATEGY} from '../../../../strategy-name.enum'; import {getApp} from '../helpers/helpers'; -import {MyAuthenticationSequence} from '../../fixtures/sequences/authentication.sequence'; -import {Strategies} from '../../../strategies/keys'; -import {Keycloak, VerifyFunction} from '../../../strategies'; -import {userWithoutReqObj} from '../../fixtures/data/bearer-data'; +import {MyAuthenticationSequence} from '../../../fixtures/sequences/authentication.sequence'; +import {Strategies} from '../../../../strategies/keys'; +import {Keycloak, VerifyFunction} from '../../../../strategies'; +import {userWithoutReqObj} from '../../../fixtures/data/bearer-data'; import {Request} from '@loopback/rest'; -import {IAuthUser} from '../../../types'; +import {IAuthUser} from '../../../../types'; describe('getting keycloak oauth2 strategy with options', () => { let app: Application; @@ -19,7 +19,7 @@ describe('getting keycloak oauth2 strategy with options', () => { beforeEach(givenAuthenticatedSequence); beforeEach(getAuthVerifier); - it('should return 200 when host and client id is passed and passReqToCallback is set true', async () => { + it('should return 302 when host and client id is passed and passReqToCallback is set true', async () => { class TestController { @get('/test') @authenticate(STRATEGY.KEYCLOAK, { @@ -40,7 +40,7 @@ describe('getting keycloak oauth2 strategy with options', () => { app.controller(TestController); - await whenIMakeRequestTo(server).get('/test').expect(200); + await whenIMakeRequestTo(server).get('/test').expect(302); }); function whenIMakeRequestTo(restServer: RestServer): Client { diff --git a/src/__tests__/integration/passport-local/local-passport.integration.ts b/src/__tests__/integration/action-sequence/passport-local/local-passport.integration.ts similarity index 92% rename from src/__tests__/integration/passport-local/local-passport.integration.ts rename to src/__tests__/integration/action-sequence/passport-local/local-passport.integration.ts index 1f70cf4..cb0e3be 100644 --- a/src/__tests__/integration/passport-local/local-passport.integration.ts +++ b/src/__tests__/integration/action-sequence/passport-local/local-passport.integration.ts @@ -2,15 +2,15 @@ import {Client, createClientForHandler, expect} from '@loopback/testlab'; import {RestServer} from '@loopback/rest'; import {Application, inject} from '@loopback/core'; import {post, requestBody} from '@loopback/openapi-v3'; -import {authenticate} from '../../../decorators'; -import {STRATEGY} from '../../../strategy-name.enum'; +import {authenticate} from '../../../../decorators'; +import {STRATEGY} from '../../../../strategy-name.enum'; import {getApp} from '../helpers/helpers'; -import {MyAuthenticationSequence} from '../../fixtures/sequences/authentication.sequence'; -import {Strategies} from '../../../strategies/keys'; -import {LocalVerifyProvider} from '../../fixtures/providers/local-password.provider'; -import {AuthenticationBindings} from '../../../keys'; -import {IAuthUser} from '../../../types'; -import {Authuser} from '../../../models'; +import {MyAuthenticationSequence} from '../../../fixtures/sequences/authentication.sequence'; +import {Strategies} from '../../../../strategies/keys'; +import {LocalVerifyProvider} from '../../../fixtures/providers/local-password.provider'; +import {AuthenticationBindings} from '../../../../keys'; +import {IAuthUser} from '../../../../types'; +import {Authuser} from '../../../../models'; /** * Testing overall flow of authentication with bearer strategy */ diff --git a/src/__tests__/integration/passport-resource-owner-password/resource-owner-password.integration.ts b/src/__tests__/integration/action-sequence/passport-resource-owner-password/resource-owner-password.integration.ts similarity index 94% rename from src/__tests__/integration/passport-resource-owner-password/resource-owner-password.integration.ts rename to src/__tests__/integration/action-sequence/passport-resource-owner-password/resource-owner-password.integration.ts index d6ab242..b93511f 100644 --- a/src/__tests__/integration/passport-resource-owner-password/resource-owner-password.integration.ts +++ b/src/__tests__/integration/action-sequence/passport-resource-owner-password/resource-owner-password.integration.ts @@ -4,14 +4,14 @@ import {Client, createClientForHandler, expect} from '@loopback/testlab'; import {RestServer} from '@loopback/rest'; import {Application, inject} from '@loopback/core'; import {post, requestBody} from '@loopback/openapi-v3'; -import {authenticate} from '../../../decorators'; -import {STRATEGY} from '../../../strategy-name.enum'; +import {authenticate} from '../../../../decorators'; +import {STRATEGY} from '../../../../strategy-name.enum'; import {getApp} from '../helpers/helpers'; -import {MyAuthenticationSequence} from '../../fixtures/sequences/authentication.sequence'; -import {Strategies} from '../../../strategies/keys'; -import {ResourceOwnerVerifyProvider} from '../../fixtures/providers/resource-owner.provider'; -import {AuthenticationBindings} from '../../../keys'; -import {IAuthUser} from '../../../types'; +import {MyAuthenticationSequence} from '../../../fixtures/sequences/authentication.sequence'; +import {Strategies} from '../../../../strategies/keys'; +import {ResourceOwnerVerifyProvider} from '../../../fixtures/providers/resource-owner.provider'; +import {AuthenticationBindings} from '../../../../keys'; +import {IAuthUser} from '../../../../types'; describe('Resource-owner-password strategy', () => { let app: Application; diff --git a/src/__tests__/integration/middleware-sequence/helpers/helpers.ts b/src/__tests__/integration/middleware-sequence/helpers/helpers.ts new file mode 100644 index 0000000..126ccfa --- /dev/null +++ b/src/__tests__/integration/middleware-sequence/helpers/helpers.ts @@ -0,0 +1,18 @@ +import {Application} from '@loopback/core'; +import {AuthenticationComponent} from '../../../../component'; +import {RestComponent} from '@loopback/rest'; +import {AuthenticationBindings} from '../../../../keys'; + +/** + *Gives an instance of application + */ +export function getApp(): Application { + const app = new Application(); + app.bind(AuthenticationBindings.CONFIG).to({ + useClientAuthenticationMiddleware: true, + useUserAuthenticationMiddleware: true, + }); + app.component(AuthenticationComponent); + app.component(RestComponent); + return app; +} diff --git a/src/__tests__/integration/middleware-sequence/passport-apple-oauth2/apple-oauth2.integration.ts b/src/__tests__/integration/middleware-sequence/passport-apple-oauth2/apple-oauth2.integration.ts new file mode 100644 index 0000000..9519263 --- /dev/null +++ b/src/__tests__/integration/middleware-sequence/passport-apple-oauth2/apple-oauth2.integration.ts @@ -0,0 +1,81 @@ +import {Client, createClientForHandler} from '@loopback/testlab'; +import {RestServer} from '@loopback/rest'; +import {Application, Provider} from '@loopback/core'; +import {get} from '@loopback/openapi-v3'; +import {authenticate} from '../../../../decorators'; +import {STRATEGY} from '../../../../strategy-name.enum'; +import {getApp} from '../helpers/helpers'; +import {MyAuthenticationMiddlewareSequence} from '../../../fixtures/sequences/authentication-middleware.sequence'; +import {Strategies} from '../../../../strategies/keys'; +import {VerifyFunction} from '../../../../strategies'; +import {userWithoutReqObj} from '../../../fixtures/data/bearer-data'; +import {Request} from '@loopback/rest'; +import AppleStrategy, {DecodedIdToken} from 'passport-apple'; + +describe('getting apple oauth2 strategy with options using Middleware Sequence', () => { + let app: Application; + let server: RestServer; + beforeEach(givenAServer); + beforeEach(givenAuthenticatedSequence); + afterEach(closeServer); + + it('should return 302 when client id is passed and passReqToCallback is set true', async () => { + getAuthVerifier(); + class TestController { + @get('/test') + @authenticate(STRATEGY.APPLE_OAUTH2, { + clientID: 'string', + clientSecret: 'string', + passReqToCallback: true, + }) + test() { + return 'test successful'; + } + } + + app.controller(TestController); + + await whenIMakeRequestTo(server).get('/test').expect(302); + }); + + function whenIMakeRequestTo(restServer: RestServer): Client { + return createClientForHandler(restServer.requestHandler); + } + + async function givenAServer() { + app = getApp(); + server = await app.getServer(RestServer); + } + + function getAuthVerifier() { + app + .bind(Strategies.Passport.APPLE_OAUTH2_VERIFIER) + .toProvider(AppleAuthVerifyProvider); + } + + function closeServer() { + app.close(); + } + + function givenAuthenticatedSequence() { + // bind user defined sequence + server.sequence(MyAuthenticationMiddlewareSequence); + } +}); + +class AppleAuthVerifyProvider implements Provider { + constructor() {} + + value(): VerifyFunction.AppleAuthFn { + return async ( + accessToken: string, + refreshToken: string, + decodedIdToken: DecodedIdToken, + profile: AppleStrategy.Profile, + cd: AppleStrategy.VerifyCallback, + req?: Request, + ) => { + return userWithoutReqObj; + }; + } +} diff --git a/src/__tests__/integration/middleware-sequence/passport-bearer/bearer-token-verify.integration.ts b/src/__tests__/integration/middleware-sequence/passport-bearer/bearer-token-verify.integration.ts new file mode 100644 index 0000000..916a1c8 --- /dev/null +++ b/src/__tests__/integration/middleware-sequence/passport-bearer/bearer-token-verify.integration.ts @@ -0,0 +1,295 @@ +import {IAuthUser} from '../../../../types'; +import {expect, Client, createClientForHandler} from '@loopback/testlab'; +import {RestServer} from '@loopback/rest'; +import {Application, inject} from '@loopback/core'; +import {get} from '@loopback/openapi-v3'; +import {authenticate} from '../../../../decorators'; +import {STRATEGY} from '../../../../strategy-name.enum'; +import {getApp} from '../helpers/helpers'; +import {MyAuthenticationMiddlewareSequence} from '../../../fixtures/sequences/authentication-middleware.sequence'; +import {Strategies} from '../../../../strategies/keys'; +import {AuthenticationBindings} from '../../../../keys'; +import {BearerTokenVerifyProvider} from '../../../fixtures/providers/bearer-passport.provider'; + +/** + * Testing overall flow of authentication with bearer strategy + */ +describe('Bearer-token strategy using Middleware Sequence', () => { + let app: Application; + let server: RestServer; + beforeEach(givenAServer); + beforeEach(givenAuthenticatedSequence); + beforeEach(getAuthVerifier); + + it('should return 401 when token is not passed', async () => { + class BearerNoTokenController { + @get('/auth/bearer/no-token') + @authenticate(STRATEGY.BEARER) + test() { + return 'test successful'; + } + } + + app.controller(BearerNoTokenController); + + await whenIMakeRequestTo(server).get('/auth/bearer/no-token').expect(401); + }); + + it('should return status 200 when token is passed', async () => { + class BearerTokenController { + @get('/auth/bearer/token') + @authenticate(STRATEGY.BEARER) + test() { + return 'test successful'; + } + } + + app.controller(BearerTokenController); + + await whenIMakeRequestTo(server) + .get('/auth/bearer/token') + .set('Authorization', 'Bearer validtoken') + .expect(200); + }); + + it('should return the user passed via verifier when no options are passed', async () => { + class BearerNoOptionsController { + constructor( + @inject(AuthenticationBindings.CURRENT_USER) // tslint:disable-next-line: no-shadowed-variable + private readonly user: IAuthUser | undefined, + ) {} + + @get('/auth/bearer/no-options') + @authenticate(STRATEGY.BEARER) + async test() { + return this.user; + } + } + + app.controller(BearerNoOptionsController); + + const user = await whenIMakeRequestTo(server) + .get('/auth/bearer/no-options') + .set('Authorization', 'Bearer validtoken') + .expect(200); + + expect(user.body).to.have.property('id'); + expect(user.body.id).to.equal(1); + }); + + it('should return the user passed via verifier and options are passed with passRequestCallback true', async () => { + class BearerForCallbackController { + constructor( + @inject(AuthenticationBindings.CURRENT_USER) // tslint:disable-next-line: no-shadowed-variable + private readonly user: IAuthUser | undefined, + ) {} + + options = { + passRequestToCallback: false, + }; + + @get('/auth/bearer/callback') + @authenticate(STRATEGY.BEARER, {passReqToCallback: true}) + async test() { + return this.user; + } + } + + app.controller(BearerForCallbackController); + + const user = await whenIMakeRequestTo(server) + .get('/auth/bearer/callback') + .set('Authorization', 'Bearer validtoken') + .expect(200); + + expect(user.body).to.have.property('id'); + expect(user.body.id).to.equal(2); + }); + + it('should return the user passed via verifier and options are passed with passRequestCallback false', async () => { + class BearerNoCallbackController { + constructor( + @inject(AuthenticationBindings.CURRENT_USER) // tslint:disable-next-line: no-shadowed-variable + private readonly user: IAuthUser | undefined, + ) {} + + options = { + passRequestToCallback: false, + }; + + @get('/auth/bearer/no-callback') + @authenticate(STRATEGY.BEARER, {passReqToCallback: false}) + async test() { + return this.user; + } + } + + app.controller(BearerNoCallbackController); + + const user = await whenIMakeRequestTo(server) + .get('/auth/bearer/no-callback') + .set('Authorization', 'Bearer validtoken') + .expect(200); + + expect(user.body).to.have.property('id'); + expect(user.body.id).to.equal(1); + }); + + it('should return status 401 as Bearer is not sent in token', async () => { + class NoBearerInTokenController { + @get('/auth/bearer/no-bearer-in-token') + @authenticate(STRATEGY.BEARER) + test() { + return 'test successful'; + } + } + + app.controller(NoBearerInTokenController); + + await whenIMakeRequestTo(server) + .get('/auth/bearer/no-bearer-in-token') + .set('Authorization', 'sometoken') + .expect(401); + }); + + it('should return error as no user was returned from provider', async () => { + class BearerNoUserController { + constructor( + @inject(AuthenticationBindings.CURRENT_USER) // tslint:disable-next-line: no-shadowed-variable + private readonly user: IAuthUser | undefined, + ) {} + + @get('/auth/bearer/no-user') + @authenticate(STRATEGY.BEARER) + async test() { + return this.user; + } + } + + app.controller(BearerNoUserController); + + await whenIMakeRequestTo(server) + .get('/auth/bearer/no-user') + .set('Authorization', 'Bearer sometoken') + .expect(401); + }); + + it('should return error when passRequestCallback is true and provider is not returning user', async () => { + class BearerNoUserFromCallbackController { + constructor( + @inject(AuthenticationBindings.CURRENT_USER) // tslint:disable-next-line: no-shadowed-variable + private readonly user: IAuthUser | undefined, + ) {} + + options = { + passRequestToCallback: false, + }; + + @get('/auth/bearer/no-user-with-callback') + @authenticate(STRATEGY.BEARER, {passReqToCallback: true}) + async test() { + return this.user; + } + } + + app.controller(BearerNoUserFromCallbackController); + + await whenIMakeRequestTo(server) + .get('/auth/bearer/no-user-with-callback') + .set('Authorization', 'Bearer sometoken') + .expect(401); + }); + + it('should return error when options are passed with passRequestCallback false and provider does not return user', async () => { + class BearerCallbackFalseController { + constructor( + @inject(AuthenticationBindings.CURRENT_USER) // tslint:disable-next-line: no-shadowed-variable + private readonly user: IAuthUser | undefined, + ) {} + + options = { + passRequestToCallback: false, + }; + + @get('/auth/bearer/no-user-when-callback-false') + @authenticate(STRATEGY.BEARER, {passReqToCallback: false}) + async test() { + return this.user; + } + } + + app.controller(BearerCallbackFalseController); + + await whenIMakeRequestTo(server) + .get('/auth/bearer/no-user-when-callback-false') + .set('Authorization', 'Bearer sometoken') + .expect(401); + }); + + function whenIMakeRequestTo(restServer: RestServer): Client { + return createClientForHandler(restServer.requestHandler); + } + + async function givenAServer() { + app = getApp(); + server = await app.getServer(RestServer); + } + + function getAuthVerifier() { + app + .bind(Strategies.Passport.BEARER_TOKEN_VERIFIER) + .toProvider(BearerTokenVerifyProvider); + } + + function givenAuthenticatedSequence() { + // bind user defined sequence + server.sequence(MyAuthenticationMiddlewareSequence); + } +}); + +describe('integration test when no provider was implemented using Middleware Sequence', () => { + let app: Application; + let server: RestServer; + beforeEach(givenAServer); + beforeEach(givenAuthenticatedSequence); + + it('should return error as the verifier is not implemented', async () => { + class BearerNoVerifierController { + constructor( + @inject(AuthenticationBindings.CURRENT_USER) // tslint:disable-next-line: no-shadowed-variable + private readonly user: IAuthUser | undefined, + ) {} + + options = { + passRequestToCallback: false, + }; + + @get('/auth/bearer/no-verifier') + @authenticate(STRATEGY.BEARER, {passReqToCallback: false}) + async test() { + return this.user; + } + } + + app.controller(BearerNoVerifierController); + + await whenIMakeRequestTo(server) + .get('/auth/bearer/no-verifier') + .set('Authorization', 'Bearer sometoken') + .expect(401); + }); + + function whenIMakeRequestTo(restServer: RestServer): Client { + return createClientForHandler(restServer.requestHandler); + } + + async function givenAServer() { + app = getApp(); + server = await app.getServer(RestServer); + } + + function givenAuthenticatedSequence() { + // bind user defined sequence + server.sequence(MyAuthenticationMiddlewareSequence); + } +}); diff --git a/src/__tests__/integration/middleware-sequence/passport-client-password/client-password-verify.integration.ts b/src/__tests__/integration/middleware-sequence/passport-client-password/client-password-verify.integration.ts new file mode 100644 index 0000000..bc6e832 --- /dev/null +++ b/src/__tests__/integration/middleware-sequence/passport-client-password/client-password-verify.integration.ts @@ -0,0 +1,201 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import {IAuthClient} from '../../../../types'; +import {Client, createClientForHandler, expect} from '@loopback/testlab'; +import {RestServer} from '@loopback/rest'; +import {Application, inject} from '@loopback/core'; +import {post, requestBody} from '@loopback/openapi-v3'; +import {authenticateClient} from '../../../../decorators'; +import {STRATEGY} from '../../../../strategy-name.enum'; +import {getApp} from '../helpers/helpers'; +import {MyAuthenticationMiddlewareSequence} from '../../../fixtures/sequences/authentication-middleware.sequence'; +import {Strategies} from '../../../../strategies/keys'; +import {AuthenticationBindings} from '../../../../keys'; +import {ClientPasswordVerifyProvider} from '../../../fixtures/providers/passport-client.provider'; + +describe('Client-password strategy using Middleware Sequence', () => { + let app: Application; + let server: RestServer; + beforeEach(givenAServer); + beforeEach(givenAuthenticatedSequence); + beforeEach(getAuthVerifier); + + it('should return status 200 when options.passRequestToCallback is set true', async () => { + class TestController { + constructor( + @inject(AuthenticationBindings.CURRENT_CLIENT) // tslint:disable-next-line: no-shadowed-variable + private readonly client: IAuthClient | undefined, + ) {} + + @authenticateClient(STRATEGY.CLIENT_PASSWORD, {passReqToCallback: true}) + @post('/test') + test(@requestBody() body: {client_id: string; client_secret: string}) { + return this.client; + } + } + + app.controller(TestController); + + const client = await whenIMakeRequestTo(server) + .post('/test') + .send({client_id: 'some id', client_secret: 'some secret'}) + .expect(200); + + expect(client.body).to.have.property('clientId'); + expect(client.body).to.have.property('clientSecret'); + expect(client.body.clientId).to.equal('some id'); + expect(client.body.clientSecret).to.equal('some secret'); + }); + + it('should return status 200 when options.passRequestToCallback is set false', async () => { + class TestController { + constructor( + @inject(AuthenticationBindings.CURRENT_CLIENT) // tslint:disable-next-line: no-shadowed-variable + private readonly client: IAuthClient | undefined, + ) {} + + @post('/test') + @authenticateClient(STRATEGY.CLIENT_PASSWORD, {passReqToCallback: false}) + test(@requestBody() body: {client_id: string; client_secret: string}) { + return this.client; + } + } + + app.controller(TestController); + + const client = await whenIMakeRequestTo(server) + .post('/test') + .send({client_id: 'some id', client_secret: 'some secret'}) + .expect(200); + + expect(client.body).to.have.property('clientId'); + expect(client.body).to.have.property('clientSecret'); + expect(client.body.clientId).to.equal('some id'); + expect(client.body.clientSecret).to.equal('some secret'); + }); + + it('should return status 401 when options.passRequestToCallback is set true', async () => { + class TestController { + constructor( + @inject(AuthenticationBindings.CURRENT_CLIENT) // tslint:disable-next-line: no-shadowed-variable + private readonly client: IAuthClient | undefined, + ) {} + + @post('/test') + @authenticateClient(STRATEGY.CLIENT_PASSWORD, {passReqToCallback: true}) + async test( + @requestBody() + body: { + client_id: string; + client_secret: string; + }, + ) { + return this.client; + } + } + + app.controller(TestController); + + await whenIMakeRequestTo(server) + .post('/test') + .send({client_id: '', client_secret: 'some secret'}) + .expect(401); + }); + + it('should return status 401 when options.passRequestToCallback is set false', async () => { + class TestController { + constructor( + @inject(AuthenticationBindings.CURRENT_CLIENT) // tslint:disable-next-line: no-shadowed-variable + private readonly client: IAuthClient | undefined, + ) {} + + @post('/test') + @authenticateClient(STRATEGY.CLIENT_PASSWORD, {passReqToCallback: false}) + async test( + @requestBody() + body: { + client_id: string; + client_secret: string; + }, + ) { + return this.client; + } + } + + app.controller(TestController); + + await whenIMakeRequestTo(server) + .post('/test') + .send({client_id: '', client_secret: 'some secret'}) + .expect(401); + }); + + function whenIMakeRequestTo(restServer: RestServer): Client { + return createClientForHandler(restServer.requestHandler); + } + + async function givenAServer() { + app = getApp(); + server = await app.getServer(RestServer); + } + + function getAuthVerifier() { + app + .bind(Strategies.Passport.OAUTH2_CLIENT_PASSWORD_VERIFIER) + .toProvider(ClientPasswordVerifyProvider); + } + + function givenAuthenticatedSequence() { + // bind user defined sequence + server.sequence(MyAuthenticationMiddlewareSequence); + } +}); + +describe('integration test for client-password and no verifier using Middleware Sequence', () => { + let app: Application; + let server: RestServer; + beforeEach(givenAServer); + beforeEach(givenAuthenticatedSequence); + + it('should return status 401 as this strategy is not implemented', async () => { + class TestController { + constructor( + @inject(AuthenticationBindings.CURRENT_CLIENT) // tslint:disable-next-line: no-shadowed-variable + private readonly client: IAuthClient | undefined, + ) {} + + @post('/test') + @authenticateClient(STRATEGY.CLIENT_PASSWORD, {passReqToCallback: true}) + test( + @requestBody() + body: { + client_id: string; + client_secret: string; + }, + ) { + return this.client; + } + } + + app.controller(TestController); + + await whenIMakeRequestTo(server) + .post('/test') + .send({client_id: 'some id', client_secret: 'some secret'}) + .expect(401); + }); + + function whenIMakeRequestTo(restServer: RestServer): Client { + return createClientForHandler(restServer.requestHandler); + } + + async function givenAServer() { + app = getApp(); + server = await app.getServer(RestServer); + } + + function givenAuthenticatedSequence() { + // bind user defined sequence + server.sequence(MyAuthenticationMiddlewareSequence); + } +}); diff --git a/src/__tests__/integration/middleware-sequence/passport-google-oauth2/google-oauth2.integration.ts b/src/__tests__/integration/middleware-sequence/passport-google-oauth2/google-oauth2.integration.ts new file mode 100644 index 0000000..ef94f48 --- /dev/null +++ b/src/__tests__/integration/middleware-sequence/passport-google-oauth2/google-oauth2.integration.ts @@ -0,0 +1,77 @@ +import {Client, createClientForHandler} from '@loopback/testlab'; +import {RestServer} from '@loopback/rest'; +import {Application, Provider} from '@loopback/core'; +import {get} from '@loopback/openapi-v3'; +import {authenticate} from '../../../../decorators'; +import {STRATEGY} from '../../../../strategy-name.enum'; +import {getApp} from '../helpers/helpers'; +import {MyAuthenticationMiddlewareSequence} from '../../../fixtures/sequences/authentication-middleware.sequence'; +import {Strategies} from '../../../../strategies/keys'; +import {VerifyFunction} from '../../../../strategies'; +import {userWithoutReqObj} from '../../../fixtures/data/bearer-data'; +import * as GoogleStrategy from 'passport-google-oauth20'; +import {Request} from '@loopback/rest'; + +describe('getting google oauth2 strategy with options using Middleware Sequence', () => { + let app: Application; + let server: RestServer; + beforeEach(givenAServer); + beforeEach(givenAuthenticatedSequence); + beforeEach(getAuthVerifier); + + it('should return 302 when client id is passed and passReqToCallback is set true', async () => { + class TestController { + @get('/test') + @authenticate(STRATEGY.GOOGLE_OAUTH2, { + clientID: 'string', + clientSecret: 'string', + passReqToCallback: true, + }) + test() { + return 'test successful'; + } + } + + app.controller(TestController); + + await whenIMakeRequestTo(server).get('/test').expect(302); + }); + + function whenIMakeRequestTo(restServer: RestServer): Client { + return createClientForHandler(restServer.requestHandler); + } + + async function givenAServer() { + app = getApp(); + server = await app.getServer(RestServer); + } + + function getAuthVerifier() { + app + .bind(Strategies.Passport.GOOGLE_OAUTH2_VERIFIER) + .toProvider(GoogleAuthVerifyProvider); + } + + function givenAuthenticatedSequence() { + // bind user defined sequence + server.sequence(MyAuthenticationMiddlewareSequence); + } +}); + +class GoogleAuthVerifyProvider + implements Provider +{ + constructor() {} + + value(): VerifyFunction.GoogleAuthFn { + return async ( + accessToken: string, + refreshToken: string, + profile: GoogleStrategy.Profile, + cd: GoogleStrategy.VerifyCallback, + req?: Request, + ) => { + return userWithoutReqObj; + }; + } +} diff --git a/src/__tests__/integration/middleware-sequence/passport-instagram-oauth2/instagram-oauth2.integration.ts b/src/__tests__/integration/middleware-sequence/passport-instagram-oauth2/instagram-oauth2.integration.ts new file mode 100644 index 0000000..a33cb35 --- /dev/null +++ b/src/__tests__/integration/middleware-sequence/passport-instagram-oauth2/instagram-oauth2.integration.ts @@ -0,0 +1,77 @@ +import {Client, createClientForHandler} from '@loopback/testlab'; +import {RestServer} from '@loopback/rest'; +import {Application, Provider} from '@loopback/core'; +import {get} from '@loopback/openapi-v3'; +import {authenticate} from '../../../../decorators'; +import {STRATEGY} from '../../../../strategy-name.enum'; +import {getApp} from '../helpers/helpers'; +import {MyAuthenticationMiddlewareSequence} from '../../../fixtures/sequences/authentication-middleware.sequence'; +import {Strategies} from '../../../../strategies/keys'; +import {VerifyCallback, VerifyFunction} from '../../../../strategies'; +import {userWithoutReqObj} from '../../../fixtures/data/bearer-data'; +import * as InstagramStrategy from 'passport-instagram'; +import {Request} from '@loopback/rest'; + +describe('getting instagram oauth2 strategy with options using Middleware Sequence', () => { + let app: Application; + let server: RestServer; + beforeEach(givenAServer); + beforeEach(givenAuthenticatedSequence); + beforeEach(getAuthVerifier); + + it('should return 302 when client id is passed and passReqToCallback is set true', async () => { + class TestController { + @get('/test') + @authenticate(STRATEGY.INSTAGRAM_OAUTH2, { + clientID: 'string', + clientSecret: 'string', + passReqToCallback: true, + }) + test() { + return 'test successful'; + } + } + + app.controller(TestController); + + await whenIMakeRequestTo(server).get('/test').expect(302); + }); + + function whenIMakeRequestTo(restServer: RestServer): Client { + return createClientForHandler(restServer.requestHandler); + } + + async function givenAServer() { + app = getApp(); + server = await app.getServer(RestServer); + } + + function getAuthVerifier() { + app + .bind(Strategies.Passport.INSTAGRAM_OAUTH2_VERIFIER) + .toProvider(InstagramAuthVerifyProvider); + } + + function givenAuthenticatedSequence() { + // bind user defined sequence + server.sequence(MyAuthenticationMiddlewareSequence); + } +}); + +class InstagramAuthVerifyProvider + implements Provider +{ + constructor() {} + + value(): VerifyFunction.InstagramAuthFn { + return async ( + accessToken: string, + refreshToken: string, + profile: InstagramStrategy.Profile, + cd: VerifyCallback, + req?: Request, + ) => { + return userWithoutReqObj; + }; + } +} diff --git a/src/__tests__/integration/middleware-sequence/passport-keycloak/keycloak.integration.ts b/src/__tests__/integration/middleware-sequence/passport-keycloak/keycloak.integration.ts new file mode 100644 index 0000000..f5a49fa --- /dev/null +++ b/src/__tests__/integration/middleware-sequence/passport-keycloak/keycloak.integration.ts @@ -0,0 +1,83 @@ +import {Client, createClientForHandler} from '@loopback/testlab'; +import {RestServer} from '@loopback/rest'; +import {Application, Provider} from '@loopback/core'; +import {get} from '@loopback/openapi-v3'; +import {authenticate} from '../../../../decorators'; +import {STRATEGY} from '../../../../strategy-name.enum'; +import {getApp} from '../helpers/helpers'; +import {MyAuthenticationMiddlewareSequence} from '../../../fixtures/sequences/authentication-middleware.sequence'; +import {Strategies} from '../../../../strategies/keys'; +import {Keycloak, VerifyFunction} from '../../../../strategies'; +import {userWithoutReqObj} from '../../../fixtures/data/bearer-data'; +import {Request} from '@loopback/rest'; +import {IAuthUser} from '../../../../types'; + +describe('getting keycloak oauth2 strategy with options using Middleware Sequence', () => { + let app: Application; + let server: RestServer; + beforeEach(givenAServer); + beforeEach(givenAuthenticatedSequence); + beforeEach(getAuthVerifier); + + it('should return 302 when host and client id is passed and passReqToCallback is set true', async () => { + class TestController { + @get('/test') + @authenticate(STRATEGY.KEYCLOAK, { + host: 'localhost', + realm: 'localhost', + callbackURL: 'localhost', + authorizationURL: 'localhost', + tokenURL: 'localhost', + userInfoURL: 'localhost', + clientID: 'string', + clientSecret: 'string', + passReqToCallback: true, + }) + test() { + return 'test successful'; + } + } + + app.controller(TestController); + + await whenIMakeRequestTo(server).get('/test').expect(302); + }); + + function whenIMakeRequestTo(restServer: RestServer): Client { + return createClientForHandler(restServer.requestHandler); + } + + async function givenAServer() { + app = getApp(); + server = await app.getServer(RestServer); + } + + function getAuthVerifier() { + app + .bind(Strategies.Passport.KEYCLOAK_VERIFIER) + .toProvider(KeycloakAuthVerifyProvider); + } + + function givenAuthenticatedSequence() { + // bind user defined sequence + server.sequence(MyAuthenticationMiddlewareSequence); + } +}); + +class KeycloakAuthVerifyProvider + implements Provider +{ + constructor() {} + + value(): VerifyFunction.KeycloakAuthFn { + return async ( + accessToken: string, + refreshToken: string, + profile: Keycloak.Profile, + cd: (err?: string | Error, user?: IAuthUser) => void, + req?: Request, + ) => { + return userWithoutReqObj; + }; + } +} diff --git a/src/__tests__/integration/middleware-sequence/passport-local/local-passport.integration.ts b/src/__tests__/integration/middleware-sequence/passport-local/local-passport.integration.ts new file mode 100644 index 0000000..ebf5384 --- /dev/null +++ b/src/__tests__/integration/middleware-sequence/passport-local/local-passport.integration.ts @@ -0,0 +1,221 @@ +import {Client, createClientForHandler, expect} from '@loopback/testlab'; +import {RestServer} from '@loopback/rest'; +import {Application, inject} from '@loopback/core'; +import {post, requestBody} from '@loopback/openapi-v3'; +import {authenticate} from '../../../../decorators'; +import {STRATEGY} from '../../../../strategy-name.enum'; +import {getApp} from '../helpers/helpers'; +import {MyAuthenticationMiddlewareSequence} from '../../../fixtures/sequences/authentication-middleware.sequence'; +import {Strategies} from '../../../../strategies/keys'; +import {LocalVerifyProvider} from '../../../fixtures/providers/local-password.provider'; +import {AuthenticationBindings} from '../../../../keys'; +import {IAuthUser} from '../../../../types'; +import {Authuser} from '../../../../models'; +/** + * Testing overall flow of authentication with bearer strategy + */ +describe('Local passport strategy using Middleware Sequence', () => { + let app: Application; + let server: RestServer; + beforeEach(givenAServer); + beforeEach(givenAuthenticatedSequence); + beforeEach(getAuthVerifier); + + it('should return 400 bad request when no user data is passed', async () => { + class TestController { + @post('/auth/local/no-user-data-passed') + @authenticate(STRATEGY.LOCAL) + test(@requestBody({required: true}) body: Authuser) { + return 'test successful'; + } + } + + app.controller(TestController); + + await whenIMakeRequestTo(server) + .post('/auth/local/no-user-data-passed') + .expect(400); + }); + + it('should return 422 bad request when invalid user data is passed', async () => { + class TestController { + @post('/auth/local/no-user-data-passed') + @authenticate(STRATEGY.LOCAL) + test( + @requestBody() + body: Authuser, + ) { + return 'test successful'; + } + } + + app.controller(TestController); + + await whenIMakeRequestTo(server) + .post('/auth/local/no-user-data-passed') + .send({}) + .expect(422); + }); + + it('should return status 200 for no options', async () => { + class TestController { + constructor( + @inject(AuthenticationBindings.CURRENT_USER) // tslint:disable-next-line: no-shadowed-variable + private readonly user: IAuthUser | undefined, + ) {} + + @post('/auth/local/no-options') + @authenticate(STRATEGY.LOCAL) + test(@requestBody() body: {username: string; password: string}) { + return this.user; + } + } + + app.controller(TestController); + + const user = await whenIMakeRequestTo(server) + .post('/auth/local/no-options') + .send({username: 'user name', password: 'password'}) + .expect(200); + + expect(user.body).to.have.property('username'); + expect(user.body.username).to.equal('user name'); + + expect(user.body).to.have.property('password'); + expect(user.body.password).to.equal('password'); + }); + + it('should return the user credentials are sent via body and options are passed with passRequestCallback true', async () => { + class TestController { + constructor( + @inject(AuthenticationBindings.CURRENT_USER) // tslint:disable-next-line: no-shadowed-variable + private readonly user: IAuthUser | undefined, + ) {} + + @post('/auth/local/pass-req-callback-true') + @authenticate(STRATEGY.LOCAL, {passReqToCallback: true}) + async test(@requestBody() body: {username: string; password: string}) { + return this.user; + } + } + + app.controller(TestController); + + const user = await whenIMakeRequestTo(server) + .post('/auth/local/pass-req-callback-true') + .send({username: 'name', password: 'password'}) + .expect(200); + + expect(user.body).to.have.property('username'); + expect(user.body.username).to.equal('name'); + + expect(user.body).to.have.property('password'); + expect(user.body.password).to.equal('password'); + }); + + it('should return the user which was passed via body and options are passed with passRequestCallback false', async () => { + class TestController { + constructor( + @inject(AuthenticationBindings.CURRENT_USER) // tslint:disable-next-line: no-shadowed-variable + private readonly user: IAuthUser | undefined, + ) {} + + @post('/auth/local/pass-req-callback-false') + @authenticate(STRATEGY.LOCAL, {passReqToCallback: false}) + async test(@requestBody() body: {username: string; password: string}) { + return this.user; + } + } + + app.controller(TestController); + + await whenIMakeRequestTo(server) + .post('/auth/local/pass-req-callback-false') + .send({username: 'username', password: 'password'}) + .expect(200); + }); + + it('should return 401 when provider returns null', async () => { + class TestController { + constructor( + @inject(AuthenticationBindings.CURRENT_USER) // tslint:disable-next-line: no-shadowed-variable + private readonly user: IAuthUser | undefined, + ) {} + + @post('/auth/local/null-user') + @authenticate(STRATEGY.LOCAL) + async test(@requestBody() body: {username: string; password: string}) { + return body; + } + } + + app.controller(TestController); + + await whenIMakeRequestTo(server) + .post('/auth/local/null-user') + .send({username: '', password: 'password'}) + .expect(401); + }); + + function whenIMakeRequestTo(restServer: RestServer): Client { + return createClientForHandler(restServer.requestHandler); + } + + async function givenAServer() { + app = getApp(); + server = await app.getServer(RestServer); + } + + function getAuthVerifier() { + app + .bind(Strategies.Passport.LOCAL_PASSWORD_VERIFIER) + .toProvider(LocalVerifyProvider); + } + + function givenAuthenticatedSequence() { + // bind user defined sequence + server.sequence(MyAuthenticationMiddlewareSequence); + } +}); + +describe('Local strategy with no verifier using Middleware Sequence', () => { + let app: Application; + let server: RestServer; + beforeEach(givenAServer); + beforeEach(givenAuthenticatedSequence); + + it('should return 401 when option passRequestCallback is false', async () => { + class TestController { + options = { + passRequestToCallback: false, + }; + + @post('/auth/local/no-verifier') + @authenticate(STRATEGY.LOCAL, {passReqToCallback: false}) + async test(@requestBody() body: {username: string; password: string}) { + return body; + } + } + + app.controller(TestController); + + await whenIMakeRequestTo(server) + .post('/auth/local/no-verifier') + .send({username: 'username', password: 'password'}) + .expect(401); + }); + + function whenIMakeRequestTo(restServer: RestServer): Client { + return createClientForHandler(restServer.requestHandler); + } + + async function givenAServer() { + app = getApp(); + server = await app.getServer(RestServer); + } + + function givenAuthenticatedSequence() { + // bind user defined sequence + server.sequence(MyAuthenticationMiddlewareSequence); + } +}); diff --git a/src/__tests__/integration/middleware-sequence/passport-resource-owner-password/resource-owner-password.integration.ts b/src/__tests__/integration/middleware-sequence/passport-resource-owner-password/resource-owner-password.integration.ts new file mode 100644 index 0000000..4fb6acd --- /dev/null +++ b/src/__tests__/integration/middleware-sequence/passport-resource-owner-password/resource-owner-password.integration.ts @@ -0,0 +1,268 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import {Client, createClientForHandler, expect} from '@loopback/testlab'; +import {RestServer} from '@loopback/rest'; +import {Application, inject} from '@loopback/core'; +import {post, requestBody} from '@loopback/openapi-v3'; +import {authenticate} from '../../../../decorators'; +import {STRATEGY} from '../../../../strategy-name.enum'; +import {getApp} from '../helpers/helpers'; +import {MyAuthenticationMiddlewareSequence} from '../../../fixtures/sequences/authentication-middleware.sequence'; +import {Strategies} from '../../../../strategies/keys'; +import {ResourceOwnerVerifyProvider} from '../../../fixtures/providers/resource-owner.provider'; +import {AuthenticationBindings} from '../../../../keys'; +import {IAuthUser} from '../../../../types'; + +describe('Resource-owner-password strategy using Middleware Sequence', () => { + let app: Application; + let server: RestServer; + beforeEach(givenAServer); + beforeEach(givenAuthenticatedSequence); + beforeEach(getAuthVerifier); + + it('should return 422 bad request when no user data is sent', async () => { + class TestController { + @post('/auth/resource-owner-pass') + @authenticate(STRATEGY.OAUTH2_RESOURCE_OWNER_GRANT) + test(@requestBody() body: {username: string; password: string}) { + return 'test successful'; + } + } + + app.controller(TestController); + + await whenIMakeRequestTo(server) + .post('/auth/resource-owner-pass') + .send({}) + .expect(401); + }); + + it('should return status 200 for no options', async () => { + class TestController { + constructor( + @inject(AuthenticationBindings.CURRENT_USER) // tslint:disable-next-line: no-shadowed-variable + private readonly user: IAuthUser | undefined, + ) {} + + @post('/auth/resource-owner-pass/no-options') + @authenticate(STRATEGY.OAUTH2_RESOURCE_OWNER_GRANT) + test( + @requestBody() + body: { + username: string; + password: string; + client_id: string; + client_secret: string; + }, + ) { + return this.user; + } + } + + app.controller(TestController); + + const res = await whenIMakeRequestTo(server) + .post('/auth/resource-owner-pass/no-options') + .send({ + username: 'username', + password: 'password', + client_id: 'client id', + client_secret: 'client secret', + }) + .expect(200); + + expect(res.body).to.have.property('username'); + expect(res.body.username).to.equal('username'); + expect(res.body).to.have.property('password'); + expect(res.body.password).to.equal('password'); + }); + + it('should return the user credentials are sent via body and options are passed with passRequestCallback true', async () => { + class TestController { + constructor( + @inject(AuthenticationBindings.CURRENT_USER) // tslint:disable-next-line: no-shadowed-variable + private readonly user: IAuthUser | undefined, + ) {} + + @post('/auth/resource-owner/passReqToCallback') + @authenticate(STRATEGY.OAUTH2_RESOURCE_OWNER_GRANT, { + passReqToCallback: true, + }) + async test( + @requestBody() + body: { + username: string; + password: string; + client_id: string; + client_secret: string; + }, + ) { + return this.user; + } + } + + app.controller(TestController); + + const res = await whenIMakeRequestTo(server) + .post('/auth/resource-owner/passReqToCallback') + .send({ + username: 'user name', + password: 'password', + client_id: 'client id', + client_secret: 'client secret', + }) + .expect(200); + + expect(res.body).to.have.property('username'); + expect(res.body.username).to.equal('user name'); + expect(res.body).to.have.property('password'); + expect(res.body.password).to.equal('password'); + }); + + it('should return the user which was passed via body and options are passed with passRequestCallback false', async () => { + class TestController { + constructor( + @inject(AuthenticationBindings.CURRENT_USER) // tslint:disable-next-line: no-shadowed-variable + private readonly user: IAuthUser | undefined, + ) {} + + @post('/auth/resource-owner/passReqToCallback-false') + @authenticate(STRATEGY.OAUTH2_RESOURCE_OWNER_GRANT, { + passReqToCallback: false, + }) + async test( + @requestBody() + body: { + username: string; + password: string; + client_id: string; + client_secret: string; + }, + ) { + return this.user; + } + } + + app.controller(TestController); + + const res = await whenIMakeRequestTo(server) + .post('/auth/resource-owner/passReqToCallback-false') + .send({ + username: 'name', + password: 'password', + client_id: 'client id', + client_secret: 'client secret', + }) + .expect(200); + + expect(res.body).to.have.property('username'); + expect(res.body.username).to.equal('name'); + expect(res.body).to.have.property('password'); + expect(res.body.password).to.equal('password'); + }); + + it('should return the user passed via verifier when no options are passed', async () => { + class TestController { + @post('/test') + @authenticate(STRATEGY.OAUTH2_RESOURCE_OWNER_GRANT) + async test( + @requestBody() + body: { + username: string; + password: string; + client_id: string; + client_secret: string; + }, + ) { + return body; + } + } + + app.controller(TestController); + + await whenIMakeRequestTo(server) + .post('/test') + .send({ + username: '', + password: 'password', + client_id: '', + client_secret: 'client secret', + }) + .expect(401); + }); + + function whenIMakeRequestTo(restServer: RestServer): Client { + return createClientForHandler(restServer.requestHandler); + } + + async function givenAServer() { + app = getApp(); + server = await app.getServer(RestServer); + } + + function getAuthVerifier() { + app + .bind(Strategies.Passport.RESOURCE_OWNER_PASSWORD_VERIFIER) + .toProvider(ResourceOwnerVerifyProvider); + } + + function givenAuthenticatedSequence() { + // bind user defined sequence + server.sequence(MyAuthenticationMiddlewareSequence); + } +}); + +describe('Resource-owner strategy with no verifier using Middleware Sequence', () => { + let app: Application; + let server: RestServer; + beforeEach(givenAServer); + beforeEach(givenAuthenticatedSequence); + + it('should return the user passed via verifier and options are passed with passRequestCallback false', async () => { + class TestController { + options = { + passRequestToCallback: false, + }; + + @post('/test') + @authenticate(STRATEGY.OAUTH2_RESOURCE_OWNER_GRANT) + async test( + @requestBody() + body: { + username: string; + password: string; + client_id: string; + client_secret: string; + }, + ) { + return body; + } + } + + app.controller(TestController); + + await whenIMakeRequestTo(server) + .post('/test') + .send({ + username: 'username', + password: 'password', + client_id: 'client id', + client_secret: 'client secret', + }) + .expect(401); + }); + + function whenIMakeRequestTo(restServer: RestServer): Client { + return createClientForHandler(restServer.requestHandler); + } + + async function givenAServer() { + app = getApp(); + server = await app.getServer(RestServer); + } + + function givenAuthenticatedSequence() { + // bind user defined sequence + server.sequence(MyAuthenticationMiddlewareSequence); + } +}); diff --git a/src/component.ts b/src/component.ts index ce4d283..92c6f3e 100644 --- a/src/component.ts +++ b/src/component.ts @@ -1,6 +1,11 @@ -import {Component, ProviderMap} from '@loopback/core'; +import {Binding, Component, inject, ProviderMap} from '@loopback/core'; +import {createMiddlewareBinding} from '@loopback/express'; import {AuthenticationBindings} from './keys'; +import { + ClientAuthenticationMiddlewareProvider, + UserAuthenticationMiddlewareProvider, +} from './middlewares'; import { AuthenticateActionProvider, AuthMetadataProvider, @@ -34,9 +39,13 @@ import { OtpVerifyProvider, } from './strategies'; import {Strategies} from './strategies/keys'; +import {AuthenticationConfig} from './types'; export class AuthenticationComponent implements Component { - constructor() { + constructor( + @inject(AuthenticationBindings.CONFIG, {optional: true}) + private readonly config?: AuthenticationConfig, + ) { this.providers = { [AuthenticationBindings.USER_AUTH_ACTION.key]: AuthenticateActionProvider, [AuthenticationBindings.CLIENT_AUTH_ACTION.key]: @@ -90,7 +99,19 @@ export class AuthenticationComponent implements Component { [Strategies.Passport.AZURE_AD_VERIFIER.key]: AzureADAuthVerifyProvider, [Strategies.Passport.KEYCLOAK_VERIFIER.key]: KeycloakVerifyProvider, }; + this.bindings = []; + if (this.config?.useClientAuthenticationMiddleware) { + this.bindings.push( + createMiddlewareBinding(ClientAuthenticationMiddlewareProvider), + ); + } + if (this.config?.useUserAuthenticationMiddleware) { + this.bindings.push( + createMiddlewareBinding(UserAuthenticationMiddlewareProvider), + ); + } } providers?: ProviderMap; + bindings?: Binding[]; } diff --git a/src/keys.ts b/src/keys.ts index 6abd9c4..254d2c9 100644 --- a/src/keys.ts +++ b/src/keys.ts @@ -4,6 +4,7 @@ import {Strategy} from 'passport'; import { AuthenticateFn, + AuthenticationConfig, AuthenticationMetadata, IAuthClient, IAuthUser, @@ -46,6 +47,10 @@ export namespace AuthenticationBindings { export const CURRENT_CLIENT = BindingKey.create( 'sf.clientAuthentication.currentClient', ); + + export const CONFIG = BindingKey.create( + 'sf.userAuthentication.config', + ); } export const USER_AUTHENTICATION_METADATA_KEY = MetadataAccessor.create< diff --git a/src/middlewares/client-authentication.middleware.ts b/src/middlewares/client-authentication.middleware.ts new file mode 100644 index 0000000..fa74a31 --- /dev/null +++ b/src/middlewares/client-authentication.middleware.ts @@ -0,0 +1,70 @@ +import { + Getter, + inject, + injectable, + Next, + Provider, + Setter, +} from '@loopback/core'; +import { + asMiddleware, + Middleware, + MiddlewareContext, + RestMiddlewareGroups, + Request, +} from '@loopback/rest'; +import {Strategy} from 'passport'; +import {AuthenticationBindings} from '../keys'; +import {StrategyAdapter} from '../strategy-adapter'; +import {IAuthClient} from '../types'; +import {isObjectLike, isEmpty} from 'lodash'; +import {AuthenticationMiddlewareGroups} from './middleware-groups.enum'; + +@injectable( + asMiddleware({ + group: AuthenticationMiddlewareGroups.CLIENT, + upstreamGroups: RestMiddlewareGroups.PARSE_PARAMS, + downstreamGroups: [ + AuthenticationMiddlewareGroups.USER, + RestMiddlewareGroups.INVOKE_METHOD, + ], + }), +) +export class ClientAuthenticationMiddlewareProvider + implements Provider +{ + constructor( + @inject.getter(AuthenticationBindings.CLIENT_STRATEGY) + readonly getStrategy: Getter, + @inject.setter(AuthenticationBindings.CURRENT_CLIENT) + readonly setCurrentClient: Setter, + ) {} + + value() { + const middleware = async (ctx: MiddlewareContext, next: Next) => { + await this.action(ctx.request); + return next(); + }; + return middleware; + } + async action(request: Request): Promise { + const strategy = await this.getStrategy(); + if (!strategy) { + this.setCurrentClient(undefined); + return undefined; + } + if (!strategy.authenticate) { + throw new Error('invalid strategy parameter'); + } + const strategyAdapter = new StrategyAdapter(strategy); + // Added for cases, where data is passed not in body but in query parameter + if (!request.body || !isObjectLike(request.body) || isEmpty(request.body)) { + request.body = request.query; + } + const client = await strategyAdapter.authenticate(request); + if (client) { + this.setCurrentClient(client); + return client; + } + } +} diff --git a/src/middlewares/index.ts b/src/middlewares/index.ts new file mode 100644 index 0000000..f2ef7ca --- /dev/null +++ b/src/middlewares/index.ts @@ -0,0 +1,2 @@ +export * from './user-authentication.middleware'; +export * from './client-authentication.middleware'; diff --git a/src/middlewares/middleware-groups.enum.ts b/src/middlewares/middleware-groups.enum.ts new file mode 100644 index 0000000..ace4f24 --- /dev/null +++ b/src/middlewares/middleware-groups.enum.ts @@ -0,0 +1,4 @@ +export enum AuthenticationMiddlewareGroups { + CLIENT = 'authenticateClient', + USER = 'authenticateUser', +} diff --git a/src/middlewares/user-authentication.middleware.ts b/src/middlewares/user-authentication.middleware.ts new file mode 100644 index 0000000..65bad71 --- /dev/null +++ b/src/middlewares/user-authentication.middleware.ts @@ -0,0 +1,88 @@ +import { + Getter, + inject, + injectable, + Next, + Provider, + Setter, +} from '@loopback/core'; +import { + asMiddleware, + HttpErrors, + Middleware, + Response, + MiddlewareContext, + RestMiddlewareGroups, + Request, +} from '@loopback/rest'; +import {Strategy} from 'passport'; +import {AuthErrorKeys} from '../error-keys'; +import {AuthenticationBindings} from '../keys'; +import {StrategyAdapter} from '../strategy-adapter'; +import {AuthenticationMetadata, IAuthUser} from '../types'; +import {AuthenticationMiddlewareGroups} from './middleware-groups.enum'; + +@injectable( + asMiddleware({ + group: AuthenticationMiddlewareGroups.USER, + upstreamGroups: RestMiddlewareGroups.PARSE_PARAMS, + downstreamGroups: RestMiddlewareGroups.INVOKE_METHOD, + }), +) +export class UserAuthenticationMiddlewareProvider + implements Provider +{ + constructor( + @inject.getter(AuthenticationBindings.USER_STRATEGY) + readonly getStrategy: Getter, + @inject.getter(AuthenticationBindings.USER_METADATA) + private readonly getMetadata: Getter, + @inject.setter(AuthenticationBindings.CURRENT_USER) + readonly setCurrentUser: Setter, + ) {} + + value() { + const middleware = async (ctx: MiddlewareContext, next: Next) => { + await this.action(ctx.request, ctx.response); + return next(); + }; + return middleware; + } + + async action( + request: Request, + response?: Response, + ): Promise { + const strategy = await this.getStrategy(); + + if (!strategy) { + this.setCurrentUser(undefined); + return undefined; + } + if (!strategy.authenticate) { + throw new HttpErrors.Unauthorized(AuthErrorKeys.UnknownError); + } + + // Read decorator metadata to fetch options + // to be passed on to authenticate method of strategy + const metadata = await this.getMetadata(); + let authOpts; + if (metadata?.authOptions) { + // Fetch options using creator function added with decorator definition + authOpts = metadata.authOptions(request); + } + + const strategyAdapter = new StrategyAdapter(strategy); + + const user = await strategyAdapter.authenticate( + request, + response, + authOpts, + ); + + if (user) { + this.setCurrentUser(user); + return user; + } + } +} diff --git a/src/types.ts b/src/types.ts index 3063d32..9571625 100644 --- a/src/types.ts +++ b/src/types.ts @@ -41,3 +41,8 @@ export interface ClientAuthCode { userId?: ID; user?: T; } + +export interface AuthenticationConfig { + useClientAuthenticationMiddleware?: boolean; + useUserAuthenticationMiddleware?: boolean; +}