Building Social Applications using Connections Cloud and WebSphere Portal: Getting Started

Part of the series Building Social Applications using Connections Cloud and WebSphere Portal.

Installing the Script Portlet

We’ll be using WebSphere Portal’s Script Portlet.  The reason is that the Script Portlet is ideal for small, web-centric applications.  Much of the Social Business Tookit’s examples are exactly that – small, web-centric apps.  So it will be easy to use the Script Portlat and Toolkit as a starter for social applications.  Also by using the Script Portlet, the technical barrier to creating these applications is lower – assuming you don’t live and breath J2EE portlet development.

If you do not already have the Script Portlet installed, see documentation.  High level steps are:

  1. Download the Script Portlet from the Greenhouse Catalog.
  2. Unpack the downloaded zip and move the scriptportlet-app-1.3.0.paa file to the Portal server.
  3. Run
    ./ConfigEngine.sh install-paa -DPAALocation=/path/scriptportlet-app-1.3.0.paa -DWasPassword=password -DPortalAdminPwd=password
  4. Run
    ./ConfigEngine.sh deploy-paa -DappName=scriptportlet-app -DWasPassword=password -DPortalAdminPwd=password
  5. Restart Portal.

Configuring Connections Cloud

The Toolkit will use OAuth to communicate with Connections Cloud and retrieve data.  To do that, you’ll need to add an “Internal App” in Connections Cloud.

  1. Log in as an administrator or app developer to Connections Cloud (usually https://apps.na.collabserv.com/manage/account/isv/input).
  2. Click Internal Apps -> Register App.
  3. Provide a name and select the OAuth 2.0 radio button.
  4. Set the callback URL to the server where you installed the Toolkit.  For example, my server is http://portal.demos.ibm.com/sbt.sample.web/service/oauth20_cb.
  5. Click Register.
  6. Back on the Internal Apps page, select the drop down for the app you created.
  7. Click “Show Credentials” and click the “Show Client Secret” link.
  8. Leave this screen open; the details will be used next.

OAuth2.0 Settings

Configuring the Social Business Toolkit SDK

Previously, we installed the SBT SDK.  Now it must be configured to work with the Internal App we created.

  1. Using a text editor, create the file sbt.properties.
  2. Copy the following into the sbt.properties file.  You will need to update the section “SmartCloud OAuth 2.0 Endpoint Parameters” with settings from the “Show Credentials” screen on the “Internal Apps” page.
    1. # IBM Social Business Toolkit Configuration
      # Library Servlet Configuration
      environments=Default:defaultEnvironment
      
      # SmartCloud OAuth 2.0 Endpoint Parameters
      smartcloudOA2.url=https://apps.na.collabserv.com
      smartcloudOA2.serviceName=LotusLive
      smartcloudOA2.appId=Oauth2Impl
      smartcloudOA2.consumerKey=app_20002887_143441864494
      smartcloudOA2.consumerSecret=4436e061cbd947c9490be505e3de9f0a5eff0283dd7987b5c5b9b91229ff4f8f38f2bbfa59f50eff6d993f29ccc53d4ec6153d45559a62e1848f47fc70336362fcb4d9e6822389377d8a1c80f61b95182f7d77c988331b4320a949964f1a55a1bc23c854d41f4d6e529c6acf3af760e515e5b52183f9f5e8f3bc0705c0b2e9
      smartcloudOA2.authorizationURL=https://apps.na.collabserv.com/manage/oauth2/authorize
      smartcloudOA2.accessTokenURL=https://apps.na.collabserv.com/manage/oauth2/token
      smartcloudOA2.apiVersion=3.0
  3. Since this tutorial focuses on Connections Cloud and OAuth, we’ll remove the SDK’s default environments and additional authentication options for clarity.
    1. Create a file called managed-beans.xml with any text editor.
    2. Copy the following into the file.
      <?xml version="1.0"?>
      <faces-config>
      <!-- Credential store physical implementation -->
      <managed-bean>
      <managed-bean-name>CredStore</managed-bean-name>
      <managed-bean-class>com.ibm.sbt.security.credential.store.MemoryStore</managed-bean-class>
      <managed-bean-scope>application</managed-bean-scope>
      </managed-bean>
      
      <!-- Default Environment -->
      <managed-bean>
      <managed-bean-name>defaultEnvironment</managed-bean-name>
      <managed-bean-class>com.ibm.sbt.jslibrary.SBTEnvironment</managed-bean-class>
      <managed-bean-scope>application</managed-bean-scope>
      <managed-property>
      <property-name>endpoints</property-name>
      <value>smartcloudOA2</value>
      </managed-property>
      <managed-property>
      <property-name>properties</property-name>
      <value>sample.email1,sample.email2</value>
      </managed-property>
      <managed-property>
      <property-name>runtimes</property-name>
      <value>smartcloudOA2</value>
      </managed-property>
      </managed-bean>
      
      <!-- SmartCloud OAuth 2.0 -->
      <managed-bean>
      <managed-bean-name>smartcloudOA2</managed-bean-name>
      <managed-bean-class>com.ibm.sbt.services.endpoints.SmartCloudOAuth2Endpoint</managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
      <!-- Endpoint URL -->
      <managed-property>
      <property-name>url</property-name>
      <value>%{smartcloudOA2.url}</value>
      </managed-property>
      <managed-property>
      <property-name>apiVersion</property-name>
      <value>%{smartcloudOA2.apiVersion}</value>
      </managed-property>
      <managed-property>
      <property-name>serviceName</property-name>
      <value>%{smartcloudOA2.serviceName}</value>
      </managed-property>
      <!-- OAuth parameters -->
      <managed-property>
      <property-name>appId</property-name>
      <value>%{smartcloudOA2.appId}</value>
      </managed-property>
      <managed-property>
      <property-name>consumerSecret</property-name>
      <value>%{smartcloudOA2.consumerSecret}</value>
      </managed-property>
      <managed-property>
      <property-name>consumerKey</property-name>
      <value>%{smartcloudOA2.consumerKey}</value>
      </managed-property>
      <managed-property>
      <property-name>authorizationURL</property-name>
      <value>%{smartcloudOA2.authorizationURL}</value>
      </managed-property>
      <managed-property>
      <property-name>accessTokenURL</property-name>
      <value>%{smartcloudOA2.accessTokenURL}</value>
      </managed-property>
      <!-- Trust the connection -->
      <managed-property>
      <property-name>forceTrustSSLCertificate</property-name>
      <value>true</value>
      </managed-property>
      <!-- Access to the credential store -->
      <managed-property>
      <property-name>credentialStore</property-name>
      <value>CredStore</value>
      </managed-property>
      </managed-bean>
      </faces-config>
      
    3. Save.
  4. Copy the sbt.properties and managed-beans.xml file to the server.  For example, /opt/IBM/WebSphere/wp_profile/sbt.  (I created the sbt directory.)
  5. Create two new JNDI URLs in WebSphere.
    1. Access the WAS admin console.
    2. Navigate to Resources -> URL -> URLs.
    3. Select the scope to be your cell.
    4. Select New to create a URL with the following properties:
      1. Name=SBT Properties
      2. JNDI name=url/ibmsbt-sbtproperties
      3. Specification=file:///opt/IBM/WebSphere/wp_profile/sbt/sbt.properties
    5. Select New to create another URL with the following properties:
      1. Name=SBT Managed Beans
      2. JNDI name=url/ibmsbt-sbtproperties
      3. Specification=file:///opt/IBM/WebSphere/wp_profile/sbt/managed-beans.xml
    6. Save.
  6. Restart the “Social Business Toolkit Sample Enterprise Application” under Enterprise Applications in WAS.

Test the Social Business Toolkit SDK

Time to test whether the above steps worked.  To do that:

  1. Go to http://<portal>:<port>/sbt.sample.web/javascript.jsp in a web browser.
  2. Select the Authentication -> Authentication Summary sample.
  3. Click the “Login” button.
  4. You should see a Connections Cloud login screen.
  5. Provide valid credentials and click “Log In”.
  6. The previous “Login” button should change to “Logout”

OAuth Authenticated

What’s Next

Next, we’ll create a simple application with the Script Portlet and the Social Business Toolkit SDK examples.

Building Social Applications using Connections Cloud and WebSphere Portal: Your First Widget

2 thoughts on “Building Social Applications using Connections Cloud and WebSphere Portal: Getting Started”

Leave a Reply

Your email address will not be published.