WebSecurityConfigurerAdapter 女爷i 2022-05-24 09:58 107阅读 0赞 ### Hello Web Security ### 在这个部分,我们对一个基于web的security作一些基本的配置。可以分成四个部分: * 更新依赖 – 我们已经在[前一篇][Link 1]文章中用Maven进行了示范 * 进行Spring Security配置 – 这个例子中,我们采用[WebSecurityConfigurerAdapter][] * 确保Spring Security配置已经被加载了 – 我们采用[AbstractAnnotationConfigDispatcherServletInitializer][] * 配置springSecurityFilterChain – 我们采用[AbstractSecurityWebApplicationInitializer][] ### WebSecurityConfigurerAdapter ### @EnableWebSecurity注解以及WebSecurityConfigurerAdapter一起配合提供基于web的security。继承了WebSecurityConfigurerAdapter之后,再加上几行代码,我们就能实现以下的功能: * 要求用户在进入你的应用的任何URL之前都进行验证 * 创建一个用户名是“user”,密码是“password”,角色是“ROLE\_USER”的用户 * 启用HTTP Basic和基于表单的验证 * Spring Security将会自动生成一个登陆页面和登出成功页面 <table style="border-spacing:0px;width:620px;margin:0px;border:0px;padding:0px;font-size:12px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;min-height:auto;background:none;"> <tbody style="margin:0px;padding:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;background:none;"> <tr style="border-top-width:0px;margin:0px;padding:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;background:none;"> <td style="padding:0px;margin:0px;border:0px;color:rgb(175,175,175);line-height:1.1em;vertical-align:baseline;float:none;height:auto;width:auto;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;background:none;"> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 1 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 2 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 3 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 4 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 5 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 6 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 7 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 8 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 9 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 10 </div></td> <td style="width:586.4px;padding:0px;margin:0px;border:0px;line-height:1.1em;vertical-align:baseline;float:none;height:auto;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;background:none;"> <div style="margin-left:-10px;width:640px;padding:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;min-height:auto;background:none;"> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">@Configuration</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">@EnableWebSecurity</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">public</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">class</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> HelloWebSecurityConfiguration </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">extends</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">WebSecurityConfigurerAdapter { </code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">@Override</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">protected</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">void</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> registerAuthentication(AuthenticationManagerBuilder auth) { </code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">auth.inMemoryAuthentication()</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.withUser(</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"user"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">).password(</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"password"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">).roles(</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"USER"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">);</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">}</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">}</code> </div> </div></td> </tr> </tbody> </table> 作为参考,我们在这里也给出相似的XML配置,不过有几个特殊配置: * Spring Security会生成一个登陆页面,验证失败页面和登出成功页面 * login-processing-url仅仅处理HTTP POST * login-page仅仅通过HTTP GET进入 <table style="border-spacing:0px;width:620px;margin:0px;border:0px;padding:0px;font-size:12px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;min-height:auto;background:none;"> <tbody style="margin:0px;padding:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;background:none;"> <tr style="border-top-width:0px;margin:0px;padding:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;background:none;"> <td style="padding:0px;margin:0px;border:0px;color:rgb(175,175,175);line-height:1.1em;vertical-align:baseline;float:none;height:auto;width:auto;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;background:none;"> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 1 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 2 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 3 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 4 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 5 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 6 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 7 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 8 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 9 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 10 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 11 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 12 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 13 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 14 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 15 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 16 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 17 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 18 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 19 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 20 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 21 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 22 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 23 </div></td> <td style="width:586.4px;padding:0px;margin:0px;border:0px;line-height:1.1em;vertical-align:baseline;float:none;height:auto;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;background:none;"> <div style="margin-left:-10px;width:640px;padding:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;min-height:auto;background:none;"> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">http</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">use-expressions</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">=</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"true"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">intercept-url</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">pattern</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">=</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"/**"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">access</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">=</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"authenticated"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">/></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">logout</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">logout-success-url</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">=</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"/login?logout"</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">logout-url</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">=</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"/logout"</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">/></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">form-login</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">authentication-failure-url</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">=</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"/login?error"</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">login-page</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">=</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"/login"</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">login-processing-url</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">=</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"/login"</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">password-parameter</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">=</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"password"</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">username-parameter</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">=</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"username"</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">/></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"></</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">http</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">authentication-manager</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">authentication-provider</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">user-service</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">user</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">name</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">=</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"user"</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">password</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">=</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"password"</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">authorities</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">=</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"ROLE_USER"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">/></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"></</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">user-service</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"></</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">authentication-provider</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"></</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">authentication-manager</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> </div></td> </tr> </tbody> </table> AbstractAnnotationConfigDispatcherServletInitializer 下一步就是保证ApplicationContext包含我们刚刚定义的HelloWebSecurityConfiguration。有[几种方法][Link 2]都可行,我们这里使用[Spring的AbstractAnnotationConfigDispatcherServletInitializer][Spring_AbstractAnnotationConfigDispatcherServletInitializer]: <table style="border-spacing:0px;width:620px;margin:0px;border:0px;padding:0px;font-size:12px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;min-height:auto;background:none;"> <tbody style="margin:0px;padding:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;background:none;"> <tr style="border-top-width:0px;margin:0px;padding:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;background:none;"> <td style="padding:0px;margin:0px;border:0px;color:rgb(175,175,175);line-height:1.1em;vertical-align:baseline;float:none;height:auto;width:auto;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;background:none;"> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 1 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 2 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 3 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 4 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 5 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 6 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 7 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 8 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 9 </div></td> <td style="width:592.8px;padding:0px;margin:0px;border:0px;line-height:1.1em;vertical-align:baseline;float:none;height:auto;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;background:none;"> <div style="margin-left:-10px;width:640px;padding:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;min-height:auto;background:none;"> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">public</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">class</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> SpringWebMvcInitializer </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">extends</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">AbstractAnnotationConfigDispatcherServletInitializer { </code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">@Override</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">protected</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">Class[] getRootConfigClasses() { </code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">return</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">new</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> Class[] { HelloWebSecurityConfiguration.</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">class</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">};</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">}</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">...</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">}</code> </div> </div></td> </tr> </tbody> </table> Spring Security通常在web.xml中包含下面几行代码进行初始化: <table style="border-spacing:0px;width:620px;margin:0px;border:0px;padding:0px;font-size:12px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;min-height:auto;background:none;"> <tbody style="margin:0px;padding:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;background:none;"> <tr style="border-top-width:0px;margin:0px;padding:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;background:none;"> <td style="padding:0px;margin:0px;border:0px;color:rgb(175,175,175);line-height:1.1em;vertical-align:baseline;float:none;height:auto;width:auto;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;background:none;"> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 1 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 2 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 3 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 4 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 5 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 6 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 7 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 8 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 9 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 10 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 11 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 12 </div></td> <td style="width:586.4px;padding:0px;margin:0px;border:0px;line-height:1.1em;vertical-align:baseline;float:none;height:auto;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;background:none;"> <div style="margin-left:-10px;width:640px;padding:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;min-height:auto;background:none;"> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,130,0);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><!-- Creates the Spring Container shared by all Servlets and Filters --></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">listener</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">listener-class</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">org.springframework.web.context.ContextLoaderListener</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"></</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">listener-class</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"></</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">listener</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,130,0);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><!-- Load all Spring XML configuration including our security.xml file --></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">context-param</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">param-name</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">>contextConfigLocation</</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">param-name</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">param-value</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">>/WEB-INF/spring/*.xml</</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">param-value</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"></</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">context-param</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> </div></td> </tr> </tbody> </table> ### AbstractSecurity WebApplicationInitializer ### 最后一步,我们需要对springSecurityFilterChain定义映射路径。我们很容易通过继承[AbstractSecurityWebApplicationInitializer][AbstractSecurityWebApplicationInitializer 1]实现,并可以有选择的通过覆盖方法来定制映射。 下面是最基本的配置,它可以接受默认的映射路径,springSecurityFilterChain具有以下的特性: * springSecurityFilterChain映射到了”/\*” * springSecurityFilterChain使用ERROR和REQUEST分派类型(dispatch type) * springSecurityFilterChain插入到其它已经配置的servlet过滤器映射(servlet Filter mapping)之前 <table style="border-spacing:0px;width:620px;margin:0px;border:0px;padding:0px;font-size:12px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;min-height:auto;background:none;"> <tbody style="margin:0px;padding:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;background:none;"> <tr style="border-top-width:0px;margin:0px;padding:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;background:none;"> <td style="padding:0px;margin:0px;border:0px;color:rgb(175,175,175);line-height:1.1em;vertical-align:baseline;float:none;height:auto;width:auto;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;background:none;"> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 1 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 2 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 3 </div></td> <td style="width:592.8px;padding:0px;margin:0px;border:0px;line-height:1.1em;vertical-align:baseline;float:none;height:auto;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;background:none;"> <div style="margin-left:-10px;width:640px;padding:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;min-height:auto;background:none;"> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">public</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">class</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> SecurityWebApplicationInitializer</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">extends</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">AbstractSecurityWebApplicationInitializer { </code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">}</code> </div> </div></td> </tr> </tbody> </table> 上面的代码等同于将这几行代码放在web.xml中: <table style="border-spacing:0px;width:620px;margin:0px;border:0px;padding:0px;font-size:12px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;min-height:auto;background:none;"> <tbody style="margin:0px;padding:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;background:none;"> <tr style="border-top-width:0px;margin:0px;padding:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;background:none;"> <td style="padding:0px;margin:0px;border:0px;color:rgb(175,175,175);line-height:1.1em;vertical-align:baseline;float:none;height:auto;width:auto;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;background:none;"> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 1 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 2 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 3 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 4 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 5 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 6 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 7 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 8 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 9 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 10 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 11 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 12 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 13 </div></td> <td style="width:586.4px;padding:0px;margin:0px;border:0px;line-height:1.1em;vertical-align:baseline;float:none;height:auto;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;background:none;"> <div style="margin-left:-10px;width:640px;padding:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;min-height:auto;background:none;"> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">filter</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">filter-name</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">>springSecurityFilterChain</</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">filter-name</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">filter-class</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">org.springframework.web.filter.DelegatingFilterProxy</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"></</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">filter-class</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"></</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">filter</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">filter-mapping</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">filter-name</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">>springSecurityFilterChain</</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">filter-name</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">url-pattern</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">>/*</</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">url-pattern</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">dispatcher</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">>ERROR</</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">dispatcher</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"><</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">dispatcher</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">>REQUEST</</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">dispatcher</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"></</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">filter-mapping</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">></code> </div> </div></td> </tr> </tbody> </table> > WebApplicationInitializer的次序 > 在AbstractSecurityWebApplicationInitializer启动之后再加入的servlet过滤器映射,它们有可能会加在springSecurityFilterChain之前。除非这个应用不需要安全验证,否则springSecurityFilterChain需要放在其它所有的过滤器映射之前。@Order可以保证任何WebApplicationInitializer都使用特定的顺序加载。 ### CustomWebSecurityConfigurerAdapter ### 这个HelloWebSecurityConfiguration范例,为我们很好的展示了Spring Security Java配置是如何工作的。让我们来看看更多定制的配置吧。 <table style="border-spacing:0px;width:620px;margin:0px;border:0px;padding:0px;font-size:12px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;min-height:auto;background:none;"> <tbody style="margin:0px;padding:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;background:none;"> <tr style="border-top-width:0px;margin:0px;padding:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;background:none;"> <td style="padding:0px;margin:0px;border:0px;color:rgb(175,175,175);line-height:1.1em;vertical-align:baseline;float:none;height:auto;width:auto;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;background:none;"> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 1 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 2 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 3 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 4 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 5 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 6 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 7 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 8 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 9 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 10 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 11 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 12 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 13 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 14 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 15 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 16 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 17 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 18 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 19 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 20 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 21 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 22 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 23 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 24 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 25 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 26 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 27 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 28 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 29 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 30 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 31 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 32 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 33 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 34 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 35 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 36 </div> <div style="padding:0px .5em 0px 1em;margin:0px;border-width:0px 3px 0px 0px;border-right-style:solid;border-right-color:rgb(108,226,108);float:none;height:auto;line-height:1.1em;text-align:right;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> 37 </div></td> <td style="width:586.4px;padding:0px;margin:0px;border:0px;line-height:1.1em;vertical-align:baseline;float:none;height:auto;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;min-height:auto;background:none;"> <div style="margin-left:-10px;width:640px;padding:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;min-height:auto;background:none;"> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">@EnableWebSecurity</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">@Configuration</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">public</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">class</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> CustomWebSecurityConfigurerAdapter </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">extends</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">WebSecurityConfigurerAdapter { </code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">@Override</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">protected</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">void</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> registerAuthentication(AuthenticationManagerBuilder auth) { </code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">auth</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.inMemoryAuthentication()</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.withUser(</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"user"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">) </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,130,0);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">// #1</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.password(</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"password"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">)</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.roles(</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"USER"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">)</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.and()</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.withUser(</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"admin"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">) </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,130,0);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">// #2</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.password(</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"password"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">)</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.roles(</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"ADMIN"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">,</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"USER"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">);</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">}</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">@Override</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">public</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">void</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> configure(WebSecurity web) </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">throws</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">Exception { </code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">web</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.ignoring()</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.antMatchers(</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"/resources/**"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">); </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,130,0);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">// #3</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">}</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#808080;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">@Override</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">protected</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">void</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;"> configure(HttpSecurity http) </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,102,153);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;font-weight:bold;min-height:auto;background:none;">throws</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">Exception { </code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">http</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.authorizeUrls()</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.antMatchers(</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"/signup"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">,</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"/about"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">).permitAll() </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,130,0);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">// #4</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.antMatchers(</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"/admin/**"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">).hasRole(</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"ADMIN"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">) </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,130,0);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">// #6</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.anyRequest().authenticated() </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,130,0);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">// #7</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.and()</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.formLogin() </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,130,0);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">// #8</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.loginUrl(</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:#0000FF;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">"/login"</code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">) </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,130,0);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">// #9</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">.permitAll(); </code> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;color:rgb(0,130,0);border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">// #5</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">}</code> </div> <div style="padding:0px 1em;margin:0px;border:0px;float:none;height:auto;line-height:1.1em;vertical-align:baseline;width:auto;min-height:auto;white-space:pre;"> <code style="font-size:14px;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;line-height:1.1em;border:0px;margin:0px;padding:0px;float:none;height:auto;vertical-align:baseline;width:auto;min-height:auto;background:none;">}</code> </div> </div></td> </tr> </tbody> </table> 我们也需要更新[`AbstractAnnotationConfigDispatcherServletInitializer`][AbstractAnnotationConfigDispatcherServletInitializer],这样`CustomWebSecurityConfigurerAdapter`可以实现以下功能: * \#1 可以在内存中的验证(memory authentication)叫作”user”的用户 * \#2 可以在内存中的验证(memory authentication)叫作”admin”的管理员用户 * \#3 忽略任何以”/resources/”开头的请求,这和在XML配置[http@security=none][http_security_none]的效果一样 * \#4 任何人(包括没有经过验证的)都可以访问”/signup”和”/about” * \#5 任何人(包括没有经过验证的)都可以访问”/login”和”/login?error”。permitAll()是指用户可以访问formLogin()相关的任何URL。 * \#6 “/admin/”开头的URL必须要是管理员用户,譬如”admin”用户 * \#7 所有其他的URL都需要用户进行验证 * \#8 使用Java配置默认值设置了基于表单的验证。使用POST提交到”/login”时,需要用”username”和”password”进行验证。 * \#9 注明了登陆页面,意味着用GET访问”/login”时,显示登陆页面 下面的XML配置和上面的Java配置类似: ### Java配置和XML命名空间的相同之处 ### 在看过了更复杂的例子之后,你可能已经找到了一些XML命名空间和Java配置的相似之处。我在这里说明几条有用的信息: * HttpSecurity和http命名空间类似。它可以对于某一部分请求进行特别配置。要看个完整的配置实例,详见[SampleMultiHttpSecurityConfig][] * WebSecurity和Security的命名空间的元素很类似,后者是针对web的,不需要父节点(security=none, debug等等)。可以对整个web security进行配置。 * WebSecurityConfigurerAdapter方便我们定制WebSecurity和HttpSecurity。我们可以对WebSecurityConfigurerAdapter进行多次继承,以实现不同的http行为。详细的实例参见[SampleMultiHttpSecurityConfig][] * 我们以上的Java配置代码作了代码格式化,所以易于阅读。“and()”类似于XML中结束一个元素的结束符。 ### Java配置和XML命名空间的不同之处 ### 你已经意识到了XML和Java配置的不同之处 * 当你在”\#1″和“\#2”中创建用户的时候,我们并没有设置为”ROLE\_“前缀,而我们在XML设置成了“ROLE\_USER”。因为这是个管理,”roles()”方法会自动添加”ROLE\_“。如果你不想要”ROLE\_“,你可以使用”authoritites()”方法。 * Java配置有一些不同的默认URL和参数。当要创建自定义的登陆页面的时候要将这一条牢记在心。默认的URL使我们的URL更加RESTful。另外,使用Spring Security可以帮我避免[信息泄露][Link 3])。例如: * GET访问`/login`登陆页面,而不是访问`/spring_security_login` * POST访问`/login,而不是/j_spring_security_check` * 用户名默认为parameter,而不是j\_username * 密码默认是password,而不是j\_password * Java配置可以更容易将多个请求映射到同样的角色上。\#4就将两个URL作了映射,以便所有人都可以访问 * Java移除了多余的代码。例如,在XML中我们不得不在`form-login`和`intercept-url`中重复两次”/login”,而在Java配置中,我们靠\#5就轻易做到了让用户都能访问到和formLogin()相关的URL。 * \#6映射HTTP请求的时候,我们使用了“hasRole()”方法,我们也没有添加”ROLE\_”前缀,而在XML中我们则添加了。这也是我们应该知道的惯例:”hasRole()”会自动添加”ROLE\_”前缀。如果你不想要“ROLE\_”前缀,你可以使用”access()”方法。 ### 更多的示例 ### 我们还提供了更多的示例,你应该想跃跃欲试了吧: * HttpSecurity的[Javadoc][]中有一些例子。查看方法的Javadoc有助你学习到不少东西,如[openid][], [remember me][]等。 * [入门教程][Link 4] * [基于Web的示例][Web] * [完整的Web应用][Web 1] ### 从XML命名空间到Java配置 ### 如果你觉得从XML转变成Java配置有一定困难,你可以先看看这些测试。这些测试中,XML元素的名称以”Namespace”开头,中间是XML元素的名称,然后以”Tests”结尾。例如,你想学习如何将http元素转换成Java配置,你可以看看[NamespaceHttpTests][];你如果想学习如何将remember-me命名空间转换成Java配置,参见[NamespaceRememberMeTests][] ### 欢迎反馈 ### 如果你发现了bug,或者觉得有什么地方值得改进,请你不要犹豫,给我们留言!我们希望听到你的想法,以便在大部分人获得代码之前,我们便确保代码的正确性。很早的尝试新功能是一种简单有效的回馈社区的方法,这样做的好处就是能帮助你获得你希望获得的功能。 请到“Java Config”目录下的[Spring Security JIRA][]记录下任何问题。记录了一个JIRA之后,我们希望(当然并不是必须的)你在pull request中提交你的代码。你可以在[贡献者指引][Link 5]中阅读更详细的步骤。如果你有任何不清楚的,请使用[Spring Security论坛][Spring Security]或者[Stack Overflow][],并使用”spring-security”标签(我会一直查看这个标签)。如果你针对这个博客有任何意见,也请留言。使用合适的工具对每个人来说都会带来便利。 ### 结论 ### 你可能已经对基于web的security的Java配置已经有了一定的认识了。[下一篇][Link 6]中,我们将会带你来看下如何用Java配置来配置基于method的security。 原文链接: [Springsource][] 翻译: [ImportNew.com ][ImportNew.com] \- [唐小娟][Link 7] 译文链接: [http://www.importnew.com/5641.html][http_www.importnew.com_5641.html] \[ 转载请保留原文出处、译者和译文链接。 \] [Link 1]: http://www.importnew.com/5520.html [WebSecurityConfigurerAdapter]: http://blog.springsource.org/2013/07/03/spring-security-java-config-preview-web-security/#wsca [AbstractAnnotationConfigDispatcherServletInitializer]: http://blog.springsource.org/2013/07/03/spring-security-java-config-preview-web-security/#aacdsi [AbstractSecurityWebApplicationInitializer]: http://blog.springsource.org/2013/07/03/spring-security-java-config-preview-web-security/aswai [Link 2]: http://static.springsource.org/spring/docs/current/javadoc-api/org/springframework/web/WebApplicationInitializer.html [Spring_AbstractAnnotationConfigDispatcherServletInitializer]: http://static.springsource.org/spring/docs/current/spring-framework-reference/htmlsingle/#mvc-container-config [AbstractSecurityWebApplicationInitializer 1]: http://static.springsource.org/spring-security/site/docs/3.2.x/apidocs/org/springframework/security/web/context/AbstractSecurityWebApplicationInitializer.html [http_security_none]: http://static.springsource.org/spring-security/site/docs/3.1.x/reference/appendix-namespace.html#nsa-http-security [SampleMultiHttpSecurityConfig]: https://github.com/SpringSource/spring-security-javaconfig/blob/master/samples-web.md#sample-multi-http-web-configuration [Link 3]: https://www.owasp.org/index.php/Information_Leak_%28information_disclosure [Javadoc]: http://static.springsource.org/spring-security/site/docs/3.2.x/apidocs/org/springframework/security/config/annotation/web/builders/HttpSecurity.html [openid]: http://static.springsource.org/spring-security/site/docs/3.2.x/apidocs/org/springframework/security/config/annotation/web/builders/HttpSecurity.html#openidLogin%28%29 [remember me]: http://static.springsource.org/spring-security/site/docs/3.2.x/apidocs/org/springframework/security/config/annotation/web/builders/HttpSecurity.html#rememberMe%28%29 [Link 4]: https://github.com/SpringSource/spring-security-javaconfig/blob/master/quickstart.md [Web]: https://github.com/SpringSource/spring-security-javaconfig/blob/master/samples-web.md [Web 1]: https://github.com/SpringSource/spring-security-javaconfig/tree/master/samples [NamespaceHttpTests]: https://github.com/SpringSource/spring-security-javaconfig/blob/master/spring-security-javaconfig/src/test/groovy/org/springframework/security/config/annotation/web/builders/NamespaceHttpTests.groovy [NamespaceRememberMeTests]: https://github.com/SpringSource/spring-security-javaconfig/blob/master/spring-security-javaconfig/src/test/groovy/org/springframework/security/config/annotation/web/configurers/NamespaceRememberMeTests.groovy [Spring Security JIRA]: https://jira.springsource.org/browse/SEC [Link 5]: https://github.com/SpringSource/spring-security/blob/master/CONTRIBUTING.md [Spring Security]: http://forum.springsource.org/forumdisplay.php?33-Security [Stack Overflow]: http://stackoverflow.com/questions/tagged/spring-security [Link 6]: http://www.importnew.com/5670.html [Springsource]: http://blog.springsource.org/2013/07/03/spring-security-java-config-preview-web-security/ [ImportNew.com]: http://www.importnew.com/ [Link 7]: http://www.importnew.com/author/tangxiaojuan [http_www.importnew.com_5641.html]: http://www.importnew.com/5641.html
相关 解决Spring Boot 2.7后WebSecurityConfigurerAdapter的过期问题 参考链接: [进入 SpringBoot2.7,有一个重要的类过期了\_慕课手记][SpringBoot2.7] 1.WebSecurityConfigurerAd 我不是女神ヾ/ 2023年10月09日 15:42/ 0 赞/ 35 阅读
相关 SpringBoot - WebSecurityConfigurerAdapter的作用是什么? 写在前面 WebSecurityConfigurer 只是一个空接口,WebSecurityConfigurerAdapter 就是针对这个空接口提供一个具体的实现,最终 迷南。/ 2023年10月08日 01:23/ 0 赞/ 70 阅读
相关 Spring Security即将弃用WebSecurityConfigurerAdapter配置类 用过`WebSecurityConfigurerAdapter`的都知道对Spring Security十分重要,总管Spring Security的配置体系。但是马上这个类要 一时失言乱红尘/ 2023年10月01日 19:42/ 0 赞/ 4 阅读
相关 Spring Security - 如何修复 WebSecurityConfigurerAdapter 已弃用 在这篇简短的文章中,我想分享如何摆脱在带有Spring Security的基于Spring的应用程序中的“WebSecurityConfigurerAdapter类型已被弃用” 刺骨的言语ヽ痛彻心扉/ 2023年09月25日 12:51/ 0 赞/ 97 阅读
相关 Spring Security 替换WebSecurityConfigurerAdapter (Deprecated)的方法 在本文中,我将提供一个解决方案来配置Spring 安全性,而无需 WebSecurityConfigurerAdapter 类。从 Spring Security 5.7 开始 野性酷女/ 2023年09月25日 12:51/ 0 赞/ 102 阅读
相关 深入理解 WebSecurityConfigurerAdapter【源码篇】 我们继续来撸 Spring Security 源码,今天来撸一个非常重要的 WebSecurityConfigurerAdapter。 我们的自定义都是继承自 WebSecu 谁践踏了优雅/ 2023年03月02日 10:53/ 0 赞/ 122 阅读
相关 SpringSecurity WebSecurityConfigurerAdapter类使用 WebSecurityConfigurerAdapter 类是个适配器, 在配置的时候,需要我们自己写个配置类去继承他,然后编写自己所特殊需要的配置 @Configurati ゞ 浴缸里的玫瑰/ 2022年10月12日 15:52/ 0 赞/ 137 阅读
相关 WebSecurityConfigurerAdapter Hello Web Security 在这个部分,我们对一个基于web的security作一些基本的配置。可以分成四个部分: 更新依赖 – 我们已经在[前一篇][ 女爷i/ 2022年05月24日 09:58/ 0 赞/ 108 阅读
还没有评论,来说两句吧...