79355565

Date: 2025-01-14 15:56:05
Score: 1
Natty:
Report link

If redirectToOriginalResource = true doesn't work there is a workaround : write a callback servlet that does the job.

configure it with redirectURI = "${baseURL}/Callback" and redirectToOriginalResource = false

@WebServlet("/Callback")
public class CallbackServlet extends HttpServlet {

    @Inject
    private OpenIdContext context;

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        if (context != null) {
            Optional<String> originalRequest = context.getStoredValue(request, response, OpenIdConstant.ORIGINAL_REQUEST);
            String originalRequestString = originalRequest.get();
            response.sendRedirect(originalRequestString);
        }
    }
}

This solution was found here : https://openliberty.io/docs/latest/enable-openid-connect-client.html

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: grigouille