|
|
|
|
|
|
<!DOCTYPE html>
|
|
<html id="htmlId">
|
|
<head>
|
|
<title>Coverage Report > SecurityConfig</title>
|
|
<style type="text/css">
|
|
@import "../../css/coverage.css";
|
|
@import "../../css/idea.min.css";
|
|
</style>
|
|
<script type="text/javascript" src="../../js/highlight.min.js"></script>
|
|
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="content">
|
|
<div class="breadCrumbs">
|
|
Current scope: <a href="../../index.html">all classes</a>
|
|
<span class="separator">|</span>
|
|
<a href="../index.html">cn.edu.ecnu.stu.bookstore.config</a>
|
|
</div>
|
|
|
|
<h1>Coverage Summary for Class: SecurityConfig (cn.edu.ecnu.stu.bookstore.config)</h1>
|
|
|
|
<table class="coverageStats">
|
|
|
|
<tr>
|
|
<th class="name">Class</th>
|
|
<th class="coverageStat
|
|
">
|
|
Method, %
|
|
</th>
|
|
<th class="coverageStat
|
|
">
|
|
Line, %
|
|
</th>
|
|
</tr>
|
|
<tr>
|
|
<td class="name">SecurityConfig</td>
|
|
<td class="coverageStat">
|
|
<span class="percent">
|
|
100%
|
|
</span>
|
|
<span class="absValue">
|
|
(5/5)
|
|
</span>
|
|
</td>
|
|
<td class="coverageStat">
|
|
<span class="percent">
|
|
100%
|
|
</span>
|
|
<span class="absValue">
|
|
(12/12)
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name">SecurityConfig$$EnhancerBySpringCGLIB$$36520b6c</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name">SecurityConfig$$EnhancerBySpringCGLIB$$36520b6c$$FastClassBySpringCGLIB$$60b6a068</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name">SecurityConfig$$FastClassBySpringCGLIB$$99c9aeb0</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name"><strong>Total</strong></td>
|
|
<td class="coverageStat">
|
|
<span class="percent">
|
|
100%
|
|
</span>
|
|
<span class="absValue">
|
|
(5/5)
|
|
</span>
|
|
</td>
|
|
<td class="coverageStat">
|
|
<span class="percent">
|
|
100%
|
|
</span>
|
|
<span class="absValue">
|
|
(12/12)
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br/>
|
|
<br/>
|
|
|
|
|
|
<pre>
|
|
<code class="sourceCode" id="sourceCode"> package cn.edu.ecnu.stu.bookstore.config;
|
|
|
|
import cn.edu.ecnu.stu.bookstore.filter.AuthenticationFilter;
|
|
import cn.edu.ecnu.stu.bookstore.handler.AuthenticationEntryPointImpl;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.security.authentication.AuthenticationManager;
|
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
|
import org.springframework.security.config.http.SessionCreationPolicy;
|
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
|
import org.springframework.security.web.AuthenticationEntryPoint;
|
|
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
|
|
|
@Configuration
|
|
<b class="fc"> public class SecurityConfig extends WebSecurityConfigurerAdapter {</b>
|
|
|
|
@Bean
|
|
public PasswordEncoder passwordEncoder() {
|
|
<b class="fc"> return new BCryptPasswordEncoder();</b>
|
|
}
|
|
|
|
@Autowired
|
|
public AuthenticationFilter authenticationFilter;
|
|
|
|
@Bean
|
|
public AuthenticationEntryPoint authenticationEntryPoint() {
|
|
<b class="fc"> return new AuthenticationEntryPointImpl();</b>
|
|
}
|
|
|
|
@Bean
|
|
@Override
|
|
public AuthenticationManager authenticationManagerBean() throws Exception {
|
|
<b class="fc"> return super.authenticationManagerBean();</b>
|
|
}
|
|
|
|
@Override
|
|
protected void configure(HttpSecurity http) throws Exception {
|
|
<b class="fc"> http.csrf().disable()</b>
|
|
<b class="fc"> .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)</b>
|
|
<b class="fc"> .and()</b>
|
|
<b class="fc"> .authorizeRequests()</b>
|
|
<b class="fc"> .antMatchers("/auth/*", "/buyer/add_funds", "/buyer/payment").permitAll()</b>
|
|
<b class="fc"> .anyRequest().authenticated();</b>
|
|
|
|
<b class="fc"> http.addFilterBefore(authenticationFilter, UsernamePasswordAuthenticationFilter.class);</b>
|
|
<b class="fc"> http.exceptionHandling().authenticationEntryPoint(authenticationEntryPoint());</b>
|
|
}
|
|
}
|
|
</code>
|
|
</pre>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
(function() {
|
|
var msie = false, msie9 = false;
|
|
/*@cc_on
|
|
msie = true;
|
|
@if (@_jscript_version >= 9)
|
|
msie9 = true;
|
|
@end
|
|
@*/
|
|
|
|
if (!msie || msie && msie9) {
|
|
hljs.highlightAll()
|
|
hljs.initLineNumbersOnLoad();
|
|
}
|
|
})();
|
|
</script>
|
|
|
|
<div class="footer">
|
|
|
|
<div style="float:right;">generated on 2023-12-12 14:34</div>
|
|
</div>
|
|
</body>
|
|
</html>
|