Liferay Enterprise ecommerce. Adding ecommerce functionality to Liferay Reading Time: 10 minutes



Similar documents
Identity Management in Liferay Overview and Best Practices. Liferay Portal 6.0 EE

Complete Java Web Development

3 Techniques for Database Scalability with Hibernate. Geert Bevin - SpringOne 2009

How To Understand The Architecture Of Java 2Ee, J2Ee, And J2E (Java) In A Wordpress Blog Post

Ch-03 Web Applications

Supporting Multi-tenancy Applications with Java EE

Customer Bank Account Management System Technical Specification Document

Unified Access for Enterprise Users

Intellicus Single Sign-on

Ping Identity, Euro Cloud award entry

Web Applications and Struts 2

<Insert Picture Here> Hudson Security Architecture. Winston Prakash. Click to edit Master subtitle style

EBA Procurement Procedure for the Supply of Website Services 2016: Annex 1 System Architecture Document SYSTEM ARCHITECTURE DOCUMENT

Managing Data on the World Wide-Web

Multi Factor Authentication API

WHITE PAPER. Domo Advanced Architecture

OpenAM All-In-One solution to securely manage access to digital enterprise and customer services, anytime and anywhere.

OpenLogin: PTA, SAML, and OAuth/OpenID

What means extensibility?

Liferay, Alfresco, SSO and LDAP Full Integration

Learning GlassFish for Tomcat Users

Building Secure Applications. James Tedrick

Tenable for CyberArk

How To Configure The Jasig Casa Single Sign On On A Workstation On Ahtml.Org On A Server On A Microsoft Server On An Ubuntu (Windows) On A Linux Computer On A Raspberry V

Application Security

Portals, Portlets & Liferay Platform

ACM Crossroads Student Magazine The ACM's First Electronic Publication

HPC PORTAL DEVELOPMENT PLATFORM

Copyright 2014 Jaspersoft Corporation. All rights reserved. Printed in the U.S.A. Jaspersoft, the Jaspersoft

Sample HP OO Web Application

Cisco ASA Adaptive Security Appliance Single Sign-On: Solution Brief

Research Article. ISSN (Print) *Corresponding author Lili Wang

ClearPass A CAS Extension Enabling Credential Replay

Title Page. Hosted Payment Page Guide ACI Commerce Gateway

IBM Rational Rapid Developer Components & Web Services

NetBeans IDE Field Guide

Installation and Administration Guide

Integrating IBM Cognos 8 BI with 3rd Party Auhtentication Proxies

Open Source Development with the Elastic Path Ecommerce Platform

Oracle Forms Services Secure Web.Show_Document() calls to Oracle Reports Server 6i

Fax User Guide 07/31/2014 USER GUIDE

Connected Data. Connected Data requirements for SSO

JBoss SOAP Web Services User Guide. Version: M5

UPGRADING SPRING SECURITY IN TIBCO JASPERREPORTS SERVER 6.0.1

SOA REFERENCE ARCHITECTURE: WEB TIER

Liferay. open source community experience distilled. Beginner's Guide. Sandeep Nair. Mahipalsinh Rana

Enterprise Edition Scalability. ecommerce Framework Built to Scale Reading Time: 10 minutes

Inside the Digital Commerce Engine. The architecture and deployment of the Elastic Path Digital Commerce Engine

WS-PGRADE Portal Introduction

Arjun V. Bala Page 20

Easy as 1-2-3: The Steps to XE. Mark Hoye Services Portfolio Consultant

Specialized Programme on Web Application Development using Open Source Tools

PingFederate. Identity Menu Builder. User Guide. Version 1.0

Using SAML for Single Sign-On in the SOA Software Platform

An introduction to Cryptosoft

EQUELLA. Blackboard Learn Configuration Guide. Version 6.2

Flexible Identity Federation

Web Container Components Servlet JSP Tag Libraries

Tomcat 5 New Features

Configuring. Moodle. Chapter 82

Welcome to Spring Forward September 26, 2006 Penn State Great Valley

Copyright Pivotal Software Inc, of 10

JBoss Portal 2.4. Quickstart User Guide

