Implement cookie-based JWT authentication

- Introduced `CookieJWTAuthentication` for authentication via HttpOnly cookies, enabling browser-initiated requests without `Authorization` headers.
- Added authentication views (`CookieTokenObtainPairView`, `CookieTokenRefreshView`, `CookieTokenBlacklistView`) to replace default SimpleJWT views.
- Updated Vuex store and frontend logic to handle sessions using HttpOnly cookies instead of localStorage.
- Enhanced backend and frontend configurations (Django settings, router, Vuex, and API service) to fully support cookie-based authentication.
- Updated authentication tests to ensure correct cookie handling and authentication flows.
This commit is contained in:
ajurna committed 2026-10-13 13:38:48 +01:00
1 parent a7e9bd0743
commit 79c0647cc4
11 files changed
+369 -170

No files matched your search

+7 -2
View File
@@ -21,9 +21,14 @@ library.add(faBook, faBookOpen, faEdit, faTurnUp, faTimes, faCheck)
import router from './router'
import store from './store'
Vue.createApp(App)
const app = Vue.createApp(App)
.use(ToastPlugin)
.use(store)
.use(router)
.component('font-awesome-icon', FontAwesomeIcon)
.mount('#app')
// Validate the cookie before the first navigation, so the router guards see the
// real session instead of whatever is left in localStorage.
store.dispatch('restoreSession').finally(() => {
app.mount('#app')
})