jwt

Demo for jwt integration

License

License

Categories

Categories

Spring Boot Container Microservices
GroupId

GroupId

com.github.crazyxxl
ArtifactId

ArtifactId

spring-boot-start-demo-jwt
Last Version

Last Version

0.0.1-RELEASE
Release Date

Release Date

Type

Type

jar
Description

Description

jwt
Demo for jwt integration
Source Code Management

Source Code Management

https://github.com/crazyxxl/jwt

Download spring-boot-start-demo-jwt

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.crazyxxl/spring-boot-start-demo-jwt/ -->
<dependency>
    <groupId>com.github.crazyxxl</groupId>
    <artifactId>spring-boot-start-demo-jwt</artifactId>
    <version>0.0.1-RELEASE</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.crazyxxl/spring-boot-start-demo-jwt/
implementation 'com.github.crazyxxl:spring-boot-start-demo-jwt:0.0.1-RELEASE'
// https://jarcasting.com/artifacts/com.github.crazyxxl/spring-boot-start-demo-jwt/
implementation ("com.github.crazyxxl:spring-boot-start-demo-jwt:0.0.1-RELEASE")
'com.github.crazyxxl:spring-boot-start-demo-jwt:jar:0.0.1-RELEASE'
<dependency org="com.github.crazyxxl" name="spring-boot-start-demo-jwt" rev="0.0.1-RELEASE">
  <artifact name="spring-boot-start-demo-jwt" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.crazyxxl', module='spring-boot-start-demo-jwt', version='0.0.1-RELEASE')
)
libraryDependencies += "com.github.crazyxxl" % "spring-boot-start-demo-jwt" % "0.0.1-RELEASE"
[com.github.crazyxxl/spring-boot-start-demo-jwt "0.0.1-RELEASE"]

Dependencies

compile (4)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter Optional jar
org.springframework.boot : spring-boot-configuration-processor Optional jar
io.jsonwebtoken : jjwt jar 0.7.0
commons-codec : commons-codec jar 1.10

provided (3)

Group / Artifact Type Version
javax.servlet : javax.servlet-api jar 3.1.0
javax.servlet.jsp : javax.servlet.jsp-api jar 2.3.1
org.projectlombok : lombok jar 1.16.12

Project Modules

There are no modules declared in this project.

springboot项目中如何使用该组件

首先添加pom

<dependency>
	<groupId>com.xxl.book</groupId>
	<artifactId>book-demo1</artifactId>
	<version>0.0.1-SNAPSHOT</version>
</dependency>

其次在程序启动处添加注解@JWT

@SpringBootApplication
@JWT
public class BookStart {
	public static void main(String[] args) {
		SpringApplication.run(BookStart.class, args);
	}
}

最后在配置文件添加配置:

##加密秘钥,不可为空
jwt.jwtKey=howsillyyouare
##需要拦截的路径,不可为空
jwt.urlPatterns=/api/v1/content/*
##认证未通过分发路径,不可为空
jwt.authFailPath=/api/v1/Authfail
##请求头起始位置标志,可为空
jwt.headerStartTag=book
##获取用户信息标志,可为空,默认为claims
jwt.claimsInfo

Versions

Version
0.0.1-RELEASE