Skip to content

Commit fceb73c

Browse files
committed
Merge branch '10.0.x' of https://github.com/macite/doubtfire-api into 10.0.x
2 parents fdd0ce1 + ad87e0e commit fceb73c

File tree

3 files changed

+40
-5
lines changed

3 files changed

+40
-5
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [10.0.0-6](https://github.com/macite/doubtfire-deploy/compare/v10.0.0-5...v10.0.0-6) (2025-05-30)
6+
7+
8+
### Bug Fixes
9+
10+
* adjust cookie function name to clarify purpose ([729efb6](https://github.com/macite/doubtfire-deploy/commit/729efb622b1257a14e28999a61e3a6343c4b2937))
11+
12+
## [10.0.0-5](https://github.com/macite/doubtfire-deploy/compare/v10.0.0-4...v10.0.0-5) (2025-05-30)
13+
14+
15+
### Features
16+
17+
* add saml signout url ([1f079b9](https://github.com/macite/doubtfire-deploy/commit/1f079b990b5bcc099f945ed15abfad0dc05f9701))
18+
* allow database auth to simulate token signin ([4e4873c](https://github.com/macite/doubtfire-deploy/commit/4e4873c2a5eeffa0fa3f9546c38f4d4870dba7b8))
19+
520
## [10.0.0-4](https://github.com/macite/doubtfire-deploy/compare/v10.0.0-3...v10.0.0-4) (2025-04-11)
621

722
## [10.0.0-3](https://github.com/macite/doubtfire-deploy/compare/v10.0.0-2...v10.0.0-3) (2025-04-10)

app/api/authentication_api.rb

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class AuthenticationApi < Grape::API
8080
# Return user details
8181
present :user, user, with: Entities::UserEntity
8282
present :auth_token, token.authentication_token
83-
add_refresh_cookie_to_response(remember)
83+
set_refresh_cookie_in_response(remember)
8484
end
8585
end
8686

@@ -153,6 +153,23 @@ class AuthenticationApi < Grape::API
153153
end
154154
redirect "#{host}/sign_in?authToken=#{onetime_token.authentication_token}&username=#{user.username}"
155155
end
156+
157+
# Saml 2 logout callback
158+
desc 'SAML2.0 logout callback'
159+
params do
160+
requires :SAMLResponse, type: String, desc: 'SAML logout response data.'
161+
end
162+
post '/auth/saml_logout' do
163+
response = OneLogin::RubySaml::Logoutresponse.new(params[:SAMLResponse], allowed_clock_drift: 1.second,
164+
settings: AuthenticationHelpers.saml_settings)
165+
166+
# Check if the SAML response is valid - if not log an error
167+
unless response.is_valid?
168+
logger.error "Invalid SAML logout response: #{response.errors.join(', ')}"
169+
end
170+
171+
redirect "#{host}/sign_in"
172+
end
156173
end
157174

158175
#
@@ -261,7 +278,7 @@ class AuthenticationApi < Grape::API
261278
# Respond user details with new auth token
262279
present :user, user, with: Entities::UserEntity
263280
present :auth_token, token.authentication_token
264-
add_refresh_cookie_to_response(params[:remember])
281+
set_refresh_cookie_in_response(params[:remember])
265282
end
266283
end
267284
end
@@ -343,7 +360,7 @@ class AuthenticationApi < Grape::API
343360
end
344361

345362
# Remove the refresh token cookie - if remember is false
346-
add_refresh_cookie_to_response(false) unless params[:remember]
363+
set_refresh_cookie_in_response(false) unless params[:remember]
347364
present nil
348365
end
349366

app/helpers/authentication_helpers.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def authenticated_via_refresh_token?
6262
true
6363
when :token_expired, :error, :missing_details
6464
# Token expired - remove cookies
65-
add_refresh_cookie_to_response(false)
65+
set_refresh_cookie_in_response(false)
6666
false
6767
end
6868
end
@@ -205,7 +205,10 @@ def db_auth?
205205
Doubtfire::Application.config.auth_method == :database
206206
end
207207

208-
def add_refresh_cookie_to_response(remember)
208+
# rubocop:disable Naming/AccessorMethodName
209+
def set_refresh_cookie_in_response(remember)
210+
# rubocop:enable Naming/AccessorMethodName
211+
209212
if remember
210213
token = current_user.auth_tokens.where(token_type: :refresh_token).last
211214

0 commit comments

Comments
 (0)