My problem is that when I call (SsoUI) UI.getCurrent(), where SsoUI inherits from UI, I get a ClassCastException at runtime saying that UI cannot be cast to SsoUI.
Just to give some context, we implemented SSO between a suite of applications in Vaadin 7 using Hazelcast, and the Hazelcast instance reference is accessed through this class SsoUI. So at some point in our code there is this line:
HazelcastInstance hi = SsoUI.getCurrentSsoUI().getHazelcastInstance();
where
public static SsoUI getSsoUI() {
return (SsoUI) UI.getCurrent();
}
and everything works fine.
So now we are developing new applications on vaadin 14 and I tried to replicate the same structure to handle single sign on, but now I get the error I wrote at the beginning, a ClassCastException.
Am I missing something or are there differences between UI in vaadin 7 and UI in vaadin 14 which render this approach unusable?
Edit: to clarify, SSO stands for Single Sign On and SsoUI is my custom class which extends UI.