Monday, April 11, 2016

Accessing the currently logged in user from a Governance Center Extension

The WSO2 Governance Registry 5.2.0 ships with two applications which constitute the Governance Center user experience.These two applications can be extended for individual needs by writing custom extensions. A common use case when writing such extensions is the need to access the currently logged in user.

The process of obtaining the logged in user is easy as:


The returned object contains the following properties:
  • username
  • tenantId

Important Note: Special care must be taken when using the tenantId property in the above object in Store application. This is due to the fact that a user can access the Store using a tenant URL thus the tenant Id of the currently logged in user may not always be the tenant Id of the store view.In order to ameliorate this difficulty the Store provides a tenant API which can be used to obtain tenant specific resources.For the complete API please consult the source [1].


Reference
[1] https://github.com/wso2/carbon-store/blob/master/apps/store/modules/tenant-api.js

No comments:

Post a Comment