Skip to content

Commit

Permalink
refactor: remove oauth2.include_legacy_error_fields config
Browse files Browse the repository at this point in the history
BREAKING CHANGE: OAuth2 errors can no longer be returned in the legacy error format. Essentially, fields `error_hint`, `error_debug` have been removed. Option `oauth2.include_legacy_error_fields` has been removed.
  • Loading branch information
aeneasr committed Sep 7, 2022
1 parent a98c067 commit 148cadb
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 12 deletions.
5 changes: 0 additions & 5 deletions driver/config/provider.go
Expand Up @@ -71,7 +71,6 @@ const (
KeyCGroupsV1AutoMaxProcsEnabled = "cgroups.v1.auto_max_procs_enabled"
KeyGrantAllClientCredentialsScopesPerDefault = "oauth2.client_credentials.default_grant_allowed_scope" // #nosec G101
KeyExposeOAuth2Debug = "oauth2.expose_internal_errors"
KeyOAuth2LegacyErrors = "oauth2.include_legacy_error_fields"
KeyExcludeNotBeforeClaim = "oauth2.exclude_not_before_claim"
KeyAllowedTopLevelClaims = "oauth2.allowed_top_level_claims"
KeyOAuth2GrantJWTIDOptional = "oauth2.grant.jwt.jti_optional"
Expand Down Expand Up @@ -387,10 +386,6 @@ func (p *DefaultProvider) GetSendDebugMessagesToClients(ctx context.Context) boo
return p.getProvider(ctx).Bool(KeyExposeOAuth2Debug)
}

func (p *DefaultProvider) GetUseLegacyErrorFormat(ctx context.Context) bool {
return p.getProvider(ctx).Bool(KeyOAuth2LegacyErrors)
}

func (p *DefaultProvider) GetEnforcePKCE(ctx context.Context) bool {
return p.getProvider(ctx).Bool(KeyPKCEEnforced)
}
Expand Down
2 changes: 1 addition & 1 deletion oauth2/handler.go
Expand Up @@ -792,7 +792,7 @@ func (h *Handler) writeAuthorizeError(w http.ResponseWriter, r *http.Request, ar
}

func (h *Handler) forwardError(w http.ResponseWriter, r *http.Request, err error) {
rfcErr := fosite.ErrorToRFC6749Error(err).WithLegacyFormat(h.c.GetUseLegacyErrorFormat(r.Context())).WithExposeDebug(h.c.GetSendDebugMessagesToClients(r.Context()))
rfcErr := fosite.ErrorToRFC6749Error(err).WithExposeDebug(h.c.GetSendDebugMessagesToClients(r.Context()))
query := rfcErr.ToValues()
http.Redirect(w, r, urlx.CopyWithQuery(h.c.ErrorURL(r.Context()), query).String(), http.StatusFound)
}
Expand Down
6 changes: 0 additions & 6 deletions spec/config.json
Expand Up @@ -761,12 +761,6 @@
}
}
},
"include_legacy_error_fields": {
"type": "boolean",
"description": "Set this to true if you want to include the `error_hint` and `error_debug` legacy fields in error responses. We recommend to set this to `false` unless you have clients using these fields.",
"default": false,
"examples": [true]
},
"exclude_not_before_claim": {
"type": "boolean",
"description": "Set to true if you want to exclude claim `nbf (not before)` part of access token.",
Expand Down

0 comments on commit 148cadb

Please sign in to comment.