本文整理匯總了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();
}