Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure omniauth for SAML #4

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
00db7f2
Update Config
tamulibrary Jan 30, 2020
c7a9526
Update docker-compose.yml
tamulibrary Jan 30, 2020
4b1fe8c
Update docker-compose.yml
tamulibrary Jan 30, 2020
4e803cb
test changes
tamulibrary Feb 8, 2020
d15ad23
Update config files
tamulibrary Feb 13, 2020
d421040
Revert "test changes"
tamulibrary Feb 15, 2020
266012c
Revert "Update docker-compose.yml"
tamulibrary Feb 15, 2020
e915f01
Revert "Update Config"
tamulibrary Feb 15, 2020
3469ed5
Revert "Update config files"
tamulibrary Feb 17, 2020
6ca3d6e
add environment variables
tamulibrary Feb 21, 2020
26bcfb1
Update settings.yml
tamulibrary Feb 21, 2020
bfa1a96
Update settings.yml
tamulibrary Feb 24, 2020
9f47b67
update config settings
tamulibrary Mar 3, 2020
06ddb88
revert fedora config
tamulibrary Mar 4, 2020
649e345
TAMU Changes
tamulibrary Mar 5, 2020
0f4b14a
tamu changes
tamulibrary Mar 8, 2020
7074808
mail hotfix
tamulibrary Mar 8, 2020
206022b
TAMU Style Changes
tamulibrary Mar 9, 2020
8c8e1a6
Style tweaks
tamulibrary Mar 9, 2020
aeb45f7
config tweaks
tamulibrary Mar 17, 2020
dd381e8
Update tamu.css
tamulibrary Mar 17, 2020
7f14917
Update _header.html.erb
tamulibrary Mar 17, 2020
d1feb09
Remove CRLF
tamulibrary Apr 3, 2020
9077465
Revert this for testing
tamulibrary Apr 3, 2020
dd7e5ea
Merge branch 'tamu_development' into tamu_master
tamulibrary Apr 4, 2020
b5a6990
fix
tamulibrary Apr 4, 2020
c4a1d71
Merge branch 'avalonmediasystem-master' into tamu_development
tamulibrary Apr 4, 2020
87db177
Update configs
tamulibrary Apr 6, 2020
58322d5
add additional jobs
tamulibrary Apr 8, 2020
f904000
tweaks
tamulibrary Apr 8, 2020
d6934d6
Tweak Changes
tamulibrary Apr 8, 2020
a45ec0d
Merge branch 'master' into tamu_development
doug-hahn Sep 24, 2020
c463acd
Reset file
doug-hahn Sep 24, 2020
79ed8b3
Merge branch 'tamu_development' into tamu_master
doug-hahn Sep 24, 2020
fdc42d0
Update solr.yml
doug-hahn Oct 9, 2020
03bde3b
Update solr.yml
doug-hahn Oct 9, 2020
e962256
Update YML
doug-hahn Oct 10, 2020
23425d4
Update solr.yml
doug-hahn Oct 10, 2020
6387a2d
Revert Fedora
doug-hahn Oct 11, 2020
363355a
Put parameters back
doug-hahn Oct 11, 2020
58d1d25
Update fedora.yml
doug-hahn Oct 11, 2020
d334948
parameterize config
doug-hahn Oct 12, 2020
b99d077
Update settings.yml
doug-hahn Oct 12, 2020
ee022b6
Update settings.yml
doug-hahn Oct 12, 2020
6837b87
Update settings.yml
doug-hahn Oct 13, 2020
9d5ee65
Update database.yml
doug-hahn Oct 15, 2020
13a80e3
Merge remote-tracking branch 'upstream/master' into tamu_development
doug-hahn Feb 10, 2021
4deda42
add missing gem
doug-hahn Feb 10, 2021
d37597b
minor tweaks
doug-hahn Feb 12, 2021
6de8168
Merge remote-tracking branch 'upstream/master' into tamu_development
doug-hahn Jun 23, 2021
001ffd2
add control vocab and update gem
doug-hahn Jun 23, 2021
d4a7f6f
Update settings.yml
doug-hahn Feb 8, 2022
5947808
Update application_controller.rb
doug-hahn Jul 2, 2022
f805a65
Update fedora.yml
doug-hahn Oct 12, 2022
65a9f00
missing settings
doug-hahn Oct 13, 2022
a7bd393
Replace database authenticatable with SAML authenticatable
wwelling Jun 28, 2024
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: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Auto detect text files and perform LF normalization
* text=auto eol=lf

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ vendor/bundle
## PROJECT::SPECIFIC
config/authentication.yml
config/avalon.yml
config/controlled_vocabulary.yml
#config/controlled_vocabulary.yml
config/matterhorn.yml
config/role_map_development.yml
config/initializers/rubyhorn.rb
Expand Down
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ gem 'ims-lti', '~> 1.1.13'
gem 'net-ldap'
gem 'omniauth-identity'
gem 'omniauth-lti', git: "https://github.com/avalonmediasystem/omniauth-lti.git", tag: 'avalon-r4'
gem 'omniauth-ldap'

