Search in sources :

Example 1 with SsoManager

use of org.codelibs.fess.sso.SsoManager in project fess by codelibs.

the class SsoAction method index.

// ===================================================================================
//                                                                       Login Execute
//                                                                      ==============
@Execute
public ActionResponse index() {
    final SsoManager ssoManager = ComponentUtil.getSsoManager();
    final LoginCredential loginCredential = ssoManager.getLoginCredential();
    if (loginCredential == null) {
        if (logger.isDebugEnabled()) {
            logger.debug("No user in SSO request.");
        }
        if (ssoManager.available()) {
            saveError(messages -> messages.addErrorsSsoLoginError(GLOBAL));
        }
        return redirect(LoginAction.class);
    } else if (loginCredential instanceof ActionResponseCredential) {
        return ((ActionResponseCredential) loginCredential).execute();
    }
    try {
        return fessLoginAssist.loginRedirect(loginCredential, op -> {
        }, () -> {
            activityHelper.login(getUserBean());
            userInfoHelper.deleteUserCodeFromCookie(request);
            return getHtmlResponse();
        });
    } catch (final LoginFailureException lfe) {
        if (logger.isDebugEnabled()) {
            logger.debug("SSO login failure.", lfe);
        }
        if (ssoManager.available()) {
            saveError(messages -> messages.addErrorsSsoLoginError(GLOBAL));
        }
        return redirect(LoginAction.class);
    }
}
Also used : FessLoginAction(org.codelibs.fess.app.web.base.FessLoginAction) ActionResponse(org.lastaflute.web.response.ActionResponse) Logger(org.slf4j.Logger) ActionResponseCredential(org.codelibs.fess.app.web.base.login.ActionResponseCredential) ComponentUtil(org.codelibs.fess.util.ComponentUtil) SsoManager(org.codelibs.fess.sso.SsoManager) Execute(org.lastaflute.web.Execute) LoggerFactory(org.slf4j.LoggerFactory) LoginCredential(org.lastaflute.web.login.credential.LoginCredential) LoginFailureException(org.lastaflute.web.login.exception.LoginFailureException) LoginAction(org.codelibs.fess.app.web.login.LoginAction) LoginFailureException(org.lastaflute.web.login.exception.LoginFailureException) LoginCredential(org.lastaflute.web.login.credential.LoginCredential) FessLoginAction(org.codelibs.fess.app.web.base.FessLoginAction) LoginAction(org.codelibs.fess.app.web.login.LoginAction) ActionResponseCredential(org.codelibs.fess.app.web.base.login.ActionResponseCredential) SsoManager(org.codelibs.fess.sso.SsoManager) Execute(org.lastaflute.web.Execute)

Aggregations

FessLoginAction (org.codelibs.fess.app.web.base.FessLoginAction)1 ActionResponseCredential (org.codelibs.fess.app.web.base.login.ActionResponseCredential)1 LoginAction (org.codelibs.fess.app.web.login.LoginAction)1 SsoManager (org.codelibs.fess.sso.SsoManager)1 ComponentUtil (org.codelibs.fess.util.ComponentUtil)1 Execute (org.lastaflute.web.Execute)1 LoginCredential (org.lastaflute.web.login.credential.LoginCredential)1 LoginFailureException (org.lastaflute.web.login.exception.LoginFailureException)1 ActionResponse (org.lastaflute.web.response.ActionResponse)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1