spring-security

X-Frame-Options: DENY is not working for spring boot REST API

烈酒焚心 提交于 2020-02-06 07:54:07
问题 My Project has ExtJs as Front end and Spring boot as backend. ExtJs will call spring boot which will respond with JSON. I wanted to prevent clickjacking attack in my project. I have a simple html script, which will just load the website in an iframe.If the website is loaded within iframe, then it means it is not secure.I have added the following flags X-Frame-Options: DENY and Content-Security-Policy: frame-ancestors 'none'; in spring boot REST API response to prevent that.But even then, it

Using Java config with Spring Security for annotation-based role checks and Basic HTTP Auth

假装没事ソ 提交于 2020-02-04 06:00:40
问题 I'm trying to accomplish annotation-based (using @PreAuthorize ) permission checking on one of my controllers. I'm using Java config, and have a SecurityConfig class extending WebSecurityConfigurerAdapter . I'm also using Basic HTTP Authentication to get to the methods that require authorization. But - the problem is, I don't want the SecurityConfig determining which methods require authentication using an antPattern() or similar. That's what the annotations are for! How can I configure my

Using Java config with Spring Security for annotation-based role checks and Basic HTTP Auth

空扰寡人 提交于 2020-02-04 05:59:33
问题 I'm trying to accomplish annotation-based (using @PreAuthorize ) permission checking on one of my controllers. I'm using Java config, and have a SecurityConfig class extending WebSecurityConfigurerAdapter . I'm also using Basic HTTP Authentication to get to the methods that require authorization. But - the problem is, I don't want the SecurityConfig determining which methods require authentication using an antPattern() or similar. That's what the annotations are for! How can I configure my

Spring Boot with AclPermissionEvaluator resulting in IllegalStateException: No ServletContext set

天大地大妈咪最大 提交于 2020-02-04 05:25:12
问题 Hello experts, I'm currently learning Spring Boot and I want to use it with Spring Security ACL. Following the documentation of Spring Security and a tutorial on Baeldung.com, I think I got an understanding about what is needed. I also looked into the DMS example of Spring. I stumbled across another example by searching for a solution. Based on this information, I have build my application. For reference, you can find the current application on GitHub. The current issue When I start the

Get destination controller from a HttpServletRequest

两盒软妹~` 提交于 2020-02-04 01:21:33
问题 I have set up spring security to authenticate and authorize requests coming into my application. I have set up the configuration as so: public class OAuth2ServerConfiguration extends ResourceServerConfigurerAdapter { @Override public void configure(ResourceServerSecurityConfigurer resources) { // ...set up token store here resources.authenticationEntryPoint(new AuthenticationEntryPoint() { @Override public void commence(HttpServletRequest request, HttpServletResponse response,

Spring Security (3.2.5) HTTP POST not forwarding to the original request after authentication

纵饮孤独 提交于 2020-02-03 18:58:46
问题 I have a sample Spring MVC application, secured by Spring security (Spring version 4.0.1.RELEASE, Spring security 3.2.5.RELEASE. When I send an HTTP GET request as an unauthenticated user, I am sent to the login page (as expected) where after I authenticate I am sent along to the page that was requested in the original GET. When I send an HTTP POST request as an unauthenticated user, I am sent to the login page (as expected), but then after successful authentication I am sent to the page as

Spring Security (3.2.5) HTTP POST not forwarding to the original request after authentication

六月ゝ 毕业季﹏ 提交于 2020-02-03 18:58:01
问题 I have a sample Spring MVC application, secured by Spring security (Spring version 4.0.1.RELEASE, Spring security 3.2.5.RELEASE. When I send an HTTP GET request as an unauthenticated user, I am sent to the login page (as expected) where after I authenticate I am sent along to the page that was requested in the original GET. When I send an HTTP POST request as an unauthenticated user, I am sent to the login page (as expected), but then after successful authentication I am sent to the page as

Spring Security (3.2.5) HTTP POST not forwarding to the original request after authentication

人盡茶涼 提交于 2020-02-03 18:57:26
问题 I have a sample Spring MVC application, secured by Spring security (Spring version 4.0.1.RELEASE, Spring security 3.2.5.RELEASE. When I send an HTTP GET request as an unauthenticated user, I am sent to the login page (as expected) where after I authenticate I am sent along to the page that was requested in the original GET. When I send an HTTP POST request as an unauthenticated user, I am sent to the login page (as expected), but then after successful authentication I am sent to the page as

Spring Security (3.2.5) HTTP POST not forwarding to the original request after authentication

扶醉桌前 提交于 2020-02-03 18:57:11
问题 I have a sample Spring MVC application, secured by Spring security (Spring version 4.0.1.RELEASE, Spring security 3.2.5.RELEASE. When I send an HTTP GET request as an unauthenticated user, I am sent to the login page (as expected) where after I authenticate I am sent along to the page that was requested in the original GET. When I send an HTTP POST request as an unauthenticated user, I am sent to the login page (as expected), but then after successful authentication I am sent to the page as

Spring app basic auth over keycloack

余生长醉 提交于 2020-02-02 10:21:29
问题 I need to add auth to my spring boot (MVC) app. Auth provider is keycloak via OpenID. Both Implicit and Authorization Code grants are disabled, so I am stuck with Resource owner credentials grant. What I want to achieve is basic auth prompt for unauthorized users. Credentials retrieved that way should be used to get token and user information from keycloak for its further usage by spring security. The token should be checked on each request. Most examples I've found are using the redirect