IBM Docs2.0 CR2 and above will support multiple repository in Editor Application and Viewer Application with 3rd party integration. Then one IBM Docs instance can integrate with multiple 3rd party applications concurrently. For example, two or more Box applications can connect to same IBM Docs instance.
Editor Application:
1. To support multiple repository in Editor Application, modify concord-config.json, and add the configure of following three classes for the supported repositories. Make sure the “id” is unique for each supported repository.
- com.ibm.docs.directory.external.ExternalDirectory
- com.ibm.docs.repository.external.rest.ExternalRestRepository
- com.ibm.docs.authentication.filters.ExternalAuth
Following is an example to support two Box apps in IBM Docs Editor Application.
- Configuration of com.ibm.docs.directory.external.ExternalDirectory. One “id” is box1 and another is box2.
{
"config": {
"s2s_token": "",
"s2s_method": "oauth2",
"keys": {
"org_id_key": "org_id",
"photo_url_key": "avatar_url",
"url_query_key": "ID",
"display_name_key": "name",
"name_key": "name",
"id_key": "id",
"email_key": "login"
},
"j2c_alias": "",
"profiles_url": "https://api.box.com/2.0/users/{ID}",
"token_key": "",
"docs_callback_endpoint": "https://docs.test.com./docs/driverscallback",
"oauth2_endpoint": "https://app.box.com/api/oauth2/token",
"current_user_profiles_url": "https://api.box.com/2.0/users/me",
"onbehalf_header": "",
"customer_id": "box1.com"
},
"id": "box1",
"class": "com.ibm.docs.directory.external.ExternalDirectory"
},
{
"config": {
"s2s_token": "",
"s2s_method": "oauth2",
"keys": {
"org_id_key": "org_id",
"photo_url_key": "avatar_url",
"url_query_key": "ID",
"display_name_key": "name",
"name_key": "name",
"id_key": "id",
"email_key": "login"
},
"j2c_alias": "",
"profiles_url": "https://api.box.com/2.0/users/{ID}",
"token_key": "",
"docs_callback_endpoint": "https://docs.test.com/docs/driverscallback",
"oauth2_endpoint": "https://app.box.com/api/oauth2/token",
"current_user_profiles_url": "https://api.box.com/2.0/users/me",
"onbehalf_header": "",
"customer_id": "box2.com"
},
"id": "box2",
"class": "com.ibm.docs.directory.external.ExternalDirectory"
}
- Configuration of com.ibm.docs.repository.external.rest.ExternalRestRepository. One “id” is box1 and another is box2.
{
"config": {
"s2s_token": "",
"s2s_method": "oauth2",
"repository_home": "https://app.box.com",
"token_key": "",
"media_meta_url": "https://api.box.com/2.0/files/{ID}",
"docs_callback_endpoint": "https:// docs.test.com /docs/driverscallback",
"media_get_url": "https://api.box.com/2.0/files/{ID}/content",
"oauth2_endpoint": "https://app.box.com/api/oauth2/token",
"j2c_alias": "",
"onbehalf_header": "",
"customer_id": "box1.com",
"media_set_url": "https://upload.box.com/api/2.0/files/{ID}/content"
},
"id": "box1",
"class": "com.ibm.docs.repository.external.rest.ExternalRestRepository"
},
{
"config": {
"s2s_token": "",
"s2s_method": "oauth2",
"repository_home": "https://app.box.com",
"token_key": "",
"media_meta_url": "https://api.box.com/2.0/files/{ID}",
"docs_callback_endpoint": "https://docs.test.com/docs/driverscallback",
"media_get_url": "https://api.box.com/2.0/files/{ID}/content",
"oauth2_endpoint": "https://app.box.com/api/oauth2/token",
"j2c_alias": "",
"onbehalf_header": "",
"customer_id": "box2.com",
"media_set_url": "https://upload.box.com/api/2.0/files/{ID}/content"
},
"id": "box2",
"class": "com.ibm.docs.repository.external.rest.ExternalRestRepository"
}
- Configuration of com.ibm.docs.authentication.filters.ExternalAuth. One “id” is box1 and another is box2.
{
"config": {
"customer_id": "box1.com",
"s2s_method": "oauth2",
"bypass_sso": "true",
"oauth2_authorize_endpoint": "https://account.box.com/api/oauth2/authorize"
},
"id": "box1",
"class": "com.ibm.docs.authentication.filters.ExternalAuth"
},
{
"config": {
"customer_id": "box2.com",
"s2s_method": "oauth2",
"bypass_sso": "true",
"oauth2_authorize_endpoint": "https://account.box.com/api/oauth2/authorize"
},
"id": "box2",
"class": "com.ibm.docs.authentication.filters.ExternalAuth"
}
2. If use OAuth2 has the s2s method, need to make sure the customer_id is unique also. “customer_id” will be used as unique key in Editor DB table CUSTOMER_CREDENTIAL. Use following commands to add OAuth credential to Editor DB.
On Editor server, go to folder ${WAS_INSTALL_ROOT}/profiles/AppSrv1/bin and run the following command:
- Linux: ./wsadmin.sh -lang jython -username xx -password xx -f ${PATH}/customer_credential_mgr.py -action add -customer customer_id -key key -value "value"
- Windows: wsadmin.bat -lang jython -username xx -password xx -f ${PATH}/customer_credential_mgr.py -action add -customer customer_id -key key -value "value"
where:
- customer_credential_mgr.py is located in the IBM Docs Editor installation package, ${PATH} is the location of the file, for example, CN30NML.zip\IBMConnectionsDocsrepo\ native\DocsApp_2.0.0.zip\installer\docs\tasks\ (extract the necessary files before using it)
- customer_id is the value specified in external customer_id in ${WAS_INSTALL_ROOT}/profiles/AppSrv1/config/cells/{cell}/IBMDocs-config/concord-config.json.
- key could be oauth2_client_id or oauth2_client_secret and value should be the one that the repository server assigned to Editor application.
Note: The customer_id and key limitation is 256 bytes, and maximum value is 2048 bytes.
For example:
./wsadmin.sh -lang jython -username xx -password xx -f customer_credential_mgr.py -action
add -customer box1.com -key oauth2_client_id -value
"l7xxf61984f99f404575a781d47c6bfebdca"
./wsadmin.sh -lang jython -username xx -password xx -f customer_credential_mgr.py -action
add -customer box1.com -key oauth2_client_secret -value
"cc692ce34451418e86d9b231ee34af65"
Viewer Application:
1. To support multiple repository in Viewer Application, modify viewer-config.json, and add the configure of following three classes for the supported repositories. Make sure the “id” is unique for each supported repository.
- com.ibm.docs.viewer.external.directory.ExternalDirectory
- com.ibm.docs.viewer.external.repository.rest.ExternalRestRepository
- com.ibm.docs.viewer.external.auth.ExternalAuth
Following is an example to support two Box apps in IBM Docs Viewer Application.
- Configuration of com.ibm.docs.viewer.external.directory.ExternalDirectory. One “id” is box1 and another is box2.
{
"config": {
"s2s_token": "",
"s2s_method": "oauth2",
"keys": {
"org_id_key": "org_id",
"photo_url_key": "avatar_url",
"url_query_key": "ID",
"display_name_key": "name",
"name_key": "name",
"id_key": "id",
"email_key": "login"
},
"j2c_alias": "",
"profiles_url": "https://api.box.com/2.0/users/{ID}",
"token_key": "",
"docs_callback_endpoint": "https://docs.test.com./viewer/driverscallback",
"oauth2_endpoint": "https://app.box.com/api/oauth2/token",
"current_user_profiles_url": "https://api.box.com/2.0/users/me",
"onbehalf_header": "",
"customer_id": "box1.com"
},
"id": "box1",
"class": " com.ibm.docs.viewer.external.directory.ExternalDirectory "
},
{
"config": {
"s2s_token": "",
"s2s_method": "oauth2",
"keys": {
"org_id_key": "org_id",
"photo_url_key": "avatar_url",
"url_query_key": "ID",
"display_name_key": "name",
"name_key": "name",
"id_key": "id",
"email_key": "login"
},
"j2c_alias": "",
"profiles_url": "https://api.box.com/2.0/users/{ID}",
"token_key": "",
"docs_callback_endpoint": "https://docs.test.com/docs/driverscallback",
"oauth2_endpoint": "https://app.box.com/api/oauth2/token",
"current_user_profiles_url": "https://api.box.com/2.0/users/me",
"onbehalf_header": "",
"customer_id": "box2.com"
},
"id": "box2",
"class": " com.ibm.docs.viewer.external.directory.ExternalDirectory "
}
- Configuration of com.ibm.docs.viewer.external.repository.rest.ExternalRestRepository. One “id” is box1 and another is box2.
{
"config": {
"s2s_token": "",
"s2s_method": "oauth2",
"repository_home": "https://app.box.com",
"token_key": "",
"media_meta_url": "https://api.box.com/2.0/files/{ID}",
"docs_callback_endpoint": "https:// docs.test.com /viewer/driverscallback",
"media_get_url": "https://api.box.com/2.0/files/{ID}/content",
"oauth2_endpoint": "https://app.box.com/api/oauth2/token",
"j2c_alias": "",
"onbehalf_header": "",
"customer_id": "box1.com",
"media_set_url": "https://upload.box.com/api/2.0/files/{ID}/content"
},
"id": "box1",
"class": " com.ibm.docs.viewer.external.repository.rest.ExternalRestRepository "
},
{
"config": {
"s2s_token": "",
"s2s_method": "oauth2",
"repository_home": "https://app.box.com",
"token_key": "",
"media_meta_url": "https://api.box.com/2.0/files/{ID}",
"docs_callback_endpoint": "https://docs.test.com/viewer/driverscallback",
"media_get_url": "https://api.box.com/2.0/files/{ID}/content",
"oauth2_endpoint": "https://app.box.com/api/oauth2/token",
"j2c_alias": "",
"onbehalf_header": "",
"customer_id": "box2.com",
"media_set_url": "https://upload.box.com/api/2.0/files/{ID}/content"
},
"id": "box2",
"class": " com.ibm.docs.viewer.external.repository.rest.ExternalRestRepository "
}
- Configuration of com.ibm.docs.viewer.external.auth.ExternalAuth. One “id” is box1 and another is box2.
{
"config": {
"customer_id": "box1.com",
"s2s_method": "oauth2",
"bypass_sso": "true",
"oauth2_authorize_endpoint": "https://account.box.com/api/oauth2/authorize"
},
"id": "box1",
"class": " com.ibm.docs.viewer.external.auth.ExternalAuth "
},
{
"config": {
"customer_id": "box2.com",
"s2s_method": "oauth2",
"bypass_sso": "true",
"oauth2_authorize_endpoint": "https://account.box.com/api/oauth2/authorize"
},
"id": "box2",
"class": "com.ibm.docs.viewer.external.auth.ExternalAuth"
}
2. If use OAuth2 has the s2s method, need to create j2c_alias in WAS console for each repository. The j2c_alias’s name should be viewerAuth_<id>. For example, viewerAuth_box1. “User ID” is oauth2_client_id, and “Password” is oauth2_client_secret.