Search in sources :

Example 1 with LoginServletBean

use of password.pwm.http.bean.LoginServletBean in project pwm by pwm-project.

the class LoginServlet method determinePostLoginUrl.

private static String determinePostLoginUrl(final PwmRequest pwmRequest) throws PwmUnrecoverableException {
    final LoginServletBean loginServletBean = pwmRequest.getPwmApplication().getSessionStateService().getBean(pwmRequest, LoginServletBean.class);
    final String decryptedValue = loginServletBean.getNextUrl();
    if (decryptedValue != null && !decryptedValue.isEmpty()) {
        final PwmURL originalPwmURL = new PwmURL(URI.create(decryptedValue), pwmRequest.getContextPath());
        if (!originalPwmURL.isLoginServlet()) {
            loginServletBean.setNextUrl(null);
            return decryptedValue;
        }
    }
    return pwmRequest.getContextPath();
}
Also used : PwmURL(password.pwm.http.PwmURL) LoginServletBean(password.pwm.http.bean.LoginServletBean)

Example 2 with LoginServletBean

use of password.pwm.http.bean.LoginServletBean in project pwm by pwm-project.

the class LoginServlet method processReceiveUrl.

@ActionHandler(action = "receiveUrl")
private ProcessStatus processReceiveUrl(final PwmRequest pwmRequest) throws PwmUnrecoverableException, IOException {
    final String encryptedNextUrl = pwmRequest.readParameterAsString(PwmConstants.PARAM_POST_LOGIN_URL);
    if (!StringUtil.isEmpty(encryptedNextUrl)) {
        final String nextUrl = pwmRequest.getPwmApplication().getSecureService().decryptStringValue(encryptedNextUrl);
        if (!StringUtil.isEmpty(nextUrl)) {
            final LoginServletBean loginServletBean = pwmRequest.getPwmApplication().getSessionStateService().getBean(pwmRequest, LoginServletBean.class);
            LOGGER.trace(pwmRequest, "received nextUrl and storing in module bean, value: " + nextUrl);
            loginServletBean.setNextUrl(nextUrl);
        }
    }
    pwmRequest.sendRedirect(PwmServletDefinition.Login);
    return ProcessStatus.Halt;
}
Also used : LoginServletBean(password.pwm.http.bean.LoginServletBean)

Aggregations

LoginServletBean (password.pwm.http.bean.LoginServletBean)2 PwmURL (password.pwm.http.PwmURL)1