Skip to content

Commit

Permalink
feat: better-session-management
Browse files Browse the repository at this point in the history
ARA-204
  • Loading branch information
regislegrand committed Dec 8, 2021
1 parent 37ee108 commit f3d6d28
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 31 deletions.
2 changes: 1 addition & 1 deletion charts/candidate/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: ara-candidate
version: 11.0.0-rc.1
version: 11.0.0-rc.2
home: https://github.com/Decathlon/ara
description: |
ARA helps you to fight against regressions by letting it preanalyze your non-regression tests runs,
Expand Down
4 changes: 2 additions & 2 deletions charts/candidate/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ api:
image:
registry: docker.io
repository: decathlon/ara-api
tag: 12.0.0
tag: 12.1.0
imagePullPolicy: IfNotPresent
loggingMode:
- logging-console
Expand Down Expand Up @@ -47,7 +47,7 @@ ui:
image:
registry: docker.io
repository: decathlon/ara-web-ui
tag: 9.3.2
tag: 9.4.0
imagePullPolicy: IfNotPresent
replicas: 1
annotations: {}
Expand Down
2 changes: 1 addition & 1 deletion code/api/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<groupId>com.decathlon.ara</groupId>
<artifactId>ara-api</artifactId>
<version>12.0.0</version>
<version>12.1.0</version>

<name>ARA API</name>
<description>
Expand Down
9 changes: 9 additions & 0 deletions code/api/api/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ info:
version: version
api:
version: @project.version@

# Srping custom conf
spring:
profiles:
include: @profiles.from.maven@,${ara.oauth2.mode},${ara.logging.mode}
Expand Down Expand Up @@ -99,6 +101,13 @@ ara:

server:
port: 8000
# Session management
servlet:
session:
timeout: 14400s
cookie:
max-age: 43200

management:
server:
port: 8001
Expand Down
2 changes: 1 addition & 1 deletion code/api/database/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<groupId>com.decathlon.ara</groupId>
<artifactId>ara-database</artifactId>
<version>12.0.0</version>
<version>12.1.0</version>

<name>ARA Database</name>
<description>
Expand Down
2 changes: 1 addition & 1 deletion code/api/generated-cucumber-report/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<groupId>com.decathlon.ara</groupId>
<artifactId>ara-generated-cucumber-report</artifactId>
<version>12.0.0</version>
<version>12.1.0</version>

<name>ARA Cucumber</name>
<description>
Expand Down
4 changes: 2 additions & 2 deletions code/api/jacoco-aggregation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<parent>
<artifactId>ara-parent</artifactId>
<groupId>com.decathlon.ara</groupId>
<version>12.0.0</version>
<version>12.1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>com.decathlon.ara</groupId>
<artifactId>jacoco-aggregation</artifactId>
<packaging>pom</packaging>
<version>12.0.0</version>
<version>12.1.0</version>

<name>Jacoco Report Aggregation</name>

Expand Down
2 changes: 1 addition & 1 deletion code/api/lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<groupId>com.decathlon.ara</groupId>
<artifactId>ara-lib</artifactId>
<version>12.0.0</version>
<version>12.1.0</version>

<properties>
<java.version>16</java.version>
Expand Down
2 changes: 1 addition & 1 deletion code/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<groupId>com.decathlon.ara</groupId>
<artifactId>ara-parent</artifactId>
<packaging>pom</packaging>
<version>12.0.0</version>
<version>12.1.0</version>

<name>ARA Parent</name>
<description>
Expand Down
2 changes: 2 additions & 0 deletions code/web-ui/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-throw-expressions",
"@babel/plugin-proposal-class-properties",
],
"env": {
"test": {
Expand All @@ -25,6 +26,7 @@
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-throw-expressions",
"@babel/plugin-proposal-class-properties",
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion code/web-ui/package-lock.json

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

2 changes: 1 addition & 1 deletion code/web-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ara-client",
"version": "9.3.2",
"version": "9.4.0",
"description": "Agile Regression Analyzer front app",
"author": "Decathlon <developers@decathlon.com>",
"private": true,
Expand Down
2 changes: 2 additions & 0 deletions code/web-ui/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ router.afterEach(() => {
window.scrollTo(0, 0)
})

AuthenticationService.setLoggedOutInterceptor(router)

util.cleanFromPreviousVersion()

Vue.prototype.$sanitizeUrl = sanitizeUrl
Expand Down
51 changes: 32 additions & 19 deletions code/web-ui/src/service/authentication.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,22 @@ const conf = config

let isLogged = false

const AuthenticationService = {
class AuthenticationServiceClass {
setLogged = (logged) => {
isLogged = logged
}

setLoggedOutInterceptor = (router) => {
Vue.http.interceptors.push((request, next) => {
next((response) => {
if (response.url !== api.paths.loggedStatus && response.status === 401) {
router.push({ name: 'login' })
}
})
})
}

async isAlreadyLoggedIn () {
isAlreadyLoggedIn = async () => {
return new Promise((resolve) => {
if (isLogged) {
resolve(true)
Expand All @@ -23,9 +36,9 @@ const AuthenticationService = {
})
}
})
},
}

updateAuthenticationStatus () {
updateAuthenticationStatus = () => {
return Vue.http.get(api.paths.loggedStatus)
.then(answer => answer.body)
.then(body => {
Expand All @@ -41,9 +54,9 @@ const AuthenticationService = {
}).catch((e) => {
isLogged = false
})
},
}

async getOauthProviders () {
getOauthProviders = async () => {
return Vue.http.get(api.paths.authenticationConfiguration(), api.REQUEST_OPTIONS)
.then(response => response.body)
.then(content => {
Expand All @@ -63,9 +76,9 @@ const AuthenticationService = {
console.debug(res)
return res
})
},
}

async manageLoginRedirection (to, from, next) {
manageLoginRedirection = async (to, from, next) => {
// RememberUrlService.redirectToLastWantedUrlWhenLoggin(from, to, next)
RememberUrlService.keepLastUrl(to)

Expand Down Expand Up @@ -126,34 +139,34 @@ const AuthenticationService = {
})
return next('/')
}
},
}

logout () {
logout = () => {
this.clearDetails()
// window.location.href = config.authentication.logoutProcessingUrl
console.debug(`conf imported ? ${conf !== undefined}`)
window.location.href = conf.authentication.logoutProcessingUrl
},
}

getDetails () {
getDetails = () => {
return {
user: JSON.parse(localStorage.getItem(USER_DETAILS)),
providerName: JSON.parse(localStorage.getItem(PROVIDER_NAME))
}
},
}

saveUserDetails (authenticationDetails) {
saveUserDetails = (authenticationDetails) => {
localStorage.setItem(USER_DETAILS, JSON.stringify(authenticationDetails))
},
}

saveProviderName (providerName) {
saveProviderName = (providerName) => {
localStorage.setItem(PROVIDER_NAME, JSON.stringify(providerName))
},
}

clearDetails () {
clearDetails = () => {
localStorage.removeItem(USER_DETAILS)
}

}

const AuthenticationService = new AuthenticationServiceClass()
export { AuthenticationService }

0 comments on commit f3d6d28

Please sign in to comment.