【发布时间】:2018-08-04 22:49:30
【问题描述】:
我正在做一个简单的弹簧安全项目。我使用 Angular 作为前端。对于身份验证,我从后端调用访问令牌,但春季没有任何 CORS 启用。如何启用 CORS。这是获取访问令牌的代码
<http pattern="/oauth/token" create-session="stateless"
authentication-manager-ref="clientAuthenticationManager"
xmlns="http://www.springframework.org/schema/security">
<intercept-url pattern="/oauth/token" access="IS_AUTHENTICATED_FULLY"/>
<anonymous enabled="false" />
<http-basic entry-point-ref="clientAuthenticationEntryPoint" />
<!-- include this only if you need to authenticate clients via request
parameters -->
<custom-filter ref="clientCredentialsTokenEndpointFilter"
after="BASIC_AUTH_FILTER" />
<access-denied-handler ref="oauthAccessDeniedHandler" />
</http>
【问题讨论】:
标签: spring-mvc spring-security cors spring-security-oauth2