@@ -135,14 +135,26 @@ func (h *Handler) DeleteConsentSession(w http.ResponseWriter, r *http.Request, p
135135 }
136136 }
137137 case allClients :
138- if triggerBackChannelLogout == "true" {
139- if err := h .r .ConsentStrategy ().ExecuteBackChannelLogoutBySubject (r .Context (), r , subject ); err != nil {
140- h .r .Logger ().WithError (err ).Warn ("Unable to execute back channel logout" )
138+ if len (loginSessionId ) > 0 {
139+ if triggerBackChannelLogout == "true" {
140+ if err := h .r .ConsentStrategy ().ExecuteBackChannelLogoutBySession (r .Context (), r , subject , loginSessionId ); err != nil {
141+ h .r .Logger ().WithError (err ).Warn ("Unable to execute back channel logout" )
142+ }
143+ }
144+ if err := h .r .ConsentManager ().RevokeLoginSessionConsentSession (r .Context (), loginSessionId ); err != nil && ! errors .Is (err , x .ErrNotFound ) {
145+ h .r .Writer ().WriteError (w , r , err )
146+ return
147+ }
148+ } else {
149+ if triggerBackChannelLogout == "true" {
150+ if err := h .r .ConsentStrategy ().ExecuteBackChannelLogoutBySubject (r .Context (), r , subject ); err != nil {
151+ h .r .Logger ().WithError (err ).Warn ("Unable to execute back channel logout" )
152+ }
153+ }
154+ if err := h .r .ConsentManager ().RevokeSubjectConsentSession (r .Context (), subject ); err != nil && ! errors .Is (err , x .ErrNotFound ) {
155+ h .r .Writer ().WriteError (w , r , err )
156+ return
141157 }
142- }
143- if err := h .r .ConsentManager ().RevokeSubjectConsentSession (r .Context (), subject ); err != nil && ! errors .Is (err , x .ErrNotFound ) {
144- h .r .Writer ().WriteError (w , r , err )
145- return
146158 }
147159 default :
148160 h .r .Writer ().WriteError (w , r , errorsx .WithStack (fosite .ErrInvalidRequest .WithHint (`Query parameter both 'client' and 'all' is not defined but one of them should have been.` )))
0 commit comments