Здравствуйте! Хочу в проекте реализовать собственный контроллер с возможностью вызова методов с аутентификацией и без. В файле rest-dispatcher-spring.xml добавил настройки безопасности для обоих случаев, но в результате анонимный доступ работает, в обоих случаях даже там где требуется аутентификация по токену(пример такого контроллера взят из документации).
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.2.xsd">
<!-- Define a base package for your controllers-->
<context:component-scan base-package="ru.infinnity.dma.web.api"/>
<security:http pattern="/rest/api/v1/anon/**"
create-session="stateless"
entry-point-ref="oauthAuthenticationEntryPoint"
xmlns="http://www.springframework.org/schema/security">
<intercept-url pattern="/rest/api/v1/anon/**" access="true"/>
<anonymous enabled="true"/>
<csrf disabled="true"/>
<cors configuration-source-ref="cuba_RestCorsSource"/>
<custom-filter ref="resourceFilter" before="PRE_AUTH_FILTER"/>
<custom-filter ref="cuba_AnonymousAuthenticationFilter" after="PRE_AUTH_FILTER"/>
<custom-filter ref="cuba_RestLastSecurityFilter" after="LAST"/>
</security:http>
<security:http pattern="/rest/api/v1/auth/**"
create-session="stateless"
entry-point-ref="oauthAuthenticationEntryPoint"
xmlns="http://www.springframework.org/schema/security">
<!-- Specify one or more protected URL patterns-->
<intercept-url pattern="/rest/api/v1/auth/**" access="isAuthenticated()"/>
<anonymous enabled="false"/>
<csrf disabled="true"/>
<cors configuration-source-ref="cuba_RestCorsSource"/>
<custom-filter ref="resourceFilter" before="PRE_AUTH_FILTER"/>
<custom-filter ref="cuba_AnonymousAuthenticationFilter" after="PRE_AUTH_FILTER"/>
</security:http>
</beans>
Подскажите пожалуйста почему так может я чтото упустил. Буду благодарен за любую информацию по данному вопросу