当前位置: 首页>>代码示例>>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;未经允许,请勿转载。