forked from alibaba/arthas
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
disable iframe deny header by default. alibaba#1873
- Loading branch information
1 parent
29aef3e
commit cc04d73
Showing
2 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
21 changes: 18 additions & 3 deletions
21
...nel/server/endpoint/ActuatorSecurity.java → .../tunnel/server/app/WebSecurityConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,30 @@ | ||
package com.alibaba.arthas.tunnel.server.endpoint; | ||
package com.alibaba.arthas.tunnel.server.app; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.actuate.autoconfigure.security.servlet.EndpointRequest; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | ||
|
||
import com.alibaba.arthas.tunnel.server.app.configuration.ArthasProperties; | ||
|
||
/** | ||
* | ||
* @author hengyunabc 2021-08-11 | ||
* | ||
*/ | ||
@Configuration | ||
public class ActuatorSecurity extends WebSecurityConfigurerAdapter { | ||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | ||
|
||
@Autowired | ||
ArthasProperties arthasProperties; | ||
@Override | ||
protected void configure(HttpSecurity httpSecurity) throws Exception { | ||
httpSecurity.authorizeRequests().requestMatchers(EndpointRequest.toAnyEndpoint()).authenticated().anyRequest() | ||
.permitAll().and().formLogin(); | ||
.permitAll().and().formLogin(); | ||
// allow iframe | ||
if (arthasProperties.isEnableIframeSupport()) { | ||
httpSecurity.headers().frameOptions().disable(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters