Token Based Authentication Using Spring Security


Today we wrapped up basic authentication of the application by wiring up Spring Security to work with JSON Web Tokens (JWT). As a part of this effort, we created the following 2 POST API end points.


/api/auth/signup – For registration end point

/api/auth/signin – For login


Through Spring Security, we configured CORS, CSRF, Session Management and also setup custom rules for protected resources. We used HS512 public key encryption technology to sign our keys. The keys are secured by applying a strong private signing key and will be used for communicating with secure backend end points Also on the frontend, we will be adding a “Http Request” interceptor and that will inject the Bearer token with all the server side calls.


At BundleN, we experiment with stack combinations on our own time.

For potential clients interested in this stack, we can always give a demo of what we have up until that point of time. You can reach us at sales@BundleN.com


For more details on this stack, click here

Here is the latest about our Angular + Java project.

Task

Create API End Point for registering users


Sample Payload

{

“name”:”Cool Customer”,

“email”:”MyEmailAddress@BundleN.com”,

“password”:”FFZ$#1FFZWM”

}

Task

Create API End Point for Logging In users


Sample Payload

{

“email”:”MyEmailAddress@BundleN.com”,

“password”:”FFZ$#1FFZWM”

}

It is always fun to show some stats along the way.

We use Postman a lot for API testing. Over 10 million developers and over 500K companies using Postman’s comprehensive set of built-in tools to support every stage of the API lifecycle.


With couple API’s done, Here is a quick snapshot of the Postman tests we developed so far.


User Registration User Interface

Sign Up User Interface

Roles API End Point

Social Login using Google

Social Login using Facebook

Logout

Dashboard

Dashboard Widgets,…….

sales@BundleN.com