Example usage for com.liferay.portal.security.sso.openid.connect.constants OpenIdConnectWebKeys OPEN_ID_CONNECT_PROVIDER_NAME

List of usage examples for com.liferay.portal.security.sso.openid.connect.constants OpenIdConnectWebKeys OPEN_ID_CONNECT_PROVIDER_NAME

Introduction

In this page you can find the example usage for com.liferay.portal.security.sso.openid.connect.constants OpenIdConnectWebKeys OPEN_ID_CONNECT_PROVIDER_NAME.

Prototype

String OPEN_ID_CONNECT_PROVIDER_NAME

To view the source code for com.liferay.portal.security.sso.openid.connect.constants OpenIdConnectWebKeys OPEN_ID_CONNECT_PROVIDER_NAME.

Click Source Link

Usage

From source file:com.liferay.login.authentication.openid.connect.web.internal.portlet.action.OpenIdConnectLoginRequestMVCActionCommand.java

License:Open Source License

@Override
public void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    try {/*w w  w  .  j a v  a 2s. c o m*/
        String openIdConnectProviderName = ParamUtil.getString(actionRequest,
                OpenIdConnectWebKeys.OPEN_ID_CONNECT_PROVIDER_NAME);

        HttpServletRequest httpServletRequest = _portal.getHttpServletRequest(actionRequest);

        httpServletRequest = _portal.getOriginalServletRequest(httpServletRequest);

        HttpServletResponse httpServletResponse = _portal.getHttpServletResponse(actionResponse);

        _openIdConnectServiceHandler.requestAuthentication(openIdConnectProviderName, httpServletRequest,
                httpServletResponse);
    } catch (Exception e) {
        if (e instanceof OpenIdConnectServiceException) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to communicate with OpenID Connect provider: " + e.getMessage());
            }

            SessionErrors.add(actionRequest, e.getClass());
        } else if (e instanceof UserEmailAddressException.MustNotBeDuplicate) {

            SessionErrors.add(actionRequest, e.getClass());
        } else {
            _log.error("Unable to process the OpenID login", e);

            _portal.sendError(e, actionRequest, actionResponse);
        }
    }
}