Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sso init #28

Merged
merged 36 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
541134a
sso init
sadnub Sep 16, 2024
0eb8166
move sso auth to auth store
sadnub Sep 16, 2024
75a9ef8
implement session auth login logic and cleanup views
sadnub Sep 18, 2024
09e39ef
rollback axios not redirecting on 401 errors for certain urls
sadnub Sep 18, 2024
c31ed66
added user session tracking, social accoutn tracking, and implemente…
sadnub Sep 28, 2024
65096e6
implement role assignment on sso user signups and log ip for sso logins
sadnub Oct 8, 2024
d0cf72b
fix 403 on sso provider signup and other tweaks to UI. Setting to dis…
sadnub Oct 18, 2024
0e59f58
auto redirect to sso login on sso signup
sadnub Oct 19, 2024
856a3b8
allow dispay full name in UI if present
sadnub Oct 21, 2024
0ce8da4
add sso user column in user table and fix disconnecting sso accounts
sadnub Oct 22, 2024
8aab840
change secret field to password and allow toggling visibility
sadnub Oct 22, 2024
3ce67b0
remove debug
wh1te909 Oct 25, 2024
79d0206
style sso login
wh1te909 Oct 25, 2024
c1cd611
add disable and hint to sso form
wh1te909 Oct 25, 2024
fada3c2
also add column for copying callback url
wh1te909 Oct 25, 2024
16b9bf1
fix run on server missing for posix
wh1te909 Oct 28, 2024
54207d1
disable certain UI elements if block_local_user_local is enabled
sadnub Oct 29, 2024
02eeea5
rename type to avoid naming conflict with component
wh1te909 Oct 31, 2024
4270fd0
fix logic
wh1te909 Oct 31, 2024
583f57f
add sso
wh1te909 Nov 1, 2024
6f6d98f
set provider icon from api
wh1te909 Nov 1, 2024
237b097
return error from backend instead if local login disabled rather than…
wh1te909 Nov 1, 2024
ec5ef65
don't allow SSO reset from UI
wh1te909 Nov 1, 2024
2690e9d
add descriptive wording
wh1te909 Nov 4, 2024
face099
urls now sent by backend and add javascript origin url
wh1te909 Nov 4, 2024
795ba12
handle 423
wh1te909 Nov 4, 2024
acaced7
clear the provider id on logout
wh1te909 Nov 5, 2024
2583e9a
make user admin modal wider
wh1te909 Nov 6, 2024
bb828b5
add client/site columns to alerts table
wh1te909 Nov 7, 2024
26ed91c
update reqs
wh1te909 Nov 7, 2024
85f408a
increase chunksize limit
wh1te909 Nov 8, 2024
64edab9
fix lint
wh1te909 Nov 8, 2024
e51efaa
typo
wh1te909 Nov 15, 2024
9f143a7
restore missing livepoll function that got missed during rework
wh1te909 Nov 15, 2024
4d8abba
make the modal persistent
wh1te909 Nov 19, 2024
09ecc36
wording
wh1te909 Nov 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
"format": "prettier --write \"**/*.{js,ts,vue,,html,md,json}\" --ignore-path .gitignore"
},
"dependencies": {
"@quasar/extras": "1.16.12",
"@vueuse/core": "11.1.0",
"@vueuse/integrations": "11.1.0",
"@vueuse/shared": "11.1.0",
"@quasar/extras": "1.16.13",
"@vueuse/core": "11.2.0",
"@vueuse/integrations": "11.2.0",
"@vueuse/shared": "11.2.0",
"apexcharts": "3.54.1",
"axios": "1.7.7",
"dotenv": "16.4.5",
"monaco-editor": "0.50.0",
"pinia": "2.2.4",
"pinia": "2.2.6",
"qrcode": "1.5.4",
"quasar": "2.17.1",
"quasar": "2.17.2",
"vue": "3.5.12",
"vue-router": "4.4.5",
"vue3-apexcharts": "1.7.0",
Expand Down
18 changes: 16 additions & 2 deletions quasar.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// Configuration for your app
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js

const { mergeConfig } = require("vite");
const { configure } = require("quasar/wrappers");
const path = require("path");
require("dotenv").config();
Expand Down Expand Up @@ -78,9 +79,22 @@ module.exports = configure(function (/* ctx */) {
// polyfillModulePreload: true,
distDir: "dist/",

// extendViteConf (viteConf) {},
/* eslint-disable quotes */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
extendViteConf(viteConf, { isServer, isClient }) {
viteConf.build = mergeConfig(viteConf.build, {
chunkSizeWarningLimit: 1600,
rollupOptions: {
output: {
entryFileNames: `[hash].js`,
chunkFileNames: `[hash].js`,
assetFileNames: `[hash].[ext]`,
},
},
});
},
/* eslint-enable quotes */
// viteVuePluginOptions: {},

// vitePlugins: []
},

Expand Down
28 changes: 28 additions & 0 deletions src/api/accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,34 @@ export async function resetTwoFactor() {
}
}

// sessions api
export async function fetchUserSessions(id) {
try {
const { data } = await axios.get(`${baseUrl}/users/${id}/sessions/`);
return data;
} catch (e) {
console.error(e);
}
}

export async function deleteAllUserSessions(id) {
try {
const { data } = await axios.delete(`${baseUrl}/users/${id}/sessions/`);
return data;
} catch (e) {
console.error(e);
}
}

export async function deleteUserSession(id) {
try {
const { data } = await axios.delete(`${baseUrl}/sessions/${id}/`);
return data;
} catch (e) {
console.error(e);
}
}

// role api function
export async function fetchRoles(params = {}) {
try {
Expand Down
7 changes: 7 additions & 0 deletions src/api/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ import type {
TestRunURLActionResponse,
} from "@/types/core/urlactions";

import type { CoreSetting } from "@/types/core/settings";

const baseUrl = "/core";

export async function fetchCoreSettings(params = {}): Promise<CoreSetting> {
const { data } = await axios.get("/core/settings/", { params: params });
return data;
}

export async function fetchDashboardInfo(params = {}) {
const { data } = await axios.get(`${baseUrl}/dashinfo/`, { params: params });
return data;
Expand Down
15 changes: 12 additions & 3 deletions src/boot/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function setErrorMessage(data, message) {

export default function ({ app, router }) {
app.config.globalProperties.$axios = axios;
axios.defaults.withCredentials = true;

axios.interceptors.request.use(
function (config) {
Expand Down Expand Up @@ -65,12 +66,20 @@ export default function ({ app, router }) {
// perms
else if (error.response.status === 403) {
// don't notify user if method is GET
if (error.config.method === "get" || error.config.method === "patch")
if (
error.config.method === "get" ||
error.config.method === "patch" ||
error.config.url === "accounts/ssoproviders/token/"
)
return Promise.reject({ ...error });
text = error.response.data.detail;
}
// catch all for other 400 error messages
else if (error.response.status >= 400 && error.response.status < 500) {
else if (
error.response.status >= 400 &&
error.response.status < 500 &&
error.response.status !== 423
) {
if (error.config.responseType === "blob") {
text = (await error.response.data.text()).replace(/^"|"$/g, "");
} else if (error.response.data.non_field_errors) {
Expand All @@ -85,7 +94,7 @@ export default function ({ app, router }) {
}
}

if (text || error.response) {
if ((text || error.response) && error.response.status !== 423) {
Notify.create({
color: "negative",
message: text ? text : "",
Expand Down
Loading