Example usage for com.liferay.portal.kernel.util PropsKeys CAS_NO_SUCH_USER_REDIRECT_URL

List of usage examples for com.liferay.portal.kernel.util PropsKeys CAS_NO_SUCH_USER_REDIRECT_URL

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util PropsKeys CAS_NO_SUCH_USER_REDIRECT_URL.

Prototype

String CAS_NO_SUCH_USER_REDIRECT_URL

To view the source code for com.liferay.portal.kernel.util PropsKeys CAS_NO_SUCH_USER_REDIRECT_URL.

Click Source Link

Usage

From source file:com.liferay.portlet.portalsettings.action.EditCompanyAction.java

License:Open Source License

protected void validateCAS(ActionRequest actionRequest) throws Exception {
    boolean casEnabled = ParamUtil.getBoolean(actionRequest, "settings--" + PropsKeys.CAS_AUTH_ENABLED + "--");

    if (!casEnabled) {
        return;//from   ww  w .j  a va 2  s  . c om
    }

    String casLoginURL = ParamUtil.getString(actionRequest, "settings--" + PropsKeys.CAS_LOGIN_URL + "--");
    String casLogoutURL = ParamUtil.getString(actionRequest, "settings--" + PropsKeys.CAS_LOGOUT_URL + "--");
    String casServerName = ParamUtil.getString(actionRequest, "settings--" + PropsKeys.CAS_SERVER_NAME + "--");
    String casServerURL = ParamUtil.getString(actionRequest, "settings--" + PropsKeys.CAS_SERVER_URL + "--");
    String casServiceURL = ParamUtil.getString(actionRequest, "settings--" + PropsKeys.CAS_SERVICE_URL + "--");
    String casNoSuchUserRedirectURL = ParamUtil.getString(actionRequest,
            "settings--" + PropsKeys.CAS_NO_SUCH_USER_REDIRECT_URL + "--");

    if (!Validator.isUrl(casLoginURL)) {
        SessionErrors.add(actionRequest, "casLoginURLInvalid");
    }

    if (!Validator.isUrl(casLogoutURL)) {
        SessionErrors.add(actionRequest, "casLogoutURLInvalid");
    }

    if (Validator.isNull(casServerName)) {
        SessionErrors.add(actionRequest, "casServerNameInvalid");
    }

    if (Validator.isNotNull(casServerURL) && Validator.isNotNull(casServiceURL)) {

        SessionErrors.add(actionRequest, "casServerURLAndServiceURLConflict");
    } else if (Validator.isNull(casServerURL) && Validator.isNull(casServiceURL)) {

        SessionErrors.add(actionRequest, "casServerURLAndServiceURLNotSet");
    } else {
        if (Validator.isNotNull(casServerURL) && !Validator.isUrl(casServerURL)) {

            SessionErrors.add(actionRequest, "casServerURLInvalid");
        }

        if (Validator.isNotNull(casServiceURL) && !Validator.isUrl(casServiceURL)) {

            SessionErrors.add(actionRequest, "casServiceURLInvalid");
        }
    }

    if (Validator.isNotNull(casNoSuchUserRedirectURL) && !Validator.isUrl(casNoSuchUserRedirectURL)) {

        SessionErrors.add(actionRequest, "casNoSuchUserURLInvalid");
    }
}