O'Reilly logo

GateIn Cookbook by Piergiorgio Lucidi, Luca Stancapiano, Ken Finnigan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Migrating an authenticated portlet

Authentication is a standard in the portlet specification. Accordingly, migrating is very simple if the standard APIs are used. In other cases, use the extended features provided by the products. Each Portal Product provides its own extensions. In this recipe, you will see an example of the migration of a portlet written with Liferay.

Getting ready

This is the Liferay portlet code to to be migrated:

try {
  User currentUser = PortalUtil.getUser(request);
} catch (PortalException e) {
  // something went wrong, we should handle it
} catch (SystemException e) {
  // something went terribly wrong, we should handle it
}
// the roles
List<Role> roles = currentUser.getRoles();
// other users
List<User> liferayUsers ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required