[GH-ISSUE #4659] [Feature Request] OIDC support for raw tokens and claim verification #3681

Closed
opened 2026-05-05 14:21:40 -06:00 by gitea-mirror · 6 comments
Owner

Originally created by @foresturquhart on GitHub (Feb 6, 2025).
Original GitHub issue: https://github.com/fatedier/frp/issues/4659

Originally assigned to: @blizard863 on GitHub.

Describe the feature request

On the client, I propose adding a rawToken field to the AuthOIDCClientConfig struct. The generateAccessToken function in pkg/auth/oidc.go would be modified to use this rawToken if provided, bypassing the client credentials flow.

On the server, I propose adding an allowedClaims field to the AuthOIDCServerConfig struct. The VerifyLogin function in pkg/auth/oidc.go would be modified to decode the JWT payload, extract any claims, and compare them against the allowed claims before performing signature verification.

Describe alternatives you've considered

No response

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @foresturquhart on GitHub (Feb 6, 2025). Original GitHub issue: https://github.com/fatedier/frp/issues/4659 Originally assigned to: @blizard863 on GitHub. ### Describe the feature request On the client, I propose adding a `rawToken` field to the `AuthOIDCClientConfig` struct. The `generateAccessToken` function in `pkg/auth/oidc.go` would be modified to use this `rawToken` if provided, bypassing the client credentials flow. On the server, I propose adding an `allowedClaims` field to the `AuthOIDCServerConfig` struct. The `VerifyLogin` function in `pkg/auth/oidc.go` would be modified to decode the JWT payload, extract any claims, and compare them against the allowed claims before performing signature verification. ### Describe alternatives you've considered _No response_ ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
gitea-mirror 2026-05-05 14:21:40 -06:00
  • closed this issue
  • added the
    proposal
    label
Author
Owner

@blizard863 commented on GitHub (Feb 7, 2025):

I don't think that's the standard for oidc, looks like it's unique to Google ?
I didn't find the definition in the RFC document for oidc.

@foresturquhart

<!-- gh-comment-id:2642552964 --> @blizard863 commented on GitHub (Feb 7, 2025): I don't think that's the standard for oidc, looks like it's unique to Google ? I didn't find the definition in the RFC document for oidc. @foresturquhart
Author
Owner

@foresturquhart commented on GitHub (Feb 7, 2025):

I didn't consider that originally, but yes, it does seem to be unique to Google. If I'd realised it was Google-specific I'd have made that clearer in the proposal.

My goal is to enable users to restrict access based on Google Workspace membership, and the hd claim is the most direct and reliable way to do that when Google is the OIDC provider. I can see the problem, though, with introducing a Google-specific check.

Maybe instead it could have a configuration option of allowedClaims, which could work like auth.oidc.allowedClaims = { "hd" = "workspace-domain.com" }? That would allow it to filter based on other types of claim, making it a bit more generic?

<!-- gh-comment-id:2642600184 --> @foresturquhart commented on GitHub (Feb 7, 2025): I didn't consider that originally, but yes, it does seem to be unique to Google. If I'd realised it was Google-specific I'd have made that clearer in the proposal. My goal is to enable users to restrict access based on Google Workspace membership, and the `hd` claim is the most direct and reliable way to do that when Google is the OIDC provider. I can see the problem, though, with introducing a Google-specific check. Maybe instead it could have a configuration option of `allowedClaims`, which could work like `auth.oidc.allowedClaims = { "hd" = "workspace-domain.com" }`? That would allow it to filter based on other types of claim, making it a bit more generic?
Author
Owner

@foresturquhart commented on GitHub (Feb 7, 2025):

@blizard863 I've amended my feature request, and also made the corresponding change to my PR.

<!-- gh-comment-id:2642632425 --> @foresturquhart commented on GitHub (Feb 7, 2025): @blizard863 I've amended my feature request, and also made the corresponding change to my PR.
Author
Owner

@blizard863 commented on GitHub (Feb 7, 2025):

I don't think this is a standard practice, it's a violation of the semantics of oidc.I looked at your code carefully and it seems that you need to configure a token string on the client side and allowedClaims on the server side to perform Google's special checks before oidc normalization checks.

If so, it seems to me to be a breach of the oidc protocol.I suggest you consider token authentication + metadata + server plugin or oidc authentication + metadata + server plugin.

Did I get it wrong? Or you could go into more detail about your scenario.

https://github.com/fatedier/frp/blob/dev/doc/server_plugin.md

<!-- gh-comment-id:2642958834 --> @blizard863 commented on GitHub (Feb 7, 2025): I don't think this is a standard practice, it's a violation of the semantics of oidc.I looked at your code carefully and it seems that you need to configure a token string on the client side and allowedClaims on the server side to perform Google's special checks before oidc normalization checks. If so, it seems to me to be a breach of the oidc protocol.I suggest you consider token authentication + metadata + server plugin or oidc authentication + metadata + server plugin. Did I get it wrong? Or you could go into more detail about your scenario. https://github.com/fatedier/frp/blob/dev/doc/server_plugin.md
Author
Owner

@foresturquhart commented on GitHub (Feb 7, 2025):

@blizard863 It's quite possible I've made a mistake, I'm not an expert on OIDC. The scenario was that we wanted to operate a single FRP server instance, and enable multiple local clients (developers) to connect to the FRP server. We wanted to make use of the OIDC token created by gcloud auth print-identity-token to streamline the process and make it easy to use.

The idea behind my implementation was to use that token as the rawToken, and then the server would verify it was a valid Google Cloud token, and verify it was associated with the correct workspace/organisation/domain. The reason I didn't use a server plugin was because I thought it still needed to be able to pass a raw token from the client, so unless I could create a client plugin, I felt I'd have to patch the code to enable the behaviour.

I spent a while trying to make this work in other ways before I made the patch and feature request, but I am absolutely more than happy if you have a better way! As I say, I haven't extensively worked with OIDC.

<!-- gh-comment-id:2642978104 --> @foresturquhart commented on GitHub (Feb 7, 2025): @blizard863 It's quite possible I've made a mistake, I'm not an expert on OIDC. The scenario was that we wanted to operate a single FRP server instance, and enable multiple local clients (developers) to connect to the FRP server. We wanted to make use of the OIDC token created by `gcloud auth print-identity-token` to streamline the process and make it easy to use. The idea behind my implementation was to use that token as the rawToken, and then the server would verify it was a valid Google Cloud token, and verify it was associated with the correct workspace/organisation/domain. The reason I didn't use a server plugin was because I thought it still needed to be able to pass a raw token from the client, so unless I could create a client plugin, I felt I'd have to patch the code to enable the behaviour. I spent a while trying to make this work in other ways before I made the patch and feature request, but I am absolutely more than happy if you have a better way! As I say, I haven't extensively worked with OIDC.
Author
Owner

@blizard863 commented on GitHub (Feb 8, 2025):

I don't know why your patch code can work, I think your scenario is like this:

Image

But OIDC work like this:

Image

So I think your scene might not be standard oidc? More like token authentication?

<!-- gh-comment-id:2644449734 --> @blizard863 commented on GitHub (Feb 8, 2025): I don't know why your patch code can work, I think your scenario is like this: <img width="1089" alt="Image" src="https://github.com/user-attachments/assets/35d34ad8-95e7-42b3-b148-09c997c36d6e" /> But OIDC work like this: <img width="815" alt="Image" src="https://github.com/user-attachments/assets/c318c7ab-03c9-40de-81ff-114b8d4328cf" /> --- So I think your scene might not be standard oidc? More like token authentication?
Sign in to join this conversation.
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: github-starred/frp#3681
No description provided.