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

java.lang.NullPointerException in HttpServletRequestDelegator.getParameter(HttpServletRequestDelegator.java:160) #333

Open
pdbs opened this issue Sep 28, 2022 · 1 comment

Comments

@pdbs
Copy link

pdbs commented Sep 28, 2022

On an OIDC Callback i.e.

http://localhost:8080/MyApplication/index.html?code=0.AXMAlS8XEZqje0-SJMahHR5cJCFY7Ad5WTJDkKCbZUg-0LdzAH8....

the following line (160) in HttpServletRequestDelegator.java

    String[] values = requestData.getParameters().get(name);

throws a java.lang.NullPointerException when accessing a request parameter which is not in the GET request sent bei OIDC server, i.e.

request.getParameter("action")

Could this be fixed?

@pdbs
Copy link
Author

pdbs commented Nov 14, 2022

By using an explicit callback servlet which does not use request.getParameter(... and redirects to the main application URL, there is no NPE anymore:

response.sendRedirect(request.getHeader("x-forwarded-proto") + "://" + request.getHeader("x-forwarded-host") + request.getContextPath());

Servlet is behind a reverse proxy, that's why the X-headers are used.

But maybe HttpServletRequestDelegator.getParameter should return null (just like in ServletRequest) when parameter name is not found.

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

No branches or pull requests

1 participant