![](/img/trans.png)
[英]How can i use the bitbucket rest api to get all the repos using springboot?
[英]How can I whitelist Domain or IP address in a Rest API application in which we are using springboot?
我正在實現 REST API,我們使用 springboot 的StreamingResponseBody
直接流式傳輸響應。 我們通過 JSON 接收查詢參數,我們通過直接流發送數據庫響應。
我們想鎖定對 URL 的訪問到特定域或 IP 地址集 - 我們如何實現這一點?
如果您使用 Java Configuration for Spring Boot Security,則必須使用
有IP地址()
在擴展 WebSecurityConfigurerAdapter 的 SecurityConfig class 中。
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/login").permitAll()
.antMatchers("/api/example/**").hasIpAddress("1.1.1.1")
.anyRequest().authenticated()
.and()
.formLogin().permitAll()
.and()
.csrf().disable();
}
// Rest of Code ...
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.