๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๋ฐ˜์‘ํ˜•

AJAX2

[Spring Boot] spring security - CSRF ์ ์šฉ , +) ajax csrf ์ ์šฉ 1. gradle ํ˜น์€ maven์— 'spring-boot-starter-security' ์ถ”๊ฐ€ implementation 'org.springframework.boot:spring-boot-starter-security' org.springframework.boot spring-boot-starter-security 2.5.5 Spring Security๋Š” ์Šคํ”„๋ง ๊ธฐ๋ฐ˜์˜ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋ณด์•ˆ์„ ๋‹ด๋‹นํ•˜๋Š” ํ”„๋ ˆ์ž„์›Œํฌ๋กœ Spring Security๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋ณด์•ˆ์ฒ˜๋ฆฌ๋ฅผ ๊ฐ„๋‹จํ•˜๋ฉด์„œ ๊ฐ•๋ ฅํ•˜๊ฒŒ ๊ตฌํ˜„๊ฐ€๋Šฅํ•˜๋‹ค! 2. XXXXApplication.java์— @EnableWebSecurity ์„ ์–ธ @EnableWebSecurity :Spring Security๋ฅผ ํ™œ์„ฑํ™” @EnableWebSecurity @SpringBoot.. 2021. 12. 7.
[Ajax] ํŒŒ์ผ file ๋‹ค์šด๋กœ๋“œ ๋ฐ›๊ธฐ ๊ฒฐ๋ก ๋ถ€ํ„ฐ ๋งํ•˜์ž๋ฉด xhr.responseType = "blob" ๋กœ ์„ค์ •ํ•ด์•ผ ํ•œ๋‹ค! ๊ธฐ์กด์— ์‚ฌ์šฉํ•˜๋˜ ์ œ์ด์ฟผ๋ฆฌ ๋ฒ„์ „์ด 1.11.1์ด์˜€๋Š”๋ฐ ์ด ๋ฒ„์ „์€ blob์ด ์ ์šฉ์•ˆ๋˜๋”๋ผ.. ๋ฒ„์ „ ๋ฌธ์ œ์ธ์ค„ ๋ชจ๋ฅด๊ณ  ํ•œ์ฐธ์„ ์”จ๋ฆ„ ํ–ˆ๋Š”๋ฐ 3.6.0์œผ๋กœ ์˜ฌ๋ฆฌ๋‹ˆ๊นŒ ํ•ด๊ฒฐ๋๋‹ค. (์–ด๋–ค ๋ฒ„์ „๋ถ€ํ„ฐ ๋˜๋Š” ๊ฑด์ง€๋Š” ๋ชจ๋ฅด๊ฒ ์Œ) ์•„๋ž˜ ์˜ˆ์‹œ ์ฐธ์กฐ!! let options = { url: "[[@{/}]]download" , beforeSubmit : loadingAjaxImage , contentType: "application/x-www-form-urlencoded;charset=UTF-8" , xhr: function () { let xhr = new XMLHttpRequest(); xhr.onreadystatechange = function .. 2021. 11. 30.
728x90
๋ฐ˜์‘ํ˜•