BAEL-89 - Adding surefire, fixing formatting

This commit is contained in:
slavisa-baeldung 2016-11-19 09:47:17 +01:00
parent 0bc2aad035
commit 5f99e5aedd
4 changed files with 23 additions and 8 deletions

View File

@ -13,7 +13,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.NEVER).and()
.authorizeRequests().anyRequest().hasRole("ADMIN");
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.NEVER).and()
.authorizeRequests().anyRequest().hasRole("ADMIN");
}
}

View File

@ -19,4 +19,5 @@
<module>jetty-session-demo</module>
<module>tomcat-session-demo</module>
</modules>
</project>

View File

@ -66,6 +66,20 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<excludes>
<exclude>**/*ControllerTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
</properties>
</project>

View File

@ -14,16 +14,16 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("admin").password("password").roles("ADMIN");
.inMemoryAuthentication()
.withUser("admin").password("password").roles("ADMIN");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.httpBasic().and()
.authorizeRequests()
.antMatchers("/tomcat/admin").hasRole("ADMIN")
.anyRequest().authenticated();
.httpBasic().and()
.authorizeRequests()
.antMatchers("/tomcat/admin").hasRole("ADMIN")
.anyRequest().authenticated();
}
}