Skip to content

Commit

Permalink
[MERGE/#47] 구글 설정 JSON 로깅 추가
Browse files Browse the repository at this point in the history
[FEAT] #47 - 구글 설정 JSON 로깅 추가
  • Loading branch information
seokbeom00 authored Jul 9, 2024
2 parents 052edc6 + 918d136 commit c860f08
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,34 @@ private Path pathFor(String id) {

@Override
public String load(String id) throws IOException {
Path path = pathFor(id);
if (!Files.exists(path)) {
return null;
}
String token = Files.readString(path);
if (!Files.exists(pathFor(id))) {
return null;
}
log.info("Loaded token from {}: {}", path, token);
return Files.readString(pathFor(id));
}

@Override
public void store(String id, String token) throws IOException {
Path path = pathFor(id);
Files.createDirectories(Paths.get(".", tokensDirectoryPath));
Files.writeString(pathFor(id), token);
log.info("Stored token to {}: {}", path, token);
}

@Override
public void delete(String id) throws IOException {
Path path = pathFor(id);
if (!Files.exists(pathFor(id))) {
return;
}
Files.delete(pathFor(id));
log.info("Deleted token at {}", path);
}
};
}
Expand All @@ -73,6 +83,8 @@ public void delete(String id) throws IOException {
public UserAuthorizer userAuthorizer(TokenStore tokenStore) throws IOException {
ClassPathResource resource = new ClassPathResource("json/credentials.json");
try (InputStream in = resource.getInputStream()) {
String credentialsContent = new String(in.readAllBytes());
log.info("Loaded credentials.json content: {}", credentialsContent);
ClientId clientId = ClientId.fromStream(in);
return UserAuthorizer.newBuilder()
.setClientId(clientId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public enum ErrorType {
INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "50001", "알 수 없는 서버 에러가 발생했습니다."),
GET_UPLOAD_PRESIGNED_URL_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "50002", "업로드를 위한 Presigned URL 획득에 실패했습니다."),
GET_GOOGLE_MEET_URL_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "50003", "구글미트 URL 획득에 실패했습니다."),
GET_GOOGLE_AUTHORIZER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "50004", "구글미트 URL 획득에 실패했습니다.");
GET_GOOGLE_AUTHORIZER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "50004", "구글 인증유저 획득에 실패했습니다.");

private final HttpStatus httpStatus;
private final String code;
Expand Down

0 comments on commit c860f08

Please sign in to comment.