Skip to content

Commit

Permalink
feat: async backchannel logout (#2849)
Browse files Browse the repository at this point in the history
Co-authored-by: aeneasr <[email protected]>
  • Loading branch information
aarmam and aeneasr authored Apr 28, 2022
1 parent 152bddd commit 22e1ebb
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 8 deletions.
6 changes: 0 additions & 6 deletions consent/strategy_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"net/url"
"strconv"
"strings"
"sync"
"time"

"github.com/ory/hydra/driver/config"
Expand Down Expand Up @@ -696,12 +695,9 @@ func (s *DefaultStrategy) executeBackChannelLogout(ctx context.Context, r *http.
tasks = append(tasks, task{url: c.BackChannelLogoutURI, clientID: c.OutfacingID, token: t})
}

var wg sync.WaitGroup
hc := httpx.NewResilientClient()
wg.Add(len(tasks))

var execute = func(t task) {
defer wg.Done()
log := s.r.Logger().WithRequest(r).
WithField("client_id", t.clientID).
WithField("backchannel_logout_url", t.url)
Expand All @@ -726,8 +722,6 @@ func (s *DefaultStrategy) executeBackChannelLogout(ctx context.Context, r *http.
go execute(t)
}

wg.Wait()

return nil
}

Expand Down
2 changes: 2 additions & 0 deletions internal/httpclient-next/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1653,6 +1653,8 @@ paths:
https://openid.net/specs/openid-connect-frontchannel-1_0.html
https://openid.net/specs/openid-connect-backchannel-1_0.html
Back-channel logout is performed asynchronously and does not affect logout flow.
operationId: disconnectUser
responses:
"302":
Expand Down
4 changes: 4 additions & 0 deletions internal/httpclient-next/api_public.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions internal/httpclient/client/public/public_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions oauth2/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ func (h *Handler) SetRoutes(admin *x.RouterAdmin, public *x.RouterPublic, corsMi
// - https://openid.net/specs/openid-connect-frontchannel-1_0.html
// - https://openid.net/specs/openid-connect-backchannel-1_0.html
//
// Back-channel logout is performed asynchronously and does not affect logout flow.
//
// Schemes: http, https
//
// Responses:
Expand Down
2 changes: 1 addition & 1 deletion spec/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -3411,7 +3411,7 @@
},
"/oauth2/sessions/logout": {
"get": {
"description": "This endpoint initiates and completes user logout at Ory Hydra and initiates OpenID Connect Front-/Back-channel logout:\n\nhttps://openid.net/specs/openid-connect-frontchannel-1_0.html\nhttps://openid.net/specs/openid-connect-backchannel-1_0.html",
"description": "This endpoint initiates and completes user logout at Ory Hydra and initiates OpenID Connect Front-/Back-channel logout:\n\nhttps://openid.net/specs/openid-connect-frontchannel-1_0.html\nhttps://openid.net/specs/openid-connect-backchannel-1_0.html\n\nBack-channel logout is performed asynchronously and does not affect logout flow.",
"operationId": "disconnectUser",
"responses": {
"302": {
Expand Down
2 changes: 1 addition & 1 deletion spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1846,7 +1846,7 @@
},
"/oauth2/sessions/logout": {
"get": {
"description": "This endpoint initiates and completes user logout at Ory Hydra and initiates OpenID Connect Front-/Back-channel logout:\n\nhttps://openid.net/specs/openid-connect-frontchannel-1_0.html\nhttps://openid.net/specs/openid-connect-backchannel-1_0.html",
"description": "This endpoint initiates and completes user logout at Ory Hydra and initiates OpenID Connect Front-/Back-channel logout:\n\nhttps://openid.net/specs/openid-connect-frontchannel-1_0.html\nhttps://openid.net/specs/openid-connect-backchannel-1_0.html\n\nBack-channel logout is performed asynchronously and does not affect logout flow.",
"schemes": [
"http",
"https"
Expand Down

0 comments on commit 22e1ebb

Please sign in to comment.