config/src/main/java/org/springframework/security/config/annotation/web/builders/HttpSecurity.java
public ChannelSecurityConfigurer<HttpSecurity>.ChannelRequestMatcherRegistry requiresChannel()
			throws Exception {
		ApplicationContext context = getContext();
		return getOrApply(new ChannelSecurityConfigurer<>(context))
				.getRegistry();
	}
public ChannelSecurityConfigurer<HttpSecurity>.ChannelRequestMatcherRegistry requiresChannel()
			throws Exception {
		ApplicationContext context = getContext();
		return getOrApply(new ChannelSecurityConfigurer<>(context))
				.getRegistry();
	}
Configures channel security. In order for this configuration to be useful at least
one mapping to a required channel must be provided.

<h2>Example Configuration</h2>

The example below demonstrates how to require HTTPs for every request. Only
requiring HTTPS for some requests is supported, but not recommended since an
application that allows for HTTP introduces many security vulnerabilities. For one
such example, read about <a
href="https://en.wikipedia.org/wiki/Firesheep">Firesheep</a>.

<pre>
&#064;Configuration
&#064;EnableWebSecurity
public class ChannelSecurityConfig extends WebSecurityConfigurerAdapter {

&#064;Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers(&quot;/**&quot;).hasRole(&quot;USER&quot;).and().formLogin()
.and().requiresChannel().anyRequest().requiresSecure();
}

&#064;Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser(&quot;user&quot;).password(&quot;password&quot;).roles(&quot;USER&quot;);
}
}
</pre>


@return the {@link ChannelSecurityConfigurer} for further customizations
@throws Exception