Skip to content

Commit

Permalink
LG-15121 Add a post_idv_followup_url configuration to service provi…
Browse files Browse the repository at this point in the history
…ders (#11591)

We have been working through issues with a service provider who has observed that users do not return to their SP after entering their mailed code or passing fraud review. We identified an opportunity to provide users with a direct link back to the SP to re-initiate their session when they complete out-of-band proofing.

This commit adds a `post_idv_followup_url` to the SP configuration for this purpose. This URL is used in the `account_verified` email if it is present. In future changes we plan to add a CTA after the user enters a mailed code and to the account page if the user has not connected their account.

This change should not impact SPs that do not have a `post_idv_followup_url` configured.

[skip changelog]
  • Loading branch information
jmhooper authored Dec 5, 2024
1 parent d461b1b commit 89afb54
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def redirect_url
if issuer.blank?
root_url
else
sp_return_url_resolver&.return_to_sp_url
sp_return_url_resolver&.post_idv_follow_up_url ||
sp_return_url_resolver&.return_to_sp_url
end
end

Expand Down
8 changes: 4 additions & 4 deletions app/presenters/idv/account_verified_email_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def service_provider
end

def show_cta?
!service_provider || service_provider_homepage_url.present?
!service_provider || service_provider_post_idv_follow_up_url.present?
end

def sign_in_url
Expand All @@ -32,11 +32,11 @@ def sign_in_url
end

def displayed_sign_in_url
service_provider_homepage_url || root_url
service_provider_post_idv_follow_up_url || root_url
end

def service_provider_homepage_url
sp_return_url_resolver.homepage_url if service_provider
def service_provider_post_idv_follow_up_url
sp_return_url_resolver.post_idv_follow_up_url if service_provider
end

def sp_name
Expand Down
4 changes: 4 additions & 0 deletions app/services/sp_return_url_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def homepage_url
service_provider.return_to_sp_url
end

def post_idv_follow_up_url
service_provider.post_idv_follow_up_url || homepage_url
end

private

def inferred_redirect_url
Expand Down
1 change: 1 addition & 0 deletions config/service_providers.localdev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ test:
assertion_consumer_logout_service_url: ''
ial: 2
allow_prompt_login: true
post_idv_follow_up_url: http://localhost/post_idv_follow_up_url

'urn:gov:gsa:openidconnect:sp:server_ial1':
agency_id: 2
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddPostIdvFollowUpUrlToServiceProvider < ActiveRecord::Migration[7.2]
def change
add_column :service_providers, :post_idv_follow_up_url, :string, comment: 'sensitive=false'
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.2].define(version: 2024_11_15_215510) do
ActiveRecord::Schema[7.2].define(version: 2024_12_03_163014) do
# These are extensions that must be enabled in order to support this database
enable_extension "citext"
enable_extension "pg_stat_statements"
Expand Down Expand Up @@ -551,6 +551,7 @@
t.boolean "use_legacy_name_id_behavior", default: false, comment: "sensitive=false"
t.boolean "irs_attempts_api_enabled", comment: "sensitive=false"
t.boolean "in_person_proofing_enabled", default: false, comment: "sensitive=false"
t.string "post_idv_follow_up_url", comment: "sensitive=false"
t.index ["issuer"], name: "index_service_providers_on_issuer", unique: true
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@
describe 'GET #show' do
subject(:action) { get :show, params: }

context 'issuer provided and return_to_sp_url present' do
context 'issuer provided and post_idv_follow_up_url present' do
let(:service_provider) do
build(
:service_provider,
issuer: 'urn:my:awesome:issuer',
return_to_sp_url: 'https://some-sp.com',
post_idv_follow_up_url: 'https://some-sp.com',
)
end

let(:params) do
{ issuer: 'urn:my:awesome:issuer', campaign_id: '123234234' }
end

it 'redirects to the service provider home page and logs event' do
it 'redirects to the service provider follow_up url and logs event' do
action

aggregate_failures 'verify response' do
Expand All @@ -50,6 +50,7 @@
:service_provider,
issuer: 'urn:my:awesome:issuer',
return_to_sp_url: nil,
post_idv_follow_up_url: nil,
acs_url: nil,
redirect_uris: nil,
)
Expand Down
7 changes: 4 additions & 3 deletions spec/presenters/idv/account_verified_email_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@
end

context 'where there is a service provider' do
context 'when the service provider has no return URL' do
context 'when the service provider has no post-IdV follow-up URL' do
let(:service_provider) do
create(
:service_provider,
issuer: 'urn:my:awesome:sp',
post_idv_follow_up_url: nil,
return_to_sp_url: nil,
friendly_name: 'My Awesome SP',
)
Expand Down Expand Up @@ -101,12 +102,12 @@
end
end

context 'when the service provider does have a return URL' do
context 'when the service provider does have a post-IdV follow-up URL' do
let(:service_provider) do
create(
:service_provider,
issuer: 'urn:my:awesome:sp',
return_to_sp_url: 'https://www.mysp.com',
post_idv_follow_up_url: 'https://www.mysp.com',
friendly_name: 'My Awesome SP',
)
end
Expand Down
31 changes: 31 additions & 0 deletions spec/services/sp_return_url_resolver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,35 @@
end
end
end

describe '#post_idv_follow_up_url' do
let(:return_to_sp_url) { nil }
let(:sp_post_idv_follow_up_url) { nil }
let(:sp) do
build(
:service_provider,
return_to_sp_url: return_to_sp_url,
post_idv_follow_up_url: sp_post_idv_follow_up_url,
)
end
let(:instance) { described_class.new(service_provider: sp) }
subject(:post_idv_follow_up_url) { instance.post_idv_follow_up_url }

context 'with not homepage url or follow_up url configured' do
it { expect(post_idv_follow_up_url).to be_nil }
end

context 'with a homepage url configured' do
let(:return_to_sp_url) { 'https://sp.gov/return_to_sp' }

it { expect(post_idv_follow_up_url).to eq(return_to_sp_url) }
end

context 'with a follow_up url configured' do
let(:return_to_sp_url) { 'https://sp.gov/return_to_sp' }
let(:sp_post_idv_follow_up_url) { 'https://sp.gov/follow_up' }

it { expect(post_idv_follow_up_url).to eq(sp_post_idv_follow_up_url) }
end
end
end

0 comments on commit 89afb54

Please sign in to comment.