/** * {@inheritDoc} */ @Override protected UserPrincipal getPrincipal() { return applicationSession.getPrincipal(); } }
/** * {@inheritDoc} */ @Override protected UserPrincipal getPrincipal() { return applicationSession.getPrincipal(); } }
/** * Gets the principal of the application session. * <p/> * {@inheritDoc} */ @Override protected UserPrincipal getPrincipal() { return getBackendController().getApplicationSession().getPrincipal(); } }
/** * Gets the principal of the application session. * <p/> * {@inheritDoc} * * @return the principal */ protected UserPrincipal getPrincipal() { return getBackendController().getApplicationSession().getPrincipal(); }
/** * {@inheritDoc} */ @Override protected UserPrincipal getPrincipal() { return getBackendController().getApplicationSession().getPrincipal(); }
/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { Map<String, Object> actionParam = (Map<String, Object>) context .get(ActionContextConstants.ACTION_PARAM); char[] typedPasswd = (char[]) actionParam.get(PASSWD_TYPED); char[] retypedPasswd = (char[]) actionParam.get(PASSWD_RETYPED); if (!Arrays.equals(typedPasswd, retypedPasswd)) { throw new ActionBusinessException( "Typed and retyped passwords are different.", "password.typed.retyped.different"); } UserPrincipal principal = getApplicationSession(context).getPrincipal(); if (changePassword(principal, (char[]) actionParam.get(PASSWD_CURRENT), typedPasswd)) { context.put(ActionContextConstants.ACTION_PARAM, getTranslationProvider( context) .getTranslation("password.change.success", getLocale(context))); return super.execute(actionHandler, context); } return false; }
/** * {@inheritDoc} */ @Override public boolean stop() { String username = getApplicationSession().getUsername(); if (getApplicationSession().getPrincipal() != null) { LOG.info("User {} logged out for session {}.", username, getApplicationSession().getId()); } selectedModules.clear(); workspaceNavigatorConnectors.clear(); workspaceViews.clear(); backwardHistoryEntries.clear(); forwardHistoryEntries.clear(); dialogContextStack.clear(); selectedWorkspaceName = null; loginCallbackHandler = null; getBackendController().removeDirtInterceptor(dirtInterceptor); started = !getBackendController().stop(); clearImplicitLogin(username); return !started; }
/** * Action start. * * @param action * the action * @param context * the context */ @Override public void actionStart(IAction action, Map<String, Object> context) { if (!isEnabled() || !filter(action)) { return; } Date startTimestamp = new Date(); if (currentCallStack.isEmpty()) { IFrontendController<?, ?, ?> frontendController = getFrontendController(context); if (frontendController != null) { currentSession = frontendController.getApplicationSession(); currentUser = currentSession.getPrincipal(); currentWorkspace = frontendController.getSelectedWorkspace(); currentModule = frontendController.getSelectedModule(); } else { IBackendController backendController = getBackendController(context); currentSession = backendController.getApplicationSession(); currentUser = backendController.getApplicationSession().getPrincipal(); } } currentCallStack.add(new ActionEntry(action, new HashMap<>(context), startTimestamp)); }
/** * {@inheritDoc} */ @Override public boolean isAccessGranted(ISecurable securable) { if (SecurityHelper.isSubjectGranted(getApplicationSession().getSubject(), securable)) { if (customSecurityPlugin != null) { try { pushToSecurityContext(securable); Map<String, Object> securityContext = new HashMap<>(); if (getApplicationSession() != null && getApplicationSession().getPrincipal() != null) { securityContext.put(SecurityContextConstants.USER_ROLES, SecurityHelper.getRoles(getApplicationSession().getSubject())); securityContext.put(SecurityContextConstants.USER_ID, getApplicationSession().getUsername()); Map<String, Object> sessionProperties = getApplicationSession().getCustomValues(); sessionProperties.putAll(getApplicationSession().getPrincipal().getCustomProperties()); securityContext.put(SecurityContextConstants.SESSION_PROPERTIES, sessionProperties); } securityContext.putAll(getSecurityContext()); return customSecurityPlugin.isAccessGranted(securable, securityContext); } finally { restoreLastSecurityContextSnapshot(); } } return true; } return false; }
private void configureHibernateGlobalFilter(Filter filter) { String filterLanguage = null; if (getLocale() != null) { filterLanguage = getLocale().getLanguage(); } if (filterLanguage == null) { filterLanguage = ""; } String filterLogin = null; if (getApplicationSession().getPrincipal() != null) { filterLogin = getApplicationSession().getUsername(); } if (filterLogin == null) { filterLogin = ""; } filter.setParameter(JSPRESSO_SESSION_GLOBALS_LANGUAGE, filterLanguage); filter.setParameter(JSPRESSO_SESSION_GLOBALS_LOGIN, filterLogin); }
/** * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { Map<String, Object> actionParam = getModelConnector(context).getConnectorValue(); String typedPasswd = (String) actionParam.get(PASSWD_TYPED); String retypedPasswd = (String) actionParam.get(PASSWD_RETYPED); if (!ObjectUtils.equals(typedPasswd, retypedPasswd)) { throw new ActionBusinessException("Typed and retyped passwords are different.", "password.typed.retyped.different"); } checkPasswordValidity(typedPasswd, context); UserPrincipal principal = getApplicationSession(context).getPrincipal(); if (changePassword(principal, (String) actionParam.get(PASSWD_CURRENT), typedPasswd)) { setActionParameter(getTranslationProvider(context).getTranslation("password.change.success", getLocale(context)), context); return super.execute(actionHandler, context); } return false; }
reportContext.putAll(context); UserPrincipal user = getController(context).getApplicationSession() .getPrincipal(); reportContext.putAll(user.getCustomProperties()); reportContext.put(JRParameter.REPORT_LOCALE, getLocale(context));
reportContext.putAll(context); UserPrincipal user = getController(context).getApplicationSession() .getPrincipal(); reportContext.putAll(user.getCustomProperties()); reportContext.put(JRParameter.REPORT_LOCALE, getLocale(context));
/** * This method installs the security subject into the application session. * * @param subject * the authenticated user subject. */ protected void loginSuccess(Subject subject) { getBackendController().getApplicationSession().setSubject(subject); String userPreferredLanguageCode = (String) getBackendController() .getApplicationSession().getPrincipal().getCustomProperty( UserPrincipal.LANGUAGE_PROPERTY); if (userPreferredLanguageCode != null) { getBackendController().getApplicationSession().setLocale( new Locale(userPreferredLanguageCode)); } if (workspaces != null) { for (Workspace workspace : workspaces.values()) { translateWorkspace(workspace); } getBackendController().installWorkspaces(workspaces); } }
/** * Gets the new map component to add. * * @param context * the action context. * @return the map to add to the collection. */ @Override @SuppressWarnings("unchecked") protected List<?> getAddedComponents(Map<String, Object> context) { IComponentDescriptor componentDescriptor = getModelDescriptor(context) .getCollectionDescriptor().getElementDescriptor(); Map<String, Object> newMap = new ObjectEqualityMap<String, Object>(); if (componentDescriptor.getLifecycleInterceptors() != null) { List<ILifecycleInterceptor> interceptors = componentDescriptor .getLifecycleInterceptors(); if (interceptors != null) { for (ILifecycleInterceptor<Map<String, Object>> interceptor : interceptors) { interceptor.onCreate(newMap, getEntityFactory(context), getApplicationSession(context).getPrincipal(), getApplicationSession(context)); } } } return Collections.singletonList(newMap); }
((ILifecycleInterceptor<Map<String, Object>>) interceptor).onCreate( newMap, getEntityFactory(context), getApplicationSession(context) .getPrincipal(), getController(context));
/** * {@inheritDoc} */ @Override public void loggedIn(Subject subject) { getApplicationSession().setSubject(subject); String userPreferredLanguageCode = (String) getApplicationSession().getPrincipal().getCustomProperty( UserPrincipal.LANGUAGE_PROPERTY); if (userPreferredLanguageCode != null) { getApplicationSession().setLocale(LocaleUtils.toLocale(userPreferredLanguageCode)); } if (getUserPreferencesStore() != null) { getUserPreferencesStore().setStorePath(getApplicationSession().getUsername()); } }