spring-bootspring-securityoauth-2.0jwtspring-security-oauth2

Spring security JWT without OAuth


Recently I started learn how to configure spring boot with oauth 2.0 + jwt, and I have a question: is it possible to use spring boot security + jwt avoiding oauth 2.0?


Solution

  • Yes, it is possible to use JWT functionalities without the usage of standardized OAuth 2.0 flows. Here is a good example implementation to help you out. Another example can be found at AUTH0. You can use for example this dependency:

    <!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-jwt -->
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-jwt</artifactId>
        <version>1.0.9.RELEASE</version>
    </dependency>