Model-View-Controller. and. Struts 2

The end. Carl Nettelblad

White Paper March 1, Integrating AR System with Single Sign-On (SSO) authentication systems

DocuSign Single Sign On Implementation Guide Published: March 17, 2016

Ameritas Single Sign-On (SSO) and Enterprise SAML Standard. Architectural Implementation, Patterns and Usage Guidelines

Configuration Worksheets for Oracle WebCenter Ensemble 10.3

CQCON 2013: five Sling features you should know

Instant Chime for IBM Sametime Installation Guide for Apache Tomcat and Microsoft SQL

Custom SIS Integration Type Development. Jim Riecken Blackboard Learn Product Development

Spring Security 3. rpafktl Pen source. intruders with this easy to follow practical guide. Secure your web applications against malicious

JBoss Portlet Container. User Guide. Release 2.0

IBM Rational Web Developer for WebSphere Software Version 6.0

HPC Portal Development Platform with E-Business and HPC Portlets

Visa Checkout September 2015

Servlet and JSP Filters

Safewhere*Identify 3.4. Release Notes

TIBCO Administrator User s Guide. Software Release March 2012

SAP NetWeaver AS Java

White paper December Addressing single sign-on inside, outside, and between organizations

CA Single Sign-On Migration Guide

Enabling Single-Sign-On between IBM Cognos 8 BI and IBM WebSphere Portal

JVA-122. Secure Java Web Development

Your Guide to Integrations with Digital River

SAAS. Best practices for SAAS implementation using an Open Source Portal (JBoss)

User Pass-Through Authentication in IBM Cognos 8 (SSO to data sources)

PHP Integration Kit. Version User Guide

University of Maine System Liferay 6 EE Solution - RFP# ADDENDUM #01

SSO Plugin. Release notes. J System Solutions. Version 3.6

Getting Started with Clearlogin A Guide for Administrators V1.01

White Pages Managed Service Solution Rapid Global Directory Implementation. White Paper

WebSphere Commerce V7 Feature Pack 5

OAuth Guide Release 6.0

HOL9449 Access Management: Secure web, mobile and cloud access

RCS Liferay Google Analytics Portlet Installation Guide

Alfresco. Wiley Publishing, Inc. PROFESSIONAL. PRACTICAL SOLUTIONS FOR ENTERPRISE. John Newton CONTENT MANAGEMENT. Michael Farman Michael G.

CA APM Cloud Monitor. Scripting Guide. Release 8.2

Transcription:

Liferay Enterprise ecommerce Adding ecommerce functionality to Liferay Reading Time: 10 minutes

Broadleaf + Liferay ecommerce + Portal Options Integration Details REST APIs Integrated IFrame Separate Conclusion APPENDIX A Authentication Portlet SEO URLs Search 4 5 5 7 8 9 10 11 11 16 17 2

Broadleaf + Liferay An enterprise commerce framework based on best of breed open source technologies For businesses seeking to implement ecommerce functionality within their current Liferay Portal Solution, Broadleaf Commerce is a Java-based ecommerce framework trusted by Fortune 500 retailers. Broadleaf and Liferay share many of the same technologies, allowing businesses to: 1) Simplify integration between systems that use the same architecture, 2) Leverage investments of existing development and infrastructure, and 3) Increase revenues by providing additional ecommerce capabilities. Liferay customers know the tremendous benefits of building a solution on the Liferay platform, and Broadleaf shares many of the same attributes, including: Cost Effective Enterprise Editions Fortune 500 Clients Highly Extensible Active Communities Strong Partner Network Spring Framework Proven Performance Open Source Software Simply stated, Broadleaf Commerce and Liferay are glove fits with regards to technology, process and people. The methods of integration, however, are varied, and highly dependent upon specific business and technology needs. This paper examines four approaches for integrating Liferay with an ecommerce platform using REST APIs, through an Integrated infrastructure, using IFrame technology, and through a Separate infrastructure. 3

