mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-15 16:51:07 +00:00
Moved generically used classes to com.sap.sse.security.ui
This commit is contained in:
1 parent
3a71030135
commit
bfb629ebe4
9 files changed
+9
-9
No files matched your search
+39
@@ -0,0 +1,39 @@
|
||||
package com.sap.sse.security.ui.authentication.generic;
|
||||
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.google.web.bindery.event.shared.SimpleEventBus;
|
||||
import com.sap.sse.gwt.common.CommonSharedResources;
|
||||
import com.sap.sse.security.ui.authentication.AuthenticationClientFactory;
|
||||
import com.sap.sse.security.ui.authentication.AuthenticationClientFactoryImpl;
|
||||
import com.sap.sse.security.ui.authentication.AuthenticationManager;
|
||||
import com.sap.sse.security.ui.authentication.AuthenticationManagerImpl;
|
||||
import com.sap.sse.security.ui.authentication.AuthenticationPlaceManagementController;
|
||||
import com.sap.sse.security.ui.authentication.view.AuthenticationMenuView;
|
||||
import com.sap.sse.security.ui.authentication.view.FlyoutAuthenticationPresenter;
|
||||
import com.sap.sse.security.ui.authentication.view.FlyoutAuthenticationView;
|
||||
import com.sap.sse.security.ui.client.UserService;
|
||||
|
||||
public class GenericAuthentication {
|
||||
private final EventBus eventBus = new SimpleEventBus();
|
||||
private final AuthenticationManager manager;
|
||||
|
||||
public GenericAuthentication(UserService userService, AuthenticationMenuView menuView,
|
||||
FlyoutAuthenticationView display, GenericAuthenticationLinkFactory linkFactory, CommonSharedResources res) {
|
||||
manager = new AuthenticationManagerImpl(userService, eventBus,
|
||||
linkFactory.createEmailValidationLink(), linkFactory.createPasswordResetLink());
|
||||
final AuthenticationClientFactory clientFactory = new AuthenticationClientFactoryImpl(manager, res);
|
||||
final GenericAuthenticationCallbackImpl callback = new GenericAuthenticationCallbackImpl(linkFactory);
|
||||
final AuthenticationPlaceManagementController controller = new AuthenticationPlaceManagementController(
|
||||
clientFactory, callback, display, eventBus);
|
||||
callback.setController(controller);
|
||||
new FlyoutAuthenticationPresenter(display, menuView, controller, eventBus, manager.getAuthenticationContext());
|
||||
}
|
||||
|
||||
public EventBus getEventBus() {
|
||||
return eventBus;
|
||||
}
|
||||
|
||||
public AuthenticationManager getAuthenticationManager() {
|
||||
return manager;
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.sap.sse.security.ui.authentication.generic;
|
||||
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.sap.sse.security.ui.authentication.AuthenticationCallback;
|
||||
import com.sap.sse.security.ui.authentication.WrappedPlaceManagementController;
|
||||
import com.sap.sse.security.ui.authentication.info.LoggedInUserInfoPlace;
|
||||
|
||||
class GenericAuthenticationCallbackImpl implements AuthenticationCallback {
|
||||
|
||||
private final GenericAuthenticationLinkFactory linkFactory;
|
||||
private WrappedPlaceManagementController controller;
|
||||
|
||||
GenericAuthenticationCallbackImpl(GenericAuthenticationLinkFactory linkFactory) {
|
||||
this.linkFactory = linkFactory;
|
||||
}
|
||||
|
||||
public void setController(WrappedPlaceManagementController controller) {
|
||||
this.controller = controller;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleSignInSuccess() {
|
||||
controller.goTo(new LoggedInUserInfoPlace());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleUserProfileNavigation() {
|
||||
Window.open(linkFactory.createUserProfileLink(), "_blank", "");
|
||||
}
|
||||
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.sap.sse.security.ui.authentication.generic;
|
||||
|
||||
import com.google.web.bindery.event.shared.HandlerRegistration;
|
||||
import com.sap.sse.security.ui.authentication.AuthenticationContextEvent;
|
||||
import com.sap.sse.security.ui.authentication.decorator.FlyoutBasedAuthorizedContentDecorator;
|
||||
|
||||
public class GenericAuthorizedContentDecorator extends FlyoutBasedAuthorizedContentDecorator {
|
||||
|
||||
private final GenericAuthentication genericAuthentication;
|
||||
private HandlerRegistration handlerRegistration;
|
||||
|
||||
public GenericAuthorizedContentDecorator(GenericAuthentication genericAuthentication) {
|
||||
super(genericAuthentication.getEventBus(), new GenericNotLoggedInView());
|
||||
this.genericAuthentication = genericAuthentication;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLoad() {
|
||||
super.onLoad();
|
||||
setUserManagementContext(genericAuthentication.getAuthenticationManager().getAuthenticationContext());
|
||||
handlerRegistration = genericAuthentication.getEventBus().addHandler(AuthenticationContextEvent.TYPE,
|
||||
new AuthenticationContextEvent.Handler() {
|
||||
@Override
|
||||
public void onUserChangeEvent(AuthenticationContextEvent event) {
|
||||
setUserManagementContext(event.getCtx());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onUnload() {
|
||||
super.onUnload();
|
||||
handlerRegistration.removeHandler();
|
||||
handlerRegistration = null;
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package com.sap.sse.security.ui.authentication.generic;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.DivElement;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.uibinder.client.UiHandler;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sse.security.ui.authentication.decorator.NotLoggedInPresenter;
|
||||
import com.sap.sse.security.ui.authentication.decorator.NotLoggedInView;
|
||||
|
||||
public class GenericNotLoggedInView extends Composite implements NotLoggedInView {
|
||||
|
||||
private static NotLoggedInViewUiBinder uiBinder = GWT.create(NotLoggedInViewUiBinder.class);
|
||||
|
||||
interface NotLoggedInViewUiBinder extends UiBinder<Widget, GenericNotLoggedInView> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
DivElement messageUi;
|
||||
|
||||
@UiField
|
||||
Button buttonUi;
|
||||
private NotLoggedInPresenter presenter;
|
||||
|
||||
public GenericNotLoggedInView() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPresenter(NotLoggedInPresenter presenter) {
|
||||
this.presenter = presenter;
|
||||
}
|
||||
|
||||
@UiHandler("buttonUi")
|
||||
void onClick(ClickEvent e) {
|
||||
presenter.doTriggerLoginForm();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMessage(String message) {
|
||||
messageUi.setInnerText(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSignInText(String signInText) {
|
||||
buttonUi.setText(signInText);
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
||||
<ui:with field="res" type="com.sap.sse.gwt.common.CommonSharedResources" />
|
||||
<ui:style>
|
||||
.message {
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
display: inline-block;
|
||||
padding-right: 1em;
|
||||
}
|
||||
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<div ui:field="messageUi" class="{style.message}" />
|
||||
<g:Button addStyleNames="{res.mainCss.button} {res.mainCss.buttonprimary}" ui:field="buttonUi" />
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
||||
Reference in new issue
Block a user