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

Sunday, April 10, 2016

Changing the authentication method of the G-Reg Governance Center Store and Publisher

The Enterprise Store (ES) 2.1.0 and Governance Registry (G-Reg) 5.2.0 products support two main authentication methods:

  • Basic authentication
  • SAML based Single Sign On (SSO)
The process of switching between these two authentication methods can be done by simply editing a configuration file and restarting the respective server.The configuration file for the active authentication method is found in the authentication block of application configuration file:
  • For the Publisher it is found at {CARBON_HOME}/repository/deployment/server/jaggeryapps/publisher/config/publisher.json
  • For the Store it is located at {CARBON_HOME}/repository/deployment/server/jaggeryapps/store/config/store.json
The {CARBON_HOME} section should be replaced with the location of the product in your file system.

The image above highlights the authentication block in the store.json file.The configuration block is the same in both the Publisher and Store applications.

Changing the active authentication method
The active authentication method can be changed by altering the activeMethod property to either basic or sso.


In the case of the SAML SSO authentication method an additional change must be done  to the {CARBON_HOME}/repository/conf/identity/sso-idp-config.xml.


The above file is used to register service providers with the embedded WSO2 Identity components which provide SAML SSO authentication support.If you are using an external IDP then you should not worry about this file.The service provide configuration blocks should be altered to reflect any port and host changes of the server.