[PR #24] refactor: centralize JWT parsing and validation logic #24

Open
opened 2026-03-01 14:36:53 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amitshekhariitbhu/go-backend-clean-architecture/pull/24
Author: @BalaadityaPatanjali
Created: 1/7/2026
Status: 🔄 Open

Base: mainHead: refactor/jwt-token-parsing


📝 Commits (1)

  • a58ba06 refactor: centralize JWT parsing and validation logic

📊 Changes

1 file changed (+24 additions, -16 deletions)

View changed files

📝 internal/tokenutil/tokenutil.go (+24 -16)

📄 Description

Both IsAuthorized and ExtractIDFromToken were independently parsing and
validating JWT tokens, resulting in duplicated logic and increased maintenance
cost. So, created a function for it and not write the same logic again and again.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/amitshekhariitbhu/go-backend-clean-architecture/pull/24 **Author:** [@BalaadityaPatanjali](https://github.com/BalaadityaPatanjali) **Created:** 1/7/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `refactor/jwt-token-parsing` --- ### 📝 Commits (1) - [`a58ba06`](https://github.com/amitshekhariitbhu/go-backend-clean-architecture/commit/a58ba06907f475f1786cd7cd9eee3fa96789a287) refactor: centralize JWT parsing and validation logic ### 📊 Changes **1 file changed** (+24 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `internal/tokenutil/tokenutil.go` (+24 -16) </details> ### 📄 Description Both `IsAuthorized` and `ExtractIDFromToken` were independently parsing and validating JWT tokens, resulting in duplicated logic and increased maintenance cost. So, created a function for it and not write the same logic again and again. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/go-backend-clean-architecture#24
No description provided.