ecommerce + Portal Options Introducing ecommerce functionality into an existing portal implementation can be done in a variety of ways. The right answer varies by company and depends largely on the ecommerce and portal needs of the company. Both Broadleaf Commerce and Liferay are frameworks for building highly customized applications. As such, both can be altered to fit integration methods based on needs. The chart below gives a brief overview of each integration method while identifying the major benefits and detriments to the integration options. NOTE: Minus indicates such feature as stated is more difficult. 4

Integration Details The following are examples of how companies can utilize the ecommerce functionality of Broadleaf and the site-building features of Liferay. While each option is presented here as mutually exclusive options, an amalgamation between different approaches can also be used. For instance, if companies decide to use the separated approach you can still use the Broadleaf REST APIs to hook into core Broadleaf functionality from pre-developed portlets. REST APIs Integrating with Broadleaf via REST endpoints usually involves deploying Broadleaf on a separate application server from Liferay. Portlets can then be developed in any controller-level (Spring Portlet MVC, JSF, Struts) and view-level (Thymeleaf, JSP) frameworks the users are most comfortable with since under the covers the REST endpoints being utilized are agnostic. These endpoints can also be immediately used in any custom Liferay overrides such as model listeners or service builder. 5

Pros of the REST API Approach Portlet framework agnostic (Spring MVC, JSF, Struts, etc) No additional work to allow other systems to use the Broadleaf features as they can all use the same services Scaling can be differentiated between Broadleaf and the Liferay portal if Broadleaf and ecommerce is a relatively small portion of your entire portal needs (or vice-versa) Easy to bring in additional external systems or Liferay plugins to communicate with Broadleaf in the future Separate upgrade paths between Broadleaf and Liferay Cons of the REST API Approach Additional work developing a client-side framework to interact with the Broadleaf endpoints along with the Liferay portlets themselves. This can be mostly mitigated by automatic processes that can build Java classes based on the Broadleaf endpoint definitions (Jersey WADLs) Potential for additional application server hardware Other Considerations All user requests to view any portlets developed in this fashion will require an additional HTTP request to the Broadleaf REST endpoints. If both the Broadleaf endpoints and Liferay are deployed to the same Tomcat instance or elsewhere on the same physical server then each user HTTP request will actually require 2 request threads (at a minimum): one to request the portlet page from Liferay and another to get a response back from any Broadleaf endpoint. This has the potential to impact scalability. If customers wish to utilize the Broadleaf endpoints publicly, additional security concerns might have to take place (such as API keys or OAuth). These concerns are outside of the scope of this paper. 6

Integrated This integration involves bundling the Broadleaf dependencies directly inside of a web application archive (with potentially multiple portlets) and then deploying this web application archive on top of Liferay. This solution is really only recommended if customers have very few (if any) custom Liferay extensions that need to additionally utilize ecommerce functionality. Pros of an Integrated Approach Ability to inject Broadleaf services and beans directly inside of your portlet controllers Single codebase to work from Cons of an Integrated Approach Large portlet web application archive (~80MB) since all Broadleaf code and dependencies must be included Inability to inject Broadleaf Spring beans and services for use in other portlets located in different web application archives Inability to inject Broadleaf Spring beans and services for use in any core Liferay extensions (such as Liferay s Service Builder or Model Listener) Scalability between Liferay and Broadleaf is very tightly coupled Lock-step upgrades between Liferay and Broadleaf that can additional challenges Spring Portlet MVC and Thymeleaf required 7

IFrame The IFrame integration involves developing and deploying Broadleaf as a normal servlet application deployed on a different instance and available through a different URL. The IFrame portlet can the simply point to a URL handled by the Broadleaf instance and display the results within a Liferay page. Pros of an IFrame Approach Separate upgrade paths for Broadleaf and Liferay Minimal (if any) portlet development required Cons of an IFrame Approach Stylesheet duplication between Broadleaf and Liferay Inability to provide a seamless UX experience 8

Separate The separate approach is similar to the IFrame integration except that there is no extra IFrame portlet within Liferay to display any Broadleaf pages alongside of other portlets. This is by far the simplest but also most limited solution. Pros of a Separate Approach No configuration required between Broadleaf and Liferay Independent scaling Separate upgrade paths between Liferay and Broadleaf Cons of a Separate Approach Shared authentication requires an SSO type of solution Requires building two completely different sites Duplicated style development if consistent UX is a concern Consolidated search is difficult between the disparate systems 9

