All Projects → bfwg → Springboot Jwt Starter

bfwg / Springboot Jwt Starter

Licence: mit
A Spring Boot JWT starter kit for stateless and token-based authentication apps.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Springboot Jwt Starter

Cerberus
A demonstration of a completely stateless and RESTful token-based authorization system using JSON Web Tokens (JWT) and Spring Security.
Stars: ✭ 482 (-10.41%)
Mutual labels:  spring-boot, spring, jwt, spring-security
Angular Spring Starter
Full stack starter kit featuring Angular 7, Spring boot and stateless JWT authentication.
Stars: ✭ 294 (-45.35%)
Mutual labels:  spring-boot, spring, jwt, spring-security
Simplemall
基于SpringCloud的微服务架构实战案例项目,以一个简单的购物流程为示例,融合spring cloud 相关组件,如spring-cloud-netflix、swagger等
Stars: ✭ 687 (+27.7%)
Mutual labels:  spring-boot, jwt, spring-security, jwt-authentication
Spring Webflux Security Jwt
A JWT authorization and authentication implementation with Spring Reactive Webflux, Spring Boot 2 and Spring Security 5
Stars: ✭ 190 (-64.68%)
Mutual labels:  spring-boot, jwt, spring-security, jwt-authentication
Milkomeda
Spring extend componets which build from experience of bussiness, let developers to develop with Spring Boot as fast as possible.(基于Spring生态打造的一系列来自业务上的快速开发模块集合。)
Stars: ✭ 117 (-78.25%)
Mutual labels:  spring-boot, spring, jwt, spring-security
Spring Reddit Clone
Reddit clone built using Spring Boot, Spring Security with JPA Authentication, Spring Data JPA with MySQL, Spring MVC. The frontend is built using Angular - You can find the frontend source code here - https://github.com/SaiUpadhyayula/angular-reddit-clone
Stars: ✭ 210 (-60.97%)
Mutual labels:  spring-boot, spring, jwt, spring-security
Jwt Spring Security Demo
This is a demo for using JWT (JSON Web Token) with Spring Security and Spring Boot. I completely rewrote my first version. Now this solution is based on the code base from the JHipster Project. I tried to extract the minimal configuration and classes that are needed for JWT-Authentication and did some changes.
Stars: ✭ 2,843 (+428.44%)
Mutual labels:  spring-boot, jwt, spring-security, jwt-authentication
Eshop Soa
EShop基于Dubbo实现SOA服务化拆分,并基于RocketMQ解决了分布式事务(新版SpringBootSOASkeleton)
Stars: ✭ 65 (-87.92%)
Mutual labels:  spring-boot, spring, jwt, spring-security
Webfluxtemplate
Spring Webflux template application with working Spring Security, Web-sockets, Rest, Web MVC, and Authentication with JWT.
Stars: ✭ 107 (-80.11%)
Mutual labels:  spring-boot, spring, spring-security, jwt-authentication
Spring Boot Webflux Jjwt
Example Spring Boot and WebFlux (Reactive Web) with Spring Security and JWT for token Authentication and Authorization
Stars: ✭ 71 (-86.8%)
Mutual labels:  spring-boot, spring, jwt, spring-security
Spring Boot In Action
Spring Boot 系列实战合集
Stars: ✭ 4,153 (+671.93%)
Mutual labels:  spring-boot, spring, jwt, spring-security
Securing Rest Api Spring Security
Spring Boot 2.2.x + Spring 5.2.x Rest Api Security Example
Stars: ✭ 117 (-78.25%)
Mutual labels:  spring-boot, spring, jwt, spring-security
Spring Webmvc Jwt Sample
Secures REST APIs with Spring Security and JWT Token based Authentication
Stars: ✭ 299 (-44.42%)
Mutual labels:  spring-boot, spring, jwt, spring-security
Spring Microservice Sample
Spring Boot based Mircoservice sample
Stars: ✭ 199 (-63.01%)
Mutual labels:  spring-boot, spring, spring-security
Awesome Spring
A curated list of awesome books, tutorials, courses, and resources for the Spring framework ecosystem.
Stars: ✭ 186 (-65.43%)
Mutual labels:  spring-boot, spring, spring-security
Javastud
Official, Main: This is Core/Advance java example series project. It help to learn java step by step using pdf tutorial provided here and corresponding demo project for the eclipse. Tag: Java Student, Java Stud, Stud Java, StudJava, Java Teachers, Studs Quick Start Guide, Studs Java, Object Oriented Programming, Core Java, Java SE, Java EE, Java Enterprise Edition, Java Blog, Java Articles, Java Web, JSP, Servlet, Maven, Spring, Hibernate, Spring-boot, Spring MVC Web, Angular JS, Angular 2, Java Security, Java CRUD, Java Login Example, File Handling, Multi threading, exception handling, Collection classes, Swing, Database, Date Time, Joda Time, JPA.
Stars: ✭ 220 (-59.11%)
Mutual labels:  spring-boot, spring, angularjs
Spring Security Pac4j
pac4j security library for Spring Security: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 231 (-57.06%)
Mutual labels:  spring-boot, jwt, spring-security
Biking2
This is the source code of http://biking.michael-simons.eu
Stars: ✭ 162 (-69.89%)
Mutual labels:  spring-boot, spring, angularjs
Eladmin
项目基于 Spring Boot 2.1.0 、 Jpa、 Spring Security、redis、Vue的前后端分离的后台管理系统,项目采用分模块开发方式, 权限控制采用 RBAC,支持数据字典与数据权限管理,支持一键生成前后端代码,支持动态路由
Stars: ✭ 16,943 (+3049.26%)
Mutual labels:  spring-boot, jwt, spring-security
Spring Boot Spring Security Jwt Authentication
Spring Boot + Security: Token Based Authentication example with JWT, Authorization, Spring Data & MySQL
Stars: ✭ 292 (-45.72%)
Mutual labels:  spring-boot, spring-security, jwt-authentication

