Hi Guys,

There are issues with the changes made to palantir in CAS 8.0.0, it keeps 
session timing out.

In palantir-dashboard.js you have

```js
async function initializePalantirSession() {
    setInterval(async () => {
        const url = new URL(location.href);
        const result = await fetch(`${url.pathname}/session`, { 
credentials: "include" });
        if (result.status !== 200) {
            Swal.close();
            Swal.fire({
                title: "Session Expired",
                text: "Your Palantir session has expired. The dashboard 
will reload shortly.",
                icon: "info",
                timer: 3000,
                timerProgressBar: true,
                showConfirmButton: false
            }).then((result) => {
                if (result.dismiss === Swal.DismissReason.timer) {
                    activateDashboardTab(Tabs.LOGOUT.index);
                }
            });

        }
    }, 15000);
}
```

But in the DashboardController.java you have
```java
    @GetMapping("/dashboard/session")
    @Operation(summary = "Get active session", description = "Gets active 
authenticated session")
    public ResponseEntity fetchSession(final HttpServletRequest request) {
        val auth = SecurityContextHolder.getContext().getAuthentication();
        val authenticated = auth != null && auth.isAuthenticated() && 
!(auth instanceof AnonymousAuthenticationToken);
        val session = request.getSession(false);

        if (!authenticated || session == null) {
            return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();
        }
        return ResponseEntity.ok(Map.of(
            "name", auth.getName(),
            "id", session.getId()
        ));
    }
```

The  mapping above has path = {StringUtils.EMPTY, "/dashboard", "/"}

should this mapping be path = {"/dashboard/session", "/session"}

otherwise the the js will need to be change from
```js
const result = await fetch(`${url.pathname}/session`, { credentials: 
"include" });
```
to
```js
const result = await fetch(`${url.pathname}/dashboard/session`, { 
credentials: "include" });
```

Regards,
Colin

-- 
- Website: https://apereo.github.io/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/dd5ebfbb-c900-4d9b-9a26-39797cf79c6an%40apereo.org.

Reply via email to