日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

如何使用postman访问若依后台权限功能

發(fā)布時(shí)間:2024/10/6 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 如何使用postman访问若依后台权限功能 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

1.前言

今天需要使用postman測(cè)試一下后端代碼,但是訪問方法需要登錄權(quán)限,在詢問了前輩后了解了解決方法,特此記錄。

2. 解決方法

首先將想要測(cè)試的方法上的權(quán)限注解注釋掉
@PreAuthorize("@ss.hasPermi(‘system:project:list’)")注釋的這里表示方法的請(qǐng)求URL。

//@PreAuthorize("@ss.hasPermi('system:project:list')")@GetMapping("/list")public TableDataInfo list(SysProjectVO sysProjectVO){startPage();List<SysProject> list = sysProjectService.selectSysProjectList(sysProjectVO);return getDataTable(list);}

然后找到framework/config/SecurityConfig

protected void configure(HttpSecurity httpSecurity) throws Exception{httpSecurity// CRSF禁用,因?yàn)椴皇褂胹ession.csrf().disable()// 認(rèn)證失敗處理類.exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()// 基于token,所以不需要session.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()// 過濾請(qǐng)求.authorizeRequests()// 對(duì)于登錄login 驗(yàn)證碼captchaImage 允許匿名訪問.antMatchers("/login", "/captchaImage").anonymous().antMatchers(HttpMethod.GET,"/*.html","/**/*.html","/**/*.css","/**/*.js").permitAll().antMatchers("/profile/**").anonymous().antMatchers("/common/download**").anonymous().antMatchers("/common/download/resource**").anonymous().antMatchers("/swagger-ui.html").anonymous().antMatchers("/swagger-resources/**").anonymous().antMatchers("/webjars/**").anonymous().antMatchers("/*/api-docs").anonymous().antMatchers("/druid/**").anonymous().antMatchers("/ctwing/receive**").anonymous().antMatchers("/ctwing/receive/getDate**").anonymous()//在這里添加想要測(cè)試的方法訪問URL,后面添加匿名訪問的權(quán)限permitAll().antMatchers("/system/project/list").permitAll()// 除上面外的所有請(qǐng)求全部需要鑒權(quán)認(rèn)證.anyRequest().authenticated().and().headers().frameOptions().disable();httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler);// 添加JWT filterhttpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);}

完成上面的工作就可以使用postman測(cè)試了。

總結(jié)

以上是生活随笔為你收集整理的如何使用postman访问若依后台权限功能的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。