-
-
Notifications
You must be signed in to change notification settings - Fork 232
feat: oidc authorize post #823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -39,6 +39,7 @@ func (m *UIMiddleware) Init() error { | |||||||||||||||||||||
| func (m *UIMiddleware) Middleware() gin.HandlerFunc { | ||||||||||||||||||||||
| return func(c *gin.Context) { | ||||||||||||||||||||||
| path := strings.TrimPrefix(c.Request.URL.Path, "/") | ||||||||||||||||||||||
| method := c.Request.Method | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| tlog.App.Debug().Str("path", path).Msg("path") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -52,6 +53,12 @@ func (m *UIMiddleware) Middleware() gin.HandlerFunc { | |||||||||||||||||||||
| c.Writer.Write([]byte("User-agent: *\nDisallow: /\n")) | ||||||||||||||||||||||
| return | ||||||||||||||||||||||
| default: | ||||||||||||||||||||||
| // For OIDC post authentication, we need to redirect the POST to /authorize to the backend | ||||||||||||||||||||||
| if method == http.MethodPost && strings.HasPrefix(path, "authorize") { | ||||||||||||||||||||||
| c.Next() | ||||||||||||||||||||||
| return | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
Comment on lines
+56
to
+60
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Match only
Suggested fix- if method == http.MethodPost && strings.HasPrefix(path, "authorize") {
+ if method == http.MethodPost && path == "authorize" {
c.Next()
return
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| _, err := fs.Stat(m.uiFs, path) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Enough for one authentication flow | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This turns authorize POST back into a GET.
Line 210 serializes the entire form body into the
Locationheader, so large or signedrequestpayloads still hit URL-length limits and end up in browser history/logs. That defeats the main reason clients use POST on the authorization endpoint. Keep the authorize parameters server-side across the login redirect instead of rebuilding them into the URL.🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest I don't believe that storing on the backend makes sense, it's way too much code for something that will be used extremely rarely. Even when it's used I am not familiar with any URL limit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@steveiliop56, that's a fair point — for standard authorization parameters the URL stays well within practical browser/server limits (~8 KB), and the certification test PASSED with 43/43 successes, which is the real validation here.The one narrow edge case would be a large
requestJWT (RFC 9101 / JARM), since those can be several KB on their own. But since you've already added theRequestfield toAuthorizeRequestand the conformance suite accepts the current approach, the complexity of server-side storage clearly isn't justified. I'll drop the suggestion.✏️ Learnings added