refactor: move iss param handling to Fosite

This commit is contained in:
Elias Schneider
2026-08-12 23:25:35 +02:00
parent 46b8d54e15
commit 1bb21c5d73
5 changed files with 5 additions and 9 deletions
+1 -1
View File
@@ -233,4 +233,4 @@ require (
modernc.org/memory v1.11.0 // indirect
)
replace github.com/ory/fosite => github.com/pocket-id/fosite v1.2.0
replace github.com/ory/fosite => github.com/pocket-id/fosite v1.3.0
+2 -2
View File
@@ -400,8 +400,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pocket-id/fosite v1.2.0 h1:Tk0ZIIChuyD8yprlYr95FMZsd0yq64FHj47sxkM2cQI=
github.com/pocket-id/fosite v1.2.0/go.mod h1:v0FwUcx6Xd7xu/V6hLbIqtFfqRSWcJRJl1f8t0cnIuU=
github.com/pocket-id/fosite v1.3.0 h1:lHs3bYhK3Xo7bKYcxSfNWN4hmSLO4gSLsQwwtl4oA0M=
github.com/pocket-id/fosite v1.3.0/go.mod h1:v0FwUcx6Xd7xu/V6hLbIqtFfqRSWcJRJl1f8t0cnIuU=
github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=
github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
@@ -21,18 +21,15 @@ const parRequestURIPrefix = "urn:ietf:params:oauth:request_uri:"
type authorizationHandler struct {
provider fosite.OAuth2Provider
authorizationService *authorizationService
baseURL string
}
func newAuthorizationHandler(
provider fosite.OAuth2Provider,
authorizationService *authorizationService,
baseURL string,
) *authorizationHandler {
return &authorizationHandler{
provider: provider,
authorizationService: authorizationService,
baseURL: baseURL,
}
}
@@ -99,8 +96,6 @@ func (h *authorizationHandler) authorize(c *gin.Context) {
return
}
response.AddParameter("iss", h.baseURL)
// fosite renders an auto-submitting HTML page for response_mode=form_post, which needs a relaxed CSP
h.relaxCSPForFormPost(c, ar)
+1 -1
View File
@@ -101,7 +101,7 @@ func New(ctx context.Context, deps Dependencies) (*Module, error) {
store: store,
cimdResolver: cimdResolver,
authorizationHandler: newAuthorizationHandler(provider, authorizationService, deps.Config.BaseURL),
authorizationHandler: newAuthorizationHandler(provider, authorizationService),
tokenHandler: newTokenHandler(provider, claimsService, deps.APIAccess),
userInfoHandler: newUserInfoHandler(provider, claimsService, deps.Config.BaseURL),
parHandler: newPARHandler(provider),
+1
View File
@@ -43,6 +43,7 @@ func newProvider(store *Store, authenticator *federatedClientAuthenticator, sign
PushedAuthorizeContextLifespan: 90 * time.Second,
IDTokenIssuer: config.BaseURL,
AccessTokenIssuer: config.BaseURL,
AuthorizationResponseIssuer: config.BaseURL,
TokenURL: config.TokenBaseURL + "/api/oidc/token",
ScopeStrategy: fosite.ExactScopeStrategy,
IgnoreUnknownScopes: true,