Search in sources :

Example 16 with LocalSessionStateBean

use of password.pwm.bean.LocalSessionStateBean in project pwm by pwm-project.

the class PwmRequest method getForwardUrl.

public String getForwardUrl() {
    final LocalSessionStateBean ssBean = this.getPwmSession().getSessionStateBean();
    String redirectURL = ssBean.getForwardURL();
    if (redirectURL == null || redirectURL.length() < 1) {
        redirectURL = this.getConfig().readSettingAsString(PwmSetting.URL_FORWARD);
    }
    if (redirectURL == null || redirectURL.length() < 1) {
        redirectURL = this.getContextPath();
    }
    return redirectURL;
}
Also used : LocalSessionStateBean(password.pwm.bean.LocalSessionStateBean)

Example 17 with LocalSessionStateBean

use of password.pwm.bean.LocalSessionStateBean in project pwm by pwm-project.

the class PwmSession method setLocale.

public boolean setLocale(final PwmApplication pwmApplication, final String localeString) throws PwmUnrecoverableException {
    if (pwmApplication == null) {
        throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_APP_UNAVAILABLE, "unable to read context manager"));
    }
    final LocalSessionStateBean ssBean = this.getSessionStateBean();
    final List<Locale> knownLocales = pwmApplication.getConfig().getKnownLocales();
    final Locale requestedLocale = LocaleHelper.parseLocaleString(localeString);
    if (knownLocales.contains(requestedLocale) || "default".equalsIgnoreCase(localeString)) {
        LOGGER.debug(this, "setting session locale to '" + localeString + "'");
        ssBean.setLocale("default".equalsIgnoreCase(localeString) ? PwmConstants.DEFAULT_LOCALE : requestedLocale);
        if (this.isAuthenticated()) {
            this.reloadUserInfoBean(pwmApplication);
        }
        return true;
    } else {
        LOGGER.error(this, "ignoring unknown locale value set request for locale '" + localeString + "'");
        ssBean.setLocale(PwmConstants.DEFAULT_LOCALE);
        return false;
    }
}
Also used : Locale(java.util.Locale) ErrorInformation(password.pwm.error.ErrorInformation) PwmUnrecoverableException(password.pwm.error.PwmUnrecoverableException) LocalSessionStateBean(password.pwm.bean.LocalSessionStateBean)

Aggregations

LocalSessionStateBean (password.pwm.bean.LocalSessionStateBean)17 ErrorInformation (password.pwm.error.ErrorInformation)9 PwmUnrecoverableException (password.pwm.error.PwmUnrecoverableException)7 PwmOperationalException (password.pwm.error.PwmOperationalException)6 PwmApplication (password.pwm.PwmApplication)5 FormConfiguration (password.pwm.config.value.data.FormConfiguration)5 PwmSession (password.pwm.http.PwmSession)5 UserInfo (password.pwm.ldap.UserInfo)5 HashMap (java.util.HashMap)4 UserIdentity (password.pwm.bean.UserIdentity)4 Configuration (password.pwm.config.Configuration)4 SearchConfiguration (password.pwm.ldap.search.SearchConfiguration)4 LoginInfoBean (password.pwm.bean.LoginInfoBean)3 PasswordData (password.pwm.util.PasswordData)3 ChaiUser (com.novell.ldapchai.ChaiUser)2 ChaiOperationException (com.novell.ldapchai.exception.ChaiOperationException)2 Instant (java.time.Instant)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 Locale (java.util.Locale)2