Skip to content

Commit

Permalink
Change to single strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
migingreen committed May 22, 2023
1 parent 5ae3415 commit 8f8b7ef
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 46 deletions.
4 changes: 1 addition & 3 deletions plugins/core/base/routes/admin/migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ module.exports = {
path: "/admin/migration/{tool}/{id?}",
method: "GET",
config: {
auth: {
strategies: ["q-auth-azure", "q-auth-ld"],
},
auth: "q-auth-azure-then-ld",
cors: {
credentials: true,
},
Expand Down
8 changes: 3 additions & 5 deletions plugins/core/base/routes/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = {
method: "GET",
options: {
auth: {
strategies: ["q-auth-azure", "q-auth-ld"],
strategy: "q-auth-azure-then-ld",
mode: "optional",
},
cors: {
Expand Down Expand Up @@ -82,7 +82,7 @@ module.exports = {
},
},
auth: {
strategies: ["q-auth-azure", "q-auth-ld"],
strategy: "q-auth-azure-then-ld",
},
cors: {
credentials: true,
Expand Down Expand Up @@ -150,9 +150,7 @@ module.exports = {
allowUnknown: true,
},
},
auth: {
strategies: ["q-auth-azure", "q-auth-ld"],
},
auth: "q-auth-azure-then-ld",
cors: {
credentials: true,
},
Expand Down
2 changes: 1 addition & 1 deletion plugins/core/base/routes/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
method: "GET",
options: {
auth: {
strategies: ["q-auth-azure", "q-auth-ld"],
strategy: "q-auth-azure-then-ld",
mode: "try",
},
cors: {
Expand Down
2 changes: 1 addition & 1 deletion plugins/core/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = {
method: "GET",
options: {
auth: {
strategies: ["q-auth-azure", "q-auth-ld"],
strategy: "q-auth-azure-then-ld",
mode: "try",
},
description: "Returns configuration for Q Editor",
Expand Down
4 changes: 1 addition & 3 deletions plugins/core/editor/routes/tools-ordered-by-user-usage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ module.exports = {
path: "/editor/tools-ordered-by-user-usage",
method: "GET",
options: {
auth: {
strategies: ["q-auth-azure", "q-auth-ld"],
},
auth: "q-auth-azure-then-ld",
cors: {
credentials: true,
},
Expand Down
2 changes: 1 addition & 1 deletion plugins/core/editor/routes/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
method: "GET",
options: {
auth: {
strategies: ["q-auth-azure", "q-auth-ld"],
strategy: "q-auth-azure-then-ld",
mode: "try",
},
description: "Returns all available Q tool names",
Expand Down
4 changes: 1 addition & 3 deletions plugins/file/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ module.exports = {
method: "POST",
path: "/file",
options: {
auth: {
strategies: ["q-auth-azure", "q-auth-ld"],
},
auth: "q-auth-azure-then-ld",
cors: {
credentials: true,
additionalHeaders: [
Expand Down
6 changes: 3 additions & 3 deletions plugins/fixtures/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
path: "/fixtures/data",
method: "POST",
options: {
auth: "q-auth-azure",
auth: "q-auth-azure-then-ld",
cors: {
credentials: true,
},
Expand All @@ -28,7 +28,7 @@ module.exports = {
method: "PUT",
payload: item,
auth: {
strategy: "q-auth-azure",
strategy: "q-auth-azure-then-ld",
credentials: request.auth.credentials,
},
});
Expand All @@ -48,7 +48,7 @@ module.exports = {
method: "POST",
payload: item,
auth: {
strategy: "q-auth-azure",
strategy: "q-auth-azure-then-ld",
credentials: request.auth.credentials,
},
});
Expand Down
2 changes: 1 addition & 1 deletion plugins/statistics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
method: "GET",
config: {
auth: {
strategies: ["q-auth-azure", "q-auth-ld"],
strategy: "q-auth-azure-then-ld",
mode: "optional",
},
cors: {
Expand Down
4 changes: 1 addition & 3 deletions plugins/tasks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ module.exports = {
options: {
description: "Returns configuration for tasks",
tags: ["api", "tasks"],
auth: {
strategies: ["q-auth-azure", "q-auth-ld"],
},
auth: "q-auth-azure-then-ld",
cors: {
credentials: true,
},
Expand Down
8 changes: 2 additions & 6 deletions test/config/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ const tasks = {
path: "/tasks/test",
method: "POST",
options: {
auth: {
strategies: ["q-auth-azure", "q-auth-ld"],
},
auth: "q-auth-azure-then-ld",
cors: {
credentials: true,
},
Expand Down Expand Up @@ -44,9 +42,7 @@ const tasks = {
path: "/tasks/admintest",
method: "POST",
options: {
auth: {
strategies: ["q-auth-azure", "q-auth-ld"],
},
auth: "q-auth-azure-then-ld",
cors: {
credentials: true,
},
Expand Down
28 changes: 14 additions & 14 deletions test/e2e-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ lab.experiment("core item", () => {
const request = {
method: "POST",
auth: {
strategy: "q-auth-azure",
strategy: "q-auth-azure-then-ld",
credentials: { username: "user", password: "pass" },
},
url: "/item",
Expand All @@ -103,7 +103,7 @@ lab.experiment("core item", () => {
const request = {
method: "PUT",
auth: {
strategy: "q-auth-azure",
strategy: "q-auth-azure-then-ld",
credentials: { username: "user", password: "pass" },
},
url: "/item",
Expand All @@ -119,7 +119,7 @@ lab.experiment("core item", () => {
const request = {
method: "PUT",
auth: {
strategy: "q-auth-azure",
strategy: "q-auth-azure-then-ld",
credentials: { username: "user", password: "pass" },
},
url: "/item",
Expand All @@ -142,7 +142,7 @@ lab.experiment("core item", () => {
const request = {
method: "POST",
auth: {
strategy: "q-auth-azure",
strategy: "q-auth-azure-then-ld",
credentials: { username: "user", password: "pass" },
},
url: "/item",
Expand All @@ -168,7 +168,7 @@ lab.experiment("core item", () => {
const request = {
method: "PUT",
auth: {
strategy: "q-auth-azure",
strategy: "q-auth-azure-then-ld",
credentials: { username: "user", password: "pass" },
},
url: "/item",
Expand Down Expand Up @@ -199,7 +199,7 @@ lab.experiment("core item", () => {
const request = {
method: "POST",
auth: {
strategy: "q-auth-azure",
strategy: "q-auth-azure-then-ld",
credentials: { username: "user", password: "pass" },
},
url: "/item",
Expand Down Expand Up @@ -230,7 +230,7 @@ lab.experiment("core item", () => {
const request = {
method: "PUT",
auth: {
strategy: "q-auth-azure",
strategy: "q-auth-azure-then-ld",
credentials: { username: "user", password: "pass" },
},
url: "/item",
Expand Down Expand Up @@ -262,7 +262,7 @@ lab.experiment("core item", () => {
const request = {
method: "PUT",
auth: {
strategy: "q-auth-azure",
strategy: "q-auth-azure-then-ld",
credentials: { username: "user", password: "pass" },
},
url: "/item",
Expand Down Expand Up @@ -294,7 +294,7 @@ lab.experiment("core item", () => {
const request = {
method: "PUT",
auth: {
strategy: "q-auth-azure",
strategy: "q-auth-azure-then-ld",
credentials: { username: "user", password: "pass" },
},
url: "/item",
Expand Down Expand Up @@ -326,7 +326,7 @@ lab.experiment("core item", () => {
const request = {
method: "PUT",
auth: {
strategy: "q-auth-azure",
strategy: "q-auth-azure-then-ld",
credentials: { username: "user", password: "pass" },
},
url: "/item",
Expand Down Expand Up @@ -801,7 +801,7 @@ lab.experiment("fixture data plugin", () => {
method: "POST",
url: "/fixtures/data",
auth: {
strategy: "q-auth-azure",
strategy: "q-auth-azure-then-ld",
credentials: { username: "user", password: "pass" },
},
});
Expand Down Expand Up @@ -868,7 +868,7 @@ lab.experiment("tasks plugin", () => {
method: "GET",
url: "/tasks",
auth: {
strategy: "q-auth-azure",
strategy: "q-auth-azure-then-ld",
credentials: { username: "user", password: "pass" },
},
});
Expand All @@ -880,7 +880,7 @@ lab.experiment("tasks plugin", () => {
method: "GET",
url: "/tasks",
auth: {
strategy: "q-auth-azure",
strategy: "q-auth-azure-then-ld",
credentials: { username: "user", password: "pass", roles: ["admin"] },
},
});
Expand All @@ -897,7 +897,7 @@ lab.experiment("tasks plugin", () => {
method: "POST",
url: "/tasks/test",
auth: {
strategy: "q-auth-azure",
strategy: "q-auth-azure-then-ld",
credentials: { username: "user", password: "pass" },
},
payload: payload,
Expand Down
3 changes: 1 addition & 2 deletions test/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ function getServer() {
},
};
});
server.auth.strategy("q-auth-azure", "mock");
server.auth.strategy("q-auth-ld", "mock");
server.auth.strategy("q-auth-azure-then-ld", "mock");
return server;
}

Expand Down

0 comments on commit 8f8b7ef

Please sign in to comment.