Integration between alfresco and spring-data - spring-data

We would like to create alfresco AMP module, which will use spring-data to connect to external database. Is it possible to create such module?
Thank you

Yes, you can do it by providing database properties in alfresco-global.properties
db.driver: The fully-qualified name of the JDBC driver class
db.url: The JDBC URL to the database connection
db.username: The name used to authenticate with the database
db.password: The password used to authenticate with the database
and configure your database with required settings
Refer this doc link for more information

Related

Keycloak server embedded in a Spring Boot application with custom User Storage SPI

I have managed to set up a Keycloak server embedded in a Spring Boot Application successfully, following this tutorial:
Keycloak Embedded in a Spring Boot Application
in order to avoid setting it up manually.
Since I am dealing with an old implementation that already has it's own DB, I decided to use Keycloak's User Storage SPI to connect to an external postgresql DB and use this for authentication instead of Keycloak DB.
To do this, I followed the tutorial on Keycloak documentation, but it envolves a standalone Keycloak server, creating a .jar with the custom provider and injecting it to <pathToKeycloak>/standalone/deployments/.
I have created an implementation that works with a standalone Keycloak server, but now I want to include it to the embedded one. Is it possible to use a Keycloak server Embedded in a Spring Boot Application and also have an embedded custom User Storage Provider, to avoid setting up manually?
If you have already implemented the provider and the provider factory, you only need to declare the provider factory class in the resources/META-INF/services/org.keycloak.storage.UserStorageProviderFactory file.
Then you can log in to the administration console and enable user storage provider on the User Federation page.

How to access the MongoDB 'local' database in Cloud Foundy?

When I create a binding with the service MongoDB, CF creates me a new user and provides me credentials/db name which cannot access the 'local' database as the user has not the admin role.
See below in the screenshot, I can access the 'local' database on my MongoDB installed locally on my PC and on the CF database (connected with SSH) I can only accesses the DB '201af166f4b82788' and I do not see the 'local'.
How could I grant access to the local DB to my CF user?
Thanks!
It looks like your Mongodb provider does not give you the permissions to do this. I don't think there's anything you can do to circumvent the permissions given by your provider.
If you have a legit use case that needs access, you should contact the Support team for your Mongodb provider and see if they can do anything to help.
Other options would be to find a different Mongodb provider, perhaps one that can provide you with a dedicated Mongodb server or host your own Mongodb. If you host your own then you can configure it to do whatever you want.
If you end up hosting your own or using a provider that's outside of your Cloud Foundry marketplace, you can create a user provided service (see cf cups) with the information, bind that to your app and read the information just like you would from a provider in the marketplace.
Hope that helps!

Connecting springDataMongo app to Cosmos Db instead of MongoDb

I have an existing java springboot application that uses springDataMongo api to connect to an underlying Mongodb instance.
I need to use the existing springDataMongo api classes but instead of Mongodb, I need to connect Cosmos Db.
I have looked it up on documentation for azure Cosmos db api for Mongodb but didn't get hold of what I am trying to do.
Can someone let me know if what I am doing is possible and if yes, point me to a relevant documentation for the same.
Yes, it is possible to connect to Azure Cosmos DB MongoDB API using springDataMongo.
What you need to do is copy the Cosmos DB connection string from the Azure portal and then put it into spring.data.mongodb.uri in application.properties file of your spring boot project.
application.properties
#mongodb
spring.data.mongodb.uri=mongodb://[username]:[passowrd]#[cosmosdbName].documents.azure.com:10255/?ssl=true
spring.data.mongodb.database=[dababaseName]
After that done, you can check this guide out: Accessing Data with MongoDB.

WSO2 Identity Server Authentication

I have a requirement that, I need to authenticate the User Credentials via WSO2 Identity Server. The user credentials are stored in the separate Database. Can anyone explain how to achieve this?
All of the WSO2 products are based on WSO2 Carbon framework (an award-winning, light-weight, service-oriented platform for all WSO2 products), and can be configured to use a existing centralized user management systems as the user store.
In WSO2 Carbon-based products, there are four user store manager classes that implement the AbstractUserStoreManager class. You can select one of those classes according to the user store that you have in your environment.
org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager
org.wso2.carbon.user.core.ldap.ReadOnlyLDAPUserStoreManager
org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager
org.wso2.carbon.user.core.ldap.ActiveDirectoryLDAPUserStoreManager
You can write a custom JDBC user store manager, if your data in RDBM system. Have a look on Writing a Custom User Store Manager, specially check on Implementing a custom JDBC user store manager
When a JDBC user store is used as a primary or secondary user store, the user details will be stored in “UM_USER” table upon user creation. Following are the columns of the table.
UM_ID
UM_USER_NAME
UM_USER_PASSWORD
UM_SALT_VALUE
UM_REQUIRE_CHANGE
UM_CHANGED_TIME
UM_TENANT_ID
All WSO2 products are defult shipped with H2 database internally. H2 database stores registry and user management data.
This H2 data can easily achived by enabling the H2DatabaseConfiguration in carbon.xml that located /repository/conf.
Follow the following configuration steps to achive H2 database in browser.
Open the carbon.xml file and paste the H2DatabaseConfiguration as follows.
Note: Don't uncomment the H2DatabaseConfiguration which already there.
<H2DatabaseConfiguration>
<property name="web"/>
<property name="webPort">8082</property>
<property name="webAllowOthers"/>
</H2DatabaseConfiguration>
Start the server.
Direct your browser to http://localhost:8082
Fill the JDBC url, username and password as follows.
JDBC url: jdbc:h2:/repository/database/WSO2CARBON_DB
username: wso2carbon
password: wso2carbon
If anyone want replace H2 database with different kind of databases like MySQL you can do it as follows. Refer[1].
[1] https://docs.wso2.com/display/IS500/Setting+up+MySQL

Get IBM Bluemix SQL Database service credentials before I bind it to application, is it possible?

When I bind SQL Database service to an application I can see credentials from application panel. But in case I've created a service and would like to work with it before I'm binding to any application, is it possible? I haven't find a way to see credentials, only internal tools to work with database.
Thank you.
Once you provision a new SQL Database instance, you need to enter the service details page in bluemix, find the 'Launch' button to go to the service page which will open up separately. On the service page go to Set up `-->` Connect Applications `-- >` Connection settings. You will get all the connection details except the username and password.
If you are not able to resolve the username and password then you have got two alternatives :-
1. Create a dummy application, bind it to your SQL Database, get the credentials from VCAP_SERVICES, and you can use them externally.
2. If you are looking for something only on `DB2` then you have another alternative called `DashDB` available in Bluemix. Here the settings are well defined, credentials are clearly available and will work even without binding the service to an application.
Hope this helps you. Thanks.