Skip to content

Commit

Permalink
Include Requested Scopes in Webhook Requests (#3891)
Browse files Browse the repository at this point in the history
  • Loading branch information
3schwartz authored Jan 2, 2025
1 parent 6673c87 commit c3ff306
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
},
"request": {
"client_id": "app-client",
"requested_scopes": [
"hydra.*",
"offline",
"openid"
],
"granted_scopes": [
"offline",
"openid",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
},
"request": {
"client_id": "app-client",
"requested_scopes": [
"hydra.*",
"offline",
"openid"
],
"granted_scopes": [
"offline",
"openid",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
},
"request": {
"client_id": "app-client",
"requested_scopes": [
"hydra.*",
"offline",
"openid"
],
"granted_scopes": [
"offline",
"openid",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
},
"request": {
"client_id": "app-client",
"requested_scopes": [
"hydra.*",
"offline",
"openid"
],
"granted_scopes": [
"offline",
"openid",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
},
"request": {
"client_id": "app-client",
"requested_scopes": [
"hydra.*",
"offline",
"openid"
],
"granted_scopes": [
"offline",
"openid",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
},
"request": {
"client_id": "app-client",
"requested_scopes": [
"hydra.*",
"offline",
"openid"
],
"granted_scopes": [
"offline",
"openid",
Expand Down
3 changes: 3 additions & 0 deletions oauth2/token_hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ type AccessRequestHook func(ctx context.Context, requester fosite.AccessRequeste
type Request struct {
// ClientID is the identifier of the OAuth 2.0 client.
ClientID string `json:"client_id"`
// RequestedScopes is the list of scopes requested to the OAuth 2.0 client.
RequestedScopes []string `json:"requested_scopes"`
// GrantedScopes is the list of scopes granted to the OAuth 2.0 client.
GrantedScopes []string `json:"granted_scopes"`
// GrantedAudience is the list of audiences granted to the OAuth 2.0 client.
Expand Down Expand Up @@ -170,6 +172,7 @@ func TokenHook(reg interface {

request := Request{
ClientID: requester.GetClient().GetID(),
RequestedScopes: requester.GetRequestedScopes(),
GrantedScopes: requester.GetGrantedScopes(),
GrantedAudience: requester.GetGrantedAudience(),
GrantTypes: requester.GetGrantTypes(),
Expand Down

0 comments on commit c3ff306

Please sign in to comment.