當前位置: 首頁>>代碼示例>>Java>>正文


Java HttpSecurity.httpBasic方法代碼示例

本文整理匯總了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();
}
 
開發者ID:Angular2Guy,項目名稱:AngularAndSpring,代碼行數:9,代碼來源:WebSecurityConfig.java

示例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();
}
 
開發者ID:CoruptiaUcide,項目名稱:va-vedem-api,代碼行數:20,代碼來源:SecurityConfig.java

示例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();
}
 
開發者ID:yujunhao8831,項目名稱:spring-boot-start-current,代碼行數:20,代碼來源:SecurityConfig.java

示例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();
}
 
開發者ID:MikeQin,項目名稱:spring-boot-vaadin-rabbitmq-pipeline-demo,代碼行數:13,代碼來源:WebSecurityConfig.java

示例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();
}
 
開發者ID:dewey-its,項目名稱:apollo-custom,代碼行數:10,代碼來源:TestWebSecurityConfig.java

示例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();
}
 
開發者ID:dewey-its,項目名稱:apollo-custom,代碼行數:7,代碼來源:WebSecurityConfig.java


注:本文中的org.springframework.security.config.annotation.web.builders.HttpSecurity.httpBasic方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。