You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I send a request POST to http://localhost:8080/api/auth/refresh, I got error in class AuthenticationResource, method refresh() in line 70: AuthenticationTokenDetails tokenDetails = ((TokenBasedSecurityContext) securityContext).getAuthenticationTokenDetails();
javax.servlet.ServletException: java.lang.ClassCastException: org.glassfish.jersey.server.internal.process.SecurityContextInjectee cannot be cast to com.cassiomolin.example.security.api.TokenBasedSecurityContext
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
...
The text was updated successfully, but these errors were encountered:
Hi,
I had a similar problem. Instead of using the injected security context, change the refresh method signature to grab the request context like this:
When I send a request POST to http://localhost:8080/api/auth/refresh, I got error in class AuthenticationResource, method refresh() in line 70:
AuthenticationTokenDetails tokenDetails = ((TokenBasedSecurityContext) securityContext).getAuthenticationTokenDetails();
javax.servlet.ServletException: java.lang.ClassCastException: org.glassfish.jersey.server.internal.process.SecurityContextInjectee cannot be cast to com.cassiomolin.example.security.api.TokenBasedSecurityContext
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
...
The text was updated successfully, but these errors were encountered: