opro 0.0.1.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +3 -0
- data/Gemfile +39 -0
- data/Gemfile.lock +138 -0
- data/MIT-LICENSE +20 -0
- data/README.md +90 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/app/controllers/oauth/auth_controller.rb +74 -0
- data/app/controllers/oauth/client_application_controller.rb +15 -0
- data/app/controllers/oauth/docs_controller.rb +36 -0
- data/app/controllers/opro_application_controller.rb +8 -0
- data/app/models/oauth/access_grant.rb +42 -0
- data/app/models/oauth/client_application.rb +30 -0
- data/app/views/oauth/auth/new.html.erb +8 -0
- data/app/views/oauth/client_application/create.html.erb +11 -0
- data/app/views/oauth/client_application/index.html.erb +18 -0
- data/app/views/oauth/client_application/new.html.erb +13 -0
- data/app/views/oauth/docs/index.html.erb +14 -0
- data/app/views/oauth/docs/markdown/curl.md.erb +6 -0
- data/app/views/oauth/docs/markdown/oauth.md.erb +1 -0
- data/app/views/oauth/docs/markdown/quick_start.md.erb +70 -0
- data/app/views/oauth/docs/show.html.erb +1 -0
- data/config/routes.rb +9 -0
- data/lib/generators/active_record/opro_generator.rb +28 -0
- data/lib/generators/active_record/templates/access_grants.rb +14 -0
- data/lib/generators/active_record/templates/client_applications.rb +11 -0
- data/lib/generators/opro/install_generator.rb +21 -0
- data/lib/generators/templates/opro.rb +4 -0
- data/lib/opro.rb +86 -0
- data/lib/opro/controllers/application_controller_helper.rb +38 -0
- data/lib/opro/engine.rb +8 -0
- data/opro.gemspec +148 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/pages_controller.rb +8 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/user.rb +10 -0
- data/test/dummy/app/views/layouts/application.html.erb +20 -0
- data/test/dummy/app/views/pages/index.html.erb +1 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +49 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +22 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +26 -0
- data/test/dummy/config/environments/production.rb +49 -0
- data/test/dummy/config/environments/test.rb +35 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/devise.rb +223 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/opro.rb +4 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/locales/devise.en.yml +57 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +63 -0
- data/test/dummy/db/migrate/20120408163038_devise_create_users.rb +49 -0
- data/test/dummy/db/migrate/20120408165729_create_opro_access_grants.rb +14 -0
- data/test/dummy/db/migrate/20120408165730_create_opro_client_applications.rb +11 -0
- data/test/dummy/db/schema.rb +54 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/javascripts/application.js +2 -0
- data/test/dummy/public/javascripts/controls.js +965 -0
- data/test/dummy/public/javascripts/dragdrop.js +974 -0
- data/test/dummy/public/javascripts/effects.js +1123 -0
- data/test/dummy/public/javascripts/prototype.js +6001 -0
- data/test/dummy/public/javascripts/rails.js +202 -0
- data/test/dummy/public/stylesheets/.gitkeep +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/integration/auth_controller_test.rb +23 -0
- data/test/integration/client_application_controller_test.rb +24 -0
- data/test/integration/docs_controller_test.rb +8 -0
- data/test/integration/oauth_test.rb +17 -0
- data/test/opro_test.rb +24 -0
- data/test/support/integration_case.rb +5 -0
- data/test/test_helper.rb +99 -0
- metadata +251 -0
data/lib/opro/engine.rb
ADDED
data/opro.gemspec
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "opro"
|
8
|
+
s.version = "0.0.1.pre"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["schneems"]
|
12
|
+
s.date = "2012-04-10"
|
13
|
+
s.description = " Enable oauth clients (iphone, android, web sites, etc.) to access and use your Rails application, what you do with it is up to you"
|
14
|
+
s.email = "richard.schneeman@gmail.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.md"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
"CHANGELOG.md",
|
20
|
+
"Gemfile",
|
21
|
+
"Gemfile.lock",
|
22
|
+
"MIT-LICENSE",
|
23
|
+
"README.md",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"app/controllers/oauth/auth_controller.rb",
|
27
|
+
"app/controllers/oauth/client_application_controller.rb",
|
28
|
+
"app/controllers/oauth/docs_controller.rb",
|
29
|
+
"app/controllers/opro_application_controller.rb",
|
30
|
+
"app/models/oauth/access_grant.rb",
|
31
|
+
"app/models/oauth/client_application.rb",
|
32
|
+
"app/views/oauth/auth/new.html.erb",
|
33
|
+
"app/views/oauth/client_application/create.html.erb",
|
34
|
+
"app/views/oauth/client_application/index.html.erb",
|
35
|
+
"app/views/oauth/client_application/new.html.erb",
|
36
|
+
"app/views/oauth/docs/index.html.erb",
|
37
|
+
"app/views/oauth/docs/markdown/curl.md.erb",
|
38
|
+
"app/views/oauth/docs/markdown/oauth.md.erb",
|
39
|
+
"app/views/oauth/docs/markdown/quick_start.md.erb",
|
40
|
+
"app/views/oauth/docs/show.html.erb",
|
41
|
+
"config/routes.rb",
|
42
|
+
"lib/generators/active_record/opro_generator.rb",
|
43
|
+
"lib/generators/active_record/templates/access_grants.rb",
|
44
|
+
"lib/generators/active_record/templates/client_applications.rb",
|
45
|
+
"lib/generators/opro/install_generator.rb",
|
46
|
+
"lib/generators/templates/opro.rb",
|
47
|
+
"lib/opro.rb",
|
48
|
+
"lib/opro/controllers/application_controller_helper.rb",
|
49
|
+
"lib/opro/engine.rb",
|
50
|
+
"opro.gemspec",
|
51
|
+
"test/dummy/Rakefile",
|
52
|
+
"test/dummy/app/controllers/application_controller.rb",
|
53
|
+
"test/dummy/app/controllers/pages_controller.rb",
|
54
|
+
"test/dummy/app/helpers/application_helper.rb",
|
55
|
+
"test/dummy/app/models/user.rb",
|
56
|
+
"test/dummy/app/views/layouts/application.html.erb",
|
57
|
+
"test/dummy/app/views/pages/index.html.erb",
|
58
|
+
"test/dummy/config.ru",
|
59
|
+
"test/dummy/config/application.rb",
|
60
|
+
"test/dummy/config/boot.rb",
|
61
|
+
"test/dummy/config/database.yml",
|
62
|
+
"test/dummy/config/environment.rb",
|
63
|
+
"test/dummy/config/environments/development.rb",
|
64
|
+
"test/dummy/config/environments/production.rb",
|
65
|
+
"test/dummy/config/environments/test.rb",
|
66
|
+
"test/dummy/config/initializers/backtrace_silencers.rb",
|
67
|
+
"test/dummy/config/initializers/devise.rb",
|
68
|
+
"test/dummy/config/initializers/inflections.rb",
|
69
|
+
"test/dummy/config/initializers/mime_types.rb",
|
70
|
+
"test/dummy/config/initializers/opro.rb",
|
71
|
+
"test/dummy/config/initializers/secret_token.rb",
|
72
|
+
"test/dummy/config/initializers/session_store.rb",
|
73
|
+
"test/dummy/config/locales/devise.en.yml",
|
74
|
+
"test/dummy/config/locales/en.yml",
|
75
|
+
"test/dummy/config/routes.rb",
|
76
|
+
"test/dummy/db/migrate/20120408163038_devise_create_users.rb",
|
77
|
+
"test/dummy/db/migrate/20120408165729_create_opro_access_grants.rb",
|
78
|
+
"test/dummy/db/migrate/20120408165730_create_opro_client_applications.rb",
|
79
|
+
"test/dummy/db/schema.rb",
|
80
|
+
"test/dummy/public/404.html",
|
81
|
+
"test/dummy/public/422.html",
|
82
|
+
"test/dummy/public/500.html",
|
83
|
+
"test/dummy/public/favicon.ico",
|
84
|
+
"test/dummy/public/javascripts/application.js",
|
85
|
+
"test/dummy/public/javascripts/controls.js",
|
86
|
+
"test/dummy/public/javascripts/dragdrop.js",
|
87
|
+
"test/dummy/public/javascripts/effects.js",
|
88
|
+
"test/dummy/public/javascripts/prototype.js",
|
89
|
+
"test/dummy/public/javascripts/rails.js",
|
90
|
+
"test/dummy/public/stylesheets/.gitkeep",
|
91
|
+
"test/dummy/script/rails",
|
92
|
+
"test/integration/auth_controller_test.rb",
|
93
|
+
"test/integration/client_application_controller_test.rb",
|
94
|
+
"test/integration/docs_controller_test.rb",
|
95
|
+
"test/integration/oauth_test.rb",
|
96
|
+
"test/opro_test.rb",
|
97
|
+
"test/support/integration_case.rb",
|
98
|
+
"test/test_helper.rb"
|
99
|
+
]
|
100
|
+
s.homepage = "http://github.com/schneems/opro"
|
101
|
+
s.licenses = ["MIT"]
|
102
|
+
s.require_paths = ["lib"]
|
103
|
+
s.rubygems_version = "1.8.10"
|
104
|
+
s.summary = "Opro turns your Rails application into an OAuth Provider"
|
105
|
+
|
106
|
+
if s.respond_to? :specification_version then
|
107
|
+
s.specification_version = 3
|
108
|
+
|
109
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
110
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 3.0.7"])
|
111
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.0.7"])
|
112
|
+
s.add_runtime_dependency(%q<bluecloth>, [">= 0"])
|
113
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
114
|
+
s.add_development_dependency(%q<bundler>, [">= 1.1.3"])
|
115
|
+
s.add_development_dependency(%q<capybara>, [">= 0.4.0"])
|
116
|
+
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
117
|
+
s.add_development_dependency(%q<launchy>, [">= 0"])
|
118
|
+
s.add_development_dependency(%q<devise>, [">= 0"])
|
119
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
120
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
121
|
+
else
|
122
|
+
s.add_dependency(%q<activesupport>, [">= 3.0.7"])
|
123
|
+
s.add_dependency(%q<rails>, [">= 3.0.7"])
|
124
|
+
s.add_dependency(%q<bluecloth>, [">= 0"])
|
125
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
126
|
+
s.add_dependency(%q<bundler>, [">= 1.1.3"])
|
127
|
+
s.add_dependency(%q<capybara>, [">= 0.4.0"])
|
128
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
129
|
+
s.add_dependency(%q<launchy>, [">= 0"])
|
130
|
+
s.add_dependency(%q<devise>, [">= 0"])
|
131
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
132
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
133
|
+
end
|
134
|
+
else
|
135
|
+
s.add_dependency(%q<activesupport>, [">= 3.0.7"])
|
136
|
+
s.add_dependency(%q<rails>, [">= 3.0.7"])
|
137
|
+
s.add_dependency(%q<bluecloth>, [">= 0"])
|
138
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
139
|
+
s.add_dependency(%q<bundler>, [">= 1.1.3"])
|
140
|
+
s.add_dependency(%q<capybara>, [">= 0.4.0"])
|
141
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
142
|
+
s.add_dependency(%q<launchy>, [">= 0"])
|
143
|
+
s.add_dependency(%q<devise>, [">= 0"])
|
144
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
145
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require File.expand_path('../config/application', __FILE__)
|
5
|
+
require 'rake'
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class User < ActiveRecord::Base
|
2
|
+
# Include default devise modules. Others available are:
|
3
|
+
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
|
4
|
+
devise :database_authenticatable, :registerable,
|
5
|
+
:rememberable, :trackable, :validatable
|
6
|
+
|
7
|
+
# Setup accessible (or protected) attributes for your model
|
8
|
+
attr_accessible :email, :password, :password_confirmation, :remember_me
|
9
|
+
# attr_accessible :title, :body
|
10
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag :all %>
|
6
|
+
<%= javascript_include_tag :defaults %>
|
7
|
+
<%= csrf_meta_tag %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%- if current_user -%>
|
12
|
+
User is logged in
|
13
|
+
<%- else -%>
|
14
|
+
There be NO logged in users here
|
15
|
+
<%- end -%>
|
16
|
+
<%= yield %>
|
17
|
+
|
18
|
+
|
19
|
+
</body>
|
20
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
Home
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "active_model/railtie"
|
4
|
+
require "active_record/railtie"
|
5
|
+
require "action_controller/railtie"
|
6
|
+
require "action_view/railtie"
|
7
|
+
require "action_mailer/railtie"
|
8
|
+
|
9
|
+
Bundler.require
|
10
|
+
require "opro"
|
11
|
+
|
12
|
+
|
13
|
+
require "devise"
|
14
|
+
|
15
|
+
|
16
|
+
module Dummy
|
17
|
+
class Application < Rails::Application
|
18
|
+
# Settings in config/environments/* take precedence over those specified here.
|
19
|
+
# Application configuration should go into files in config/initializers
|
20
|
+
# -- all .rb files in that directory are automatically loaded.
|
21
|
+
|
22
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
23
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
24
|
+
|
25
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
26
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
27
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
28
|
+
|
29
|
+
# Activate observers that should always be running.
|
30
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
31
|
+
|
32
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
33
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
34
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
35
|
+
|
36
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
37
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
38
|
+
# config.i18n.default_locale = :de
|
39
|
+
|
40
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
41
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
42
|
+
|
43
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
44
|
+
config.encoding = "utf-8"
|
45
|
+
|
46
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
47
|
+
config.filter_parameters += [:password]
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
development:
|
4
|
+
adapter: sqlite3
|
5
|
+
database: db/development.sqlite3
|
6
|
+
pool: 5
|
7
|
+
timeout: 5000
|
8
|
+
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
10
|
+
# re-generated from your development database when you run "rake".
|
11
|
+
# Do not set this db to the same as development or production.
|
12
|
+
test:
|
13
|
+
adapter: sqlite3
|
14
|
+
database: db/test.sqlite3
|
15
|
+
pool: 5
|
16
|
+
timeout: 5000
|
17
|
+
|
18
|
+
production:
|
19
|
+
adapter: sqlite3
|
20
|
+
database: db/production.sqlite3
|
21
|
+
pool: 5
|
22
|
+
timeout: 5000
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
# config.action_view.debug_rjs = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Don't care if the mailer can't send
|
18
|
+
config.action_mailer.raise_delivery_errors = false
|
19
|
+
|
20
|
+
# Print deprecation notices to the Rails logger
|
21
|
+
config.active_support.deprecation = :log
|
22
|
+
|
23
|
+
# Only use best-standards-support built into browsers
|
24
|
+
config.action_dispatch.best_standards_support = :builtin
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The production environment is meant for finished, "live" apps.
|
5
|
+
# Code is not reloaded between requests
|
6
|
+
config.cache_classes = true
|
7
|
+
|
8
|
+
# Full error reports are disabled and caching is turned on
|
9
|
+
config.consider_all_requests_local = false
|
10
|
+
config.action_controller.perform_caching = true
|
11
|
+
|
12
|
+
# Specifies the header that your server uses for sending files
|
13
|
+
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
14
|
+
|
15
|
+
# For nginx:
|
16
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
17
|
+
|
18
|
+
# If you have no front-end server that supports something like X-Sendfile,
|
19
|
+
# just comment this out and Rails will serve the files
|
20
|
+
|
21
|
+
# See everything in the log (default is :info)
|
22
|
+
# config.log_level = :debug
|
23
|
+
|
24
|
+
# Use a different logger for distributed setups
|
25
|
+
# config.logger = SyslogLogger.new
|
26
|
+
|
27
|
+
# Use a different cache store in production
|
28
|
+
# config.cache_store = :mem_cache_store
|
29
|
+
|
30
|
+
# Disable Rails's static asset server
|
31
|
+
# In production, Apache or nginx will already do this
|
32
|
+
config.serve_static_assets = false
|
33
|
+
|
34
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
35
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
36
|
+
|
37
|
+
# Disable delivery errors, bad email addresses will be ignored
|
38
|
+
# config.action_mailer.raise_delivery_errors = false
|
39
|
+
|
40
|
+
# Enable threaded mode
|
41
|
+
# config.threadsafe!
|
42
|
+
|
43
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
44
|
+
# the I18n.default_locale when a translation can not be found)
|
45
|
+
config.i18n.fallbacks = true
|
46
|
+
|
47
|
+
# Send deprecation notices to registered listeners
|
48
|
+
config.active_support.deprecation = :notify
|
49
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Log error messages when you accidentally call methods on nil.
|
11
|
+
config.whiny_nils = true
|
12
|
+
|
13
|
+
# Show full error reports and disable caching
|
14
|
+
config.consider_all_requests_local = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Raise exceptions instead of rendering exception templates
|
18
|
+
config.action_dispatch.show_exceptions = false
|
19
|
+
|
20
|
+
# Disable request forgery protection in test environment
|
21
|
+
config.action_controller.allow_forgery_protection = false
|
22
|
+
|
23
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
24
|
+
# The :test delivery method accumulates sent emails in the
|
25
|
+
# ActionMailer::Base.deliveries array.
|
26
|
+
config.action_mailer.delivery_method = :test
|
27
|
+
|
28
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
29
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
30
|
+
# like if you have constraints or database-specific column types
|
31
|
+
# config.active_record.schema_format = :sql
|
32
|
+
|
33
|
+
# Print deprecation notices to the stderr
|
34
|
+
config.active_support.deprecation = :stderr
|
35
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,223 @@
|
|
1
|
+
# Use this hook to configure devise mailer, warden hooks and so forth.
|
2
|
+
# Many of these configuration options can be set straight in your model.
|
3
|
+
Devise.setup do |config|
|
4
|
+
# ==> Mailer Configuration
|
5
|
+
# Configure the e-mail address which will be shown in Devise::Mailer,
|
6
|
+
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
7
|
+
config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
|
8
|
+
|
9
|
+
# Configure the class responsible to send e-mails.
|
10
|
+
# config.mailer = "Devise::Mailer"
|
11
|
+
|
12
|
+
# Automatically apply schema changes in tableless databases
|
13
|
+
config.apply_schema = false
|
14
|
+
|
15
|
+
# ==> ORM configuration
|
16
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
17
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
18
|
+
# available as additional gems.
|
19
|
+
require 'devise/orm/active_record'
|
20
|
+
|
21
|
+
# ==> Configuration for any authentication mechanism
|
22
|
+
# Configure which keys are used when authenticating a user. The default is
|
23
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
24
|
+
# authenticating a user, both parameters are required. Remember that those
|
25
|
+
# parameters are used only when authenticating and not when retrieving from
|
26
|
+
# session. If you need permissions, you should implement that in a before filter.
|
27
|
+
# You can also supply a hash where the value is a boolean determining whether
|
28
|
+
# or not authentication should be aborted when the value is not present.
|
29
|
+
# config.authentication_keys = [ :email ]
|
30
|
+
|
31
|
+
# Configure parameters from the request object used for authentication. Each entry
|
32
|
+
# given should be a request method and it will automatically be passed to the
|
33
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
34
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
35
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
36
|
+
# config.request_keys = []
|
37
|
+
|
38
|
+
# Configure which authentication keys should be case-insensitive.
|
39
|
+
# These keys will be downcased upon creating or modifying a user and when used
|
40
|
+
# to authenticate or find a user. Default is :email.
|
41
|
+
config.case_insensitive_keys = [ :email ]
|
42
|
+
|
43
|
+
# Configure which authentication keys should have whitespace stripped.
|
44
|
+
# These keys will have whitespace before and after removed upon creating or
|
45
|
+
# modifying a user and when used to authenticate or find a user. Default is :email.
|
46
|
+
config.strip_whitespace_keys = [ :email ]
|
47
|
+
|
48
|
+
# Tell if authentication through request.params is enabled. True by default.
|
49
|
+
# It can be set to an array that will enable params authentication only for the
|
50
|
+
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
51
|
+
# enable it only for database (email + password) authentication.
|
52
|
+
# config.params_authenticatable = true
|
53
|
+
|
54
|
+
# Tell if authentication through HTTP Basic Auth is enabled. False by default.
|
55
|
+
# It can be set to an array that will enable http authentication only for the
|
56
|
+
# given strategies, for example, `config.http_authenticatable = [:token]` will
|
57
|
+
# enable it only for token authentication.
|
58
|
+
# config.http_authenticatable = false
|
59
|
+
|
60
|
+
# If http headers should be returned for AJAX requests. True by default.
|
61
|
+
# config.http_authenticatable_on_xhr = true
|
62
|
+
|
63
|
+
# The realm used in Http Basic Authentication. "Application" by default.
|
64
|
+
# config.http_authentication_realm = "Application"
|
65
|
+
|
66
|
+
# It will change confirmation, password recovery and other workflows
|
67
|
+
# to behave the same regardless if the e-mail provided was right or wrong.
|
68
|
+
# Does not affect registerable.
|
69
|
+
# config.paranoid = true
|
70
|
+
|
71
|
+
# By default Devise will store the user in session. You can skip storage for
|
72
|
+
# :http_auth and :token_auth by adding those symbols to the array below.
|
73
|
+
# Notice that if you are skipping storage for all authentication paths, you
|
74
|
+
# may want to disable generating routes to Devise's sessions controller by
|
75
|
+
# passing :skip => :sessions to `devise_for` in your config/routes.rb
|
76
|
+
config.skip_session_storage = [:http_auth]
|
77
|
+
|
78
|
+
# ==> Configuration for :database_authenticatable
|
79
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
80
|
+
# using other encryptors, it sets how many times you want the password re-encrypted.
|
81
|
+
#
|
82
|
+
# Limiting the stretches to just one in testing will increase the performance of
|
83
|
+
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
84
|
+
# a value less than 10 in other environments.
|
85
|
+
config.stretches = Rails.env.test? ? 1 : 10
|
86
|
+
|
87
|
+
# Setup a pepper to generate the encrypted password.
|
88
|
+
# config.pepper = "bfb1eccd5fb5d817a646f0ac7402c050ba84106ba8c7c9f33a9e8ebb03b075b91f921e132d2fd30e4c05330ad7936656bc7e7b97ec429633bce2dfff23026b39"
|
89
|
+
|
90
|
+
# ==> Configuration for :confirmable
|
91
|
+
# A period that the user is allowed to access the website even without
|
92
|
+
# confirming his account. For instance, if set to 2.days, the user will be
|
93
|
+
# able to access the website for two days without confirming his account,
|
94
|
+
# access will be blocked just in the third day. Default is 0.days, meaning
|
95
|
+
# the user cannot access the website without confirming his account.
|
96
|
+
# config.allow_unconfirmed_access_for = 2.days
|
97
|
+
|
98
|
+
# If true, requires any email changes to be confirmed (exctly the same way as
|
99
|
+
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
100
|
+
# db field (see migrations). Until confirmed new email is stored in
|
101
|
+
# unconfirmed email column, and copied to email column on successful confirmation.
|
102
|
+
config.reconfirmable = true
|
103
|
+
|
104
|
+
# Defines which key will be used when confirming an account
|
105
|
+
# config.confirmation_keys = [ :email ]
|
106
|
+
|
107
|
+
# ==> Configuration for :rememberable
|
108
|
+
# The time the user will be remembered without asking for credentials again.
|
109
|
+
# config.remember_for = 2.weeks
|
110
|
+
|
111
|
+
# If true, extends the user's remember period when remembered via cookie.
|
112
|
+
# config.extend_remember_period = false
|
113
|
+
|
114
|
+
# If true, uses the password salt as remember token. This should be turned
|
115
|
+
# to false if you are not using database authenticatable.
|
116
|
+
config.use_salt_as_remember_token = true
|
117
|
+
|
118
|
+
# Options to be passed to the created cookie. For instance, you can set
|
119
|
+
# :secure => true in order to force SSL only cookies.
|
120
|
+
# config.cookie_options = {}
|
121
|
+
|
122
|
+
# ==> Configuration for :validatable
|
123
|
+
# Range for password length. Default is 6..128.
|
124
|
+
# config.password_length = 6..128
|
125
|
+
|
126
|
+
# Email regex used to validate email formats. It simply asserts that
|
127
|
+
# an one (and only one) @ exists in the given string. This is mainly
|
128
|
+
# to give user feedback and not to assert the e-mail validity.
|
129
|
+
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
130
|
+
|
131
|
+
# ==> Configuration for :timeoutable
|
132
|
+
# The time you want to timeout the user session without activity. After this
|
133
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
134
|
+
# config.timeout_in = 30.minutes
|
135
|
+
|
136
|
+
# ==> Configuration for :lockable
|
137
|
+
# Defines which strategy will be used to lock an account.
|
138
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
139
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
140
|
+
# config.lock_strategy = :failed_attempts
|
141
|
+
|
142
|
+
# Defines which key will be used when locking and unlocking an account
|
143
|
+
# config.unlock_keys = [ :email ]
|
144
|
+
|
145
|
+
# Defines which strategy will be used to unlock an account.
|
146
|
+
# :email = Sends an unlock link to the user email
|
147
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
148
|
+
# :both = Enables both strategies
|
149
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
150
|
+
# config.unlock_strategy = :both
|
151
|
+
|
152
|
+
# Number of authentication tries before locking an account if lock_strategy
|
153
|
+
# is failed attempts.
|
154
|
+
# config.maximum_attempts = 20
|
155
|
+
|
156
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
157
|
+
# config.unlock_in = 1.hour
|
158
|
+
|
159
|
+
# ==> Configuration for :recoverable
|
160
|
+
#
|
161
|
+
# Defines which key will be used when recovering the password for an account
|
162
|
+
# config.reset_password_keys = [ :email ]
|
163
|
+
|
164
|
+
# Time interval you can reset your password with a reset password key.
|
165
|
+
# Don't put a too small interval or your users won't have the time to
|
166
|
+
# change their passwords.
|
167
|
+
config.reset_password_within = 6.hours
|
168
|
+
|
169
|
+
# ==> Configuration for :encryptable
|
170
|
+
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
171
|
+
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
172
|
+
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
173
|
+
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
174
|
+
# REST_AUTH_SITE_KEY to pepper)
|
175
|
+
# config.encryptor = :sha512
|
176
|
+
|
177
|
+
# ==> Configuration for :token_authenticatable
|
178
|
+
# Defines name of the authentication token params key
|
179
|
+
# config.token_authentication_key = :auth_token
|
180
|
+
|
181
|
+
# ==> Scopes configuration
|
182
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
183
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
184
|
+
# are using only default views.
|
185
|
+
# config.scoped_views = false
|
186
|
+
|
187
|
+
# Configure the default scope given to Warden. By default it's the first
|
188
|
+
# devise role declared in your routes (usually :user).
|
189
|
+
# config.default_scope = :user
|
190
|
+
|
191
|
+
# Configure sign_out behavior.
|
192
|
+
# Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
|
193
|
+
# The default is true, which means any logout action will sign out all active scopes.
|
194
|
+
# config.sign_out_all_scopes = true
|
195
|
+
|
196
|
+
# ==> Navigation configuration
|
197
|
+
# Lists the formats that should be treated as navigational. Formats like
|
198
|
+
# :html, should redirect to the sign in page when the user does not have
|
199
|
+
# access, but formats like :xml or :json, should return 401.
|
200
|
+
#
|
201
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
202
|
+
# should add them to the navigational formats lists.
|
203
|
+
#
|
204
|
+
# The "*/*" below is required to match Internet Explorer requests.
|
205
|
+
# config.navigational_formats = ["*/*", :html]
|
206
|
+
|
207
|
+
# The default HTTP method used to sign out a resource. Default is :delete.
|
208
|
+
config.sign_out_via = :delete
|
209
|
+
|
210
|
+
# ==> OmniAuth
|
211
|
+
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
212
|
+
# up on your models and hooks.
|
213
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
|
214
|
+
|
215
|
+
# ==> Warden configuration
|
216
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
217
|
+
# change the failure app, you can configure them inside the config.warden block.
|
218
|
+
#
|
219
|
+
# config.warden do |manager|
|
220
|
+
# manager.intercept_401 = false
|
221
|
+
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
|
222
|
+
# end
|
223
|
+
end
|