Skip to content

Coreoz/Plume-admin

Repository files navigation

Plume Admin

Build Status Maven Central

Plume Admin is based on Plume Framework, it provides Jersey web services to build an administration area.

If you are looking for a JavaScript frontened that uses these web-services, check out the Plume Admin UI for AngularJS.

Looking for a demo? Check out the Plume Demo project.

Installation

  1. Maven dependency:
<dependency>
    <groupId>com.coreoz</groupId>
    <artifactId>plume-admin-ws</artifactId>
</dependency>
  1. Guice module: install(new GuiceAdminWsWithDefaultsModule())
  2. Jersey web-services: packages("com.coreoz.plume.admin.webservices")
  3. Jersey admin security: register(AdminSecurityFeature.class)
  4. Generate a JWT secret key and register it in your configuration: admin.jwt-secret = "long_generated_password_to_secure_jwt_tokens"
  5. SQL, see setup files
  6. Install a JS frontend like Plume Admin UI for AngularJS

Current user access

To fetch the current user in an administration web-service, this Jersey binder must be installed in the Jersey configuration class:

register(new AbstractBinder() {
	@Override
	protected void configure() {
		bindFactory(WebSessionAdminFactory.class).to(WebSessionPermission.class).in(RequestScoped.class);
		bindFactory(WebSessionAdminFactory.class).to(WebSessionAdmin.class).in(RequestScoped.class);
	}
});

Admin security

To use this module without Admin Web-services, an implementation of WebSessionClassProvider must be provided.

Configuration

To generate JWT secret, LastPass generator can be used with a password length of about 50 characters.

# this key should be changed in production if test users cannot be trusted
admin.jwt-secret = "long_generated_password_to_secure_jwt_tokens"
# default values
admin.session-duration = 12 hours
admin.login.max-attempts = 5
admin.login.blocked-duration = 30 seconds
# enable to ensure that users passwords are long enough
admin.passwords.min-length = 0

WS System module

To set up the module, install the Plume Schedule module in ApplicationModule: install(new GuiceSchedulerModule());

HTTP API Log module

To set up the module:

  • Maven:
<dependency>
  <groupId>com.coreoz</groupId>
  <artifactId>plume-admin-api-log</artifactId>
</dependency>
  • Install the Plume Schedule module in ApplicationModule: install(new GuiceSchedulerModule());
  • Scheduler:
LogApiScheduledJobs logApiScheduledJobs; // from dependency injection
logApiScheduledJobs.scheduleJobs();

Upgrade instructions

See the upgrade file to see the upgrade instructions.

Hibernate

If hibernate is used, install Guice brige module: install(new GuiceHibernateToQuerydslBridgeModule())