-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a30f5ad
commit 1c46c8f
Showing
13 changed files
with
91 additions
and
188 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 was deleted.
Oops, something went wrong.
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,32 +1,17 @@ | ||
class User < ApplicationRecord | ||
|
||
if Blacklight::Utils.needs_attr_accessible? | ||
attr_accessible :email, :password, :password_confirmation | ||
attr_accessible :username | ||
end | ||
# Connects this user object to Blacklights Bookmarks. | ||
include Blacklight::User | ||
# Include default devise modules. Others available are: | ||
# :confirmable, :lockable, :timeoutable and :omniauthable | ||
devise :database_authenticatable, :registerable, | ||
:recoverable, :rememberable, :trackable, :validatable, | ||
:omniauthable, :omniauth_providers => [:google_oauth2] | ||
# Use SAML and trackable only | ||
devise :saml_authenticatable, :trackable | ||
|
||
# Method added by Blacklight; Blacklight uses #to_s on your | ||
# user class to get a user-displayable login/identifier for | ||
# the account. | ||
def to_s | ||
username | ||
end | ||
|
||
# Find or create a user | ||
def self.from_omniauth(auth) | ||
where(provider: auth.provider, uid: auth.uid).first_or_create do |user| | ||
user.provider = auth.provider | ||
user.uid = auth.uid | ||
user.email = auth.info.email | ||
user.name = auth.info.name | ||
user.password = Devise.friendly_token[0,20] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"urn:mace:dir:attribute-def:uid": "username" |
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,21 @@ | ||
class UpdateUsersForSaml < ActiveRecord::Migration[5.1] | ||
def up | ||
drop_table :users | ||
create_table :users do |t| | ||
|
||
## SAML authenticatable | ||
t.string :username, null: false | ||
|
||
## Trackable | ||
t.integer :sign_in_count, default: 0, null: false | ||
t.datetime :current_sign_in_at | ||
t.datetime :last_sign_in_at | ||
t.string :current_sign_in_ip | ||
t.string :last_sign_in_ip | ||
end | ||
end | ||
|
||
def down | ||
raise ActiveRecord::IrreversibleMigration | ||
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
Oops, something went wrong.