mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-16 15:23:31 +00:00
RequestMatcherDelegatingAuthorizationManager defaults to deny
Closes gh-11958
This commit is contained in:
parent
d0653afec3
commit
753e113a13
@ -34,7 +34,6 @@ import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
|
|||||||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||||
import org.springframework.beans.factory.xml.ParserContext;
|
import org.springframework.beans.factory.xml.ParserContext;
|
||||||
import org.springframework.beans.factory.xml.XmlReaderContext;
|
import org.springframework.beans.factory.xml.XmlReaderContext;
|
||||||
import org.springframework.security.authorization.AuthenticatedAuthorizationManager;
|
|
||||||
import org.springframework.security.authorization.AuthorizationManager;
|
import org.springframework.security.authorization.AuthorizationManager;
|
||||||
import org.springframework.security.authorization.ObservationAuthorizationManager;
|
import org.springframework.security.authorization.ObservationAuthorizationManager;
|
||||||
import org.springframework.security.config.Elements;
|
import org.springframework.security.config.Elements;
|
||||||
@ -43,7 +42,6 @@ import org.springframework.security.web.access.expression.WebExpressionAuthoriza
|
|||||||
import org.springframework.security.web.access.intercept.AuthorizationFilter;
|
import org.springframework.security.web.access.intercept.AuthorizationFilter;
|
||||||
import org.springframework.security.web.access.intercept.RequestAuthorizationContext;
|
import org.springframework.security.web.access.intercept.RequestAuthorizationContext;
|
||||||
import org.springframework.security.web.access.intercept.RequestMatcherDelegatingAuthorizationManager;
|
import org.springframework.security.web.access.intercept.RequestMatcherDelegatingAuthorizationManager;
|
||||||
import org.springframework.security.web.util.matcher.AnyRequestMatcher;
|
|
||||||
import org.springframework.security.web.util.matcher.RequestMatcher;
|
import org.springframework.security.web.util.matcher.RequestMatcher;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.util.xml.DomUtils;
|
import org.springframework.util.xml.DomUtils;
|
||||||
@ -197,8 +195,7 @@ class AuthorizationFilterParser implements BeanDefinitionParser {
|
|||||||
.entrySet()) {
|
.entrySet()) {
|
||||||
builder.add(entry.getKey(), entry.getValue());
|
builder.add(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
AuthorizationManager<HttpServletRequest> manager = builder
|
AuthorizationManager<HttpServletRequest> manager = builder.build();
|
||||||
.add(AnyRequestMatcher.INSTANCE, AuthenticatedAuthorizationManager.authenticated()).build();
|
|
||||||
if (!this.observationRegistry.isNoop()) {
|
if (!this.observationRegistry.isNoop()) {
|
||||||
return new ObservationAuthorizationManager<>(this.observationRegistry, manager);
|
return new ObservationAuthorizationManager<>(this.observationRegistry, manager);
|
||||||
}
|
}
|
||||||
|
@ -358,7 +358,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getWhenServletPathRoleAdminConfiguredAndRoleIsUserAndWithoutServletPathThenRespondsWithOk()
|
public void getWhenServletPathRoleAdminConfiguredAndRoleIsUserAndWithoutServletPathThenRespondsWithForbidden()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
this.spring.register(ServletPathConfig.class, BasicController.class).autowire();
|
this.spring.register(ServletPathConfig.class, BasicController.class).autowire();
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
@ -366,7 +366,7 @@ public class AuthorizeHttpRequestsConfigurerTests {
|
|||||||
.with(user("user")
|
.with(user("user")
|
||||||
.roles("USER"));
|
.roles("USER"));
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
this.mvc.perform(requestWithUser).andExpect(status().isOk());
|
this.mvc.perform(requestWithUser).andExpect(status().isForbidden());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -139,7 +139,10 @@ public class AuthenticationManagerBeanDefinitionParserTests {
|
|||||||
+ "<user-service>"
|
+ "<user-service>"
|
||||||
+ " <user name='user' password='password' authorities='ROLE_A,ROLE_B' />"
|
+ " <user name='user' password='password' authorities='ROLE_A,ROLE_B' />"
|
||||||
+ "</user-service>"
|
+ "</user-service>"
|
||||||
+ "<http/>")
|
+ "<http>"
|
||||||
|
+ " <intercept-url pattern=\"/**\" access=\"authenticated\"/>"
|
||||||
|
+ " <http-basic />"
|
||||||
|
+ "</http>")
|
||||||
.mockMvcAfterSpringSecurityOk()
|
.mockMvcAfterSpringSecurityOk()
|
||||||
.autowire();
|
.autowire();
|
||||||
this.mockMvc.perform(get("/").with(httpBasic("user", "password")))
|
this.mockMvc.perform(get("/").with(httpBasic("user", "password")))
|
||||||
|
@ -120,7 +120,7 @@ public class InterceptUrlConfigTests {
|
|||||||
this.spring.configLocations(this.xml("PatchMethodAuthorizationManager")).autowire();
|
this.spring.configLocations(this.xml("PatchMethodAuthorizationManager")).autowire();
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
this.mvc.perform(get("/path").with(userCredentials()))
|
this.mvc.perform(get("/path").with(userCredentials()))
|
||||||
.andExpect(status().isOk());
|
.andExpect(status().isForbidden());
|
||||||
this.mvc.perform(patch("/path").with(userCredentials()))
|
this.mvc.perform(patch("/path").with(userCredentials()))
|
||||||
.andExpect(status().isForbidden());
|
.andExpect(status().isForbidden());
|
||||||
this.mvc.perform(patch("/path").with(adminCredentials()))
|
this.mvc.perform(patch("/path").with(adminCredentials()))
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -85,6 +85,7 @@ public class SessionManagementConfigServlet31Tests {
|
|||||||
String id = request.getSession().getId();
|
String id = request.getSession().getId();
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
loadContext("<http>\n"
|
loadContext("<http>\n"
|
||||||
|
+ " <intercept-url pattern=\"/**\" access=\"authenticated\"/>\n"
|
||||||
+ " <form-login/>\n"
|
+ " <form-login/>\n"
|
||||||
+ " <session-management/>\n"
|
+ " <session-management/>\n"
|
||||||
+ " <csrf disabled='true'/>\n"
|
+ " <csrf disabled='true'/>\n"
|
||||||
@ -107,6 +108,7 @@ public class SessionManagementConfigServlet31Tests {
|
|||||||
String id = request.getSession().getId();
|
String id = request.getSession().getId();
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
loadContext("<http>\n"
|
loadContext("<http>\n"
|
||||||
|
+ " <intercept-url pattern=\"/**\" access=\"authenticated\"/>\n"
|
||||||
+ " <form-login/>\n"
|
+ " <form-login/>\n"
|
||||||
+ " <session-management session-fixation-protection='changeSessionId'/>\n"
|
+ " <session-management session-fixation-protection='changeSessionId'/>\n"
|
||||||
+ " <csrf disabled='true'/>\n"
|
+ " <csrf disabled='true'/>\n"
|
||||||
|
@ -512,7 +512,7 @@ class AuthorizeHttpRequestsDslTests {
|
|||||||
request.servletPath = "/other"
|
request.servletPath = "/other"
|
||||||
request
|
request
|
||||||
})
|
})
|
||||||
.andExpect(status().isOk)
|
.andExpect(status().isForbidden)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ -602,7 +602,7 @@ class AuthorizeHttpRequestsDslTests {
|
|||||||
servletPath = "/other"
|
servletPath = "/other"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.andExpect(status().isOk)
|
.andExpect(status().isForbidden)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2017 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -22,7 +22,10 @@
|
|||||||
|
|
||||||
<b:bean id="passwordEncoder" class="org.springframework.security.crypto.password.NoOpPasswordEncoder" factory-method="getInstance"/>
|
<b:bean id="passwordEncoder" class="org.springframework.security.crypto.password.NoOpPasswordEncoder" factory-method="getInstance"/>
|
||||||
|
|
||||||
<http />
|
<http>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
|
<http-basic />
|
||||||
|
</http>
|
||||||
|
|
||||||
<authentication-manager>
|
<authentication-manager>
|
||||||
<authentication-provider>
|
<authentication-provider>
|
||||||
|
@ -3,7 +3,10 @@
|
|||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
http://www.springframework.org/schema/security https://www.springframework.org/schema/security/spring-security.xsd">
|
http://www.springframework.org/schema/security https://www.springframework.org/schema/security/spring-security.xsd">
|
||||||
<http />
|
<http>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
|
<http-basic />
|
||||||
|
</http>
|
||||||
|
|
||||||
<authentication-manager>
|
<authentication-manager>
|
||||||
<authentication-provider>
|
<authentication-provider>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,7 +25,9 @@
|
|||||||
|
|
||||||
<debug/>
|
<debug/>
|
||||||
|
|
||||||
<http/>
|
<http auto-config="true">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
|
</http>
|
||||||
|
|
||||||
<authentication-manager>
|
<authentication-manager>
|
||||||
<authentication-provider ref="authProvider"/>
|
<authentication-provider ref="authProvider"/>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -24,6 +24,7 @@
|
|||||||
<http auto-config="true">
|
<http auto-config="true">
|
||||||
<access-denied-handler ref="accessDeniedHandler"/>
|
<access-denied-handler ref="accessDeniedHandler"/>
|
||||||
<csrf/>
|
<csrf/>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
<b:import resource="CsrfConfigTests-shared-userservice.xml"/>
|
<b:import resource="CsrfConfigTests-shared-userservice.xml"/>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
<http auto-config="true">
|
<http auto-config="true">
|
||||||
<csrf request-handler-ref="requestHandler"/>
|
<csrf request-handler-ref="requestHandler"/>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
<b:bean id="requestHandler" class="org.springframework.security.web.csrf.CsrfTokenRequestAttributeHandler"
|
<b:bean id="requestHandler" class="org.springframework.security.web.csrf.CsrfTokenRequestAttributeHandler"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http auto-config="true">
|
<http auto-config="true">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
<b:import resource="userservice.xml"/>
|
<b:import resource="userservice.xml"/>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
<http auto-config="true">
|
<http auto-config="true">
|
||||||
<csrf disabled="true"/>
|
<csrf disabled="true"/>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
<b:import resource="userservice.xml"/>
|
<b:import resource="userservice.xml"/>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -29,6 +29,7 @@
|
|||||||
authentication-failure-forward-url="/failure_forward_url"/>
|
authentication-failure-forward-url="/failure_forward_url"/>
|
||||||
|
|
||||||
<csrf disabled="true"/>
|
<csrf disabled="true"/>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
<b:import resource="userservice.xml"/>
|
<b:import resource="userservice.xml"/>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -29,6 +29,7 @@
|
|||||||
authentication-success-forward-url="/success_forward_url"/>
|
authentication-success-forward-url="/success_forward_url"/>
|
||||||
|
|
||||||
<csrf disabled="true"/>
|
<csrf disabled="true"/>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
<b:import resource="userservice.xml"/>
|
<b:import resource="userservice.xml"/>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -31,6 +31,7 @@
|
|||||||
password-parameter="custom_pass"/>
|
password-parameter="custom_pass"/>
|
||||||
|
|
||||||
<csrf disabled="true"/>
|
<csrf disabled="true"/>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
<b:import resource="userservice.xml"/>
|
<b:import resource="userservice.xml"/>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http>
|
<http>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<http-basic/>
|
<http-basic/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http authentication-manager-ref="authMgr">
|
<http authentication-manager-ref="authMgr">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<http-basic/>
|
<http-basic/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http authentication-manager-ref="authMgr">
|
<http authentication-manager-ref="authMgr">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<http-basic/>
|
<http-basic/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -24,7 +24,9 @@
|
|||||||
http://www.springframework.org/schema/beans
|
http://www.springframework.org/schema/beans
|
||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http auto-config="true"/>
|
<http auto-config="true">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
|
</http>
|
||||||
|
|
||||||
<b:import resource="userservice.xml"/>
|
<b:import resource="userservice.xml"/>
|
||||||
</b:beans>
|
</b:beans>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http>
|
<http>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<http-basic authentication-details-source-ref="authenticationDetailsSource"/>
|
<http-basic authentication-details-source-ref="authenticationDetailsSource"/>
|
||||||
<form-login authentication-details-source-ref="authenticationDetailsSource"/>
|
<form-login authentication-details-source-ref="authenticationDetailsSource"/>
|
||||||
<x509 subject-principal-regex="OU=(.*?)(?:,|$)" authentication-details-source-ref="authenticationDetailsSource"/>
|
<x509 subject-principal-regex="OU=(.*?)(?:,|$)" authentication-details-source-ref="authenticationDetailsSource"/>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http auto-config="true">
|
<http auto-config="true">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<custom-filter ref="${customFilterRef}" position="FIRST"/>
|
<custom-filter ref="${customFilterRef}" position="FIRST"/>
|
||||||
<custom-filter ref="userFilter" before="SECURITY_CONTEXT_FILTER"/>
|
<custom-filter ref="userFilter" before="SECURITY_CONTEXT_FILTER"/>
|
||||||
<custom-filter ref="userFilter" after="LOGOUT_FILTER"/>
|
<custom-filter ref="userFilter" after="LOGOUT_FILTER"/>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http auto-config="true">
|
<http auto-config="true">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<logout delete-cookies="JSESSIONID, mycookie"/>
|
<logout delete-cookies="JSESSIONID, mycookie"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http>
|
<http>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<http-basic/>
|
<http-basic/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -27,6 +27,7 @@
|
|||||||
<http-firewall ref="firewall"/>
|
<http-firewall ref="firewall"/>
|
||||||
|
|
||||||
<http>
|
<http>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<http-basic/>
|
<http-basic/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http auto-config="true" jaas-api-provision="true">
|
<http auto-config="true" jaas-api-provision="true">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
<b:bean class="org.springframework.security.config.http.MiscHttpConfigTests.JaasController"/>
|
<b:bean class="org.springframework.security.config.http.MiscHttpConfigTests.JaasController"/>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http>
|
<http>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<jee mappable-roles="admin,user"/>
|
<jee mappable-roles="admin,user"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http auto-config="true">
|
<http auto-config="true">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<logout success-handler-ref="logoutSuccessEndpoint"/>
|
<logout success-handler-ref="logoutSuccessEndpoint"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http>
|
<http>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<http-basic/>
|
<http-basic/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -24,5 +24,7 @@
|
|||||||
http://www.springframework.org/schema/beans
|
http://www.springframework.org/schema/beans
|
||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http auto-config="true"/>
|
<http auto-config="true">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
|
</http>
|
||||||
</b:beans>
|
</b:beans>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http>
|
<http>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<form-login/>
|
<form-login/>
|
||||||
<csrf disabled="true"/>
|
<csrf disabled="true"/>
|
||||||
<anonymous enabled="false"/>
|
<anonymous enabled="false"/>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -24,7 +24,9 @@
|
|||||||
http://www.springframework.org/schema/beans
|
http://www.springframework.org/schema/beans
|
||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http auto-config="true"/>
|
<http auto-config="true">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
|
</http>
|
||||||
|
|
||||||
<authentication-manager>
|
<authentication-manager>
|
||||||
<authentication-provider user-service-ref="userService"/>
|
<authentication-provider user-service-ref="userService"/>
|
||||||
|
@ -23,10 +23,12 @@
|
|||||||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
|
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http pattern="/first/**" create-session="stateless">
|
<http pattern="/first/**" create-session="stateless">
|
||||||
|
<intercept-url pattern="/first/**" access="authenticated"/>
|
||||||
<http-basic/>
|
<http-basic/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
<http pattern="/second/**">
|
<http pattern="/second/**">
|
||||||
|
<intercept-url pattern="/second/**" access="authenticated"/>
|
||||||
<form-login login-processing-url="/second/login"/>
|
<form-login login-processing-url="/second/login"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -23,10 +23,12 @@
|
|||||||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
|
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http create-session="stateless">
|
<http create-session="stateless">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<http-basic/>
|
<http-basic/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
<http>
|
<http>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<form-login/>
|
<form-login/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
|
@ -23,10 +23,12 @@
|
|||||||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
|
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http pattern="/first/**" create-session="stateless">
|
<http pattern="/first/**" create-session="stateless">
|
||||||
|
<intercept-url pattern="/first/**" access="authenticated"/>
|
||||||
<http-basic/>
|
<http-basic/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
<http pattern="/first/**">
|
<http pattern="/first/**">
|
||||||
|
<intercept-url pattern="/first/**" access="authenticated"/>
|
||||||
<form-login/>
|
<form-login/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
|
@ -23,10 +23,12 @@
|
|||||||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
|
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http authentication-manager-ref="firstAuthenticationManager" pattern="/first/**" create-session="stateless">
|
<http authentication-manager-ref="firstAuthenticationManager" pattern="/first/**" create-session="stateless">
|
||||||
|
<intercept-url pattern="/first/**" access="authenticated"/>
|
||||||
<http-basic/>
|
<http-basic/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
<http authentication-manager-ref="secondAuthenticationManager" pattern="/second/**">
|
<http authentication-manager-ref="secondAuthenticationManager" pattern="/second/**">
|
||||||
|
<intercept-url pattern="/second/**" access="authenticated"/>
|
||||||
<form-login login-processing-url="/second/login"/>
|
<form-login login-processing-url="/second/login"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
@ -47,6 +49,6 @@
|
|||||||
</user-service>
|
</user-service>
|
||||||
</authentication-provider>
|
</authentication-provider>
|
||||||
</authentication-manager>
|
</authentication-manager>
|
||||||
|
|
||||||
<b:import resource="handlermappingintrospector.xml"/>
|
<b:import resource="handlermappingintrospector.xml"/>
|
||||||
</b:beans>
|
</b:beans>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2020 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
<http auto-config="true">
|
<http auto-config="true">
|
||||||
<oauth2-client authorized-client-repository-ref="authorizedClientRepository" />
|
<oauth2-client authorized-client-repository-ref="authorizedClientRepository" />
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
<mvc:annotation-driven />
|
<mvc:annotation-driven />
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
<authorization-code-grant
|
<authorization-code-grant
|
||||||
authorization-redirect-strategy-ref="authorizationRedirectStrategy"/>
|
authorization-redirect-strategy-ref="authorizationRedirectStrategy"/>
|
||||||
</oauth2-client>
|
</oauth2-client>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
<b:bean id="authorizationRedirectStrategy" class="org.mockito.Mockito" factory-method="mock">
|
<b:bean id="authorizationRedirectStrategy" class="org.mockito.Mockito" factory-method="mock">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2020 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -32,6 +32,7 @@
|
|||||||
authorization-request-resolver-ref="authorizationRequestResolver"
|
authorization-request-resolver-ref="authorizationRequestResolver"
|
||||||
access-token-response-client-ref="accessTokenResponseClient"/>
|
access-token-response-client-ref="accessTokenResponseClient"/>
|
||||||
</oauth2-client>
|
</oauth2-client>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
<client-registrations>
|
<client-registrations>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2020 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
<http auto-config="true">
|
<http auto-config="true">
|
||||||
<oauth2-client client-registration-repository-ref="clientRegistrationRepository"/>
|
<oauth2-client client-registration-repository-ref="clientRegistrationRepository"/>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
<b:bean id="clientRegistrationRepository" class="org.mockito.Mockito" factory-method="mock">
|
<b:bean id="clientRegistrationRepository" class="org.mockito.Mockito" factory-method="mock">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2020 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -32,6 +32,7 @@
|
|||||||
authorization-request-resolver-ref="authorizationRequestResolver"
|
authorization-request-resolver-ref="authorizationRequestResolver"
|
||||||
access-token-response-client-ref="accessTokenResponseClient"/>
|
access-token-response-client-ref="accessTokenResponseClient"/>
|
||||||
</oauth2-client>
|
</oauth2-client>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
<client-registrations>
|
<client-registrations>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2020 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
<http auto-config="true">
|
<http auto-config="true">
|
||||||
<oauth2-client/>
|
<oauth2-client/>
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
<client-registrations>
|
<client-registrations>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http auto-config="true">
|
<http auto-config="true">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<session-management session-authentication-error-url="/max-exceeded">
|
<session-management session-authentication-error-url="/max-exceeded">
|
||||||
<concurrency-control max-sessions="2" error-if-maximum-exceeded="true"/>
|
<concurrency-control max-sessions="2" error-if-maximum-exceeded="true"/>
|
||||||
</session-management>
|
</session-management>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2021 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -24,6 +24,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http auto-config="true">
|
<http auto-config="true">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<session-management
|
<session-management
|
||||||
session-authentication-error-url="/max-exceeded">
|
session-authentication-error-url="/max-exceeded">
|
||||||
<concurrency-control
|
<concurrency-control
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http auto-config="true">
|
<http auto-config="true">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<session-management
|
<session-management
|
||||||
authentication-strategy-explicit-invocation="false">
|
authentication-strategy-explicit-invocation="false">
|
||||||
<concurrency-control session-registry-ref="sessionRegistry"/>
|
<concurrency-control session-registry-ref="sessionRegistry"/>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http auto-config="true" create-session="always">
|
<http auto-config="true" create-session="always">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<csrf disabled="true"/>
|
<csrf disabled="true"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2018 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http auto-config="true">
|
<http auto-config="true">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<csrf disabled="true"/>
|
<csrf disabled="true"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2021 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http auto-config="true">
|
<http auto-config="true">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<password-management change-password-page="/custom-change-password-page"/>
|
<password-management change-password-page="/custom-change-password-page"/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2002-2021 the original author or authors.
|
~ Copyright 2002-2022 the original author or authors.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +25,7 @@
|
|||||||
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<http auto-config="true">
|
<http auto-config="true">
|
||||||
|
<intercept-url pattern="/**" access="authenticated"/>
|
||||||
<password-management/>
|
<password-management/>
|
||||||
</http>
|
</http>
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -44,6 +44,8 @@ import org.springframework.util.Assert;
|
|||||||
*/
|
*/
|
||||||
public final class RequestMatcherDelegatingAuthorizationManager implements AuthorizationManager<HttpServletRequest> {
|
public final class RequestMatcherDelegatingAuthorizationManager implements AuthorizationManager<HttpServletRequest> {
|
||||||
|
|
||||||
|
private static final AuthorizationDecision DENY = new AuthorizationDecision(false);
|
||||||
|
|
||||||
private final Log logger = LogFactory.getLog(getClass());
|
private final Log logger = LogFactory.getLog(getClass());
|
||||||
|
|
||||||
private final List<RequestMatcherEntry<AuthorizationManager<RequestAuthorizationContext>>> mappings;
|
private final List<RequestMatcherEntry<AuthorizationManager<RequestAuthorizationContext>>> mappings;
|
||||||
@ -81,8 +83,10 @@ public final class RequestMatcherDelegatingAuthorizationManager implements Autho
|
|||||||
new RequestAuthorizationContext(request, matchResult.getVariables()));
|
new RequestAuthorizationContext(request, matchResult.getVariables()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.logger.trace("Abstaining since did not find matching RequestMatcher");
|
if (this.logger.isTraceEnabled()) {
|
||||||
return null;
|
this.logger.trace(LogMessage.of(() -> "Denying request since did not find matching RequestMatcher"));
|
||||||
|
}
|
||||||
|
return DENY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -67,8 +67,7 @@ public class RequestMatcherDelegatingAuthorizationManagerTests {
|
|||||||
public void checkWhenMultipleMappingsConfiguredThenDelegatesMatchingManager() {
|
public void checkWhenMultipleMappingsConfiguredThenDelegatesMatchingManager() {
|
||||||
RequestMatcherDelegatingAuthorizationManager manager = RequestMatcherDelegatingAuthorizationManager.builder()
|
RequestMatcherDelegatingAuthorizationManager manager = RequestMatcherDelegatingAuthorizationManager.builder()
|
||||||
.add(new MvcRequestMatcher(null, "/grant"), (a, o) -> new AuthorizationDecision(true))
|
.add(new MvcRequestMatcher(null, "/grant"), (a, o) -> new AuthorizationDecision(true))
|
||||||
.add(new MvcRequestMatcher(null, "/deny"), (a, o) -> new AuthorizationDecision(false))
|
.add(new MvcRequestMatcher(null, "/deny"), (a, o) -> new AuthorizationDecision(false)).build();
|
||||||
.add(new MvcRequestMatcher(null, "/neutral"), (a, o) -> null).build();
|
|
||||||
|
|
||||||
Supplier<Authentication> authentication = () -> new TestingAuthenticationToken("user", "password", "ROLE_USER");
|
Supplier<Authentication> authentication = () -> new TestingAuthenticationToken("user", "password", "ROLE_USER");
|
||||||
|
|
||||||
@ -80,11 +79,10 @@ public class RequestMatcherDelegatingAuthorizationManagerTests {
|
|||||||
assertThat(deny).isNotNull();
|
assertThat(deny).isNotNull();
|
||||||
assertThat(deny.isGranted()).isFalse();
|
assertThat(deny.isGranted()).isFalse();
|
||||||
|
|
||||||
AuthorizationDecision neutral = manager.check(authentication, new MockHttpServletRequest(null, "/neutral"));
|
AuthorizationDecision defaultDeny = manager.check(authentication,
|
||||||
assertThat(neutral).isNull();
|
new MockHttpServletRequest(null, "/unmapped"));
|
||||||
|
assertThat(defaultDeny).isNotNull();
|
||||||
AuthorizationDecision abstain = manager.check(authentication, new MockHttpServletRequest(null, "/abstain"));
|
assertThat(defaultDeny.isGranted()).isFalse();
|
||||||
assertThat(abstain).isNull();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user