Search in sources :

Example 1 with ClientSideAuthProvider

use of org.activityinfo.ui.client.inject.ClientSideAuthProvider in project activityinfo by bedatadriven.

the class ActivityInfoEntryPoint method onModuleLoad.

/**
 * This is the entry point method.
 */
@Override
public void onModuleLoad() {
    Log.info("Application: onModuleLoad starting");
    Log.info("Application Permutation: " + GWT.getPermutationStrongName());
    ApplicationBundle.INSTANCE.styles().ensureInjected();
    try {
        new ClientSideAuthProvider().get();
    } catch (Exception e) {
        Log.error("Exception getting client side authentication", e);
        SessionUtil.forceLogin();
    }
    if (Log.isErrorEnabled()) {
        GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {

            @Override
            public void onUncaughtException(Throwable e) {
                Log.error("Uncaught exception", e);
            }
        });
    }
    GXT.setDefaultTheme(Theme.BLUE, true);
    // avoid cookie overflow
    StateManager.get().setProvider(new SafeStateProvider());
    Log.trace("Application: GXT theme set");
    final AppInjector injector = GWT.create(AppInjector.class);
    if (Window.Location.getHash() != null && Window.Location.getHash().startsWith("#print/")) {
        // Show form only view appropriate for printing
        openPrintView(injector);
    } else if (Window.Location.getHash() != null && Window.Location.getHash().startsWith("#import/")) {
        openImport(injector);
    } else {
        // Launch the normal application
        injector.createAppLoader();
        injector.createDashboardLoader();
        injector.createDataEntryLoader();
        injector.createReportLoader();
        injector.createConfigLoader();
        injector.createFormLoader();
        injector.getUsageTracker();
        injector.getHistoryManager();
        injector.createOfflineController();
        createCaches(injector);
        AppCacheMonitor.start();
    }
    Log.info("Application: everyone plugged, firing Init event");
    injector.getEventBus().fireEvent(AppEvents.INIT);
}
Also used : ClientSideAuthProvider(org.activityinfo.ui.client.inject.ClientSideAuthProvider) AppInjector(org.activityinfo.ui.client.inject.AppInjector) GWT(com.google.gwt.core.client.GWT) SafeStateProvider(org.activityinfo.ui.client.dispatch.state.SafeStateProvider)

Example 2 with ClientSideAuthProvider

use of org.activityinfo.ui.client.inject.ClientSideAuthProvider in project activityinfo by bedatadriven.

the class UserProfilePage method bindProfile.

private void bindProfile() {
    userProfile = new UserProfileDTO();
    AuthenticatedUser user = new ClientSideAuthProvider().get();
    dispatcher.execute(new GetUserProfile(user.getUserId()), new AsyncCallback<UserProfileDTO>() {

        @Override
        public void onFailure(Throwable caught) {
            Log.error("error binding profile", caught);
            MessageBox.alert(I18N.CONSTANTS.serverError(), caught.getMessage(), null);
        }

        @Override
        public void onSuccess(UserProfileDTO userProfileDTO) {
            userProfile = userProfileDTO;
            binding.bind(userProfile);
            UserProfilePage.this.show();
            maybeShowSwitchLocaleLink();
        }
    });
}
Also used : ClientSideAuthProvider(org.activityinfo.ui.client.inject.ClientSideAuthProvider) GetUserProfile(org.activityinfo.legacy.shared.command.GetUserProfile) UserProfileDTO(org.activityinfo.legacy.shared.model.UserProfileDTO) AuthenticatedUser(org.activityinfo.legacy.shared.AuthenticatedUser)

Aggregations

ClientSideAuthProvider (org.activityinfo.ui.client.inject.ClientSideAuthProvider)2 GWT (com.google.gwt.core.client.GWT)1 AuthenticatedUser (org.activityinfo.legacy.shared.AuthenticatedUser)1 GetUserProfile (org.activityinfo.legacy.shared.command.GetUserProfile)1 UserProfileDTO (org.activityinfo.legacy.shared.model.UserProfileDTO)1 SafeStateProvider (org.activityinfo.ui.client.dispatch.state.SafeStateProvider)1 AppInjector (org.activityinfo.ui.client.inject.AppInjector)1