213.4d25e21f.js 1.4 KB
Newer Older
茶陵後's avatar
茶陵後 已提交
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[213],{636:function(t,e,n){"use strict";n.r(e);var i=n(56),s=Object(i.a)({},(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[n("h1",{attrs:{id:"webtestclient-security-setup"}},[n("a",{staticClass:"header-anchor",attrs:{href:"#webtestclient-security-setup"}},[t._v("#")]),t._v(" WebTestClient Security Setup")]),t._v(" "),n("p",[t._v("The basic setup looks like this:")]),t._v(" "),n("div",{staticClass:"language- extra-class"},[n("pre",{pre:!0,attrs:{class:"language-text"}},[n("code",[t._v("@RunWith(SpringRunner.class)\n@ContextConfiguration(classes = HelloWebfluxMethodApplication.class)\npublic class HelloWebfluxMethodApplicationTests {\n\t@Autowired\n\tApplicationContext context;\n\n\tWebTestClient rest;\n\n\t@Before\n\tpublic void setup() {\n\t\tthis.rest = WebTestClient\n\t\t\t.bindToApplicationContext(this.context)\n\t\t\t// add Spring Security test Support\n\t\t\t.apply(springSecurity())\n\t\t\t.configureClient()\n\t\t\t.filter(basicAuthentication())\n\t\t\t.build();\n\t}\n\t// ...\n}\n")])])]),n("p",[n("RouterLink",{attrs:{to:"/en/spring-security/index.html"}},[t._v("Testing Web Security")]),n("RouterLink",{attrs:{to:"/en/spring-security/authentication.html"}},[t._v("Testing Authentication")])],1)])}),[],!1,null,null,null);e.default=s.exports}}]);