Skip to content

Commit

Permalink
refactor : add internal logging
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Diger committed Feb 20, 2024
1 parent 8fc352e commit d652bd4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.palette.easelauthservice;

import org.palette.aop.EaselAuthenticationContext;
import org.palette.aop.LoggingAspect;
import org.palette.aop.PassportAspect;
import org.palette.config.CommonModuleConfig;
import org.springframework.boot.SpringApplication;
Expand All @@ -10,7 +11,8 @@
@Import({
CommonModuleConfig.class,
EaselAuthenticationContext.class,
PassportAspect.class
PassportAspect.class,
LoggingAspect.class
})
@SpringBootApplication
public class EaselAuthServiceApplication {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.palette.easelauthservice.usecase;

import lombok.RequiredArgsConstructor;
import org.palette.aop.InternalErrorLogging;
import org.palette.easelauthservice.component.jwt.JwtAgent;
import org.palette.easelauthservice.component.jwt.component.JwtPair;
import org.palette.easelauthservice.component.mailsender.EmailAuthMailSender;
Expand Down Expand Up @@ -28,6 +29,7 @@ public class AuthUsecase extends GAuthServiceGrpc.GAuthServiceImplBase {
private final JwtAgent jwtAgent;
private final PassportGenerator passportGenerator;

@InternalErrorLogging
public void verifyEmail(SendEmailAuthRequest sendEmailAuthRequest) {
String email = sendEmailAuthRequest.email();
EmailAuth emailAuth = redisEmailAuthService.loadByEmail(email);
Expand All @@ -41,6 +43,7 @@ public void verifyEmail(SendEmailAuthRequest sendEmailAuthRequest) {
redisEmailAuthService.update(emailAuth);
}

@InternalErrorLogging
public void resend(ResendEmailAuthRequest resendEmailAuthRequest) {
String email = resendEmailAuthRequest.email();
EmailAuth emailAuth = redisEmailAuthService.loadByEmail(email);
Expand All @@ -52,6 +55,7 @@ public void resend(ResendEmailAuthRequest resendEmailAuthRequest) {
emailAuthMailSender.send(email, emailAuth.getAuthPayload());
}

@InternalErrorLogging
public JwtPair login(LoginRequest loginRequest) {
String email = loginRequest.email();
String password = loginRequest.password();
Expand All @@ -61,6 +65,7 @@ public JwtPair login(LoginRequest loginRequest) {
);
}

@InternalErrorLogging
public String validateJWT(String jwtPayload) {
Long userId = jwtAgent.parseUserId(jwtPayload);
GLoadUserInfoFromIdResponse gLoadUserInfoFromIdResponse = grpcUserClient.loadById(userId);
Expand Down

0 comments on commit d652bd4

Please sign in to comment.