Giter Club home page Giter Club logo

security-jwt-spring-boot-starter's Introduction

security-jwt-spring-boot-starter

security starter for spring boot

组件简介

基于 Security 的 Spring Boot Starter 实现

主要 扩展 Security + JWT 与Spring Boot的整合,实现通过yaml配置即可实现权限拦截扩展,类似Shiro的 shiro.ini 配置方式

使用说明

1、Spring Boot 项目添加 Maven 依赖
<dependency>
	<groupId>com.github.hiwepy</groupId>
	<artifactId>security-jwt-spring-boot-starter</artifactId>
	<version>${project.version}</version>
</dependency>
2、在application.yml文件中增加如下配置
spring:
  # Spring Security 配置
  security:
    # 默认路径拦截规则定义
    filter-chain-definition-map:
      '[/]' : anon
      '[/**/favicon.ico]' : anon
      '[/webjars/**]': anon
      '[/assets/**]' : anon
      '[/error*]' : anon
      '[/logo/**]' : anon
      '[/swagger-ui.html**]' : anon
      '[/swagger-resources/**]' : anon
      '[/doc.html**]' : anon
      '[/bycdao-ui/**]' : anon
      '[/v2/**]' : anon
      '[/kaptcha*]' : anon
      '[/actuator*]' : anon
      '[/actuator/**]' : anon
      '[/druid/*]' : ipaddr[192.168.1.0/24]
      '[/monitoring]' : roles[admin]
      '[/monitoring2]' : roles[1,admin]
      '[/monitoring3]' : perms[1,admin]
      '[/monitoring4]' : perms[1]
    stateless: true
    jwt:
      authc:
        enabled: true
        continue-chain-before-successful-authentication: false
        login-url-patterns: /login/jwt
        password-parameter: pwd
        post-only: true
        use-forward: false
      authz:
        enabled: true
        allow-session-creation: false
        continue-chain-before-successful-authentication: true
        path-pattern: /**
3、使用示例
 SecurityPrincipal principal = SubjectUtils.getPrincipal(SecurityPrincipal.class);

Jeebiz 技术社区

Jeebiz 技术社区 微信公共号小程序,欢迎关注反馈意见和一起交流,关注公众号回复「Jeebiz」拉你入群。

公共号 小程序

security-jwt-spring-boot-starter's People

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

cnony breggor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.