Skip to content

rbaul/jwt-security-spring-boot

Repository files navigation

JWT Security Spring Boot Starter

Spring Boot Starter for JWT Security.

Easy JWT security for your Spring Boot applications

Build Status Sonatype Nexus (Snapshots) badge CodeFactor License

Demo

Build on

  • Java 8
  • Spring Boot 2.1.2

Setup

Maven dependency
<repositories>
    <repository>
        <id>Sonatype</id>
        <name>Sonatype's repository</name>
        <url>https://oss.sonatype.org/content/groups/public/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

<dependency>
    <groupId>com.github.rbaul</groupId>
    <artifactId>jwt-security-spring-boot-starter</artifactId>
    <version>0.0.2-SNAPSHOT</version>
</dependency>
Gradle dependency
repositories {
    maven { url "https://oss.sonatype.org/content/groups/public" }
}

compile 'com.github.rbaul:jwt-security-spring-boot-starter:0.0.2-SNAPSHOT'

Properties example

Privilege must have prefix ROLE_

security.jwt:
#    token:
#      expiration: 600000
#      secret-key: secret-key-for-encryption
#      header-name: Authorization
#      password-strength: 7
#      prefix: Bearer
#      claims:
#        roles-key: roles
#        privilege-key: privileges
  roles:
    - name: Viewer
      description: View user
      privileges:
        - ROLE_VIEW_PRIVILEGE
    - name: Editor
      description: Editor user
      privileges:
        - ROLE_CHANGE_PRIVILEGE
        - ROLE_VIEW_PRIVILEGE
  users:
    - username: viewer
      password: viewer
      roles:
        - Viewer
    - username: editor
      password: editor
      roles:
        - Editor
  privileges:
    - name: ROLE_CHANGE_PRIVILEGE
      description: "Change privilege"
    - name: ROLE_VIEW_PRIVILEGE
      description: "View privilege"
#  administrator:
#    username: admin
#    password: admin
#    role-name: Administrator
#    privilege-name: ROLE_ADMIN_PRIVILEGE

About

JWT Security Spring Boot Starter

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •