๐ŸŒธ [SPRING BOOT] | ์‹œํ๋ฆฌํ‹ฐ & ํƒ€์ž„๋ฆฌํ”„ - sec:authorize="isAnonymous()" , Spring Security Thymleaf Library, Spring security, th:with="auth=${#authentication.getPrincipal()}"

0
post-thumbnail

๐ŸŸฆ sec:authorize="isAnonymous()"

โœ… <li sec:authorize="isAnonymous()">๋กœ๊ทธ์ธ</li>

<li sec:authorize="isAnonymous()">๋กœ๊ทธ์ธ</li>
  • isAnonymous()๋Š” ๋กœ๊ทธ์ธ ํ•˜์ง€ ์•Š์€ Anonymous User์ธ์ง€ ํ™•์ธํ•˜์—ฌ
  • Anonymous User์ธ ๊ฒฝ์šฐ true๋ฅผ returnํ•œ๋‹ค.

๐ŸŸฆ Spring Security Thymleaf Library

  • Thymeleaf๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด View ํŽ˜์ด์ง€์—์„œ ์‚ฌ์šฉ์ž์˜ ์ธ์ฆ ์ •๋ณด๋ฅผ ์ฐธ์กฐํ•˜๊ณ  ์‹ถ์€๊ฒฝ์šฐ
  • Thymeleaf์—์„œ ์ œ๊ณตํ•˜๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ํ•˜๋‚˜ ์ถ”๊ฐ€ํ•˜๋ฉด ๊ฐ„๋‹จํ•˜๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.
  • ์ด๋Š” Spring Security๊ฐ€ ์•„๋‹Œ ํƒ€์ž„๋ฆฌํ”„์—์„œ ์ œ๊ณตํ•˜๋Š” ๊ฒƒ์ด๋‹ค.

๐ŸŸฆ Spring security

  • Spring ๊ธฐ๋ฐ˜ ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๋ณด์•ˆ๊ธฐ๋Šฅ ๊ตฌํ˜„์— ์ด์šฉ๋˜๋Š” ํ”„๋ ˆ์ž„์›Œํฌ.
  • ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ณด์•ˆ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ด์ค๋‹ˆ๋‹ค.
  • ๋กœ๊ทธ์ธ ์ธ์ฆ(Authentication)
  • ๊ถŒํ•œ์— ๋”ฐ๋ฅธ ์ ‘๊ทผ ์ธ๊ฐ€(Authorization)
  • ์„ธ์…˜ ๊ด€๋ฆฌ
  • ์•”ํ˜ธํ™” (encryption)
  • CSRF(cross site request forgery) ๊ณต๊ฒฉ ๋ฐฉ์–ด
  • ๋ธŒ๋ผ์šฐ์ € ๊ธฐ๋Šฅ์„ ์ด์šฉํ•œ ๊ณต๊ฒฉ์œผ๋กœ๋ถ€ํ„ฐ ๋ฐฉ์–ด

๐ŸŸฆ th:with="auth=${#authentication.getPrincipal()}"

โœ… th:with="auth=${#authentication.getPrincipal()}"

profile
๋ช‡ ๋ฒˆ์„ ๋„˜์–ด์ ธ๋„ ์•ž์œผ๋กœ ๊ณ„์† ๋‚˜์•„๊ฐ€์ž

0๊ฐœ์˜ ๋Œ“๊ธ€