keycloak / keycloak/keycloak-nodejs-connect

Fix generate cleanUrl in post-auth.js with hostname

Open
#390 1 comment 1 reaction 0 assignees View on GitHub
kind/feature status/triage
Dominant language
JavaScript
Stars
740
Forks
442
PR merge metrics
No merged PRs in 30d

Description

### Description

### Function postAuth can't redirect to full cleanUrl.

Because we have an app name after the hostname and current version redirect with error.

_Our url:_
_http://host-name/app-name/path_

_Redirect url in current version:_
_http://host-name/path_

**Add generation for redirect as in protect.js**
```
const host = request.hostname
const headerHost = request.headers.host.split(':')
const port = headerHost[1] || ''
const protocol = request.protocol

const redirectUrl = protocol + '://' + host + (port === '' ? '' : ':' + port) + cleanUrl
```

### Discussion

_No response_

### Motivation

_No response_

### Details

#391

Contributor guide

Open the contributing guide

Research direction

Start in post-auth.js and compare its cleanUrl redirect generation with the implementation in protect.js. Check the existing redirect path for an application mounted after the hostname, including any port, and verify that the resulting URL preserves the full http://host-name/app-name/path form.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
authentication
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.