Example usage for com.liferay.portal.kernel.util PrefsPropsUtil getBoolean

List of usage examples for com.liferay.portal.kernel.util PrefsPropsUtil getBoolean

Introduction

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

Prototype

public static boolean getBoolean(PortletPreferences preferences, String name, boolean defaultValue) 

Source Link

Usage

From source file:com.liferay.twitter.TwitterAutoLogin.java

License:Open Source License

@Override
protected String[] doLogin(HttpServletRequest request, HttpServletResponse response) throws Exception {
    long companyId = PortalUtil.getCompanyId(request);

    boolean twitterAuthEnabled = PrefsPropsUtil.getBoolean(companyId, "twitter.auth.enabled", true);

    if (!twitterAuthEnabled) {
        return null;
    }//  w ww.j a va2  s .c  om

    User user = getUser(request, companyId);

    if (user == null) {
        return null;
    }

    String[] credentials = new String[3];

    credentials[0] = String.valueOf(user.getUserId());
    credentials[1] = user.getPassword();
    credentials[2] = Boolean.TRUE.toString();

    return credentials;
}