Skip to content

Commit

Permalink
๐Ÿš€ [Deploy] - ํ•ด์ปคํ†ค ์ดํ›„, ์ˆ˜์ •์‚ฌํ•ญ ์ˆ˜์ • ํ›„ ๋ฐฐํฌ (#166)
Browse files Browse the repository at this point in the history
* refactor: ์ฝ”๋“œ ์Šคํƒ€์ผ ์ˆ˜์ • (#154)

* Chore: ๋ถˆํ•„์š”ํ•œ ๋ถ€๋ถ„ ์‚ญ์ œ (#157)

* ๐Ÿ› [Fix] - ์ž‘์—… ๋ชฉ๋ก API ์ˆ˜์ • (#158)

* refactor: ์ฝ”๋“œ ์Šคํƒ€์ผ ์ˆ˜์ •

* fix: Work ์ƒ์„ฑ ๋‚ ์งœ ๊ธฐ์ค€์œผ๋กœ ๋‚ด๋ฆผ์ฐจ์ˆœ ์„ค์ •

* ๐Ÿ› [Fix] - PeerReview ๋‹จ๊ณ„ ์˜ˆ์™ธ์ฒ˜๋ฆฌ (#160)

* refactor: ์ฝ”๋“œ ์Šคํƒ€์ผ ์ˆ˜์ •

* fix: Work ์ƒ์„ฑ ๋‚ ์งœ ๊ธฐ์ค€์œผ๋กœ ๋‚ด๋ฆผ์ฐจ์ˆœ ์„ค์ •

* fix: PeerReview์ผ ๊ฒฝ์šฐ ์ถ”๊ฐ€

* Chore: discord command ์ด๋ฆ„ ๋ณ€๊ฒฝ (#163)

* Hotfix: ๋น„๋ฐ€๋ฒˆํ˜ธ ์ธ์ฆ ๋กœ์ง ์ถ”๊ฐ€ (#165)

---------

Co-authored-by: JeongHeumChoi <[email protected]>
  • Loading branch information
dlawjddn and JeongHeumChoi authored Mar 26, 2024
1 parent 34206c6 commit bd71e78
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ public static void main(String[] args) {
.setMemberCachePolicy(MemberCachePolicy.ALL)
.setActivity(Activity.playing("START UP VALLEY"))
.addEventListeners(new DiscordListener(
context.getBean(UserService.class),
context.getBean(TeamService.class),
context.getBean(MemberService.class),
context.getBean(QuestionService.class),
context.getBean(AnswerService.class),
context.getBean(ScrumService.class),
context.getBean(WorkService.class),
context.getBean(GptService.class),
context.getBean(ReviewService.class)
context.getBean(UserService.class),
context.getBean(TeamService.class),
context.getBean(MemberService.class),
context.getBean(QuestionService.class),
context.getBean(AnswerService.class),
context.getBean(ScrumService.class),
context.getBean(WorkService.class),
context.getBean(GptService.class),
context.getBean(ReviewService.class)
)
)
.build();

jda.updateCommands().addCommands(
Commands.slash("ํŒ€์›์—…๋ฐ์ดํŠธ", "์›น์— ์‚ฌ์šฉ์ž๋“ค๊ณผ ํ˜„์žฌ ์ง„ํ–‰ํ•˜๋Š” ํ”„๋กœ์ ํŠธ๋ฅผ ์—ฐ๋™ํ•ด์š” ! "),
Commands.slash("ํŒŒํŠธ์ž…๋ ฅํ•˜๊ธฐ", "ํ”„๋กœ์ ํŠธ์—์„œ ๋งก์€ ๋ณธ์ธ์˜ ์—ญํ• ์„ ์ž…๋ ฅํ•ด ์ฃผ์„ธ์š” !")
.addOption(OptionType.STRING, "part", "๋ณธ์ธ์˜ ์—ญํ• ์„ 'BACKEND', 'FRONTEND', 'FULLSTACK', 'PM', 'DESIGN' ์ค‘์—์„œ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š” !", true),
.addOption(OptionType.STRING, "part", "๋ณธ์ธ์˜ ์—ญํ• ์„ 'BACKEND', 'FRONTEND', 'FULLSTACK', 'PM', 'DESIGN' ์ค‘์—์„œ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š” !", true),
Commands.slash("์งˆ๋ฌธํ•˜๊ธฐ", "๊ถ๊ธˆํ•œ ์ ์„ ์งˆ๋ฌธํ•ด๋ด์š” ! ")
.addOption(OptionType.USER, "receiver", "์งˆ๋ฌธ ๋ฐ›์„ ์‚ฌ๋žŒ์„ ์„ ํƒํ•ด์ฃผ์„ธ์š” !", true)
.addOption(OptionType.STRING, "question_content", "์งˆ๋ฌธ ๋‚ด์šฉ์„ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š” !", true),
Expand All @@ -60,7 +60,7 @@ public static void main(String[] args) {
Commands.slash("์—…๋ฌด์‹œ์ž‘", "์˜ค๋Š˜์˜ ์—…๋ฌด ์‹œ๊ฐ„์„ ์‹œ์ž‘ํ•ด์š” !"),
Commands.slash("์—…๋ฌด์ข…๋ฃŒ", "์˜ค๋Š˜์˜ ์—…๋ฌด๋ฅผ ์ข…๋ฃŒํ•ด์š” ! ์—…๋ฌด ๋‚ด์šฉ๊ณผ ํ•จ๊ป˜ ๊ธฐ์ž…ํ•ด์ฃผ์„ธ์š” ~ !")
.addOption(OptionType.STRING, "work_list", "์˜ค๋Š˜์˜ ์—…๋ฌด ๋‚ด์šฉ์„ '; '์„ ํ†ตํ•ด์„œ ๊ตฌ๋ถ„ํ•˜์—ฌ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š” !! ", true),
Commands.slash("์Šคํฌ๋Ÿผ์ข…๋ฃŒ", "์ง€๊ธˆ๊นŒ์ง€์˜ ์—…๋ฌด๋“ค๋กœ ํ•˜๋‚˜์˜ ์Šคํฌ๋Ÿผ์„ ์ƒ์„ฑํ•ด์š” ! "),
Commands.slash("๋ฐฑ๋กœ๊ทธ์ข…๋ฃŒ", "์ง€๊ธˆ๊นŒ์ง€์˜ ์—…๋ฌด๋“ค๋กœ ํ•˜๋‚˜์˜ ๋ฐฑ๋กœ๊ทธ๋ฅผ ์ƒ์„ฑํ•ด์š” ! "),
Commands.slash("ํ”„๋กœ์ ํŠธ์ข…๋ฃŒ", "ํ”„๋กœ์ ํŠธ์˜ ๋ฆฌ๋”๊ฐ€ ๊ฒฐ์ • ํ•  ์ˆ˜ ์žˆ์–ด์š” ! ์ข…๋ฃŒํ•˜๊ณ  ๋™๋ฃŒํ‰๊ฐ€ ๋‹จ๊ณ„๋กœ ๋„˜์–ด๊ฐ€์š” ! "),
Commands.slash("์„œ๋ฒ„์ตœ์‹ ํ™”", "๋””์Šค์ฝ”๋“œ์˜ ์„œ๋ฒ„ ์ด๋ฆ„๊ณผ ์ด๋ฏธ์ง€์˜ ๋ณ€๊ฒฝ์ ์„ ์›น์— ์ ์šฉํ•ด์š” ! "),
Commands.slash("๋™๋ฃŒํ‰๊ฐ€์ž‘์„ฑ", "๊ฐœ๋ฐœ์ด ๋งˆ๋ฌด๋ฆฌ ๋˜์…จ๋‚˜์š”? ํ”„๋กœ์ ํŠธ ์ข…๋ฃŒ ์ดํ›„์— ํŒ€์›๋“ค ์‚ฌ์ด์— ๋™๋ฃŒํ‰๊ฐ€๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค !")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ public void onSlashCommandInteraction(SlashCommandInteractionEvent event) {
.setEphemeral(true).queue();
break;

case "์Šคํฌ๋Ÿผ์ข…๋ฃŒ":
case "๋ฐฑ๋กœ๊ทธ์ข…๋ฃŒ":
Optional<Scrum> optionalScrum = getProcessingScrum(event, event.getUser().getName());
// ์ข…๋ฃŒํ•  ์Šคํฌ๋Ÿผ์ด ์—†๋Š” ๊ฒฝ์šฐ
if (optionalScrum.isEmpty()){
event.reply("์ง„ํ–‰ ํ–ˆ๋˜ ์—…๋ฌด๊ฐ€ ์—†์–ด์„œ ์Šคํฌ๋Ÿผ์„ ์ข…๋ฃŒํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค ใ… ใ… .. ์—…๋ฌด๋ฅผ ์‹œ์ž‘ํ•˜์—ฌ ๋ฐ์ดํ„ฐ๋ฅผ ๋งŒ๋“ค์–ด ์ฃผ์„ธ์š” !!! ")
event.reply("์ง„ํ–‰ ํ–ˆ๋˜ ์—…๋ฌด๊ฐ€ ์—†์–ด์„œ ๋ฐฑ๋กœ๊ทธ๋ฅผ ์ข…๋ฃŒํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค ใ… ใ… .. ์—…๋ฌด๋ฅผ ์‹œ์ž‘ํ•˜์—ฌ ๋ฐ์ดํ„ฐ๋ฅผ ๋งŒ๋“ค์–ด ์ฃผ์„ธ์š” !!! ")
.setEphemeral(true).queue();
return;
}
Expand All @@ -220,7 +220,7 @@ public void onSlashCommandInteraction(SlashCommandInteractionEvent event) {
// ์—…๋ฌด๊ฐ€ ์•„์ง ์ข…๋ฃŒ๋˜์ง€ ์•Š๋Š” ๊ฒƒ์ด ์žˆ๋Š” ๊ฒฝ์šฐ
Optional<Work> optionWork = getMyProcessingWork(event);
if (optionWork.isPresent()){
event.reply("์ง„ํ–‰ ์ค‘์ธ ์—…๋ฌด๊ฐ€ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค ใ… ใ…  ์—…๋ฌด๋ฅผ ์ข…๋ฃŒํ•œ ๋’ค, ์Šคํฌ๋Ÿผ์„ ์ข…๋ฃŒํ•˜์—ฌ ์ฃผ์„ธ์š” ! ")
event.reply("์ง„ํ–‰ ์ค‘์ธ ์—…๋ฌด๊ฐ€ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค ใ… ใ…  ์—…๋ฌด๋ฅผ ์ข…๋ฃŒํ•œ ๋’ค, ๋ฐฑ๋กœ๊ทธ๋ฅผ ์ข…๋ฃŒํ•˜์—ฌ ์ฃผ์„ธ์š” ! ")
.setEphemeral(true).queue();
return ;
}
Expand All @@ -242,7 +242,7 @@ public void onSlashCommandInteraction(SlashCommandInteractionEvent event) {
.setEphemeral(true).queue();
return ;
}
event.reply("ํ•˜๋‚˜์˜ ์Šคํฌ๋Ÿผ์ด ๋งˆ๋ฌด๋ฆฌ ๋์–ด์š” ~! ์•ž์œผ๋กœ์˜ ์Šคํฌ๋Ÿผ๋„ ํ™”์ดํŒ…์ž…๋‹ˆ๋‹ค ~ !\n")
event.reply("ํ•˜๋‚˜์˜ ๋ฐฑ๋กœ๊ทธ๊ฐ€ ๋งˆ๋ฌด๋ฆฌ ๋์–ด์š” ~! ์•ž์œผ๋กœ์˜ ๋ฐฑ๋กœ๊ทธ๋„ ํ™”์ดํŒ…์ž…๋‹ˆ๋‹ค ~ !\n")
.setEphemeral(true).queue();
break;

Expand Down Expand Up @@ -300,7 +300,7 @@ public void onSlashCommandInteraction(SlashCommandInteractionEvent event) {
event.reply("์ด๋ฏธ ๋™๋ฃŒํ‰๊ฐ€๋ฅผ ์ž‘์„ฑํ•œ ํŒ€์›์ž…๋‹ˆ๋‹ค ! ๋‹ค๋ฅธ ๋ถ„์˜ ๋™๋ฃŒํ‰๊ฐ€๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š” !").setEphemeral(true).queue();
return ;
}

// ๋ณธ์ธ์—๊ฒŒ ์ž‘์„ฑํ•  ์ˆ˜ ์—†์Œ
if (sendMember.getId().equals(receiveMember.getId())){
event.reply("๋ณธ์ธ์—๊ฒŒ ๋™๋ฃŒํ‰๊ฐ€๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค ! ๋‹ค๋ฅธ ๋ถ„์˜ ๋™๋ฃŒํ‰๊ฐ€๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š” !").setEphemeral(true).queue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import goormthon.team28.startup_valley.exception.ErrorCode;
import goormthon.team28.startup_valley.security.info.AuthenticationResponse;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.core.AuthenticationException;
Expand All @@ -13,11 +12,13 @@
@Component
public class CustomAuthenticationEntryPointHandler implements AuthenticationEntryPoint {
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException {
// filter ๋‹จ์—์„œ ๋ฐœ์ƒํ•œ ์—๋Ÿฌ ํ•ธ๋“ค๋ง
ErrorCode errorCode = (ErrorCode) request.getAttribute("exception");
if (errorCode == null)
if (errorCode == null) {
AuthenticationResponse.makeFailureResponse(response, ErrorCode.WRONG_ENTRY_POINT);
return ;
}
AuthenticationResponse.makeFailureResponse(response, errorCode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,36 @@
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class JwtAuthenticationProvider implements AuthenticationProvider {
private final BCryptPasswordEncoder bCryptPasswordEncoder;
private final CustomUserDetailService customUserDetailService;
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
log.info("AuthenticationProvider ์ง„์ž… ์„ฑ๊ณต");
if (authentication.getPrincipal().getClass().equals(String.class)){
// form login ์š”์ฒญ์ธ ๊ฒฝ์šฐ
log.info("๋กœ๊ทธ์ธ ๋กœ์ง ์ธ์ฆ ๊ณผ์ •");
return authOfBeforeLogin(authentication.getPrincipal().toString());
return authOfLogin(authentication);

} else { // ๋กœ๊ทธ์ธ ์ดํ›„์˜ ๊ฒฝ์šฐ์— String์ด ์•„๋‹Œ ๋ณตํ•ฉ ์ •๋ณด๊ฐ€ ๋“ค์–ด์˜ค๋Š” ๊ฒฝ์šฐ
log.info("๋กœ๊ทธ์ธํ•œ ์‚ฌ์šฉ์ž ๊ฒ€์ฆ ๊ณผ์ •");
return authOfAfterLogin((JwtUserInfo) authentication.getPrincipal());
}
}
private Authentication authOfBeforeLogin(String serialId){
UserPrincipal userPrincipal = customUserDetailService.loadUserByUsername(serialId);
private Authentication authOfLogin(Authentication authentication){
// DB์— ์ €์žฅ๋œ ์‹ค์ œ ๋ฐ์ดํ„ฐ
UserPrincipal userPrincipal = customUserDetailService.loadUserByUsername(authentication.getPrincipal().toString());

// ๋น„๋ฐ€๋ฒˆํ˜ธ ๊ฒ€์ฆ ๋กœ์ง
if (!bCryptPasswordEncoder.matches(authentication.getCredentials().toString(), userPrincipal.getPassword()))
throw new UsernameNotFoundException("๋น„๋ฐ€๋ฒˆํ˜ธ๊ฐ€ ์ผ์น˜ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค ! ");
return new UsernamePasswordAuthenticationToken(userPrincipal, null, userPrincipal.getAuthorities());
}
private Authentication authOfAfterLogin(JwtUserInfo userInfo){
Expand Down

0 comments on commit bd71e78

Please sign in to comment.