All Projects → thiagoprocaci → Springboot React Jwt

thiagoprocaci / Springboot React Jwt

JSON Web Token / React / Spring Boot example

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Springboot React Jwt

Simplemall
基于SpringCloud的微服务架构实战案例项目,以一个简单的购物流程为示例,融合spring cloud 相关组件,如spring-cloud-netflix、swagger等
Stars: ✭ 687 (+854.17%)
Mutual labels:  spring-boot, jwt
Spring Boot Webflux Jjwt
Example Spring Boot and WebFlux (Reactive Web) with Spring Security and JWT for token Authentication and Authorization
Stars: ✭ 71 (-1.39%)
Mutual labels:  spring-boot, jwt
Jose Jwt
Ultimate Javascript Object Signing and Encryption (JOSE) and JSON Web Token (JWT) Implementation for .NET and .NET Core
Stars: ✭ 692 (+861.11%)
Mutual labels:  jwt, jwt-token
F License
Open Source License Key Generation and Verification Tool written in Go
Stars: ✭ 535 (+643.06%)
Mutual labels:  jwt, jwt-token
Spring React Boilerplate
Boilerplate application to demonstrate how to wire up Spring, JWT Authentication, React, Redux and Websockets
Stars: ✭ 70 (-2.78%)
Mutual labels:  spring-boot, jwt
Springboot Jwt Starter
A Spring Boot JWT starter kit for stateless and token-based authentication apps.
Stars: ✭ 538 (+647.22%)
Mutual labels:  spring-boot, jwt
Go Book Store Api
Go Sample project to understand Mysql CRUD operation with best practises Includes logging, JWT, Swagger and Transactions
Stars: ✭ 18 (-75%)
Mutual labels:  jwt, jwt-token
Jwt
Go JWT signing, verifying and validating
Stars: ✭ 394 (+447.22%)
Mutual labels:  jwt, jwt-token
Jwt
Kotlin JWT 🔑 implementation (Json Web Token) as required by APNs 🔔 (Apple Push Notifications) or Sign in with Apple 🍏
Stars: ✭ 31 (-56.94%)
Mutual labels:  jwt, jwt-token
Php Storageless Sessions
Sessions handler which stores session data in HMAC-signed and encrypted cookies
Stars: ✭ 29 (-59.72%)
Mutual labels:  jwt, jwt-token
Shirojwt
API SpringBoot + Shiro + Java-Jwt + Redis(Jedis)
Stars: ✭ 503 (+598.61%)
Mutual labels:  spring-boot, jwt
Duckygo
一个同时支持Session以及JWT的高性能高可用 Golang Restful API 脚手架 !
Stars: ✭ 57 (-20.83%)
Mutual labels:  jwt, jwt-token
Cerberus
A demonstration of a completely stateless and RESTful token-based authorization system using JSON Web Tokens (JWT) and Spring Security.
Stars: ✭ 482 (+569.44%)
Mutual labels:  spring-boot, jwt
Spring Cloud Platform
🔥🔥🔥国内首个Spring Cloud微服务化RBAC的管理平台,核心采用Spring Boot 2.4、Spring Cloud 2020.0.0 & Alibaba,前端采用d2-admin中台框架。 🔝 🔝 记得上边点个star 关注更新
Stars: ✭ 5,514 (+7558.33%)
Mutual labels:  spring-boot, jwt
Spring Boot In Action
Spring Boot 系列实战合集
Stars: ✭ 4,153 (+5668.06%)
Mutual labels:  spring-boot, jwt
Spring Boot Jwt
JWT auth service using Spring Boot, Spring Security and MySQL
Stars: ✭ 795 (+1004.17%)
Mutual labels:  spring-boot, jwt
His
HIS英文全称 hospital information system(医院信息系统http://59.110.234.89:9999/swagger-ui.html ),医疗信息就诊系统,系统主要功能按照数据流量、流向及处理过程分为临床诊疗、药品管理、财务管理、患者管理。诊疗活动由各工作站配合完成,并将临床信息进行整理、处理、汇总、统计、分析等。本系统包括以下工作站:门诊医生工作站、药房医生工作站、医技医生工作站、收费员工作站、对帐员工作站、管理员工作站。需求为东软提供的云医院。
Stars: ✭ 359 (+398.61%)
Mutual labels:  spring-boot, jwt
Microservices Spring Boot
The source code for series of articles on Medium about Microservices with Spring Boot
Stars: ✭ 382 (+430.56%)
Mutual labels:  spring-boot, jwt
Hello Sso Jwt Resource
Single Sign On (SSO) Example with JSON Web Token (JWT), Spring Boot
Stars: ✭ 10 (-86.11%)
Mutual labels:  spring-boot, jwt
Oidc Workshop Spring Io 2019
Workshop at Spring I/O 2019 on "Securing Microservices with OpenID Connect and Spring Security 5.1"
Stars: ✭ 43 (-40.28%)
Mutual labels:  spring-boot, jwt

JSON Web Token / React / Spring Boot example

This is an example project where a Spring REST API is secured using JSON Web Tokens. There are few examples available for Java and React and there are some traps. So, I decided to make my proof of concept, creating a standalone project. Everything is published in this repository.

JSON Web Tokens

JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed. JWTs can be signed using a secret (with the HMAC algorithm) or a public/private key pair using RSA [1].

When should you use JSON Web Tokens?

Here are some scenarios where JSON Web Tokens are useful:

  • Authentication: This is the most common scenario for using JWT. Once the user is logged in, each subsequent request will include the JWT, allowing the user to access routes, services, and resources that are permitted with that token. Single Sign On is a feature that widely uses JWT nowadays, because of its small overhead and its ability to be easily used across different domains [1].

  • Information Exchange: JSON Web Tokens are a good way of securely transmitting information between parties, because as they can be signed, for example using public/private key pairs, you can be sure that the senders are who they say they are. Additionally, as the signature is calculated using the header and the payload, you can also verify that the content hasn't been tampered with [1].

More Information About JSON Web Tokens

For more details, check out the website https://jwt.io/ .

Server Side: Spring Boot

Spring boot is excellent to create RESTful services. On the server side, the JWT signing is done in the /api/authentication REST call in AuthProviderService (the class that implements the AuthenticationProvider from Spring Security). In addition, it has an H2 database containing 2 users (username: admin ; pass: admin / username: tomcat ; pass: tomcat). The api/user REST call in UserController returns the user data, if the user is already aauthenticated.

The verification is done in the Filter (JwtAuthenticationTokenFilter). It filters every request different from /api/authentication and api/user. If a correct token isn't found an 401 http response is returned. If a correct token is found, the Authentication object is added to the Spring Security Context and can be used in any REST endpoint (as shown in UserController).

The JWT signing is done by an excellent Java JWT library (https://github.com/jwtk/jjwt).

Client Side: ReactJS

The simple React app shows a login page. On successful login it, the user is redirected to the main page which shows his username and token.

Setup

  • Install node version 4.4.7
  • Install npm version 2.15.8
  • Install Java jdk 1.8
  • Install Maven 3.x
  • Add Java and Maven to the env variable PATH

Everything tested on ubuntu 15.10

Install

  • In the folder back-end run "mvn install"
  • In the folder back-end/target run "sample-app-1.0-SNAPSHOT.jar " and keep it running
  • In the folder front-end/app-react run "sh run.sh" and keep it running

Usage

URL access: http://localhost:8080

References

[1] https://jwt.io/introduction/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].