๋ฐ์ํ
๋ฌธ์ : Security ๋ก๊ทธ์ธ์ ์ฑ๊ณต์ ํ๋ฉด ๋ด๊ฐ ์ค์ ํด๋ url๋ก redirect๊ฐ ๋์ง ์๊ณ .css ํ์ผ์ด๋ imageํ์ผ๋ก ์ด๋ํ๋ค.
๋ฌธ์ ์ : Security config์์ js ๋๋ css ํด๋๋ฅผ ํ์ฉํด์ฃผ์ง ์์๊ธฐ ๋๋ฌธ์
๋ฌธ์ ์ ์๋ ์ฝ๋
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.defaultSuccessUrl("/")
.and()
.logout()
.logoutSuccessUrl("/")
.and()
.csrf().disable();
}
์์ ๋ ์ฝ๋
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring()
.requestMatchers(PathRequest.toStaticResources().atCommonLocations());
}
SecurityConfig.java์ ํด๋น ๋ฉ์๋๋ฅผ ์ถ๊ฐํด์คฌ๋ค. ํด๋น ๋ฉ์๋๋ ์๋์ฝ๋์ ๋ฉ์๋๋ณด๋ค ๋ ๋น ๋ฅด๊ฒ ์คํ๋๊ธฐ ๋๋ฌธ์ ์ด๋ฌํ static ๋ฆฌ์์ค ํ์ผ๋ค์ ํํฐ๋ง์์ ์ ์ธํ๊ธฐ ์ํด ์ฌ์ฉํ๋ฉด ์๋ ์ธก๋ฉด์์ ๋ ์ข๋ค๊ณ ํ์ จ๋ค. (feat. ๋ฐฑ๊ธฐ์ ๋)
์ฐธ๊ณ :
Spring security login crashes after the login page it shows the css , js, image files . How to fix this?
when i open the web application from browser. localhost:8080/myapp it shows the login page with out styled in the css file. even refresh also it shows normal form but we can give the login creden...
stackoverflow.com
๋ฐ์ํ