Merge pull request #259 from differentreality/openid_documentation
Documentation about using OpenID
This commit is contained in:
commit
b1094342b5
4 changed files with 57 additions and 7 deletions
21
README.md
21
README.md
|
|
@ -45,6 +45,27 @@ http://localhost:3000
|
||||||
```
|
```
|
||||||
9. Sign up, the first user will be automatically assigned the admin role.
|
9. Sign up, the first user will be automatically assigned the admin role.
|
||||||
|
|
||||||
|
10. Use openID
|
||||||
|
In order to use the OpenID feature you need to register your application with the providers
|
||||||
|
(Google and Facebook) and enter their API keys in config/secrets.yml file, changing the existing sample values.
|
||||||
|
|
||||||
|
You can register as a devoloper with Google from https://code.google.com/apis/console#:access
|
||||||
|
You can register as a devoloper with Facebook from https://developers.facebook.com/,
|
||||||
|
by selecting from the top menu the option 'Apps' -> 'Create a New App'
|
||||||
|
|
||||||
|
Unless you add the key and secret for each provider, you will not be able to see the image that
|
||||||
|
redirects to the login page of the provider.
|
||||||
|
|
||||||
|
If you add a provider that does not require developers to register their application, you still need
|
||||||
|
to create two (2) variables, in config/secrets.yml
|
||||||
|
with the format of providername_key and providername_secret and add some sample text as their values.
|
||||||
|
Example:
|
||||||
|
myprovider_key = 'sample data'
|
||||||
|
myprovider_secret = 'sample data'
|
||||||
|
|
||||||
|
That is required so that the check in app/views/devise/shared/_openid.html.haml will pass and
|
||||||
|
the image-link to login using the provider will be shown.
|
||||||
|
|
||||||
### Run OSEM in production
|
### Run OSEM in production
|
||||||
We recommend to run OSEM in production with [mod_passenger](https://www.phusionpassenger.com/download/#open_source)
|
We recommend to run OSEM in production with [mod_passenger](https://www.phusionpassenger.com/download/#open_source)
|
||||||
and the [apache web-server](https://www.apache.org/). There are tons of guides on how to deploy rails apps on various
|
and the [apache web-server](https://www.apache.org/). There are tons of guides on how to deploy rails apps on various
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
- if devise_mapping.omniauthable?
|
- if devise_mapping.omniauthable?
|
||||||
- resource_class.omniauth_providers.each do |provider|
|
- resource_class.omniauth_providers.each do |provider|
|
||||||
= link_to image_tag("#{provider}.png", size: '32x32') + provider , omniauth_authorize_path(resource_name, provider)
|
- provider_key = "#{provider}_key"
|
||||||
%br
|
- provider_secret = "#{provider}_secret"
|
||||||
|
- unless Rails.application.secrets.send(provider_key).blank? || Rails.application.secrets.send(provider_secret).blank?
|
||||||
|
= link_to image_tag("#{provider}.png", size: '32x32') + provider , omniauth_authorize_path(resource_name, provider)
|
||||||
|
%br
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,27 @@ defaults: &defaults
|
||||||
# Your errbit API key
|
# Your errbit API key
|
||||||
# errbit_key: '12345'
|
# errbit_key: '12345'
|
||||||
|
|
||||||
|
# Leave the variables' names empty, unless you use the providers, in which case you need to
|
||||||
|
# register your applicaton and add the actual keys.
|
||||||
|
|
||||||
|
# If you add more providers, keep the format of the variables: provider_key, provider_secret
|
||||||
|
|
||||||
|
# Register your appllication with Google from https://code.google.com/apis/console#:access
|
||||||
|
google_key: ''
|
||||||
|
google_secret: ''
|
||||||
|
|
||||||
|
# Register your application with Facebook from https://developers.facebook.com/
|
||||||
|
facebook_key: ''
|
||||||
|
facebook_secret: ''
|
||||||
|
|
||||||
|
# Developers do not need to register their application for novell account to work.
|
||||||
|
# You must, however, leave the sample data there, for the login option to appear.
|
||||||
|
|
||||||
|
novell_key: 'sample data'
|
||||||
|
novell_secret: 'sample data'
|
||||||
|
|
||||||
|
# If you add more providers that do not require a key, you still have to create the 2 variables with sample data
|
||||||
|
|
||||||
development:
|
development:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,11 @@ module OmniauthMacros
|
||||||
# The mock_auth configuration allows you to set per-provider (or default)
|
# The mock_auth configuration allows you to set per-provider (or default)
|
||||||
# authentication hashes to return during integration testing.
|
# authentication hashes to return during integration testing.
|
||||||
|
|
||||||
|
Rails.application.secrets.google_key = 'test key google'
|
||||||
|
Rails.application.secrets.google_secret = 'test secret google'
|
||||||
|
Rails.application.secrets.facebook_key = 'test key facebook'
|
||||||
|
Rails.application.secrets.facebook_secret = 'test secret facebook'
|
||||||
|
|
||||||
def mock_auth_new_user
|
def mock_auth_new_user
|
||||||
OmniAuth.config.mock_auth[:google] =
|
OmniAuth.config.mock_auth[:google] =
|
||||||
OmniAuth::AuthHash.new(
|
OmniAuth::AuthHash.new(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue