Server๐Ÿงค

Server๐Ÿงค/SpringSecurity

[Spring] SpringSecurity ์•„ํ‚คํ…์ฒ˜ (๋‚ด๋ถ€๊ตฌ์กฐ, ThreadLocal, PasswordSecurity)

๋‚ด๋ถ€๊ตฌ์กฐ SecurityContext context = SecurityContextHolder.getContext(); // Security Context Authentication authentication = context.getAuthentication(); // authentication authentication.getPrincipal(); authentication.getAuthorities(); authentication.getCredentials(); authentication.getDetails(); authentication.isAuthenticated(); SecurityContextHolder SecurityContextHolder๋Š” SecurityContext๋ฅผ ์ œ๊ณตํ•˜๋Š” stati..

Server๐Ÿงค/SpringSecurity

[Spring] Spring Security์ด๋ž€

Spring Security ๋ž€ ์ธ์ฆ๊ณผ ์ธ๊ฐ€๋ผ๋Š” ๊ฐœ๋…์„ ์ตœ๋Œ€ํ•œ ์‰ฝ๊ณ  ์œ ์—ฐํ•˜๊ฒŒ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋งŒ๋“ค์–ด์ง„ Framework Spring์„ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด ์‚ฌ์‹ค์ƒ ์ตœ์„ ์˜ Security Framework Web ๊ธฐ๋ฐ˜ Application์— ๋ณด์•ˆ์ ์ธ ์ œํ•œ์„ ์ถ”๊ฐ€ํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” Security Framework ์ค‘์— ํ•˜๋‚˜ Rest API endpoint, mvc url, ์ •์  ๋ฆฌ์†Œ์Šค์™€๊ฐ™์€ ๋ฆฌ์†Œ์Šค๋“ค์— ์ ‘๊ทผํ•˜๋ ค๋Š” ์š”์ฒญ์˜ ์ธ์ฆ์„ ์ฑ…์ž„์ง€๋Š” ๊ฒƒ. Spring ์ƒํƒœ๊ณ„์™€ ํ˜ธํ™˜์„ฑ์ด ๋†’๊ณ  ์ปค์Šคํ…€์ด ๋งค์šฐ ์‰ฝ๋‹ค. ์ธ์ฆ ์‚ฌ์šฉ์ž๊ฐ€ ๋ˆ„๊ตฌ์ธ์ง€ ํ™•์ธํ•˜๋Š” ์ ˆ์ฐจ. ์ฆ‰, "๋‹น์‹ ์€ ๋ˆ„๊ตฌ์ž…๋‹ˆ๊นŒ?"๋ฅผ ํ™•์ธ ์—ฌ๊ธฐ์„œ ๋ฌธ์ œ์ ์ด ๋ฐœ์ƒํ•œ๋‹ค. ์ดํ›„์— ์œ ์ €๊ฐ€ UserA๋ผ๋Š” ๊ฒƒ์„ ์–ด๋–ป๊ฒŒ ์ฆ๋ช…ํ•  ์ˆ˜ ์žˆ์„๊นŒ? ๋ฐฉ๋ฒ• 1 : ๋ชจ๋“  ์š”์ฒญ๋งˆ๋‹ค ๋‚˜์˜ ID์™€ ํŒจ์Šค์›Œ๋“œ๋ฅผ ํฌํ•จ์‹œ์ผœ์„œ..

Server๐Ÿงค/QueryDsl

[Querydsl] ๋ฌดํ•œ ์Šคํฌ๋กค ๊ธฐ๋Šฅ ๊ตฌํ˜„ ( Offset vs No Offest )

