-
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.
Refactor configuration to use config gem; add OpenAM SSO
- Loading branch information
Showing
20 changed files
with
154 additions
and
181 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 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,31 @@ | ||
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController | ||
# The default OmniAuth forms don't provide CSRF tokens, so we can't verify | ||
# them. Trying to verify results in a cleared session. | ||
skip_before_action :verify_authenticity_token | ||
|
||
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength | ||
def openam | ||
@user = User.from_omniauth(request.env['omniauth.auth']) | ||
if @user.persisted? | ||
flash[:success] = I18n.t('devise.omniauth_callbacks.success') | ||
sign_in @user, event: :authentication | ||
user_session[:full_login] = true | ||
end | ||
|
||
if request['target_id'] | ||
redirect_to object_path(request['target_id']) | ||
elsif params[:url] | ||
redirect_to params[:url] | ||
elsif session[:previous_url] | ||
redirect_to session.delete :previous_url | ||
else | ||
redirect_to root_url | ||
end | ||
end | ||
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength | ||
|
||
def failure | ||
flash[:error] = I18n.t('devise.omniauth_callbacks.failure') | ||
redirect_to root_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class Users::SessionsController < Devise::SessionsController | ||
def new | ||
redirect_to user_omniauth_authorize_path(:openam) | ||
end | ||
|
||
def destroy | ||
super | ||
flash[:success] = flash[:notice] | ||
flash[:notice] = nil | ||
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.