Skip to content
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

redirect (bounce, bounce_redirect) should use req.originalUrl instead of req.url #7

Open
andimeier opened this issue Feb 29, 2016 · 0 comments
Assignees
Labels

Comments

@andimeier
Copy link

When used in a node backend with hierarchical routers, the req.url will be stripped off of any "mount points".

For instance, if the node express server defines a sub-router like this:

app.use('/details', detailsRouter);

and in detailsRouter, the following route is defined:

detailsRouter.get(/general, cas.bounce, ...)

then cas.bounce and any other middleware function will see the following properties of req:

req.url: /general
req.originalUrl: /details/general

So, the "mount point" /general has been stripped off in the sub-router (see http://expressjs.com/de/api.html#req.originalUrl).

Now, when cas-authentication tries to assemble the target URL which it should redirect to once the authentication cycle has been successfully finished, it will request something like

http://SERVER.name/general?ticket...

which obvisouly cannot be resolved by the backend.

Solution: use req.originalUrl instead. I didn't file a PR yet because I am not sure if there are any side effects. If there is no reasoning against it, req.originalUrl should be used throughout.

Otherwise, cas-authentication cannot be used for a clean node express server with hierarchical routers without change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants