Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #27 from admin-ch/develop
Browse files Browse the repository at this point in the history
New Debug Log Information
  • Loading branch information
fabe2913 authored Jun 23, 2020
2 parents 8ad88fb + 8c16d37 commit 610a39f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import java.security.SecureRandom;
import java.time.LocalDate;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

import static net.logstash.logback.argument.StructuredArguments.kv;

@Service
@Transactional(readOnly = true)
Expand Down Expand Up @@ -45,7 +48,7 @@ public AuthorizationCodeResponseDto create(AuthorizationCodeCreateDto createDto)
AuthorizationCode authorizationCode = new AuthorizationCode(authCode, createDto.getOnsetDate(), createDto.getOnsetDate().minusDays(onsetSubtractionDays), ZonedDateTime.now().plusMinutes(codeExpirationDelay));
authorizationCodeRepository.saveAndFlush(authorizationCode);
log.info("New authorizationCode saved with id '{}'.", authorizationCode.getId());
log.debug("New authorizationCode saved with id '{}' and code '{}' and onset '{}'.", authorizationCode.getId(), authorizationCode.getCode(), authorizationCode.getOnsetDate());
log.debug("New authorizationCode saved: {}, {}, {}.", kv("id", authorizationCode.getId()), kv("creationDateTime", authorizationCode.getCreationDateTime().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)), kv("onsetDate",authorizationCode.getOnsetDate()));
return new AuthorizationCodeResponseDto(authorizationCode.getCode());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

import static net.logstash.logback.argument.StructuredArguments.kv;

@Service
@Transactional(readOnly = true)
@Slf4j
Expand Down Expand Up @@ -48,6 +50,7 @@ public AuthorizationCodeVerifyResponseDto verify(String code, String fake) {
}

existingCode.incrementCallCount();
log.debug("AuthorizationCode verified: '{}', '{}'", kv("id", existingCode.getId()), kv("callCount", existingCode.getCallCount()));
return new AuthorizationCodeVerifyResponseDto(tokenProvider.createToken(existingCode.getOnsetDate().format(DATE_FORMATTER), fake));

}
Expand Down

0 comments on commit 610a39f

Please sign in to comment.