Conclusion Broadleaf Commerce integrates with Liferay through multiple methods. Whether through REST APIs, Direct, IFrame or Separate integrations, Liferay portlets can be used to process ecommerce transactions using the Broadleaf Commerce framework. With a shared technology stack and development tools, businesses already running Liferay can leverage their infrastructure investment and developer base to provide Broadleaf s best of breed ecommerce toolset across a variety of catalog, cart and checkout needs. Integrating Broadleaf with a Liferay portal allows businesses to continue leveraging Liferay for integrated content, and Broadleaf for ecommerce transactions. Through technical methods outlined in this paper Broadleaf and Liferay prove business value through: 1) Simplifying integration between systems that use the same architecture, 2) Leveraging investments of existing development and infrastructure, and 3) Increasing revenues by providing additional ecommerce capabilities. For more information on the web visit: http://www.broadleafcommerce.com/liferay Or email: info@broadleafcommerce.com 10

APPENDIX A Common challenges between all integrations Authentication Specifically, this section presents solutions to associating a Broadleaf Customer to the Liferay User so that orders can stay in sync between users. REST Authentication Considerations Liferay s user attributes (reference: http://www.liferay.com/community/wiki/- /wiki/main/how%20to%20use%20custom%20attributes%20to%20enhance%20u sers) provide a convenient mechanism to store the Broadleaf customer id. From the Liferay portlet this looks something like: User liferayuser = UserServiceUtil.getUserById(Long.parseLong(request.getRemoteUser())); if (liferayuser.getexpandobridge().getattribute( broadleafcustomerid ) == null) { OrderWrapper wrapper = resttemplate.postforobject( http://broadleafinstance/cart, null, OrderWrapper.class); liferayuser.getexpandobridge().setattribute( broadleafcustomerid, wrapper.getcustomer().getid()); After this association has been made, subsequent calls to the Broadleaf REST endpoints that require a Broadleaf customer ID can now utilize the broadleafcustomerid Liferay custom user attribute. For example, to obtain the current Liferay user s cart sometime later: Map<String, Object> vars = new HashMap<String, Object>(); vars.put( customerid, liferayuser.getexpandobridge().getattribute( broadleafcustomerid )); resttemplate.getforobject( http://broadleaf-instance/cart, OrderWrapper.class, vars); 11

This relationship can also be realized from the Broadleaf endpoints by overriding Broadleaf s RestAPICustomerStateFilter. By default, this filter checks for a customerid request parameter. Assuming that the Broadleaf Customer has been extended to store the Liferay user id like so: @Table( LIFERAY_CUSTOMER ) @Entity public class LiferayCustomerImpl extends CustomerImpl { @Column(name = LIFERAY_USER_ID ) protected Long liferayuserid; public Long getliferayuserid() { return liferayuserid; public void setliferayuserid(long liferayuserid) { this.liferayuserid = liferayuserid; (reference: http://docs.broadleafcommerce.org/core/current/broadleafconcepts/data-and-service-models/extending-entities) Then a service can be created to actually look up a Broadleaf customer based on the Liferay user id public LiferayCustomerService { public Customer findcustomerbyliferayuser(long liferayuserid) { //invoke dao to execute database query 12

And finally, the filter could be extended to look for a liferayuserid request parameter: LiferayAPICustomerStateFilter extends RestAPICustomerStateFilter { @Override public void dofilter(servletrequest servletrequest, ServletResponse servletresponse, FilterChain filterchain) throws IOException, ServletException { String userid = servletrequest.getparameter( liferayuserid ); if (userid!= null) { Long liferayuser = Long.parseLong(userId); LiferayCustomer liferaycustomer = liferaycustomerservice.findcustomerbyliferayuser(liferayuser); if (liferaycustomer == null) { liferaycustomer = customerservice.createcustomer(); liferaycustomer.setliferayuserid(liferayuser); CustomerState.setCustomer(liferayCustomer); filterchain.dofilter(request, servletresponse); else { super.dofilter(servletrequest, servletresponse, filterchain); Integrated Authentication Considerations Security via the integrated approach involves using Spring Security interceptors. These interceptors are responsible for duplicating the Broadleaf servlet filters (that cannot be used in portlets) and correctly associating a Broadleaf customer with the Liferay User on each request. If the integrated solution appeals to you, contact Broadleaf at info@broadleafcommerce.com for more information on these Spring Security interceptors. 13

IFrame Authentication Considerations Liferay s out of the box IFrame portlet only supports 2 types of authentication: HTTP basic and form-based. However, in both casese the username and password from Liferay is only sent on the first request to load the initial IFrame. If a user clicks through on a link within the IFrame itself, the Liferay instance does not send the authentication information again. In order to save the current user s information from Liferay, one solution is to have Broadleaf store the Liferay user in session to be retrieved at a later date. Assume that you have configured a Liferay IFrame portlet with the following values: Authentication Type: FORM Form Method: GET User Name: liferayemail=@email_address@ Similar to the REST authentication solution you will need a custom override to the Broadleaf Customer: @Table( LIFERAY_CUSTOMER ) @Entity public class LiferayCustomerImpl extends CustomerImpl { @Column(name = LIFERAY_EMAIL ) protected String liferayemail; public String getliferayemail() { return liferayuserid; public void setliferayemail(string liferayemail) { this.liferayemail = liferayemail; 14

and an override to the CustomerStateFilter: LiferayAPICustomerStateFilter extends CustomerStateFilter { @Override public void dofilter(servletrequest servletrequest, ServletResponse servletresponse, FilterChain filterchain) throws IOException, ServletException { String liferayemail = servletrequest.getparameter( liferayemail ); if (liferayemail!= null) { LiferayCustomer liferaycustomer = liferaycustomerservice.findcustomerbyliferayuser(liferayuser); if (liferaycustomer == null) { liferaycustomer = customerservice.createcustomer(); liferaycustomer.setliferayemail(liferayemail); CustomerState.setCustomer(liferayCustomer); filterchain.dofilter(request, servletresponse); else { super.dofilter(servletrequest, servletresponse, filterchain); Separate Authentication Considerations When Liferay and Broadleaf are in completely different containers Broadleaf recommends integrating with an SSO provider that Liferay integrates with such as SAML, CAS or OpenID. 15

Portlet SEO URLs When developing portlets (via either the REST or integrated option) Liferay provides a FriendlyURLMapper which can be referenced through liferay-portlet.xml and corresponding route configuration (reference: http://www.liferay.com/community/wiki/-/wiki/main/friendlyurlmapper). For instance, routes can be configured to handle catalog URLs that have been configured through the Broadleaf admin. Consider the following liferay-portlet.xml and routes.xml configuration for a catalog portlet (designed to handle both category and product URLs): liferay-portlet.xml <portlet> <portlet-name>broadleaf-catalog</portlet-name> <icon>/icon.png</icon> <friendly-url-mapperclass>com.liferay.portal.kernel.portlet.defaultfriendlyurlmapper</friendly-urlmapper-class> <friendly-url-mapping>catalog</friendly-url-mapping> <friendly-url-routes>catalog-routes.xml</friendly-url-routes> <instanceable>false</instanceable> </portlet> routes.xml <routes> <route> <pattern>{catalogurl</pattern> </route> </routes> Now all catalog URLs will be of the form: http://yourcompany.com/-/catalog/category-url http://yourcompany.com/-/catalog/product-url 16

> Note: The above approach is only available via the integrated and REST approaches. Not included here is also the MVC implementation of receiving the catalogurl request parameter within the catalog portlet and responding appropriately. Additional references: http://www.liferay.com/community/wiki/- /wiki/main/friendlyurlmapper Search Integrated search is available through hooking into Liferay s Faceted Search capabilities as you would any other custom entity. Details surrounding specific search Indexer implementations are outside the scope of this document. Liferay provides an excellent guide for implementing faceted search for custom objects at http://www.liferay.com/web/raymond.auge/blog/-/blogs/faceted-search-in-liferay- 6-1. > Note: since integrated search uses a Liferay extension this is only available via the REST integration method. 17