-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2328 from 18F/stages/rc-2018-07-20
Deploy stages/rc-2018-07-20 to int (RC62)
- Loading branch information
Showing
159 changed files
with
2,245 additions
and
836 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ gem 'pg' | |
gem 'phonelib' | ||
gem 'pkcs11' | ||
gem 'premailer-rails' | ||
gem 'proofer', github: '18F/identity-proofer-gem', tag: 'v2.5.0' | ||
gem 'proofer', github: '18F/identity-proofer-gem', tag: 'v2.6.1' | ||
gem 'rack-attack' | ||
gem 'rack-cors', require: 'rack/cors' | ||
gem 'rack-headers_filter' | ||
|
@@ -112,7 +112,7 @@ group :test do | |
end | ||
|
||
group :production do | ||
gem 'aamva', git: '[email protected]:18F/identity-aamva-api-client-gem', tag: 'v3.0.1' | ||
gem 'aamva', git: '[email protected]:18F/identity-aamva-api-client-gem', tag: 'v3.1.0' | ||
gem 'equifax', git: '[email protected]:18F/identity-equifax-api-client-gem.git', tag: 'v1.1.0' | ||
gem 'lexisnexis', git: '[email protected]:18F/identity-lexisnexis-api-client-gem', tag: 'v1.0.0' | ||
gem 'lexisnexis', git: '[email protected]:18F/identity-lexisnexis-api-client-gem', tag: 'v1.1.0' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
GIT | ||
remote: [email protected]:18F/identity-aamva-api-client-gem | ||
revision: 015186dd86691294404229ee051cfcf9e87fb6c7 | ||
tag: v3.0.1 | ||
revision: f69b0295933809057292736ed173a5a5e11b668c | ||
tag: v3.1.0 | ||
specs: | ||
aamva (3.0.1) | ||
aamva (3.1.0) | ||
dotenv | ||
hashie | ||
httpi | ||
|
@@ -24,10 +24,10 @@ GIT | |
|
||
GIT | ||
remote: [email protected]:18F/identity-lexisnexis-api-client-gem | ||
revision: 2cf954c312a7e66cd24c48ccc7af8bdc72339525 | ||
tag: v1.0.0 | ||
revision: d17049ab1a03d50c0cc8a272d86cf2144192fab5 | ||
tag: v1.1.0 | ||
specs: | ||
lexisnexis (1.0.0) | ||
lexisnexis (1.1.0) | ||
dotenv | ||
typhoeus | ||
|
||
|
@@ -41,10 +41,10 @@ GIT | |
|
||
GIT | ||
remote: https://github.com/18F/identity-proofer-gem.git | ||
revision: 55191ec2124fb2b36111adf15d626d483436b74d | ||
tag: v2.5.0 | ||
revision: 875246d603bbd9b29cbc82493513f948d4e8689b | ||
tag: v2.6.1 | ||
specs: | ||
proofer (2.5.0) | ||
proofer (2.6.1) | ||
|
||
GIT | ||
remote: https://github.com/18F/redis-session-store.git | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
class SmsController < ApplicationController | ||
include ActionController::HttpAuthentication::Basic::ControllerMethods | ||
include SecureHeadersConcern | ||
|
||
# Twilio supports HTTP Basic Auth for request URL | ||
# https://www.twilio.com/docs/usage/security | ||
before_action :authenticate | ||
|
||
# Disable CSRF check | ||
skip_before_action :verify_authenticity_token, only: [:receive] | ||
|
||
def receive | ||
signature = request.headers[TwilioService::Sms::Request::SIGNATURE_HEADER] | ||
message = TwilioService::Sms::Request.new(request.url, params, signature) | ||
|
||
handle_result(message, SmsForm.new(message).submit) | ||
end | ||
|
||
private | ||
|
||
def handle_result(message, result) | ||
if result.success? | ||
process_success(message, result) | ||
else | ||
process_failure(result) | ||
end | ||
end | ||
|
||
def process_success(message, result) | ||
response = TwilioService::Sms::Response.new(message) | ||
SmsReplySenderJob.perform_later(response.reply) | ||
|
||
analytics.track_event( | ||
Analytics::TWILIO_SMS_INBOUND_MESSAGE_RECEIVED, | ||
result.to_h | ||
) | ||
|
||
head :accepted | ||
end | ||
|
||
def process_failure(result) | ||
analytics.track_event( | ||
Analytics::TWILIO_SMS_INBOUND_MESSAGE_VALIDATION_FAILED, | ||
result.to_h | ||
) | ||
|
||
head :forbidden | ||
end | ||
|
||
# `http_basic_authenticate_with name` had issues related to testing, so using | ||
# this method with a before action instead. (The former is a shortcut for the | ||
# following, which is called internally by Rails.) | ||
def authenticate | ||
env = Figaro.env | ||
|
||
head :unauthorized unless auth_configured?(env) | ||
|
||
authenticate_or_request_with_http_basic do |username, password| | ||
# This comparison uses & so that it doesn't short circuit and | ||
# uses `secure_compare` so that length information | ||
# isn't leaked. | ||
ActiveSupport::SecurityUtils.secure_compare( | ||
username, env.twilio_http_basic_auth_username | ||
) & ActiveSupport::SecurityUtils.secure_compare( | ||
password, env.twilio_http_basic_auth_password | ||
) | ||
end | ||
end | ||
|
||
def auth_configured?(env) | ||
env.twilio_http_basic_auth_username.present? && | ||
env.twilio_http_basic_auth_password.present? | ||
end | ||
end |
46 changes: 46 additions & 0 deletions
46
app/controllers/two_factor_authentication/options_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
module TwoFactorAuthentication | ||
class OptionsController < ApplicationController | ||
include TwoFactorAuthenticatable | ||
|
||
def index | ||
@two_factor_options_form = TwoFactorLoginOptionsForm.new(current_user) | ||
@presenter = two_factor_options_presenter | ||
analytics.track_event(Analytics::MULTI_FACTOR_AUTH_OPTION_LIST_VISIT) | ||
end | ||
|
||
def create | ||
@two_factor_options_form = TwoFactorLoginOptionsForm.new(current_user) | ||
result = @two_factor_options_form.submit(two_factor_options_form_params) | ||
analytics.track_event(Analytics::MULTI_FACTOR_AUTH_OPTION_LIST, result.to_h) | ||
|
||
if result.success? | ||
process_valid_form | ||
else | ||
@presenter = two_factor_options_presenter | ||
render :index | ||
end | ||
end | ||
|
||
private | ||
|
||
def two_factor_options_presenter | ||
TwoFactorLoginOptionsPresenter.new(current_user, view_context, current_sp) | ||
end | ||
|
||
def process_valid_form | ||
factor_to_url = { | ||
'voice' => otp_send_url(otp_delivery_selection_form: { otp_delivery_preference: 'voice' }), | ||
'personal_key' => login_two_factor_personal_key_url, | ||
'sms' => otp_send_url(otp_delivery_selection_form: { otp_delivery_preference: 'sms' }), | ||
'auth_app' => login_two_factor_authenticator_url, | ||
'piv_cac' => login_two_factor_piv_cac_url, | ||
} | ||
url = factor_to_url[@two_factor_options_form.selection] | ||
redirect_to url if url | ||
end | ||
|
||
def two_factor_options_form_params | ||
params.require(:two_factor_options_form).permit(:selection) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.