Skip to content

Commit

Permalink
fixed merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
dPreininger committed Nov 10, 2023
2 parents fa49e04 + 78f55ca commit c136884
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/pages/prometheus/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Once the plugin is installed, you have to add it to your project configuration.
uriPath: "/monitoring",
authentication: true,
onAuthenticate: (req, username, password) => {
return username === process.env.PROM_USER_NAME && password = process.env.PROM_USER_PASS
return username === process.env.PROM_USER_NAME && password === process.env.PROM_USER_PASS
},
},
},
Expand Down
17 changes: 17 additions & 0 deletions packages/medusa-plugin-auth/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [1.8.0](https://github.com/adrien2p/medusa-plugins/compare/medusa-plugin-auth@1.4.5...medusa-plugin-auth@1.8.0) (2023-11-09)


### Bug Fixes

* failure redirect not working properly ([#103](https://github.com/adrien2p/medusa-plugins/issues/103)) ([5a10308](https://github.com/adrien2p/medusa-plugins/commit/5a103084b5d53a07913c70958a3fad892af08700))
* Force medusa deps version to be in range ([7cd666e](https://github.com/adrien2p/medusa-plugins/commit/7cd666e3ff343ebaff17c9a89a5f69accbd2409f))


### Features

* add support for strict options ([#84](https://github.com/adrien2p/medusa-plugins/issues/84)) ([3e18cb3](https://github.com/adrien2p/medusa-plugins/commit/3e18cb3734ebc875b4459a18531b76b1b621adee))





# [1.5.0](https://github.com/adrien2p/medusa-plugins/compare/medusa-plugin-auth@1.4.5...medusa-plugin-auth@1.5.0) (2023-06-26)


Expand Down
4 changes: 2 additions & 2 deletions packages/medusa-plugin-auth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "medusa-plugin-auth",
"version": "1.5.1",
"version": "1.8.0",
"description": "Social authentication plugin for medusajs",
"keywords": [
"social",
Expand Down Expand Up @@ -46,7 +46,7 @@
"test:ci": "yarn add -D @medusajs/medusa@${MEDUSAJS_VERSION} && yarn run test"
},
"peerDependencies": {
"@medusajs/medusa": "^1.9.0",
"@medusajs/medusa": "<=1.16.x",
"passport": "^0.6.0",
"typeorm": "*"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/medusa-plugin-auth/src/core/passport/Strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function PassportStrategy<T extends Type<any> = any>(
const validateResult = await this.validate(...params);
done(null, validateResult);
} catch (err) {
done(err, null);
done(null, null, { msg: err.message });
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,28 @@ export function passportAuthRoutesBuilder({

next();
},
passport.authenticate(strategyName, {
...passportCallbackAuthenticateMiddlewareOptions,
session: false,
}),
callbackHandler
function (req, res, next) {
passport.authenticate(
strategyName,
Object.assign({}, passportCallbackAuthenticateMiddlewareOptions, {
session: false,
failureRedirect: false,
}),
(err, user, options) => {
if (options?.msg) {
if (passportCallbackAuthenticateMiddlewareOptions?.failureRedirect) {
return res.redirect(
passportCallbackAuthenticateMiddlewareOptions.failureRedirect + '?message=' + options.msg
);
} else {
return res.status(401).json({ message: options.msg });
}
}
req.user ??= user;
return callbackHandler(req, res);
}
)(req, res, next);
}
);

return router;
Expand Down
26 changes: 22 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3261,6 +3261,11 @@
resolved "https://registry.yarnpkg.com/@medusajs/types/-/types-1.11.2.tgz#a12de0b8df4b0c0e822e0935ee2dcf45347d67da"
integrity sha512-4+k32og+dFd5Qe5dK9Wug1kX/IZefSWX0zZgOYxSFt4WAKQJ8D1vbUr8CslHB+EH9ZDBEgZurf0iPrTNjHdZ/g==

"@medusajs/types@^1.11.4":
version "1.11.5"
resolved "https://registry.yarnpkg.com/@medusajs/types/-/types-1.11.5.tgz#83a697a8ced531ec2aecdd5d90b556fcb5833aa4"
integrity sha512-hoZ7FEFZqMiUItmMT2FmvG2tp1iygMqriepyIGMjoAWKJsNl3pfJDYgi4vvaVJjLuY5GCsiuXrvfAA/ngnw+dQ==

"@medusajs/utils@1.8.2":
version "1.8.2"
resolved "https://registry.yarnpkg.com/@medusajs/utils/-/utils-1.8.2.tgz#e398c5c7e99a7802a5340db4cb38ce513c46dae4"
Expand All @@ -3272,7 +3277,20 @@
typeorm "^0.3.14"
ulid "^2.3.0"

"@medusajs/utils@^1.10.0", "@medusajs/utils@^1.10.1", "@medusajs/utils@^1.10.2":
"@medusajs/utils@^1.10.0", "@medusajs/utils@^1.10.1":
version "1.10.4"
resolved "https://registry.yarnpkg.com/@medusajs/utils/-/utils-1.10.4.tgz#31a85b086aabcf0a6a19dfe7643f90415f788bc1"
integrity sha512-qNZQnd28mQ3xh48qXq3xtokZSKsOI2D3YK7Z3GDib3NwHKyDP0YBEY1+5VZAlj3Nte+92bLHrvSTBD0wAawghQ==
dependencies:
"@medusajs/types" "^1.11.4"
"@mikro-orm/core" "5.7.12"
"@mikro-orm/migrations" "5.7.12"
"@mikro-orm/postgresql" "5.7.12"
awilix "^8.0.1"
knex "2.4.2"
ulid "^2.3.0"

"@medusajs/utils@^1.10.2":
version "1.10.2"
resolved "https://registry.yarnpkg.com/@medusajs/utils/-/utils-1.10.2.tgz#86b52ca7a9be4450dc5365c5bc6871d03313190d"
integrity sha512-2n9xiKL285FJEhd/YqC+GHxNjPbRqofKlgdCCAm8bdDQV+r57cZecrQo991WXw3fH1zcczoQrASyLBX0jv+X1A==
Expand Down Expand Up @@ -4443,9 +4461,9 @@
picomatch "^2.3.1"

"@rushstack/ts-command-line@^4.12.2":
version "4.16.1"
resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.16.1.tgz#3537bbc323f77c8646646465c579b992d39feb16"
integrity sha512-+OCsD553GYVLEmz12yiFjMOzuPeCiZ3f8wTiFHL30ZVXexTyPmgjwXEhg2K2P0a2lVf+8YBy7WtPoflB2Fp8/A==
version "4.17.1"
resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.17.1.tgz#c78db928ce5b93f2e98fd9e14c24f3f3876e57f1"
integrity sha512-2jweO1O57BYP5qdBGl6apJLB+aRIn5ccIRTPDyULh0KMwVzFqWtw6IZWt1qtUoZD/pD2RNkIOosH6Cq45rIYeg==
dependencies:
"@types/argparse" "1.0.38"
argparse "~1.0.9"
Expand Down

0 comments on commit c136884

Please sign in to comment.