Soptmakers์—์„œ, ๋๋ง์ž‡๊ธฐ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ–ˆ๋‹ค. ์ฒ˜์Œ MVP๋Š” ๋ชจ๋“  ํšŒ์ฐจ์˜ ๋๋ง์ž‡๊ธฐ ๋ชฉ๋ก์„ ๋ณด์ด๋„๋ก ํ•˜๊ธฐ๋กœ ํ–ˆ๋‹ค. ๋ฌดํ•œ ์Šคํฌ๋กค์„ ๊ตฌํ˜„ํ• ๋•Œ๋Š” limit, cursor, hasNext์™€ ๊ฐ™์€ ํ•„๋“œ๊ฐ€ ํ•„์š”ํ•˜๋‹ค. limit : ํŽ˜์ด์ง€ ์‚ฌ์ด์ฆˆ cursor: ์ฝ๊ณ  ์‹ถ์€ ํ–‰์˜ ๋ฐ์ดํ„ฐ ๊ฐœ์ˆ˜ hasNext: ์Šคํฌ๋กค ์ดํ›„ ๊ทธ ๋’ค์˜ ๋ฐ์ดํ„ฐ๊ฐ€ ๋‚จ์•„์žˆ๋Š”์ง€ ์—†๋Š”์ง€ ํŒ๋‹จํ•˜๋Š” ํ•„๋“œ ๋ฌธ์ œ์  ๋ฐœ์ƒ ์ „์ฒด ์กฐํšŒํ•˜๋Š” ๊ฒฝ์šฐ์—, ์ค‘๋ณต๋˜๋Š” ๋ฐ์ดํ„ฐ๊ฐ€ ๋ณด์ด๊ฒŒ๋จ limit์€ 10 cursor๋Š” 10, 20, 30~ ์˜ ๊ฐ’์œผ๋กœ ์š”์ฒญ ์ด ๊ณผ์ •์—์„œ, (0 ~ 10) (10 ~ 20) (20 ~ 30) ์ค‘๊ฐ„์˜ ๊ฐ’๋“ค์ด ์ค‘๋ณต๋˜๋Š” ํ˜„์ƒ ๋ฐœ์ƒ ๐Ÿ“Offest Based Pagination @Repository @RequiredArgsConstructor publi..

Server๐Ÿงค/JPA

[JPA] Java Persistence API

JPA ๊ฐœ์š” Persistence Java ๊ฐ์ฒด(์— ํฌํ•จ๋˜์–ด์žˆ๋Š” ๋ฐ์ดํ„ฐ)๋ฅผ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ํ†ตํ•ด ์ €์žฅ ๋ฐ ๊ด€๋ฆฌํ•จ์œผ๋กœ์จ ๊ฐ์ฒด์˜ ์˜์†์„ฑ์„ ๋ณด์žฅํ•จ Java Persistence API Object-Relational Mapping(ORM) ์„ ์‹คํ–‰ํ•˜๊ธฐ ์œ„ํ•œ Java ํ‘œ์ค€ API Entity๋กœ ์ •์˜๋œ Java ๊ฐ์ฒด์™€ ๋ฐ์ดํ„ฐ ๋ฒ ์ด์Šค ์‚ฌ์ด์˜ mapping ๋ฐฉ๋ฒ•์„ ์„ค์ •(annotation ์ด์šฉ) ์„ค์ •๋œ Mapping์— ๋”ฐ๋ผ Java๊ฐ์ฒด๋ฅผ DB์— ์ €์žฅ, ์ˆ˜์ •, ์‚ญ์ œ ๊ฒ€์ƒ‰ ํ•  ์ˆ˜ ์žˆ๋Š” Interface ์ œ๊ณต -> EntityManager JDBC API๋‚˜ Data Mapper (ex: MyBatis)์˜ ๋Œ€์•ˆ Java ์ค‘์‹ฌ์˜ ๋ฐ์ดํ„ฐ ๊ด€๋ฆฌ๊ฐ€ ๊ฐ€๋Šฅํ•ด์ง„๋‹ค. Persistence Provider (JPA Provider) JPA์˜..

yujindonut
'Server๐Ÿงค' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (4 Page)