Skip to content

Commit

Permalink
refactor: change authsamlhelper class to module
Browse files Browse the repository at this point in the history
Change authsamlhelper class to module, mark as helper for and prefix
correctly
Remove import authsamlhelper since helpers are imported by default
  • Loading branch information
sneaky-patriki committed Apr 15, 2022
1 parent 0d6f7c2 commit 8aa1203
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/api/authentication_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require 'json/jwt'
require 'onelogin/ruby-saml'
require 'entities/user_entity'
require 'helpers/auth/auth_saml_helper.rb'
#
# Provides the authentication API for Doubtfire.
# Users can sign in via email and password and receive an auth token
Expand All @@ -11,6 +10,7 @@
class AuthenticationApi < Grape::API
helpers LogHelper
helpers AuthenticationHelpers
helpers Auth::AuthSamlHelper

#
# Sign in - only mounted if AAF auth is NOT used
Expand Down Expand Up @@ -86,10 +86,10 @@ class AuthenticationApi < Grape::API
end
post '/auth/jwt' do
# this endpoint is being deprecated and will be removed
AuthSAMLHelper.auth_saml2 params[:SAMLResponse]
AuthSamlHelper.auth_saml2 params[:SAMLResponse]
end
post '/auth/saml2' do
AuthSAMLHelper.auth_saml2 params[:SAMLResponse]
AuthSamlHelper.auth_saml2 params[:SAMLResponse]
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/auth/auth_saml_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'json/jwt'
require 'onelogin/ruby-saml'

class AuthSamlHelper
module Auth::AuthSamlHelper
def auth_saml2 (respSAML)
response = OneLogin::RubySaml::Response.new(respSAML, allowed_clock_drift: 1.second,
settings: AuthenticationHelpers.saml_settings)
Expand Down

0 comments on commit 8aa1203

Please sign in to comment.