-
Notifications
You must be signed in to change notification settings - Fork 9
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
#345 | Admin session handling improved #355
#345 | Admin session handling improved #355
Conversation
token expiration increased to 5 hours
} | ||
|
||
val SESSION_REFRESHERS = setOf(HttpMethod.POST, HttpMethod.DELETE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All POST
and DELETE
should now refresh the session
import io.vertx.reactivex.ext.auth.jwt.JWTAuth | ||
import io.vertx.reactivex.ext.web.RoutingContext | ||
|
||
open class JwtCommon { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Common logic for handling JWT token
.then(response => response.json()); | ||
.then(response => { | ||
if (response.headers.get('token')) { | ||
setToken(response.headers.get('token')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any API response can potentially contain refreshed token
@@ -91,8 +91,7 @@ export const login = (credentials, loginAsGuest) => dispatch => { | |||
dispatch(pushNotification(NOTIFICATIONS.LOGIN(`Guest: ${guestName}`))); | |||
} else { | |||
return fetchData(URL.LOGIN, { method: 'POST', data: credentials }).then( | |||
({ token }) => { | |||
setToken(token); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to fetchData
@@ -66,7 +66,7 @@ Cypress.Commands.add( | |||
username: username, | |||
password: password | |||
}).then(response => { | |||
const loginBody = response.body.token.split(' '); | |||
const loginBody = response.headers['token'].split(' '); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the token is now returned as a header - as it should be from the begining
token expiration increased to 5 hours
Description
Motivation and Context
It was quite easy to lost changes made to boards due to session expiration.
Types of changes
Checklist:
I hereby agree to the terms of the Cogboard Contributor License Agreement.