spring security

  1. security定義
    Spring Security 是一個提供身份驗證,授權和保護以防止常見攻擊的框架.憑藉對命令式和響應式應用程序的一流支持,他是用於保護基於Spring的應用程序的事實上的標準.
  2. 使用先決條件
    需要Java 8 或更高版本的運行環境
  3. 許可認證
    Spring Security 是在 Apache 2.0許可下發行的開源軟件
  4. spring Securtity 的源碼地址
    https://github.com/spring-projects/spring-security/
  5. maven 裏面的pom.xml 引入
    SpringBoot 版
<dependencies>
    <!-- ... other dependency elements ... -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
</dependencies>

由於springboot提供了一個Maven BOM 來管理依賴版本,因此我們無需指定版本,如果可以更改版本
可以加上一下任意一種配置

<properties>
    <!-- ... -->
    <spring-security.version>5.3.0.RELEASE</spring-security.version>
</dependencies>
或者
<properties>
    <!-- ... -->
    <spring.version>5.2.4.RELEASE</spring.version>
</dependencies>

非SpringBoot版
當我們沒在springboot下面使用SpringSecurity時,首選方法是使用SpringSecurity的BO,以確保在整個項目中使用一致的SpringSecurity版本

<dependencyManagement>
    <dependencies>
        <!-- ... other dependency elements ... -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-bom</artifactId>
            <version>{spring-security-version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
  1. SpringSecurity的特點
    SpringSecurity 爲身份驗證,授權和針對常見漏洞的防護提供了全面的支持.他還提供與其他庫的集成,以簡化其應用.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章