-
创建和解析明文压缩JWTs
-
创建、解析和验证所有标准JWS算法的数字签名紧凑JWTs(又称JWSs):
-
HS256: HMAC using SHA-256
-
HS384: HMAC using SHA-384
-
HS512: HMAC using SHA-512
-
RS256: RSASSA-PKCS-v1_5 using SHA-256
-
RS384: RSASSA-PKCS-v1_5 using SHA-384
-
RS512: RSASSA-PKCS-v1_5 using SHA-512
-
PS256: RSASSA-PSS using SHA-256 and MGF1 with SHA-256
-
PS384: RSASSA-PSS using SHA-384 and MGF1 with SHA-384
-
PS512: RSASSA-PSS using SHA-512 and MGF1 with SHA-512
-
ES256: ECDSA using P-256 and SHA-256
-
ES384: ECDSA using P-384 and SHA-384
-
ES512: ECDSA using P-521 and SHA-512
这里以github上的demo演示,理解原理,集成到自己项目中即可。如果您正在学习Spring Boot,推荐一个连载多年还在继续更新的免费教程:http://blog.didispace.com/spring-boot-learning-2x/
应用采用 spring boot + angular + jwt
结构图
Maven 引进 : pom.xml
<project xmlns=“http://maven.apache.org/POM/4.0.0” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=“http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”>
4.0.0
com.nibado.example
jwt-angular-spring
0.0.2-SNAPSHOT
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<commons.io.version>2.4</commons.io.version>
<jjwt.version>0.6.0</jjwt.version>
<junit.version>4.12</junit.version>
<spring.boot.version>1.5.3.RELEASE</spring.boot.version>
org.springframework.boot
spring-boot-maven-plugin
${spring.boot.version}
repackage
org.springframework.boot
spring-boot-starter