[中文版]

                _             _                 _       _          _         _             _
 ___ _ __  _ __(_)_ __   __ _| |__   ___   ___ | |_    (_)_      _| |_   ___| |_ __ _ _ __| |_ ___ _ __
/ __| '_ \| '__| | '_ \ / _` | '_ \ / _ \ / _ \| __|   | \ \ /\ / / __| / __| __/ _` | '__| __/ _ \ '__|
\__ \ |_) | |  | | | | | (_| | |_) | (_) | (_) | |_    | |\ V  V /| |_  \__ \ || (_| | |  | ||  __/ |
|___/ .__/|_|  |_|_| |_|\__, |_.__/ \___/ \___/ \__|  _/ | \_/\_/  \__| |___/\__\__,_|_|   \__\___|_|
    |_|                 |___/                        |__/

npm Build Status License MIT

A Springboot token-based security starter kit featuring AngularJS and Springboot (JSON Web Token)

If you're looking for using Angular 4 for frontend implementation, please checkout angular-spring-starter, a fullstack starter kit featuring Angular 4, Router, Forms, Http, Services, Spring boot, Json Web Token

Live Demo

Springboot JWT Starter

Authentication 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.

-- Auth0

Quick start

Make sure you have Maven and Java 1.7 or greater

# clone our repo
# --depth 1 removes all but one .git commit history
git clone --depth 1 https://github.com/bfwg/springboot-jwt-starter.git

# change directory to our repo
cd springboot-jwt-starter

# install the repo with mvn
mvn install

# start the server
mvn spring-boot:run

# the app will be running on port 8080
# there are two built-in user accounts to demonstrate the differing levels of access to the endpoints:
# - User - user:123
# - Admin - admin:123

Run with docker

docker-compose up --build -d

File Structure

springboot-jwt-starter/
 ├──src/                                                        * our source files
 │   ├──main
 │   │   ├──java.com.bfwg
 │   │   │   ├──config
 │   │   │   │   └──WebSecurityConfig.java                      * config file for filter, custom userSerivce etc.
 │   │   │   ├──model
 │   │   │   │   ├──Authority.java
 │   │   │   │   ├──UserTokenState.java                         * JWT model
 │   │   │   │   └──User.java                                   * our main User model.
 │   │   │   ├──repository                                      * repositories folder for accessing database
 │   │   │   │   └──UserRepository.java
 │   │   │   ├──rest                                            * rest endpoint folder
 │   │   │   │   ├──AuthenticationController.java               * auth related REST controller, refresh token endpoint etc.
 │   │   │   │   └──UserController.java                         * REST controller to handle User related requests
 │   │   │   ├──security                                        * Security related folder(JWT, filters)
 │   │   │   │   ├──auth
 │   │   │   │   │   ├──JwtAuthenticationRequest.java           * login request object, contains username and password
 │   │   │   │   │   ├──RestAuthenticationEntryPoint.java       * handle auth exceptions, like invalid token etc.
 │   │   │   │   │   ├──TokenAuthenticationFilter.java          * the JWT token filter, configured in WebSecurityConfig
 │   │   │   │   │   └──TokenBasedAuthentication.java           * this is our custom Authentication class and it extends AbstractAuthenticationToken.
 │   │   │   │   └──TokenHelper.java                             * token helper class
 │   │   │   ├──service
 │   │   │   │   ├──impl
 │   │   │   │   │   ├──CustomUserDetailsService.java           * custom UserDatilsService implementataion, tells formLogin() where to check username/password
 │   │   │   │   │   └──UserServiceImpl.java
 │   │   │   │   └──UserService.java
 │   │   │   └──Application.java                                * Application main enterance
 │   │   └──recources
 │   │       ├──static                                          * static assets are served here(Angular and html templates)
 │   │       ├──application.yml                                 * application variables are configured here
 │   │       └──import.sql                                      * h2 database query(table creation)
 │   └──test                                                    * Junit test folder
 └──pom.xml                                                     * what maven uses to manage it's dependencies

Table of Contents

Configuration

  • WebSecurityConfig.java: The server-side authentication configurations.
  • application.yml: Application level properties i.e the token expire time, token secret etc. You can find a reference of all application properties here.
  • JWT token TTL: JWT Tokens are configured to expire after 10 minutes, you can get a new token by signing in again.
  • Using a different database: This Starter kit is using an embedded H2 database that is automatically configured by Spring Boot. If you want to connect to another database you have to specify the connection in the application.yml in the resource directory. Here is an example for a MySQL DB:
spring:
  jpa:
    hibernate:
      # possible values: validate | update | create | create-drop
      ddl-auto: create-drop
  datasource:
    url: jdbc:mysql://localhost/myDatabase
    username: myUser
    password: myPassword
    driver-class-name: com.mysql.jdbc.Driver

Hint: For other databases like MySQL sequences don't work for ID generation. So you have to change the GenerationType in the entity beans to 'AUTO' or 'IDENTITY'.

JSON Web Token

JSON Web Tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties. for more info, checkout https://jwt.io/

Contributing

I'll accept pretty much everything so feel free to open a Pull-Request

This project is inspried by


License

MIT

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].