Hi Team,
We use jmix-oidc and KeyCloak for Single sign on.
Now we use URL Routing , send the link to customer:
For example: http://host:port/#main/tasks?task_id=5jqtc3pwzx6g6mq1vv5gkyjn0s
If user already login, then route is working.
But if no login, redirect to KeyCloak login screen. After login successful, return to Main Screen, and not route to the Task screen by the link.
Please help us!
I have read about KeyCloak, and found that keycloak client redirect uris must not contain an uri fragment (with symbol “#” ). But Jmix app url always have "# " fragment (like /#main/task) .This is cause of above problem.
I don’t know how to fix this issue! Please help us!
I have found work around solution
- Use param in URL for example:
http://localhost:8081/?app_redirect=main/0/task-detail?task_id=123456 - extends JmixVaadinServlet , change URL use Interceptor request
All code here:
@Component("vaadinServlet")
@Primary
public class MyVaadinServlet extends JmixVaadinServlet {
public MyVaadinServlet(ApplicationContext applicationContext) {
super(applicationContext);
}
@Override
protected void service(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
String fragment = request
.getParameter("app_redirect");
if (fragment != null) {
String url = request.getRequestURL().toString();
response.sendRedirect(url +"#"+fragment);
} else
super.service(request, response);
}
}