gem 'devise_saml_authenticatable'

# Media Access & Transcoding
gem 'active_encode', '~> 0.7.0'
Expand Down
19 changes: 15 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ GEM
multi_json (~> 1.11, >= 1.11.2)
rack (>= 2.0.8, < 3)
railties (>= 5.2.4.1)
activestorage (5.2.4.4)
actionpack (= 5.2.4.4)
activerecord (= 5.2.4.4)
activestorage (5.2.4.5)
actionpack (= 5.2.4.5)
activerecord (= 5.2.4.5)
marcel (~> 0.3.1)
activesupport (5.2.4.5)
concurrent-ruby (~> 1.0, >= 1.0.2)
Expand Down Expand Up @@ -1482,6 +1482,11 @@ GEM
omniauth-identity (1.1.1)
bcrypt-ruby (~> 3.0)
omniauth (~> 1.0)
omniauth-ldap (1.0.5)
net-ldap (~> 0.12)
omniauth (~> 1.0)
pyu-ruby-sasl (~> 0.0.3.2)
rubyntlm (~> 0.3.4)
orm_adapter (0.5.0)
os (1.0.1)
parallel (1.17.0)
Expand All @@ -1504,6 +1509,7 @@ GEM
public_suffix (3.0.3)
puma (4.3.5)
nio4r (~> 2.0)
pyu-ruby-sasl (0.0.3.3)
raabro (1.3.1)
racc (1.5.2)
rack (2.2.3)
Expand Down Expand Up @@ -1674,6 +1680,7 @@ GEM
mime-types
nokogiri
rest-client
rubyntlm (0.3.4)
rubyzip (1.3.0)
safe_yaml (1.0.5)
samvera-persona (0.1.7)
Expand Down Expand Up @@ -1765,6 +1772,8 @@ GEM
railties (>= 3.1)
tzinfo (1.2.9)
thread_safe (~> 0.1)
tzinfo-data (1.2022.1)
tzinfo (>= 1.0.0)
uber (0.0.15)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
Expand Down Expand Up @@ -1893,6 +1902,7 @@ DEPENDENCIES
noid-rails (~> 3.0.1)
okcomputer
omniauth-identity
omniauth-ldap
omniauth-lti!
parallel
pg
Expand Down Expand Up @@ -1929,6 +1939,7 @@ DEPENDENCIES
sprockets (~> 3.7.2)
sprockets-es6
sqlite3
tzinfo-data
uglifier (>= 1.3.0)
wavefile (~> 1.0.1)
web-console
Expand All @@ -1941,4 +1952,4 @@ DEPENDENCIES
zoom

BUNDLED WITH
2.2.11
2.3.17
Binary file added app/assets/images/tamu/tamu-logo-with-bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions app/assets/images/tamu/tamu.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#header-navbar .navbar-brand {
background: transparent "tamu-logo-with-bar.png" no-repeat top left;
background: transparent url(/assets/tamu/tamu-logo-with-bar.png) no-repeat top left;
margin-top: 10px;
margin-bottom: -10px;
}

#header-navbar .navbar-toggle, #header-navbar .facets-toggle {
background: #ffcf08;
}

.container > .navbar-header, .container > .navbar-collapse, .container > #facet-panel-collapse, .container > div[id*='facet-panel-'], .container-fluid > .navbar-header, .container-fluid > .navbar-collapse, .container-fluid > #facet-panel-collapse, .container-fluid > div[id*='facet-panel-'] {
background-color: #500000;
}

.custom-header {
background-color: #3c0000;
padding: 0px 0px 0px 0px;
}

.navbar-default {
background: #500000;
border-top: 1px solid #8d8d8d;
}

.navbar-right {
background: #3c0000;
}

.navbar-title {
background: #3c0000;
color: white;
}

.header-wrapper .header-logo > a:hover {
text-decoration: none;
}

#footer.homepage-footer {
background: #3c0000;
padding: 0px 0px 0px 0px;
}

.navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus {
color: #500000;
background-color: #ffcf08;
}

.navbar-default .navbar-nav > li > a {
color: white;
}

.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus {
color: #500000;
background-color: #ffcf08;
}

.navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .navbar-default .navbar-nav > .active > a:focus {
color: #333333;
}

.btn-primary {
color: white;
background-color: #500000;
border-color: #500000;
}

