Spring只允许HTTPS

时间:2019-01-21 08:38:01

标签: spring spring-boot heroku spring-security spring-security-oauth2

设置

我有具有以下#!/bin/bash echo "script started" python /xxxx/xxx/move_files.py echo "Training Started" for N in {1..9}; do /xxxx/xxx/openface-master/util/align-dlib.py /xxxx/xxx/openface-master/training_dataset align outerEyesAndNose /xxxx/xxx/openface-master/aligned_data --size 96 & done /xxxx/xxx/openface-master/batch-represent/main.lua -outDir /xxxx/xxx/openface-master/feature -data /xxxx/xxx/openface-master/aligned_data /xxxx/xxx/openface-master/demos/classifier_original.py train feature echo "Model running" /xxxx/xxx/openface-master/demos/classifier_updated.py 设置的Spring Boot授权服务器(oauth2)

HttpSecurity

带有httpSecurity .cors().and() .csrf().disable() .formLogin().disable() .httpBasic().disable() .jee().disable() .rememberMe().disable() .servletApi().disable() .x509().disable() .addFilterBefore(this.basicAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class) .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and().logout().logoutUrl(Url.LOG_OUT).addLogoutHandler(this.customLogoutHandler).logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler(HttpStatus.NO_CONTENT)) .and().authorizeRequests().antMatchers("some mappings").permitAll() .and().authorizeRequests().anyRequest().denyAll() .and().requiresChannel().requestMatchers(r -> r.getHeader("X-Forwarded-Proto") != null).requiresSecure(); 的部分 是Heroku docs

的推荐

问题

我的API按照预期的方式服务于.requiresChannel().requestMatchers(r -> r.getHeader("X-Forwarded-Proto") != null).requiresSecure()请求,但它也允许https,我应该避免。 有什么办法吗?

修改:1

这仅在用http注释的端点上发生,当用@FrameworkController调用时,所有自定义端点都返回302

0 个答案:

没有答案