API Connect

 View Only

IBM API Connect Developer Portal - Creating a private site – another way

By Anne Redwood posted Thu March 02, 2023 01:21 PM

  

Introduction

You can create a private version of the Developer Portal, so that authenticated users only can access content on the site. You might want to do this if you want to restrict public access to your content unless they are logged in.  This has been covered in this tutorial.  This post demonstrates the way page variants can be used to change the home page of a developer portal site depending on whether a user is logged in or not.

Export your configuration settings

In case of slip ups in changing the site permissions, backup your configuration settings using the toolkit CLI.  This is covered in the IBM docs tutorial Exporting and importing custom themes and site configuration which provides further details on how to do this.

Warning - as the Welcome page is content and NOT configuration it is not currently possible to backup and then restore the page – if you make a mistake here then it would be difficult to get back to the default Welcome page, without recreating the site entirely.  To be extra safe another option would be to create a completely new home page from the tutorial Changing the front page to replicate the Welcome page or page you wish to see and to then create variants on that page according to the user role.

Restrict all permissions to authenticated users

As previously outlined in this IBM documentation tutorial – log in as an administrator to the portal site. Navigate to Manage, People, Permissions. Clear all check boxes that are associated with the anonymous user. Click Save at the bottom of the permissions page.

Create a page variant for the Welcome page

In this example, we are adding a page variant to the existing default welcome page – this is intended to be identical to the default page but not include all the blocks on the existing welcome page.

  1. As admin Manage, Structure, Pages.  Click Edit next to the Welcome page.

  2. Click the Variant “Panels” – this is the default page created on site creation. 

    1. Click “Selection Criteria”
    2. Select “User Role” , click “Add Condition”
    3. Check “Authenticated user”, click Save. 
      Selection Criteria settings for private home page using authenticated, user role
    4. Click “Update and save”
  3. Select the Add variant tab.   
    1. Page variant type form 
      1. Label:  “Anonymous”
      2. Type: Panels
      3. Do not check any optional features, click Next 
        Page Variant Configuration
    2. Builder: Standard, click Next
    3. Layout: Bootstrap, One column, click Next 
    4. Layout Settings: Keep all defaults except for Region: Content, Classes – select “Row”, click Next 
      Configuring the layout of a page variant
    5. Page title: leave blank 
    6. Add New block, click and select for each desired block, select, uncheck “Display title”, click “Add block”:
      Adding a block to a page variantFor example, we are including the Welcome Banner.  (If you do not want the featured content block DO NOT select it.)
    7. Click “Finish” once all blocks you want to display on anonymous log in page have been added.  Tip: check the ordering of the blocks, rearrange either by displaying the row weights and altering or hide them and use the drag and drop icons to rearrange.  
      Ordering blocks on a page variant
  4. Click “Update and Save”. 
Notes
  1. Though you can use the page variant by modifying which blocks which user role sees, the best way to manage whether a user can see or not see an API or an API Product is by setting the visibility on it when publishing it to the catalog. 
  2. You can have more than one page variant and set selection criteria on each page variant.  The order in which the rules are applied and satisfied is determined by the order in which the page variants are ordered – this can be changed via the “Reorder variants” tab  
  3. Tip - alternative, would be to have negate condition on the “Anonymous” variant, you need to check the order of the page variants. 
  4. You can delete a page variant on the General section for that variant – USE WITH CAUTION 
  5. For this example, I did not hide the Sign in or Create Account links from the menu bar – which is possible by following the steps in the previously mentioned tutorial.  Managing whether the user can see and use the “Create Account” link is determined by whether the provider organisation owner has set self-sign up for the site catalog.  
  6. The admin link on the login page can be hidden by following the steps detailed in this  topic in the IBM Documentation

Conclusion

As you can see from this example, there are many ways to configure and create content in your Developer Portal to achieve the user experience you want to deliver to your API consumers. 



#APIConnect
#developerportal

0 comments
29 views

Permalink