Skip to content

Commit

Permalink
add omniauth conifg
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Feb 23, 2024
1 parent fff795d commit bc39c9e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ gem 'net-pop', require: false
gem 'net-smtp', require: false
gem 'nokogiri', '~> 1.14'
gem 'odf-report'
gem 'omniauth'
gem 'omniauth-rails_csrf_protection'
gem 'pg'
gem 'pg_search'
gem 'psych', '~> 3.3', '>= 3.3.4'
Expand Down Expand Up @@ -77,4 +79,4 @@ end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

gem "omniauth-keycloak", "~> 1.5"
gem 'omniauth-keycloak', '~> 1.5'
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ GEM
omniauth-oauth2 (1.8.0)
oauth2 (>= 1.4, < 3)
omniauth (~> 2.0)
omniauth-rails_csrf_protection (1.0.1)
actionpack (>= 4.2)
omniauth (~> 2.0)
parallel (1.24.0)
parser (3.3.0.5)
ast (~> 2.4.1)
Expand Down Expand Up @@ -488,7 +491,9 @@ DEPENDENCIES
net-smtp
nokogiri (~> 1.14)
odf-report
omniauth
omniauth-keycloak (~> 1.5)
omniauth-rails_csrf_protection
pg
pg_search
pry
Expand Down
1 change: 1 addition & 0 deletions app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
%div.container-fluid
%div.row.d-flex.justify-content-center
%div.col-8
= button_to "Login", "/auth/keycloak", method: :post
= yield
= turbo_frame_tag "remote_modal", target: "_top"

3 changes: 3 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0

config.session_store :cookie_store, key: '_interslice_session'
config.middleware.use ActionDispatch::Cookies # Required for all session management
config.middleware.use ActionDispatch::Session::CookieStore, config.session_options
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
Expand Down
8 changes: 6 additions & 2 deletions config/initializers/omniauth.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Rails.application.config.middleware.use OmniAuth::Builder do
provider :keycloak_openid, 'pitc_skills_rails_backend', 'r609dv7dl50164n4rlga121ott',
provider(
:keycloak_openid,
'pitc_skills_rails_backend',
'r609dv7dl50164n4rlga121ott',
scope: "openid",
client_options: {site: 'https://sso-test.puzzle.ch', realm: 'pitc'},
name: 'pitc_skills_rails_backend'
name: 'keycloak')
end

0 comments on commit bc39c9e

Please sign in to comment.