Showing posts with label Store. Show all posts
Showing posts with label Store. Show all posts

Friday, August 5, 2016

How to Share Userstore Between Two WSO2 Servers

We can share user store between WSO2 carbon servers. Here I'm going to explain using WSO2 App Manager and WSO2 Identity Server.
  1. Create new database called APPM_UM_DB in MYSQL server
  2. Create tables inside the created database by executing the script in <APPM_HOME>/dbscripts/mysql.sql
  3. If App Manager and Identity Server are running on the same machine, follow this step.
  4. Set Offset value to 1 in /repository/conf/carbon.xml.
       
       <Offset>1</Offset>  
       
  5. Specify the datasource definition like below in the <APPM_HOME>/repository/conf/datasources/master-datasources.xml to connect early created APPM_UM_DB database to share user store.
       
       <datasource>  
          <name>WSO2UM_DB</name>  
          <description>The datasource used for user manager database</description>  
          <jndiConfig>  
            <name>jdbc/WSO2UM_DB</name>  
          </jndiConfig>  
           <definition type="RDBMS">  
             <configuration>  
               <url>jdbc:mysql://localhost:3306/APPM_UM_DB</url>  
                <username>username</username>  
                <password>password</password>  
                <driverClassName>com.mysql.jdbc.Driver</driverClassName>  
                <maxActive>50</maxActive>  
                <maxWait>60000</maxWait>  
                <testOnBorrow>true</testOnBorrow>  
                <validationQuery>SELECT 1</validationQuery>  
                <validationInterval>30000</validationInterval>  
             </configuration>  
         </definition>  
       </datasource>  
          
    
  6. Add the same data source configuration to <IS_HOME>/repository/conf/datasources/master-datasources.xml.
  7. Copy the database driver to both <IS_HOME>/repository/components/lib and <AppM_HOME>/repository/components/lib directories.
  8. Update the <APPM_HOME>/repository/conf/user-mgt.xml with jndiConfig name added in step 4 (i.e. jdbc/WSO2UM_DB) as below.
       
       <configuration>   
         ...  
         <Property name="dataSource">jdbc/WSO2UM_DB</Property>  
       </configuration>  
       
  9. Repeat step 7 to <IS_HOME>/repository/conf/user-mgt.xml.
  10. The Identity Server has an embedded LDAP user store and App manager has a JDBC user store by default. You can use either JDBC or LDAP user store in both servers(Both should be the same.) Here I'm using JDBC user store. Copy following configuration from <APPM_HOME>/repository/conf/user-mgt.xml to <IS_HOME>/repository/conf/user-mgt.xml. Remember to remove LDAP user store from Identity server user-mgt.xml.
       
       <UserStoreManager class="org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager">  
           <Property name="TenantManager">org.wso2.carbon.user.core.tenant.JDBCTenantManager</Property>  
             <Property name="ReadOnly">false</Property>  
           <Property name="MaxUserNameListLength">100</Property>  
           <Property name="IsEmailUserName">false</Property>  
           <Property name="DomainCalculation">default</Property>  
           <Property name="PasswordDigest">SHA-256</Property>  
           <Property name="StoreSaltedPassword">true</Property>  
           <Property name="ReadGroups">true</Property>  
            <Property name="WriteGroups">true</Property>  
           <Property name="UserNameUniqueAcrossTenants">false</Property>  
           <Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property>  
           <Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>  
            <Property name="UsernameJavaRegEx">^[^~!#$;%^*+={}\\|\\\\&lt;&gt;,\'\"]{3,30}$</Property>  
            <Property name="UsernameJavaScriptRegEx">^[\S]{3,30}$</Property>  
            <Property name="RolenameJavaRegEx">^[^~!#$;%^*+={}\\|\\\\&lt;&gt;,\'\"]{3,30}$</Property>  
            <Property name="RolenameJavaScriptRegEx">^[\S]{3,30}$</Property>  
           <Property name="UserRolesCacheEnabled">false</Property>  
           <Property name="MaxRoleNameListLength">100</Property>  
           <Property name="MaxUserNameListLength">100</Property>  
            <Property name="SharedGroupEnabled">false</Property>  
           <Property name="SCIMEnabled">false</Property>  
         </UserStoreManager>  
       
    
  11. Restart both servers.
That's all. Now if you create a user or a role from one server, it will be shown in both servers.

Friday, July 29, 2016

How to Change WSO2 App Manager Store and Webapp Favicons

If you want to use WSO2 App Manager as the app store of your organization, it is very important to know how to replace default favicon of WSO2 App Manager by your organization logo. Here are the steps to do it.

How to Change Store Favicon


If you want to change the Store favicon, replace favicon.png in <APPM_HOME>/repository/deployment/server/jaggeryapps/store/themes/store/libs/theme-wso2_1.0/images by the logo you want to have.

Then, Store will be like below. You will see the new favicon.



How to Change Webapp Favicons


If you want to change the favicon of all webapps, you need to do some code changes. Here's how to do it.

1. Clone wso2 carbon-mediation code from here. Make you sure to use correct branch as per your App Manager version. For example, you need to get release-4.6.1 version for App Manager 1.2.0.

2. Go to carbon-mediation/components/mediation-initializer/org.wso2.carbon.mediation.transport.handlers directory.

3. Change the icon location of favicon icon in here like this.
   
   response.addHeader("Location", "http://wso2.org/favicon.ico");  
   
4. Build org.wso2.carbon.mediation.transport.handlers component. Then there will be org.wso2.carbon.mediation.transport.handlers-4.6.1.jar in the target folder.

5. Add org.wso2.carbon.mediation.transport.handlers-4.6.1.jar as a patch to App Manager server. For that, create a directory "patch0900" inside <APPM_HOME>/repository/component/patches/ and copy the jar into it.

6. Restart the server.

Favicon of Gateway response will be displayed as below.