Implements iChain authentication

This commit is contained in:
chrisbr 2014-11-04 17:42:47 +01:00
parent 15c6ed127f
commit 49d565def2
21 changed files with 269 additions and 126 deletions

View file

@ -16,6 +16,11 @@ defaults: &defaults
speakerdeck: 'Speakerdeck',
instagram: 'Instagram' }
# If you want to use iChain to handle registration and authentication enable the next lines
authentication:
ichain:
enabled: false
development:
<<: *defaults

View file

@ -244,4 +244,35 @@ Devise.setup do |config|
# When using omniauth, Devise cannot automatically set Omniauth path,
# so you need to do it manually. For the users scope, it would be:
# config.omniauth_path_prefix = "/my_engine/users/auth"
# You will always need to set this parameter.
config.ichain_base_url = "https://my.application.org"
# Paths (relative to ichain_base_url) used by your proxy
# config.ichain_login_path = "ICSLogin/"
# config.ichain_registration_path = "ICSLogin/auth-up/"
# config.ichain_logout_path = "cmd/ICSLogout/"
# The header used by your iChain proxy to pass the username.
# config.ichain_username_header = "HTTP_X_USERNAME"
# Additional parameters, beyond the username, provided by the iChain proxy.
# HTTP_X_EMAIL is expected by default. Set to {} if no additional attributes
# are configured in the proxy.
# config.ichain_attributes_header = {:email => "HTTP_X_EMAIL"}
# Configuration options for requests sent to the iChain proxy
# config.ichain_context = "default"
# config.ichain_proxypath = "reverse"
# Activate the test mode, useful when no real iChain is present, like in
# testing and development environments
# config.ichain_test_mode = true
# In test mode, you can skip asking for the user information by always
# forcing the following username. The user will be permanently signed in.
# config.ichain_force_test_username = "testuser"
# In test mode, force the following additional attributes
# config.ichain_force_test_attributes = {:email => "testuser@example.com"}
end

View file

@ -17,7 +17,7 @@ en:
unauthenticated: 'You need to sign in or sign up before continuing.'
unconfirmed: 'You have to confirm your account before continuing.'
locked: 'Your account is locked.'
invalid: 'Invalid email or password.'
invalid: 'Invalid login or password.'
invalid_token: 'Invalid authentication token.'
timeout: 'Your session expired, please sign in again to continue.'
inactive: 'Your account was not activated yet.'

View file

@ -1,8 +1,16 @@
Osem::Application.routes.draw do
devise_for :users, controllers: { registrations: :registrations,
omniauth_callbacks: 'users/omniauth_callbacks' },
path: 'accounts'
if CONFIG['authentication']['ichain']['enabled']
devise_for :users, controllers: { registrations: :registrations }
else
devise_for :users,
controllers: {
registrations: :registrations,
omniauth_callbacks: 'users/omniauth_callbacks' },
path: 'accounts'
end
resources :users, except: [:new, :index, :create, :destroy]
namespace :admin do
resources :users