Public User Registration Database module
The Public User Registration Database module depends on the Public User Registration module and also on Rest Security module. This module doesn’t replace the functionality of Magnolia’s PUR. The idea behind this module is to provide a way to save public users in an external SQL database. On top of that, it also provides additional rest endpoints for easier public user management, authorization, and authentication. Authentication is based on JWT token (for more info please check Rest Security module).
The information here covers the submodules:
PUR DB Core: allows saving users to an external SQL database.
PUR DB App: lets you browse and manage users from Magnolia Custom Content application.
PUR DB REST: provides a REST API which is used to manage as well as authenticate and authorize users from the SQL database.
This module is at the INCUBATOR level.
Installing with Maven
Maven is the easiest way to install the module. Add the following to your bundle:
<dependency> <groupId>info.magnolia.pur</groupId> <artifactId>magnolia-module-pur-db-core</artifactId> <version>1.0</version> </dependency>
<dependency> <groupId>info.magnolia.pur</groupId> <artifactId>magnolia-module-pur-db-app</artifactId> <version>1.0</version> </dependency>
<dependency> <groupId>info.magnolia.pur</groupId> <artifactId>magnolia-module-pur-db-rest</artifactId> <version>1.0</version> </dependency>
This usage section is broken down into the PUR DB Core and PUR DB REST usage.
|Once installed, the PUR DB App is used and accessed directly from admincentral.|
PUR DB Core
To function properly, this module requires configuration(s) in module configuration locations. Configuration can be located in JCR config node or a
First, we need to pass the database connection information to the module. This is minimum configuration that needs to be passed to the module so it can connect to a database instance:
datasource: username: [db_user] password: [db_password] url: [db_url] driver: [db_driver] migration: path: pur-db-core/dbmigration/[db_type] run: [true/false]
datasource: username: user password: password url: jdbc:mysql://127.0.0.1:3306/pur driver: com.mysql.cj.jdbc.Driver migration: path: pur-db-core/dbmigration/mysql run: true
All properties that are prefixed with "pur-db." are be passed to the ebean server. This way we can easily tune ebean ORM framework.
For more info on Ebean ORM, see here.
Database info and requirements
This module does not create a database. The database must exist and a database user has to have also
CREATE/DROP/ALTER RIGHTS on that database.
In case database structure needs to be updated, it has to be done through ebean dbmigration (manual db update is not allowed by ebean as there is a
checksum verification). This can be done by simply updating domain beans (new or removed fields), and running main method from
GenerateDbMigration class (`pathToResource` might have to be adapted there) which will generate new files in corresponding path.
For the database connection to work, we need the appropriate database driver to be available on the classpath. For example, if we are using a mysql database with a tomcat server, we need to place "mysql-connector-java-8.0.18.jar" in the tomcat
PUR DB REST
To function properly the PUR DB REST module requires configuration in module configuration locations. Configurations can be located in JCR config node or the
Below is default module configuration which can be overwritten if needed, by providing custom Form Processors.
registrationProcessorClass: 'info.magnolia.module.publicuserregistration.processors.RegistrationProcessor' validateRegistrationProcessorClass: 'info.magnolia.module.publicuserregistration.processors.EnableUserByUuidProcessor' loginProcessorClass: 'info.magnolia.pur.db.app.processors.DbLoginProcessor' forgotPasswordProcessorClass: 'info.magnolia.pur.db.app.processors.DbPasswordProcessor' changePasswordProcessorClass: 'info.magnolia.module.publicuserregistration.processors.TokenPasswordProcessor' updateProfileProcessorClass: 'info.magnolia.module.publicuserregistration.processors.UpdateProcessor'