Revision 51fe9924
Added by Cherian Mathew about 9 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/ui/AbstractAuthenticatedUI.java | ||
---|---|---|
15 | 15 |
public abstract class AbstractAuthenticatedUI extends UI { |
16 | 16 |
|
17 | 17 |
/** |
18 |
*
|
|
18 |
* |
|
19 | 19 |
*/ |
20 | 20 |
private static final long serialVersionUID = 1L; |
21 | 21 |
|
22 | 22 |
Navigator navigator; |
23 |
|
|
23 |
|
|
24 | 24 |
private static final String AUTHENTICATION_VIEW = "abstractAuthenticatedUI"; |
25 | 25 |
|
26 |
private boolean ignoreAuthentication = false; |
|
27 |
|
|
26 | 28 |
private final static Logger logger = |
27 | 29 |
Logger.getLogger(AbstractAuthenticatedUI.class.getName()); |
28 | 30 |
|
29 | 31 |
@Override |
30 |
protected void init(VaadinRequest request) {
|
|
31 |
|
|
32 |
protected void init(VaadinRequest request) { |
|
33 |
|
|
32 | 34 |
// Create a navigator to control the views |
33 | 35 |
navigator = new Navigator(this, this); |
34 |
|
|
36 |
|
|
35 | 37 |
AuthenticationView av = new AuthenticationView(); |
36 | 38 |
navigator.addView(AUTHENTICATION_VIEW, av); |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
39 | 41 |
new AuthenticationPresenter(av); |
40 | 42 |
// Create and register the views |
41 |
Authentication authentication = (Authentication) VaadinSession.getCurrent().getAttribute("authentication");
|
|
42 |
|
|
43 |
Authentication authentication = (Authentication) VaadinSession.getCurrent().getAttribute("authentication"); |
|
44 |
|
|
43 | 45 |
doInit(); |
44 |
|
|
45 |
if(authentication != null && authentication.isAuthenticated()) {
|
|
46 |
|
|
47 |
if(ignoreAuthentication || (authentication != null && authentication.isAuthenticated())) {
|
|
46 | 48 |
UI.getCurrent().getNavigator().navigateTo(getFirstViewName()); |
47 | 49 |
} else { |
48 | 50 |
UI.getCurrent().getNavigator().navigateTo(AUTHENTICATION_VIEW); |
49 | 51 |
} |
50 | 52 |
} |
51 |
|
|
53 |
|
|
52 | 54 |
protected abstract void doInit(); |
53 |
|
|
55 |
|
|
54 | 56 |
public abstract String getFirstViewName(); |
55 | 57 |
|
58 |
public void setIgnoreAuthentication(boolean ignoreAuthentication) { |
|
59 |
this.ignoreAuthentication = ignoreAuthentication; |
|
60 |
} |
|
61 |
|
|
56 | 62 |
} |
Also available in: Unified diff
First commit for Status Editor
StatusEditorUI, StatusEditorView, StatusComposite, IStatusComposite, StatusPresenter : MVP classes for status editor
CdmSQLContainer, CdmSpringContextHelper : using new connection pool method
LeafNodeTaxonContainer : container for status editor
CdmStatementDelegate : sql statement delegate for cdm
AbstractAuthenticatedUI : added method for bypassing authentication (for testing)