-
Notifications
You must be signed in to change notification settings - Fork 0
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 #32 from nla/feat/blac-580-patron-keycloak
feat: patron keycloak
- Loading branch information
Showing
22 changed files
with
247 additions
and
195 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
module AuthSessionConcern | ||
extend ActiveSupport::Concern | ||
|
||
def new_session_path(_scope) | ||
new_user_session_path | ||
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
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,21 +1,25 @@ | ||
<h1>Login</h1> | ||
|
||
<%= form_for(resource, as: resource_name, html: {'data-turbo' => "false"}, url: session_path(resource_name)) do |f| %> | ||
<div class="field form-group"> | ||
<%= f.label :username, "User ID" %> | ||
<%= f.text_field :username, autofocus: true, autocomplete: "username",class: "form-control col-md-4" %> | ||
</div> | ||
<% if ENV["KC_PATRON_REALM"] %> | ||
<%= button_to t("auth.patron_login"), user_catalogue_patron_omniauth_authorize_path, class: "btn btn-primary", data: { turbo: false } %> | ||
<% else %> | ||
<%= form_for(resource, as: resource_name, html: {'data-turbo' => "false"}, url: session_path(resource_name)) do |f| %> | ||
<div class="field form-group"> | ||
<%= f.label :username, "User ID" %> | ||
<%= f.text_field :username, autofocus: true, autocomplete: "username",class: "form-control col-md-4" %> | ||
</div> | ||
|
||
<div class="field form-group"> | ||
<%= f.label :password, "Family Name" %> | ||
<%= f.text_field :password, autocomplete: "off",class: "form-control col-md-4" %> | ||
</div> | ||
<div class="field form-group"> | ||
<%= f.label :password, "Family Name" %> | ||
<%= f.text_field :password, autocomplete: "off",class: "form-control col-md-4" %> | ||
</div> | ||
|
||
<p><%= t("devise.registrations.register", url: ENV["NATIONAL_LIBRARY_CARD_URL"]).html_safe %></p> | ||
<p><%= t("devise.registrations.register", url: ENV["NATIONAL_LIBRARY_CARD_URL"]).html_safe %></p> | ||
|
||
<div class="actions"> | ||
<%= f.submit "Login", class: "btn btn-primary" %> | ||
</div> | ||
<div class="actions"> | ||
<%= f.submit "Login", class: "btn btn-primary" %> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
|
||
<%= render "users/shared/links" %> |
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
class ApplicationController < ActionController::Base | ||
# Attempt to find the mapped route for devise based on request path | ||
|
||
if ENV["KC_PATRON_REALM"] | ||
include AuthSessionConcern | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<h1>Pages#home</h1> | ||
<p>Find me in app/views/pages/home.html.erb</p> | ||
<h1>Pages#about</h1> | ||
<p>Find me in app/views/pages/about.html.erb</p> |
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,2 +1,6 @@ | ||
<h1>Pages#home</h1> | ||
<p>Find me in app/views/pages/home.html.erb</p> | ||
|
||
<% if current_user.present? %> | ||
Logged in as <%= current_user %> | ||
<% 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
Oops, something went wrong.