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