Skip to content
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

feat: async backchannel logout #2849

Merged
merged 3 commits into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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