Posts

Showing posts from March, 2020

Liferay Keycloak integration - SSO and SLO implementation

Liferay Keycloak - Single Sign On / Single Logout Overview Previous article ( https://lifedev-solutions.blogspot.com/2019/10/liferay-keycloak-integration-using.html ) describes steps to configure Keycloak SSO Authorization in Liferay using OpenID Connect Provider. However, this approach has several limitations: - it can't be used as a default login mechanism: user needs to click "Sign In", chose "OpenId Connect", select "OpenId Connect Provider", and only then he is redirected to the Keycloak sign-in form; - After logging out from Liferay user stays logged in in Keycloak. This article will show how to overcome these issues. SSO with Servlet Filter For automatic redirection to Keycloak's Sign In form the servlet filter may be implemented: @Component ( immediate = true , property = { "servlet-context-name=" , "servlet-filter-name=Keycloak Login Filter" ,

Fix AMD Loader issue for jQuery Plugins

Image
 Fix AMD Loader issue for jQuery libraries Prerequisites Custom portlet has included jQuery library, sample: com.liferay.portlet.header-portlet-javascript=/js/jstree.js" Error Javascript error during loading portlet:   Fix Modify the library source: ( function (factory) { "use strict" ; if ( typeof define === 'function' && define.amd ) { define ([ 'jquery' ], factory); } else if ( typeof module !== 'undefined' && module . exports ) { module . exports = factory( require ( 'jquery' )); } else { factory( jQuery ); } }( function ($, undefined) { ...   Replace the 'define.amd' with false to fix the AMD loading issue.   P.S. Related article for including jQuery into theme: https://lifedev-solutions.blogspot.com/2019/10/include-jquery-plugin-into-theme.html

Fixing PWC6188 JSTL Error on JSP

Fixing PWC6188 JSTL Error on JSP Prerequisites Portlet module with JSTL core included on JSP: <%@ taglib uri =" http://java.sun.com/jsp/jstl/core " prefix =" c " %> Error Such exception may be thrown after portlet deployment: 2020-03-18 17:42:26.302 ERROR [http-nio-8080-exec-8][PortletRequestDispatcherImpl:295] Unable to dispatch request: /view.jsp(1,1) /init.jsp(3,66) PWC6188: The absolute uri: http://java.sun.com/portlet_2_0 cannot be resolved in either web.xml or the jar files deployed with this application 2020-03-18 17:42:26.303 ERROR [http-nio-8080-exec-8][PortletServlet:112] javax.portlet.PortletException: org.apache.jasper.JasperException: /view.jsp(1,1) /init.jsp(3,66) PWC6188: The absolute uri: http://java.sun.com/portlet_2_0 cannot be resolved in either web.xml or the jar files deployed with this application javax.portlet.PortletException: org.apache.jasper.JasperException: /view.jsp(1,1) /init.jsp(3,66) PWC6188: The absolute uri: http

Configurable Scheduled Task (Cronjob) in Liferay DXP

Configurable Scheduled Task  Overview This article will explain and give you an example of configurable scheduled task. It may be enabled or disabled on-the-fly, cronjob expression for the task may be also changed dynamically. Example This is an example of scheduled task, which uses custom OSGi configuration: ______________________________________________________________________________ import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.messaging.BaseMessageListener; import com.liferay.portal.kernel.messaging.DestinationNames; import com.liferay.portal.kernel.messaging.Message; import com.liferay.portal.kernel.scheduler.*; import org.osgi.service.component.annotations.*; import java.util.Date; import java.util.Map; @Component( configurationPid = MyConfigurationKeys.MY_CONFIGURATION_ID, //todo 1: - set configuration ID immediate = true, property = { }, se