Example usage for com.liferay.portal.security.sso.facebook.connect.constants FacebookConnectWebKeys FACEBOOK_APP_ID

List of usage examples for com.liferay.portal.security.sso.facebook.connect.constants FacebookConnectWebKeys FACEBOOK_APP_ID

Introduction

In this page you can find the example usage for com.liferay.portal.security.sso.facebook.connect.constants FacebookConnectWebKeys FACEBOOK_APP_ID.

Prototype

String FACEBOOK_APP_ID

To view the source code for com.liferay.portal.security.sso.facebook.connect.constants FacebookConnectWebKeys FACEBOOK_APP_ID.

Click Source Link

Usage

From source file:com.liferay.login.authentication.facebook.connect.web.internal.servlet.taglib.FacebookConnectNavigationPreDynamicInclude.java

License:Open Source License

@Override
public void include(HttpServletRequest request, HttpServletResponse response, String key) throws IOException {

    String strutsAction = ParamUtil.getString(request, "struts_action");

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    if (strutsAction.startsWith("/login/facebook_connect")
            || !_facebookConnect.isEnabled(themeDisplay.getCompanyId())) {

        return;/* w ww . j a  va  2s.c  o  m*/
    }

    String facebookAuthRedirectURL = _facebookConnect.getRedirectURL(themeDisplay.getCompanyId());

    request.setAttribute(FacebookConnectWebKeys.FACEBOOK_AUTH_REDIRECT_URL, facebookAuthRedirectURL);

    String facebookAuthURL = _facebookConnect.getAuthURL(themeDisplay.getCompanyId());

    request.setAttribute(FacebookConnectWebKeys.FACEBOOK_AUTH_URL, facebookAuthURL);

    String facebookAppId = _facebookConnect.getAppId(themeDisplay.getCompanyId());

    request.setAttribute(FacebookConnectWebKeys.FACEBOOK_APP_ID, facebookAppId);

    RequestDispatcher requestDispatcher = _servletContext.getRequestDispatcher(_JSP_PATH);

    try {
        requestDispatcher.include(request, response);
    } catch (ServletException se) {
        _log.error("Unable to include JSP " + _JSP_PATH, se);

        throw new IOException("Unable to include JSP " + _JSP_PATH, se);
    }
}