Skip to content

Conversation

@fetiu
Copy link
Member

@fetiu fetiu commented Sep 25, 2025

설명

/browse 엔드포인트에 Bearer 인증을 통한 로그인 기능을 추가합니다.

세부사항

  • 기존의 userId를 path에 제공하여 접속하는 /browse/[userId] 방식에서, 모든 계정이 동일하게 /browse에 접속하는 방식으로 바뀌었습니다.
  • account.getCurrentUseraccount.signIn API를 사용해야해서 약간 내용이 방대해지긴 했지만, window.prompt 같은 요소만을 사용해서 변경을 최소화 했습니다.
  • 한번 로그인으로 접속한 뒤에는 토큰이 날라가지 않고 Local storage에 유지되어 편의성도 기존과 같이 유지됩니다.
  • 한번 로그인 하면 다른 User의 endpoint 접속은 불가능하며, 로그인 실패 시에 Access Denied가 되는 등의 올바른 동작을 확인했습니다.
  • Access Denied 시에 새로 고침하면 로그인 재시도도 할 수 있습니다. Query string으로 ?login=0처럼 보내면 이전 계정의 토큰이 삭제되어 마찬가지로 로그인을 재시도 할 수 있습니다.

Github Copilot (Claude Sonnet 3.5) 으로 작성했기 때문에 최신 트렌드와 맞지 않거나 코드베이스 상의 설계 방식과 다를 수 있습니다. 조언 부탁드립니다!

@fetiu fetiu requested a review from gomjellie September 25, 2025 19:36
@fetiu fetiu self-assigned this Sep 25, 2025
} from '~/server/api/trpc';
export const s3Router = createTRPCRouter({
listUserFiles: publicProcedure
listUserFiles: protectedProcedure
Copy link
Member Author

@fetiu fetiu Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 변경으로 authorization이 완전히 충족되는지는 모르겠으나, 이 엔드포인트를 이런 식으로 막아도 딱 원하는 동작까지는 달성할 수 있었고, https://4cut.us/download/[userId]/${filename}은 여전히 토큰 인증 없이도 동작함을 확인했습니다.

Copy link
Member

@gomjellie gomjellie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fetiu fetiu force-pushed the add-browse-auth branch 2 times, most recently from 638b999 to 4334c60 Compare September 25, 2025 20:51
@fetiu fetiu force-pushed the add-browse-auth branch 4 times, most recently from 1cce8b2 to 0ea6c77 Compare September 29, 2025 02:38
Copy link
Member Author

@fetiu fetiu Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제거된 것으로 뜨지만, 아래 index.tsx 파일로 이름이 변경된 것. git mv 등을 사용해도 두 파일을 합치는 것이 불가능 한 듯...
추가 변경 내역은 다음 커밋 참조: 0ea6c77

Copy link
Member

@gomjellie gomjellie Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 diff 안만들고 먼저 파일명만 바꾸는 커밋 만든다음에 index.tsx 내용을 바꾸면됨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants