-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switched to OmniAuth for authentication.
The open_id_authentication gem is no longer used. This commit includes a migration that removes the two tables used by the open_id_authentication gem (i.e. the open_id_authentication_nonces and open_id_authentication_associations tables). Enki now supports Google OpenID Connect (OAuth 2.0 for Login) and OpenID 2.0 by default. But further OmniAuth strategies can be added if desired. Closes #97.
- Loading branch information
Showing
21 changed files
with
325 additions
and
127 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
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,10 +1,27 @@ | ||
class ApplicationController < ActionController::Base | ||
protect_from_forgery | ||
|
||
OMNIAUTH_GOOGLE_OAUTH2_STRATEGY = 'google_oauth2' | ||
OMNIAUTH_OPEN_ID_ADMIN_STRATEGY = 'open_id_admin' | ||
OMNIAUTH_OPEN_ID_COMMENT_STRATEGY = 'open_id_comment' | ||
|
||
protected | ||
|
||
def enki_config | ||
@@enki_config = Enki::Config.default | ||
end | ||
|
||
# Used for OmniAuth routing. | ||
def auth_path(provider, query_string_params = '') | ||
path = "/auth/#{provider.to_s}" | ||
|
||
if !query_string_params.blank? | ||
return path + "?#{query_string_params}" | ||
end | ||
|
||
path | ||
end | ||
|
||
helper_method :enki_config | ||
helper_method :auth_path | ||
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,5 @@ | ||
class OmniAuthDetails < ActiveRecord::Base | ||
serialize :info, Hash | ||
serialize :credentials, Hash | ||
serialize :extra, Hash | ||
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,10 +1,16 @@ | ||
<h1><%= link_to(enki_config[:title], '/') %></h1> | ||
<% if flash[:error] %><p><%= flash[:error] %></p><% end %> | ||
<%= form_tag(admin_session_path) do -%> | ||
<h2>Stop! Who are you?</h2> | ||
<p><%= text_field_tag 'openid_url' %></p> | ||
<% if allow_login_bypass? -%> | ||
<p><%= check_box_tag 'bypass_login' %> <label for="bypass_login">Bypass credentials check</label></p> | ||
<% end -%> | ||
<p><%= submit_tag("Login with OpenID") %></p> | ||
<h2>Stop! Who are you?</h2> | ||
<% if allow_login_bypass? -%> | ||
<%= form_tag(admin_session_path) do -%> | ||
<%= hidden_field_tag 'bypass_login', '1' -%> | ||
<p><%= submit_tag('Bypass credentials check') %></p> | ||
<%- end %> | ||
<%- end %> | ||
<%= form_tag(auth_path(:google_oauth2)) do -%> | ||
<p><%= submit_tag('Login with Google OpenID Connect') %></p> | ||
<% end -%> | ||
<%= form_tag(auth_path(:open_id_admin)) do -%> | ||
<p><%= text_field_tag 'openid_url', nil, placeholder: 'Enter your OpenID URL' %></p> | ||
<p><%= submit_tag('Login with OpenID') %></p> | ||
<% 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
database.yml | ||
defensio.yml | ||
google_oauth2.yml |
Oops, something went wrong.