本文整理汇总了Java中org.springframework.security.config.annotation.web.builders.HttpSecurity.httpBasic方法的典型用法代码示例。如果您正苦于以下问题:Java HttpSecurity.httpBasic方法的具体用法?Java HttpSecurity.httpBasic怎么用?Java HttpSecurity.httpBasic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.security.config.annotation.web.builders.HttpSecurity
的用法示例。
在下文中一共展示了HttpSecurity.httpBasic方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import org.springframework.security.config.annotation.web.builders.HttpSecurity; //导入方法依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
http.httpBasic();
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.ALWAYS);
http.authorizeRequests().anyRequest().permitAll().anyRequest().anonymous();
http.antMatcher("/**/orderbook").authorizeRequests().anyRequest().authenticated();
http.csrf().disable();
}
示例2: configure
import org.springframework.security.config.annotation.web.builders.HttpSecurity; //导入方法依赖的package包/类
/**
* By default, the access to is permitted to every endpoint in the application
* The actual authorization will be placed at method level
*
* @param http the https security object
* @throws Exception
*/
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.anyRequest()
.permitAll();
http
.httpBasic();
http
.csrf()
.disable();
}
示例3: configure
import org.springframework.security.config.annotation.web.builders.HttpSecurity; //导入方法依赖的package包/类
@Override
protected void configure ( HttpSecurity http ) throws Exception {
// Page with login form is served as /login.html and does a POST on /login
http.formLogin().loginPage( "/login.html" ).loginProcessingUrl( "/login" ).permitAll();
// The UI does a POST on /logout on logout
http.logout().logoutUrl( "/logout" );
// The ui currently doesn't support csrf
http.csrf().disable();
// Requests for the login page and the static assets are allowed
http.authorizeRequests()
.antMatchers( "/login.html", "/**/*.css", "/img/**", "/third-party/**" )
.permitAll();
// ... and any other request needs to be authorized
http.authorizeRequests().antMatchers( "/**" ).authenticated();
// Enable so that the clients can authenticate via HTTP basic for registering
http.httpBasic();
}
示例4: configure
import org.springframework.security.config.annotation.web.builders.HttpSecurity; //导入方法依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
http.httpBasic();
http.authorizeRequests()
.anyRequest().authenticated() // All requests must be authenticated
.antMatchers("/events", "/console/*").hasRole("ADMIN"); // Authorization
// Dev ONLY for access H2 DB console: /console
http.csrf().disable();
http.headers().frameOptions().sameOrigin();
}
示例5: configure
import org.springframework.security.config.annotation.web.builders.HttpSecurity; //导入方法依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
http.httpBasic();
http.csrf().disable();
http.authorizeRequests().antMatchers("/").permitAll().and()
.authorizeRequests().antMatchers("/console/**").permitAll();
http.headers().frameOptions().disable();
}
示例6: configure
import org.springframework.security.config.annotation.web.builders.HttpSecurity; //导入方法依赖的package包/类
@Override
protected void configure(HttpSecurity http) throws Exception {
http.httpBasic();
http.csrf().disable();
http.headers().frameOptions().disable();
}