Shibboleth IdP v5.0.0 Upgrade: Issue with HttpServletRequest Bean Cast
Noriyuki TAKEI
ntakei at sios.com
Fri Oct 20 16:42:55 UTC 2023
Hi,all
In Shibboleth IdP v4.0.0, we defined the following Beans in the
configuration file:
```
<bean id="shibboleth.HttpServletRequest"
class="net.shibboleth.utilities.java.support.net.ThreadLocalHttpServletRequestProxy"
/>
<bean id="shibboleth.HttpServletResponse"
class="net.shibboleth.utilities.java.support.net.ThreadLocalHttpServletResponseProxy"
/>
```
Inside our custom Java code that we developed, we used the following line
to retrieve the HTTP request and it was working without any issues:
```
HttpServletRequest req = (HttpServletRequest)
context.getBean("shibboleth.HttpServletRequest");
```
Due to the specification changes in Shibboleth IdP v5.0.0, we defined the
following Beans in conf/global.xml:
```
<bean id="shibboleth.HttpServletRequest"
class="net.shibboleth.shared.servlet.impl.ThreadLocalHttpServletRequestSupplier"
/>
<bean id="shibboleth.HttpServletResponse"
class="net.shibboleth.shared.servlet.impl.ThreadLocalHttpServletResponseSupplier"
/>
```
Just as with Shibboleth IdP v4, we tried to retrieve the HTTP request using
the same code:
```
HttpServletRequest req = (HttpServletRequest)
context.getBean("shibboleth.HttpServletRequest");
```
However, we encountered the following error:
```
java.lang.ClassCastException: class
net.shibboleth.shared.servlet.impl.ThreadLocalHttpServletRequestSupplier
cannot be cast to class jakarta.servlet.http.HttpServletRequest
(net.shibboleth.shared.servlet.impl.ThreadLocalHttpServletRequestSupplier
is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader
@ba54932; jakarta.servlet.http.HttpServletRequest is in unnamed module of
loader 'app')
```
Do you have any solutions to this problem?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20231021/58452569/attachment.htm>
More information about the users
mailing list