Skip to content

Commit b03db50

Browse files
authored
Add OPENID_CONNECT path logout variable (#6066)
1 parent 0619897 commit b03db50

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

app/controllers/api/v1/sessions_controller.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,17 @@ def create
6969
# Clears the session cookie and signs the user out
7070
def destroy
7171
id_token = session.delete(:oidc_id_token)
72+
logout_path = ENV.fetch('OPENID_CONNECT_LOGOUT_PATH', '')
7273

7374
# Make logout request to OIDC
74-
if id_token.present? && external_auth?
75+
if logout_path.present? && id_token.present? && external_auth?
7576
issuer_url = if ENV.fetch('LOADBALANCER_ENDPOINT', nil).present?
7677
File.join(ENV.fetch('OPENID_CONNECT_ISSUER'), "/#{current_provider}")
7778
else
7879
ENV.fetch('OPENID_CONNECT_ISSUER')
7980
end
8081

81-
end_session = File.join(issuer_url, 'protocol', 'openid-connect', 'logout')
82+
end_session = File.join(issuer_url, logout_path)
8283

8384
url = "#{end_session}?client_id=#{ENV.fetch('OPENID_CONNECT_CLIENT_ID', nil)}" \
8485
"&id_token_hint=#{id_token}" \

sample.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ REDIS_URL=
4646
#OPENID_CONNECT_ISSUER=
4747
#OPENID_CONNECT_REDIRECT=
4848
#OPENID_CONNECT_UID_FIELD=sub
49+
#OPENID_CONNECT_LOGOUT_PATH="/protocol/openid-connect/logout"
4950

5051
# Uncomment the following flag if you want to use EMAIL as a Unique ID backup, useful for setups with existing users who want to switch to an IDP setup.
5152
# More information: https://github.com/bigbluebutton/greenlight/issues/5872

spec/controllers/sessions_controller_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,12 @@
160160
session[:oidc_id_token] = 'sample_id_token'
161161
allow(controller).to receive(:external_auth?).and_return(true)
162162
ENV['OPENID_CONNECT_ISSUER'] = 'https://openid.example'
163+
ENV['OPENID_CONNECT_LOGOUT_PATH'] = '/protocol/openid-connect/logout'
163164
end
164165

165166
after do
166167
ENV['OPENID_CONNECT_ISSUER'] = nil
168+
ENV['OPENID_CONNECT_LOGOUT_PATH'] = nil
167169
end
168170

169171
it 'returns the OIDC logout url' do

0 commit comments

Comments
 (0)