
Java Security
JWT json web token - used for authentication instead of storing login sessions on the server, the client sends token with every request flow User Login -> Server verifies credentials -> Server creates JWT -> Clients stores JWT Client sends JWT in request -> Server verifies and grants access Authorization: Bearer token Jwt structure HEADER.PAYLOAD.SIGNATURE jwt.io Header contains algorithm: { "alg":"HS256" "typ":"JWT" } payload : { "sub":" a@c.com ", "iat":"8765456, "exp":98765456 } Signature: created using a scret key Dependecies <dependency> <groupId> org.springframework.boot </groupId> <artifactId> spring-boot-starter-security </artifactId> </dependency> <dependency> <groupId> io.jsonwebtoken </groupId> <artifactId> jjwt-api </artifactId> <version> 0.12.6 </version> </dependency> <dependency> <groupId> io.jsonwebtoken </groupId> <artifactId> jjwt-impl </artifactId> <version> 0.12.6 </version> <scope> runtime </scope> </dependency> <dependency> <groupId> io.jsonwebtoken </groupId> <ar
Continue reading on Dev.to
Opens in a new tab




