[PR #550] [MERGED] refactor: some clean-up in OIDC service and controller (1.0) #736

Open
opened 2025-10-07 00:21:31 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/pocket-id/pocket-id/pull/550
Author: @ItalyPaleAle
Created: 5/19/2025
Status: Merged
Merged: 5/19/2025
Merged by: @stonith404

Base: v1.0.0Head: refactor-1


📝 Commits (5)

📊 Changes

3 files changed (+127 additions, -96 deletions)

View changed files

📝 backend/internal/controller/oidc_controller.go (+10 -21)
📝 backend/internal/controller/well_known_controller.go (+1 -1)
📝 backend/internal/service/oidc_service.go (+116 -74)

📄 Description

As I started working on #361, I wanted to split out a small initial refactor/code cleanup, so the upcoming main PR wouldn't contain irrelevant refactorings.

  • In OidcService, CreateToken and all the functions it calls now accept a struct and return a struct. This avoids passing up to 5 arguments and having up to 5 return values (some functions did not use all input args and did not return all 5 outputs).
  • Define constants for the grant types, including urn:ietf:params:oauth:grant-type:device_code
  • When verifying client credentials, if the user passed a client secret we always validate it, even for public clients (before, we entirely skipped the validation if the client was public, which was not the ideal behavior (if the client does pass a credential, it should be validated or rejected)

🔄 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/pocket-id/pocket-id/pull/550 **Author:** [@ItalyPaleAle](https://github.com/ItalyPaleAle) **Created:** 5/19/2025 **Status:** ✅ Merged **Merged:** 5/19/2025 **Merged by:** [@stonith404](https://github.com/stonith404) **Base:** `v1.0.0` ← **Head:** `refactor-1` --- ### 📝 Commits (5) - [`7cad759`](https://github.com/pocket-id/pocket-id/commit/7cad7595b71edb506b2afc7515249f5c3afead12) Code clean-up - [`46e125f`](https://github.com/pocket-id/pocket-id/commit/46e125f6c180d897b26c8b9debeb79e0173103f7) Use some constants - [`00a6144`](https://github.com/pocket-id/pocket-id/commit/00a61445b31e22db51ac1b1405b61414e2f18cfb) Some more refactor - [`f80b57a`](https://github.com/pocket-id/pocket-id/commit/f80b57afedc52171e4baf2f196205857243c24de) Last changes - [`fdf9fec`](https://github.com/pocket-id/pocket-id/commit/fdf9fec905065a7abdef405608652effa71cc73c) Merge branch 'v1.0.0' of https://github.com/pocket-id/pocket-id into refactor-1 ### 📊 Changes **3 files changed** (+127 additions, -96 deletions) <details> <summary>View changed files</summary> 📝 `backend/internal/controller/oidc_controller.go` (+10 -21) 📝 `backend/internal/controller/well_known_controller.go` (+1 -1) 📝 `backend/internal/service/oidc_service.go` (+116 -74) </details> ### 📄 Description As I started working on #361, I wanted to split out a small initial refactor/code cleanup, so the upcoming main PR wouldn't contain irrelevant refactorings. - In `OidcService`, `CreateToken` and all the functions it calls now accept a struct and return a struct. This avoids passing up to 5 arguments and having up to 5 return values (some functions did not use all input args and did not return all 5 outputs). - Define constants for the grant types, including `urn:ietf:params:oauth:grant-type:device_code` - When verifying client credentials, if the user passed a client secret we always validate it, even for public clients (before, we entirely skipped the validation if the client was public, which was not the ideal behavior (if the client does pass a credential, it should be validated or rejected) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2025-10-07 00:21:31 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pocket-id#736