Skip to content

Commit

Permalink
4743: change mobile lighthouse letters client id to match new key (#1…
Browse files Browse the repository at this point in the history
…2172)

Co-authored-by: Andrew Herzberg <andrew.herzberg@adhocteam.us>
  • Loading branch information
kpethtel and aherzberg authored Apr 19, 2023
1 parent 536f749 commit abbca2d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 34 deletions.
9 changes: 2 additions & 7 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1493,14 +1493,9 @@ lighthouse_health_immunization:
- "patient/Immunization.read"
- "patient/Location.read"

mobile_lighthouse_letters:
mobile_lighthouse:
client_id: '0oajpx78t3M8kurld2p7'
key_path: ~
aud_claim_url: "https://deptva-eval.okta.com/oauth2/ausftw7zk6eHr7gMN2p7/v1/token"
access_token_url: 'https://sandbox-api.va.gov/oauth2/va-letter-generator/system/v1/token'
api_url: 'https://sandbox-api.va.gov/services/va-letter-generator/v1/'
api_scopes:
- "letters.read"
rsa_key: ~

token_validation:
url: https://dev-api.va.gov/internal/auth
Expand Down
9 changes: 3 additions & 6 deletions modules/mobile/app/models/mobile/v0/lighthouse_assertion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ module V0
class LighthouseAssertion
TTL = 300

CLIENT_IDS = { health: Settings.lighthouse_health_immunization.client_id,
letters: Settings.mobile_lighthouse_letters.client_id }.freeze
CLIENT_IDS = { health: Settings.lighthouse_health_immunization.client_id }.freeze

AUD_CLAIM_URLS = { health: Settings.lighthouse_health_immunization.audience_claim_url,
letters: Settings.mobile_lighthouse_letters.aud_claim_url }.freeze
AUD_CLAIM_URLS = { health: Settings.lighthouse_health_immunization.audience_claim_url }.freeze

KEY_PATHS = { health: Settings.lighthouse_health_immunization.key_path,
letters: Settings.mobile_lighthouse_letters.key_path }.freeze
KEY_PATHS = { health: Settings.lighthouse_health_immunization.key_path }.freeze

def initialize(api)
@client_id = CLIENT_IDS[api]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ def token(api)

def scopes
{
health: Settings.lighthouse_health_immunization.scopes.join(' '),
letters: Settings.mobile_lighthouse_letters.api_scopes.join(' ')
health: Settings.lighthouse_health_immunization.scopes.join(' ')
}
end

Expand Down
19 changes: 0 additions & 19 deletions modules/mobile/spec/models/lighthouse_assertion_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,5 @@
]
)
end

it 'encodes the letters claim as a jwt token' do
expect(JWT.decode(Mobile::V0::LighthouseAssertion.new(:letters).token, rsa_key.public_key, true,
{ algorithm: 'RS512' })).to eq(
[
{
'aud' => 'https://deptva-eval.okta.com/oauth2/ausftw7zk6eHr7gMN2p7/v1/token',
'iss' => '0oajpx78t3M8kurld2p7',
'sub' => '0oajpx78t3M8kurld2p7',
'jti' => uuid,
'iat' => 1_633_910_400,
'exp' => 1_633_910_700
},
{
'alg' => 'RS512'
}
]
)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
end

before do
skip('Temporary disabling of specs until new LH service available')
allow(File).to receive(:read).and_return(rsa_key.to_s)
allow_any_instance_of(IAMUser).to receive(:icn).and_return('24811694708759028')
user = build(:iam_user)
Expand Down

0 comments on commit abbca2d

Please sign in to comment.