Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vaadin + Apache Shiro and Java Based Login #36

Open
ghost opened this issue Apr 28, 2014 · 1 comment
Open

Vaadin + Apache Shiro and Java Based Login #36

ghost opened this issue Apr 28, 2014 · 1 comment

Comments

@ghost
Copy link

ghost commented Apr 28, 2014

I develop a Vaadin application with Java based login (to avoid any actual webpages in my application):

final Subject currentUser = SecurityUtils.getSubject();
final AuthenticationToken token = new UsernamePasswordToken(username, password);
currentUser.login(token);

UI.getCurrent().getNavigator().navigateTo(HomeView.NAVIGATION_NAME);

As you can see, I navigate to my home view (for authenticated user only) after a successful login. However, the ShiroSecurityNavigator seems to have already decided which views are allowed and which one are not. Hence the navigator does not allow to navigate to home. My current workaround is to reinitialize the navigator:

currentUser.login(token);

UI.getCurrent().setNavigator(new ShiroSecurityNavigator(UI.getCurrent(), UI.getCurrent()));
UI.getCurrent().getNavigator().setErrorView(new ErrorView());
UI.getCurrent().getNavigator().navigateTo(HomeView.NAVIGATION_NAME);

There should be a better approach in my opinion. The security navigator should recognize changes in the authentication or should at least provide a method to re-read the allowed views.

@wassimz
Copy link

wassimz commented May 13, 2014

Hi,

I am trying to do the same thing but unsuccessfully.
Can you please provide some examples or hints to help me integrating such feature

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant