数据库第二次大作业boostore
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

170 lines
4.8 KiB

<!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">&nbsp;package cn.edu.ecnu.stu.bookstore.config;
&nbsp;
&nbsp;import cn.edu.ecnu.stu.bookstore.filter.AuthenticationFilter;
&nbsp;import cn.edu.ecnu.stu.bookstore.handler.AuthenticationEntryPointImpl;
&nbsp;import org.springframework.beans.factory.annotation.Autowired;
&nbsp;import org.springframework.context.annotation.Bean;
&nbsp;import org.springframework.context.annotation.Configuration;
&nbsp;import org.springframework.security.authentication.AuthenticationManager;
&nbsp;import org.springframework.security.config.annotation.web.builders.HttpSecurity;
&nbsp;import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
&nbsp;import org.springframework.security.config.http.SessionCreationPolicy;
&nbsp;import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
&nbsp;import org.springframework.security.crypto.password.PasswordEncoder;
&nbsp;import org.springframework.security.web.AuthenticationEntryPoint;
&nbsp;import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
&nbsp;
&nbsp;@Configuration
<b class="fc">&nbsp;public class SecurityConfig extends WebSecurityConfigurerAdapter {</b>
&nbsp;
&nbsp; @Bean
&nbsp; public PasswordEncoder passwordEncoder() {
<b class="fc">&nbsp; return new BCryptPasswordEncoder();</b>
&nbsp; }
&nbsp;
&nbsp; @Autowired
&nbsp; public AuthenticationFilter authenticationFilter;
&nbsp;
&nbsp; @Bean
&nbsp; public AuthenticationEntryPoint authenticationEntryPoint() {
<b class="fc">&nbsp; return new AuthenticationEntryPointImpl();</b>
&nbsp; }
&nbsp;
&nbsp; @Bean
&nbsp; @Override
&nbsp; public AuthenticationManager authenticationManagerBean() throws Exception {
<b class="fc">&nbsp; return super.authenticationManagerBean();</b>
&nbsp; }
&nbsp;
&nbsp; @Override
&nbsp; protected void configure(HttpSecurity http) throws Exception {
<b class="fc">&nbsp; http.csrf().disable()</b>
<b class="fc">&nbsp; .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)</b>
<b class="fc">&nbsp; .and()</b>
<b class="fc">&nbsp; .authorizeRequests()</b>
<b class="fc">&nbsp; .antMatchers(&quot;/auth/*&quot;, &quot;/buyer/add_funds&quot;, &quot;/buyer/payment&quot;).permitAll()</b>
<b class="fc">&nbsp; .anyRequest().authenticated();</b>
&nbsp;
<b class="fc">&nbsp; http.addFilterBefore(authenticationFilter, UsernamePasswordAuthenticationFilter.class);</b>
<b class="fc">&nbsp; http.exceptionHandling().authenticationEntryPoint(authenticationEntryPoint());</b>
&nbsp; }
&nbsp;}
</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>