Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,3 @@ yarn-error.log
.yarnrc.yml

Dockerfile.dev
Dockerfile.dev.v2

Dockerfile.dev.v2
10 changes: 6 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ gem 'stimulus-rails'
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem 'jbuilder'

# Use Redis adapter to run Action Cable in production
# gem "redis", "~> 4.0"
# Redis for Action Cable (production) and Rails.cache (production)
gem 'redis', '~> 5.0'

# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"
Expand All @@ -52,13 +52,15 @@ gem 'wicked'

gem 'countries', require: 'countries/global'

# gem 'voog_footer', path: 'vendor/gems/voog_footer'
gem 'voog_footer', github: 'internetee/voog_footer'

gem 'wicked_pdf'
gem 'wkhtmltopdf-binary', '~> 0.12.6.5'

gem 'omniauth', '>=2.0.0'
gem 'omniauth-rails_csrf_protection'
gem 'omniauth-tara', github: 'internetee/omniauth-tara'
# gem 'omniauth-tara', path: 'vendor/gems/omniauth-tara'
gem 'omniauth_openid_connect'

gem 'coderay', '~> 1.1', '>= 1.1.2'

Expand Down
48 changes: 29 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
GIT
remote: https://github.com/internetee/omniauth-tara.git
revision: d7babe56fe666739a0aca4bc94ddc8629641d220
remote: https://github.com/internetee/voog_footer.git
revision: ddbaeef72f380d8798a4df69cc93039a343b66fd
specs:
omniauth-tara (0.7.1)
omniauth (>= 1.9, < 3)
openid_connect (~> 2.2)
voog_footer (0.1.0)
nokogiri (~> 1.10)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -77,8 +76,9 @@ GEM
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
aes_key_wrap (1.1.0)
attr_required (1.0.1)
bindata (2.4.15)
attr_required (1.0.2)
base64 (0.3.0)
bindata (2.5.1)
bindex (0.8.1)
bootsnap (1.16.0)
msgpack (~> 1.2)
Expand All @@ -98,6 +98,7 @@ GEM
launchy
coderay (1.1.3)
concurrent-ruby (1.2.2)
connection_pool (3.0.2)
countries (5.6.0)
unaccent (~> 0.3)
crack (0.4.5)
Expand All @@ -111,13 +112,15 @@ GEM
reline (>= 0.3.1)
diff-lcs (1.5.0)
docile (1.4.0)
email_validator (2.2.4)
activemodel
erubi (1.12.0)
faker (3.2.1)
i18n (>= 1.8.11, < 2)
faraday (2.7.10)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-follow_redirects (0.3.0)
faraday-follow_redirects (0.5.0)
faraday (>= 1, < 3)
faraday-net_http (3.0.2)
fuubar (2.5.1)
Expand All @@ -138,9 +141,10 @@ GEM
activesupport (>= 5.0.0)
jsbundling-rails (1.1.2)
railties (>= 6.0.0)
json-jwt (1.16.3)
json-jwt (1.17.0)
activesupport (>= 4.2)
aes_key_wrap
base64
bindata
faraday (~> 2.0)
faraday-follow_redirects
Expand Down Expand Up @@ -184,17 +188,20 @@ GEM
omniauth-rails_csrf_protection (1.0.1)
actionpack (>= 4.2)
omniauth (~> 2.0)
openid_connect (2.2.0)
omniauth_openid_connect (0.8.0)
omniauth (>= 1.9, < 3)
openid_connect (~> 2.2)
openid_connect (2.4.0)
activemodel
attr_required (>= 1.0.0)
email_validator
faraday (~> 2.0)
faraday-follow_redirects
json-jwt (>= 1.16)
net-smtp
mail
rack-oauth2 (~> 2.2)
swd (~> 2.0)
tzinfo
validate_email
validate_url
webfinger (~> 2.0)
pagy (6.0.4)
Expand All @@ -205,7 +212,7 @@ GEM
nio4r (~> 2.0)
racc (1.7.1)
rack (2.2.8)
rack-oauth2 (2.2.0)
rack-oauth2 (2.3.0)
activesupport
attr_required
faraday (~> 2.0)
Expand Down Expand Up @@ -247,6 +254,10 @@ GEM
rake (13.0.6)
rdoc (6.5.0)
psych (>= 4.0.0)
redis (5.4.1)
redis-client (>= 0.22.0)
redis-client (0.29.0)
connection_pool
regexp_parser (2.8.1)
reline (0.3.8)
io-console (~> 0.5)
Expand Down Expand Up @@ -291,7 +302,7 @@ GEM
stimulus-rails (1.2.2)
railties (>= 6.0.0)
stringio (3.0.8)
swd (2.0.2)
swd (2.0.3)
activesupport (>= 3)
attr_required (>= 0.0.5)
faraday (~> 2.0)
Expand All @@ -305,9 +316,6 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unaccent (0.4.0)
validate_email (0.1.6)
activemodel (>= 3.0)
mail (>= 2.2.5)
validate_url (1.0.15)
activemodel (>= 3.0.0)
public_suffix
Expand All @@ -317,7 +325,7 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webfinger (2.1.2)
webfinger (2.1.3)
activesupport
faraday (~> 2.0)
faraday-follow_redirects
Expand Down Expand Up @@ -360,10 +368,11 @@ DEPENDENCIES
jwt
omniauth (>= 2.0.0)
omniauth-rails_csrf_protection
omniauth-tara!
omniauth_openid_connect
pagy
puma (~> 6.0)
rails (~> 7.0.2, >= 7.0.2.2)
redis (~> 5.0)
rspec-rails
selenium-webdriver
simplecov (= 0.22.0)
Expand All @@ -372,6 +381,7 @@ DEPENDENCIES
turbo-rails
tzinfo-data
vcr
voog_footer!
web-console
webmock
wicked
Expand Down
13 changes: 7 additions & 6 deletions app/assets/stylesheets/menu/social.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@
}
ul {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 12px 16px;
list-style: none;
padding: 0;
li {
margin-right: 20px;
&:last-child {
margin-right: 0;
}
margin-right: 0;
a:not(.btn) {
display: block;
width: 40px;
Expand Down Expand Up @@ -52,8 +51,9 @@
right: 40px;
padding: 0;
ul {
gap: 8px 10px;
li {
margin-right: 10px;
margin-right: 0;
a:not(.btn) {
width: 30px;
height: 30px;
Expand All @@ -72,8 +72,9 @@
margin-top: 5px;
border-top: 1px solid #EAEBED;
ul {
gap: 8px 10px;
li {
margin-right: 10px;
margin-right: 0;
a:not(.btn) {
width: 30px;
height: 30px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
module Auth
class TaraController < AuthController
class OidcController < AuthController
before_action :require_no_authentication, only: :callback

# GET /auth/oidc/callback
def callback
conn = ApiConnector::Auth::OmniauthTaraChecker.new(username: nil)
result = conn.call_action(params: tara_callback_params)
conn = ApiConnector::Auth::OmniauthChecker.new(username: nil)
result = conn.call_action(params: oidc_callback_params)
handle_response(result); return if performed?

create { user_payload }
end

# GET /auth/oidc/cancel
def cancel
message_key = params[:message]

translated = if message_key.present?
I18n.t("omniauth.errors.#{message_key}", default: message_key.humanize)
end

flash[:alert] = translated.presence || t(:sign_in_cancelled)
redirect_to login_url
end

private

def tara_callback_params
def oidc_callback_params
{
auth: {
uid: omniauth_user_hash.try(:uid),
Expand Down
12 changes: 7 additions & 5 deletions app/controllers/concerns/authentication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def logged_in?
end

def sign_out
clear_auth_cache
session[:uuid] = nil
clear_cache
end

def sign_in(uuid)
Expand Down Expand Up @@ -60,9 +60,11 @@ def construct_auth_info(token, request_ip, data)
}
end

def clear_cache
Rails.cache.instance_variable_get(:@data)&.each_key do |key|
Rails.cache.delete(key) unless key.match?(/distribution_data|growth_rate_data/)
end
# Auth session payload (uuid) and bulk-change wizard state (session.id) only.
# Leaves stats (distribution_data, growth_rate_data) and Voog footer (voog_footer/links/*) intact.
def clear_auth_cache
auth_uuid = session[:uuid]
Rails.cache.delete(auth_uuid) if auth_uuid.present?
Rails.cache.delete(session.id)
end
end
1 change: 1 addition & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module ApplicationHelper
include Pagy::Frontend
include VoogFooterHelper

CONTACT_TYPE = {
tech: 'TechDomainContact',
Expand Down
Loading
Loading