.btn-primary:hover {
color: white;
background-color: #3c0000;
border-color: #3c0000;
}
3 changes: 2 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ def time_str_to_milliseconds(value)
def current_ability
session_opts ||= user_session
session_opts ||= {}
@current_ability ||= Ability.new(current_user, session_opts.merge(remote_ip: request.remote_ip))
@current_ability ||= Ability.new(current_user, session_opts.merge(remote_ip: request.env['HTTP_X_REAL_IP']))
# @current_ability ||= Ability.new(current_user, session_opts.merge(remote_ip: request.remote_ip))
end

rescue_from CanCan::AccessDenied do |exception|
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def application_name
end

def release_text
"#{application_name} #{t(:release_label)} #{Avalon::VERSION}"
"#{Avalon::VERSION}"
end

def share_link_for(obj, only_path: false)
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable
# Registration is controlled via settings.yml
devise_list = [ :database_authenticatable, :invitable, :omniauthable,
devise_list = [ :saml_authenticatable, :invitable, :omniauthable,
:recoverable, :rememberable, :trackable, :validatable ]
devise_list << :registerable if Settings.auth.registerable
devise_list << { authentication_keys: [:login] }
Expand Down
5 changes: 1 addition & 4 deletions app/views/_user_util_links.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@ Unless required by applicable law or agreed to in writing, software distributed
<% end %>

<li class="divider desktop-hidden" />
<%= link_to_if user_signed_in?, 'Sign out', main_app.destroy_user_session_path do %>
<%# Fallback if the test above fails %>
<%= link_to 'Sign in', main_app.new_user_session_path %>
<% end %>

<% unless current_page?(main_app.root_path) %>
<li class="desktop-hidden"><%= render :partial=>'modules/avalon_search_form' %></li>
<% end %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/catalog/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ Unless required by applicable law or agreed to in writing, software distributed
<%= render :partial=>'modules/avalon_search_form' %>
</div>

<div class="homepage-splash-lead-copy">
<!-- <div class="homepage-splash-lead-copy">
<div class="container">
<p class="lead">Avalon Media System is an open source system for managing and providing access to large
collections of
digital audio and video.</p>
</div>
</div>
</div> -->
</section>

<% if @featured_collection.present? %>
Expand Down
20 changes: 11 additions & 9 deletions app/views/modules/_footer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@ Unless required by applicable law or agreed to in writing, software distributed
specific language governing permissions and limitations under the License.
--- END LICENSE_HEADER BLOCK ---
%>
<div id="footer" class="<%= "homepage-footer" if current_page?(main_app.root_path) %>">

<div id="footer" class="homepage-footer">

<footer class="container">
<div class="separator"></div>
<ul>
<li class="footer-logo">
<%= image_tag "AvalonMediaSystem_Logo_A.png", alt: "Avalon Media System - #{t(:release_label)} #{Avalon::VERSION}" %>
<li><a href="http://www.avalonmediasystem.org">Avalon Media System Project Website</a> </li>
<li><%= link_to "Contact Us", main_app.comments_path %></li>

<li><a href="https://howdy.tamu.edu">howdy.tamu.edu</a></li>
<li><a href="https://library.tamu.edu/services/tech_troubleshooting.html">Off-Campus Access</a></li>
<li><a href="https://www.tamu.edu">Texas A&amp;M University</a></li>
<li><a href="https://library.tamu.edu/about/compliance.html">Site Policies</a></li>
<li><a href="https://askus.library.tamu.edu/contact/index">Comments</a></li>
<li><a href="https://library.tamu.edu/status/">Services Status</a></li>
<li><%= render 'modules/user_management' %></li>

</ul>
<div class="release">
<%=release_text%>
<%= git_commit_info(" (%s %s [%s])") if Rails.env == 'development' %>
</div>
</footer>
</div>
22 changes: 12 additions & 10 deletions app/views/modules/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,27 @@ Unless required by applicable law or agreed to in writing, software distributed
specific language governing permissions and limitations under the License.
--- END LICENSE_HEADER BLOCK ---
%>
<link rel="stylesheet" media="all" href="/assets/tamu/tamu.css" />
<div class="custom-header">
<div class="container">
<header class="header-wrapper">
<div class="header-logo">
<%= link_to main_app.root_path do %>
<%= image_tag "Home.png", class: "img-responvies", alt: "Avalon Media System - #{t(:release_label)} #{Avalon::VERSION}" %>
<%= image_tag "tamu/tamu-logo-with-bar.png", class: "img-responvies", alt: "Texas A&amp;M University Libraries Logo" %>
<span class="navbar-title">Texas A&amp;M University Libraries - Audio & Video Repository</span>
<% end %>
</div>

<% unless current_page?(main_app.root_path) %>
<div class="header-search">
<%= render :partial=>'modules/avalon_search_form' %>
</div>
<% end %>
<div>
<div class="navbar-default navbar-right">
<ul class="nav navbar-nav">
<li>
<a href="http://askus.library.tamu.edu">Help</a>
</li>
</ul>
</div>
</div>

<%# By default shift log in / log out to the header %>
<div class="text-right log-in-out text-muted header-user">
<%= render 'modules/user_management' %>
</div>
</header>
</div>
</div>
9 changes: 7 additions & 2 deletions app/views/modules/_user_management.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ Unless required by applicable law or agreed to in writing, software distributed
%>
<%# The containers for the links need to be defined by the calling partial %>
<% if user_signed_in? %>
<%= user_key %> | <%= link_to t('auth.sign_out'), main_app.destroy_user_session_path %>

<% if defined?(current_user) %>
<%= current_user.email %>
<% end %>

| <%= link_to t('auth.sign_out'), main_app.destroy_user_session_path %>
<% else %>
<%= link_to t('auth.sign_in'), main_app.new_user_session_path, :class => "btn btn-info" %>
<%= link_to t('auth.sign_in'), main_app.new_user_session_path, :class => "tamu-btn tamu-btn-info" %>
<% end %>
3 changes: 3 additions & 0 deletions config/attribute-map.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# attribute-map.yml
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": "user_name"
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": "email"
40 changes: 40 additions & 0 deletions config/controlled_vocabulary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
units:
- Collections
- Default Unit
- Digital Initiatives
- Graduate Student Research
- LAUNCH
- Oaktrust
- University Libraries
identifier_types:
local: Catalog Key
oclc: OCLC
lccn: LCCN
issue number: Issue Number
matrix number: Matrix Number
music publisher: Music Publisher/Label
videorecording identifier: Videorecording Identifier
other: Other
note_types:
general: General Note
awards: Awards
biographical/historical: Bibliographical/Historical Note
creation/production credits: Creation/Production Credits
language: Language Note
local: Local Note
performers: Performers
statement of responsibility: Statement of Responsibility
venue: Venue/Event Date
rights_statements:
http://rightsstatements.org/vocab/InC/1.0/: In Copyright
http://rightsstatements.org/vocab/InC-OW-EU/1.0/: In Copyright - EU Orphan Work
http://rightsstatements.org/vocab/InC-EDU/1.0/: In Copyright - Educational Use Permitted
http://rightsstatements.org/vocab/InC-NC/1.0/: In Copyright - Non-Commercial Use Permitted
http://rightsstatements.org/vocab/InC-RUU/1.0/: In Copyright - Rights-Holders Unlocatable or Unidentifiable
http://rightsstatements.org/vocab/NoC-CR/1.0/: No Copyright - Contractual Restrictions
http://rightsstatements.org/vocab/NoC-NC/1.0/: No Copyright - Non-Commercial Use Only
http://rightsstatements.org/vocab/NoC-OKLR/1.0/: No Copyright - Other Known Legal Restrictions
http://rightsstatements.org/vocab/NoC-US/1.0/: No Copyright - United States
http://rightsstatements.org/vocab/CNE/1.0/: Copyright Not Evaluated
http://rightsstatements.org/vocab/UND/1.0/: Copyright Undetermined
http://rightsstatements.org/vocab/NKC/1.0/: No Known Copyright
10 changes: 8 additions & 2 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#

# Increase the default pool size for large jobs.
# DCH
default: &default
adapter: sqlite3
pool: 10
pool: 40
timeout: 10000

development:
Expand All @@ -21,7 +24,10 @@ test:
pool: 20
database: db/test.sqlite3


# Increase the default pool size for large jobs.
# DCH
production:
<<: *default
pool: 20
pool: 40
database: db/production.sqlite3
15 changes: 15 additions & 0 deletions config/docker_schedule.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
set :output, "log/whenever_cron.log"
job_type :locking_rake, "source /etc/profile.d/container_environment.sh && cd :path && :environment_variable=:environment script/locking_runner :lock_name bundle exec rake :task --silent :output"
job_type :locking_runner, "source /etc/profile.d/container_environment.sh && cd :path && :environment_variable=:environment script/locking_runner :lock_name :task :output"

every 1.minute do
locking_rake "avalon:batch:ingest", :lock_name => "batch_ingest", :environment => ENV['RAILS_ENV'] || 'production'
end

every 15.minutes do
locking_rake "avalon:batch:ingest_status_check", :lock_name => "batch_ingest", :environment => ENV['RAILS_ENV'] || 'production'
end

every 1.day do
locking_rake "avalon:batch:ingest_stalled_check", :lock_name => "batch_ingest", :environment => ENV['RAILS_ENV'] || 'production'
end
Loading