Skip to content

Commit

Permalink
SSO URL: Accept host and port
Browse files Browse the repository at this point in the history
  • Loading branch information
jlledom committed Oct 24, 2024
1 parent 020fa86 commit 20f8027
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/buyers/impersonations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def create
sso_token.redirect_url = params[:redirect_url] if params[:redirect_url] && params[:redirect_url] != "null"
sso_token.account = provider

sso_url = sso_token.sso_url!(provider.external_admin_domain)
sso_url = sso_token.sso_url!(host: provider.external_admin_domain, port: request.port)

respond_to do | format |
format.json { render json: {url: sso_url}, status: :created }
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/partners/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def openid
sso_token = SSOToken.new user_id: @user.id
sso_token.protocol = 'http' unless request.ssl?
sso_token.account = @account
sso_url = sso_token.sso_url!(@account.external_admin_domain)
sso_url = sso_token.sso_url!(host: @account.external_admin_domain, port: request.port)
sso_url << "&return_to=#{params[:return_to]}" if params[:return_to].present?
redirect_to sso_url
end
Expand Down
3 changes: 2 additions & 1 deletion app/models/sso_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ def assign_attributes values
# however, if the provider is also master, host needs to be the provider's admin domain for which we create the URL
#
#
def sso_url! host = nil
def sso_url!(host: nil, port: nil)
save if new_record?

params= {
host: host || account.external_domain,
port: port,
protocol: protocol,
token: encrypted_token,
expires_at: expires_at.to_i,
Expand Down

0 comments on commit 20f8027

Please sign in to comment.