1. 程式人生 > >shiro+springboot 許可權攔截器問題

shiro+springboot 許可權攔截器問題

login.html:1 Uncaught SyntaxError: Unexpected token <
login.html:17 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8088/login/login.html".
login.html:13 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8088/login/login.html".
login.html:1 Uncaught SyntaxError: Unexpected token <
login.html:14 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8088/login/login.html".
login.html:18 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8088/login/login.html".
4login.html:1 Uncaught SyntaxError: Unexpected token <
login.html?username=puu&password=rootroot:190 Uncaught ReferenceError: toastr is not defined
    at login.html?username=puu&password=rootroot:190
(anonymous) @ login.html?username=puu&password=rootroot:190
2login.html:1 Uncaught SyntaxError: Unexpected token <

該錯誤是因為前端的配置檔案沒有載入進來,改正加上配置檔案的目錄即可

        filterChainDefinitionMap.put("/static/**", "anon");
        filterChainDefinitionMap.put("/img/**", "anon");
        filterChainDefinitionMap.put("/lib/**", "anon");
        filterChainDefinitionMap.put("/login/**", "anon");
        filterChainDefinitionMap.put("/maxgraph/**", "anon");

相關推薦

shiro+springboot 許可權攔截問題

login.html:1 Uncaught SyntaxError: Unexpected token < login.html:17 Resource interpreted as Stylesheet but transferred with MIME type t

java專案許可權控制的理解和示例(基於shiro和傳統攔截filter兩種方式)

1.概念 個人理解,許可權就是做到對不同使用者進行訪問限制,前提是保證在許可權需求設計範圍內不會出現非法也能訪問到不該訪問到的東西.因此按資料表設計將許可權分為:部門,使用者,角色,角色許可權中間表,許可權.(個人覺得一般專案可以考慮部門和角色合為一個),這

springboot 實現攔截許可權過濾,以及用攔截實現操作日誌功能(二)

接上文 繼承WebMvcConfigurerAdapter 類,新增 上文寫的攔截類 具體程式碼如下: package com.hcmony.web.interceptor; import org

SpringBoot攔截使用@Autowired註入接口為null解決方法

res 自定義 row 攔截 request spa mvcc gist private 最近使用SpringBoot的自定義攔截器,在攔截器中註入了一個DAO,準備下面作相應操作,攔截器代碼: public class TokenInterceptor implemen

SpringBoot配置攔截

href 步驟 reg void 成功 config 技術分享 pub 表示 【配置步驟】 1.為類添加註解@Configuration,配置攔截器 2.繼承WebMvcConfigurerAdapter類 3.重寫addInterceptors方法,添加需要攔截的請求 @

springboot(5)——攔截

1、使用註解@Configuration配置攔截器 2、繼承WebMvcConfigurerAdapter 3、重寫addInterceptors 註冊新增需要的攔截器,匹配地址 編寫一個監聽器 // CommonInterceptor.java 獲取專

springboot初探攔截過濾器及監聽器

先上一張常見的圖。 過濾器會在請求進入servlet之前預處理請求,可以修改HttpServletRequest的請求頭和請求資料,需要實現java的Filter介面。攔截器則是在請求被Servlet接收後,通過java反射呼叫方式實現的,自定義攔截器需要實現Interceptor介面,或

SpringBoot 增加 攔截 判斷是否登入

1、建立攔截器 package com.example.demo.interceptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.servlet.Hand

springboot-登入攔截

小夥伴們大家好,今天給大家分享一個簡單的springboot版登入攔截器 首先我們需要在springboot的啟動類中讓它實現WebMvcConfigurer 這個介面 比如: 1 public class springApplication implements WebMvcConfigurer

SpringBoot專案攔截中通過流獲取Request請求物件中的引數後,控制器中@RequestBody註解引數獲取不到

一、場景     第一次搭建專案開發環境,需要在專案中實現日誌攔截器,用來獲取使用者請求引數日誌,以便在後期維護中出現BUG時能夠快速定位錯誤發生的場景。請求引數一般通過GET和POST方式進行傳遞,GET請求引數獲取通過request.getParameterMap()獲

springboot攔截的使用

第一步:建立一個實現 HandlerInterceptor 的類。 import org.springframework.web.servlet.HandlerInterceptor; import

SpringBoot攔截使用@Autowired注入介面為null解決方法

public class TokenInterceptor implements HandlerInterceptor { @Autowired private ITokenDao tokenDao; @Override public

淘淘商城08_許可權攔截04

把使用者的許可權和選單存放到session中 SysPermissionUserMapper: package com.taotao.mapper; import java.util.List; import com.taotao.pojo.SysPermission; publ

SpringBoot攔截

其實SpringBoot和SpringMVC的攔截器是一樣的,SpringBoot只是拋棄了XML配置,在Java類裡面完成配置而已。 程式碼示例: 1、建立我們自己的攔截器類並實現 HandlerInterceptor 介面,LoginInterceptor類、 /** * @aut

springboot實現攔截

1,先寫個介面,如下: 測試一下寫好的介面,如下 2,新建一個類並實現HandlerInterceptor,如下 基本的攔截只需要重寫preHandle方法,下面兩個方法可以不用管 3,新建一個類,繼承WebMvcConfigurerAdapter,並加入第2步新建的

SpringBoot攔截對資料庫的訪問

    在專案中遇到了需要在攔截器中對資料庫進行查詢!     在網上查了一些方法,像@Bean或者@Service等都沒有得到想要的結果。但是還是找到了一種方法進行解決。     忘記了是在那個網頁看到的了!!!抱歉!     解決方案如下:     第一步: @Con

springboot(八)攔截之驗證登入

新增jar包,這個jar包不是必須的,只是在攔截器裡用到了,如果不用的話,完全可以不引入 <dependency> <groupId>org.apache.commons</groupId> <artifactId&g

spring boot入門(七) springboot攔截Interceptor。最完整、簡單易懂、詳細的spring boot教程。

很多同學搞不懂攔截器和過濾器的區別,我們先說一下他們的區別: 過濾器和攔截器非常相似,但是它們有很大的區別 最簡單明瞭的區別就是過濾器可以修改request,而攔截器不能 過濾器需要在servlet容器中實現,攔截器可以適用於javaEE,javaSE等各種環境 攔截

springBoot實現攔截的幾種方式

1)攔截器實現HandlerInterceptor介面,重寫三個方法:preHandle,postHandle,afterCompletion, MySpringMVCConfig 實現 WebMvcConfigurer 重寫addInterceptors方法,新增攔截路徑及排除攔截路徑。 im

spring boot 整合shiro,swagger 加入攔截後 swagger 不能訪問

在shiro的配置檔案中放行swagger: filterMap.put("/swagger-ui.html", "anon"); filterMap.put("/