Skip to content

Spring Lemon Reactive Guide

Sanjay Patel edited this page Jun 28, 2019 · 6 revisions

Just like spring-lemon-jpa, spring-lemon-reactive is another leafs in the spring-lemon set of libraries, which your reactive monoliths or authentication services can use. It adds authentication functionalities to spring-lemon-commons-mongo. It comes with a lot of things, which are discussed below. To know how use these, please refer to the demo reactive application.

AbstractMongoUser

AbstractMongoUser comes with the essential user fields, such as email and password. Your User entity should inherit this. To know how, refer to the demo reactive application.

Adding roles to your application

The roles field of AbstractUser holds all the user roles. It's a set of String, and so you're free to add any custom roles you may want to use in your application.

Security configuration

LemonReactiveSecurityConfig, along with all the helper beans in the com.naturalprogrammer.spring.lemonreactive.security package, are responsible for configuring security of your application.

It's quite customizable — provide your own bean to override a built-in one.

Email Validation for uniqueness

UniqueEmail and UniqueEmailValidator define a constraint that's used in AbstractMongoUser for ensuring uniqueness of emails of the user.

LemonReactiveController and LemonReactiveService

LemonReactiveController and LemonReactiveService classes define a user-module API. You'll need to extend these. To know how, refer to the demo reactive application.

LemonReactiveService is composed of many protected methods, which could be overridden for any customization.

LerUtils

LerUtils contains a few of utility methods.