Java Code Examples for org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository#setHeaderName()

The following examples show how to use org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository#setHeaderName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UnieapSecurityConfig.java    From open-capacity-platform with Apache License 2.0 4 votes vote down vote up
private CsrfTokenRepository csrfTokenRepository() {
	HttpSessionCsrfTokenRepository repository = new HttpSessionCsrfTokenRepository();
	repository.setHeaderName("X-XSRF-TOKEN");
	return repository;
}
 
Example 2
Source File: AuthenticationUtils.java    From Insights with Apache License 2.0 4 votes vote down vote up
public CsrfTokenRepository csrfTokenRepository() {
	HttpSessionCsrfTokenRepository repository = new HttpSessionCsrfTokenRepository();
	repository.setHeaderName(AuthenticationUtils.CSRF_COOKIE_NAME);
	return repository;
}
 
Example 3
Source File: PlatformSecurityConfiguration.java    From abixen-platform with GNU Lesser General Public License v2.1 4 votes vote down vote up
private CsrfTokenRepository csrfTokenRepository() {
    HttpSessionCsrfTokenRepository repository = new HttpSessionCsrfTokenRepository();
    repository.setHeaderName("X-XSRF-TOKEN");
    return repository;
}
 
Example 4
Source File: SsoUiApplication.java    From building-microservices with Apache License 2.0 4 votes vote down vote up
private CsrfTokenRepository csrfTokenRepository() {
	HttpSessionCsrfTokenRepository repository = new HttpSessionCsrfTokenRepository();
	repository.setHeaderName("X-XSRF-TOKEN");
	return repository;
}
 
Example 5
Source File: PolymerDemoSpringSessionConfig.java    From spring-polymer-demo with Artistic License 2.0 4 votes vote down vote up
private CsrfTokenRepository csrfTokenRepository() {
	HttpSessionCsrfTokenRepository repository = new HttpSessionCsrfTokenRepository();
	repository.setHeaderName("X-XSRF-TOKEN");
	return repository;
}
 
Example 6
Source File: PolymerDemoOAuthConfig.java    From spring-polymer-demo with Artistic License 2.0 4 votes vote down vote up
private CsrfTokenRepository csrfTokenRepository() {
	HttpSessionCsrfTokenRepository repository = new HttpSessionCsrfTokenRepository();
	repository.setHeaderName("X-XSRF-TOKEN");
	return repository;
}
 
Example 7
Source File: OAuthConfiguration.java    From moserp with Apache License 2.0 2 votes vote down vote up
/**
 * Angular sends the CSRF token in a custom header named "X-XSRF-TOKEN"
 * rather than the default "X-CSRF-TOKEN" that Spring security expects.
 * Hence we are now telling Spring security to expect the token in the
 * "X-XSRF-TOKEN" header.<br><br>
 *
 * This customization is added to the <code>csrf()</code> filter.
 *
 * @return
 */
private CsrfTokenRepository getCSRFTokenRepository() {
    HttpSessionCsrfTokenRepository repository = new HttpSessionCsrfTokenRepository();
    repository.setHeaderName(CSRF_ANGULAR_HEADER_NAME);
    return repository;
}
 
Example 8
Source File: OAuthConfiguration.java    From spring-boot-microservices with Apache License 2.0 2 votes vote down vote up
/**
 * Angular sends the CSRF token in a custom header named "X-XSRF-TOKEN"
 * rather than the default "X-CSRF-TOKEN" that Spring security expects.
 * Hence we are now telling Spring security to expect the token in the
 * "X-XSRF-TOKEN" header.<br><br>
 * 
 * This customization is added to the <code>csrf()</code> filter.
 * 
 * @return
 */
private CsrfTokenRepository getCSRFTokenRepository() {
	HttpSessionCsrfTokenRepository repository = new HttpSessionCsrfTokenRepository();
	repository.setHeaderName(CSRF_ANGULAR_HEADER_NAME);
	return repository;
}