auth_passport_office 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YzVhOTgwNzM2M2FmMDhiNDY3ZWEwMjYxYjQ5YWFhYmRmMTg5ZjY2Zg==
5
+ data.tar.gz: !binary |-
6
+ NDFlOTcyYjUyZjk1OGI5MDdkOGE5ZmMzNDNiYmRmMjMxNDZkZjAzNQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MjIwYzRlNzhjYWIxNWJhYWUyYjY0MmZiMTM0ZjY1ZGRkMDBkNjc1MjkyODg0
10
+ ZThjMjIzNDhlNjg3YzhhODE2ZTdjMDBmNDI2MDllYmI2ZmFiYzc0YzgyY2Zh
11
+ YzNmMjQ4NThjNDA5YmMwZjdkMDVjYjllNzQ0ZWFlZjEyNWY4Njk=
12
+ data.tar.gz: !binary |-
13
+ YzE4YTY5MWFmODY2N2VjYTU4MjJiZWQ2NDkzMGNmNzRhYjg3OTUwMzdmNDM0
14
+ ZjI0OTY1OTgzNzkwNGZhMjgyYzYwNWE1MWExM2NhYTE0ODJlYzM2NDkzOWE5
15
+ ODg5M2VjZWIxNTdkNDJiYzc1ZTEyNWQ3OGRkNTA2MTYzZDZhODQ=
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,5 @@
1
+ = AuthPassportOffice
2
+
3
+ * See AuthOriginControl documentation (gem 'auth_origin_control')
4
+ * See Authentifyd documentation (gem 'authentifyd')
5
+ * See DoorKeeper documentation (gem 'doorkeeper')
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'AuthPassportOffice'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,4 @@
1
+ module AuthPassportOffice
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,16 @@
1
+ class AuthPassportOffice::UsersController < AuthPassportOffice::ApplicationController
2
+ doorkeeper_for :all
3
+ respond_to :json
4
+
5
+ # GET /user.json
6
+ def me
7
+ render :json => current_resource_owner
8
+ end
9
+
10
+ private
11
+
12
+ # Find the user that owns the access token
13
+ def current_resource_owner
14
+ Authentifyd::User.find(doorkeeper_token.resource_owner_id).try(:to_json) if doorkeeper_token
15
+ end
16
+ end
@@ -0,0 +1,4 @@
1
+ module AuthPassportOffice
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>AuthPassportOffice</title>
5
+ <%= stylesheet_link_tag "auth_passport_office/application", :media => "all" %>
6
+ <%= javascript_include_tag "auth_passport_office/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1 @@
1
+ AuthOriginControl.path = "/"
@@ -0,0 +1 @@
1
+ Authentifyd.path = '/auth'
@@ -0,0 +1,242 @@
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
+ # ==> ORM configuration
13
+ # Load and configure the ORM. Supports :active_record (default) and
14
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
15
+ # available as additional gems.
16
+ require 'devise/orm/active_record'
17
+
18
+ # ==> Configuration for any authentication mechanism
19
+ # Configure which keys are used when authenticating a user. The default is
20
+ # just :email. You can configure it to use [:username, :subdomain], so for
21
+ # authenticating a user, both parameters are required. Remember that those
22
+ # parameters are used only when authenticating and not when retrieving from
23
+ # session. If you need permissions, you should implement that in a before filter.
24
+ # You can also supply a hash where the value is a boolean determining whether
25
+ # or not authentication should be aborted when the value is not present.
26
+ # config.authentication_keys = [ :email ]
27
+
28
+ # Configure parameters from the request object used for authentication. Each entry
29
+ # given should be a request method and it will automatically be passed to the
30
+ # find_for_authentication method and considered in your model lookup. For instance,
31
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
32
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
33
+ # config.request_keys = []
34
+
35
+ # Configure which authentication keys should be case-insensitive.
36
+ # These keys will be downcased upon creating or modifying a user and when used
37
+ # to authenticate or find a user. Default is :email.
38
+ config.case_insensitive_keys = [ :email ]
39
+
40
+ # Configure which authentication keys should have whitespace stripped.
41
+ # These keys will have whitespace before and after removed upon creating or
42
+ # modifying a user and when used to authenticate or find a user. Default is :email.
43
+ config.strip_whitespace_keys = [ :email ]
44
+
45
+ # Tell if authentication through request.params is enabled. True by default.
46
+ # It can be set to an array that will enable params authentication only for the
47
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
48
+ # enable it only for database (email + password) authentication.
49
+ # config.params_authenticatable = true
50
+
51
+ # Tell if authentication through HTTP Basic Auth is enabled. False by default.
52
+ # It can be set to an array that will enable http authentication only for the
53
+ # given strategies, for example, `config.http_authenticatable = [:token]` will
54
+ # enable it only for token authentication.
55
+ # config.http_authenticatable = false
56
+
57
+ # If http headers should be returned for AJAX requests. True by default.
58
+ # config.http_authenticatable_on_xhr = true
59
+
60
+ # The realm used in Http Basic Authentication. "Application" by default.
61
+ # config.http_authentication_realm = "Application"
62
+
63
+ # It will change confirmation, password recovery and other workflows
64
+ # to behave the same regardless if the e-mail provided was right or wrong.
65
+ # Does not affect registerable.
66
+ # config.paranoid = true
67
+
68
+ # By default Devise will store the user in session. You can skip storage for
69
+ # :http_auth and :token_auth by adding those symbols to the array below.
70
+ # Notice that if you are skipping storage for all authentication paths, you
71
+ # may want to disable generating routes to Devise's sessions controller by
72
+ # passing :skip => :sessions to `devise_for` in your config/routes.rb
73
+ config.skip_session_storage = [:http_auth]
74
+
75
+ # ==> Configuration for :database_authenticatable
76
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
77
+ # using other encryptors, it sets how many times you want the password re-encrypted.
78
+ #
79
+ # Limiting the stretches to just one in testing will increase the performance of
80
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
81
+ # a value less than 10 in other environments.
82
+ config.stretches = Rails.env.test? ? 1 : 10
83
+
84
+ # Setup a pepper to generate the encrypted password.
85
+ config.pepper = "<%= SecureRandom.hex(64).inspect %>"
86
+
87
+ # ==> Configuration for :confirmable
88
+ # A period that the user is allowed to access the website even without
89
+ # confirming his account. For instance, if set to 2.days, the user will be
90
+ # able to access the website for two days without confirming his account,
91
+ # access will be blocked just in the third day. Default is 0.days, meaning
92
+ # the user cannot access the website without confirming his account.
93
+ # config.allow_unconfirmed_access_for = 2.days
94
+
95
+ # A period that the user is allowed to confirm their account before their
96
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
97
+ # their account within 3 days after the mail was sent, but on the fourth day
98
+ # their account can't be confirmed with the token any more.
99
+ # Default is nil, meaning there is no restriction on how long a user can take
100
+ # before confirming their account.
101
+ # config.confirm_within = 3.days
102
+
103
+ # If true, requires any email changes to be confirmed (exactly the same way as
104
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
105
+ # db field (see migrations). Until confirmed new email is stored in
106
+ # unconfirmed email column, and copied to email column on successful confirmation.
107
+ config.reconfirmable = true
108
+
109
+ # Defines which key will be used when confirming an account
110
+ # config.confirmation_keys = [ :email ]
111
+
112
+ # ==> Configuration for :rememberable
113
+ # The time the user will be remembered without asking for credentials again.
114
+ # config.remember_for = 2.weeks
115
+
116
+ # If true, extends the user's remember period when remembered via cookie.
117
+ # config.extend_remember_period = false
118
+
119
+ # Options to be passed to the created cookie. For instance, you can set
120
+ # :secure => true in order to force SSL only cookies.
121
+ # config.rememberable_options = {}
122
+
123
+ # ==> Configuration for :validatable
124
+ # Range for password length. Default is 8..128.
125
+ config.password_length = 8..128
126
+
127
+ # Email regex used to validate email formats. It simply asserts that
128
+ # one (and only one) @ exists in the given string. This is mainly
129
+ # to give user feedback and not to assert the e-mail validity.
130
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
131
+
132
+ # ==> Configuration for :timeoutable
133
+ # The time you want to timeout the user session without activity. After this
134
+ # time the user will be asked for credentials again. Default is 30 minutes.
135
+ # config.timeout_in = 30.minutes
136
+
137
+ # If true, expires auth token on session timeout.
138
+ # config.expire_auth_token_on_timeout = false
139
+
140
+ # ==> Configuration for :lockable
141
+ # Defines which strategy will be used to lock an account.
142
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
143
+ # :none = No lock strategy. You should handle locking by yourself.
144
+ # config.lock_strategy = :failed_attempts
145
+
146
+ # Defines which key will be used when locking and unlocking an account
147
+ # config.unlock_keys = [ :email ]
148
+
149
+ # Defines which strategy will be used to unlock an account.
150
+ # :email = Sends an unlock link to the user email
151
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
152
+ # :both = Enables both strategies
153
+ # :none = No unlock strategy. You should handle unlocking by yourself.
154
+ # config.unlock_strategy = :both
155
+
156
+ # Number of authentication tries before locking an account if lock_strategy
157
+ # is failed attempts.
158
+ # config.maximum_attempts = 20
159
+
160
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
161
+ # config.unlock_in = 1.hour
162
+
163
+ # ==> Configuration for :recoverable
164
+ #
165
+ # Defines which key will be used when recovering the password for an account
166
+ # config.reset_password_keys = [ :email ]
167
+
168
+ # Time interval you can reset your password with a reset password key.
169
+ # Don't put a too small interval or your users won't have the time to
170
+ # change their passwords.
171
+ config.reset_password_within = 6.hours
172
+
173
+ # ==> Configuration for :encryptable
174
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
175
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
176
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
177
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
178
+ # REST_AUTH_SITE_KEY to pepper).
179
+ #
180
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
181
+ # config.encryptor = :sha512
182
+
183
+ # ==> Configuration for :token_authenticatable
184
+ # Defines name of the authentication token params key
185
+ # config.token_authentication_key = :auth_token
186
+
187
+ # ==> Scopes configuration
188
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
189
+ # "users/sessions/new". It's turned off by default because it's slower if you
190
+ # are using only default views.
191
+ # config.scoped_views = false
192
+
193
+ # Configure the default scope given to Warden. By default it's the first
194
+ # devise role declared in your routes (usually :user).
195
+ # config.default_scope = :user
196
+
197
+ # Set this configuration to false if you want /users/sign_out to sign out
198
+ # only the current scope. By default, Devise signs out all scopes.
199
+ # config.sign_out_all_scopes = true
200
+
201
+ # ==> Navigation configuration
202
+ # Lists the formats that should be treated as navigational. Formats like
203
+ # :html, should redirect to the sign in page when the user does not have
204
+ # access, but formats like :xml or :json, should return 401.
205
+ #
206
+ # If you have any extra navigational formats, like :iphone or :mobile, you
207
+ # should add them to the navigational formats lists.
208
+ #
209
+ # The "*/*" below is required to match Internet Explorer requests.
210
+ # config.navigational_formats = ["*/*", :html]
211
+
212
+ # The default HTTP method used to sign out a resource. Default is :delete.
213
+ config.sign_out_via = :delete
214
+
215
+ # ==> OmniAuth
216
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
217
+ # up on your models and hooks.
218
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
219
+
220
+ # ==> Warden configuration
221
+ # If you want to use other strategies, that are not supported by Devise, or
222
+ # change the failure app, you can configure them inside the config.warden block.
223
+ #
224
+ # config.warden do |manager|
225
+ # manager.intercept_401 = false
226
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
227
+ # end
228
+
229
+ # ==> Mountable engine configurations
230
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
231
+ # is mountable, there are some extra configurations to be taken into account.
232
+ # The following options are available, assuming the engine is mounted as:
233
+ #
234
+ # mount MyEngine, at: "/my_engine"
235
+ #
236
+ # The router that invoked `devise_for`, in the example above, would be:
237
+ # config.router_name = :my_engine
238
+ #
239
+ # When using omniauth, Devise cannot automatically set Omniauth path,
240
+ # so you need to do it manually. For the users scope, it would be:
241
+ # config.omniauth_path_prefix = "/my_engine/users/auth"
242
+ end
@@ -0,0 +1,68 @@
1
+ Doorkeeper.configure do
2
+ # Change the ORM that doorkeeper will use.
3
+ # Currently supported options are :active_record, :mongoid2, :mongoid3, :mongo_mapper
4
+ orm :active_record
5
+
6
+ # This block will be called to check whether the resource owner is authenticated or not.
7
+ resource_owner_authenticator do
8
+ #raise "Please configure doorkeeper resource_owner_authenticator block located in #{__FILE__}"
9
+ # Put your resource owner authentication logic here.
10
+ # Example implementation:
11
+ # User.find_by_id(session[:user_id]) || redirect_to(new_user_session_url)
12
+ current_user || warden.authenticate!(:scope => :user)
13
+ end
14
+
15
+ # If you want to restrict access to the web interface for adding oauth authorized applications, you need to declare the block below.
16
+ # admin_authenticator do
17
+ # # Put your admin authentication logic here.
18
+ # # Example implementation:
19
+ # Admin.find_by_id(session[:admin_id]) || redirect_to(new_admin_session_url)
20
+ # end
21
+
22
+ # Authorization Code expiration time (default 10 minutes).
23
+ # authorization_code_expires_in 10.minutes
24
+
25
+ # Access token expiration time (default 2 hours).
26
+ # If you want to disable expiration, set this to nil.
27
+ # access_token_expires_in 2.hours
28
+
29
+ # Issue access tokens with refresh token (disabled by default)
30
+ # use_refresh_token
31
+
32
+ # Provide support for an owner to be assigned to each registered application (disabled by default)
33
+ # Optional parameter :confirmation => true (default false) if you want to enforce ownership of
34
+ # a registered application
35
+ # Note: you must also run the rails g doorkeeper:application_owner generator to provide the necessary support
36
+ # enable_application_owner :confirmation => false
37
+
38
+ # Define access token scopes for your provider
39
+ # For more information go to https://github.com/applicake/doorkeeper/wiki/Using-Scopes
40
+ # default_scopes :public
41
+ # optional_scopes :write, :update
42
+
43
+ # Change the way client credentials are retrieved from the request object.
44
+ # By default it retrieves first from the `HTTP_AUTHORIZATION` header, then
45
+ # falls back to the `:client_id` and `:client_secret` params from the `params` object.
46
+ # Check out the wiki for more information on customization
47
+ # client_credentials :from_basic, :from_params
48
+
49
+ # Change the way access token is authenticated from the request object.
50
+ # By default it retrieves first from the `HTTP_AUTHORIZATION` header, then
51
+ # falls back to the `:access_token` or `:bearer_token` params from the `params` object.
52
+ # Check out the wiki for mor information on customization
53
+ # access_token_methods :from_bearer_authorization, :from_access_token_param, :from_bearer_param
54
+
55
+ # Change the test redirect uri for client apps
56
+ # When clients register with the following redirect uri, they won't be redirected to any server and the authorization code will be displayed within the provider
57
+ # The value can be any string. Use nil to disable this feature. When disabled, clients must provide a valid URL
58
+ # (Similar behaviour: https://developers.google.com/accounts/docs/OAuth2InstalledApp#choosingredirecturi)
59
+ #
60
+ # test_redirect_uri 'urn:ietf:wg:oauth:2.0:oob'
61
+
62
+ # Under some circumstances you might want to have applications auto-approved,
63
+ # so that the user skips the authorization step.
64
+ # For example if dealing with trusted a application.
65
+ # skip_authorization do |resource_owner, client|
66
+ # SuperApp.find_by_uid(client.uid)
67
+ # end
68
+ end
@@ -0,0 +1,9 @@
1
+ AuthPassportOffice::Engine.routes.draw do
2
+ mount Authentifyd::Engine => Authentifyd.path
3
+ mount AuthOriginControl::Engine => AuthOriginControl.path
4
+ match "/user" => "users#me"
5
+
6
+ end
7
+ Rails.application.routes.draw do
8
+ use_doorkeeper
9
+ end
@@ -0,0 +1,42 @@
1
+ class CreateDoorkeeperTables < ActiveRecord::Migration
2
+ def change
3
+ create_table :oauth_applications do |t|
4
+ t.string :name, :null => false
5
+ t.string :uid, :null => false
6
+ t.string :secret, :null => false
7
+ t.string :redirect_uri, :null => false
8
+ t.timestamps
9
+ end
10
+
11
+ add_index :oauth_applications, :uid, :unique => true
12
+
13
+ create_table :oauth_access_grants do |t|
14
+ t.integer :resource_owner_id, :null => false
15
+ t.integer :application_id, :null => false
16
+ t.string :token, :null => false
17
+ t.integer :expires_in, :null => false
18
+ t.string :redirect_uri, :null => false
19
+ t.datetime :created_at, :null => false
20
+ t.datetime :revoked_at
21
+ t.string :scopes
22
+ end
23
+
24
+ add_index :oauth_access_grants, :token, :unique => true
25
+
26
+ create_table :oauth_access_tokens do |t|
27
+ t.integer :resource_owner_id
28
+ t.integer :application_id, :null => false
29
+ t.string :token, :null => false
30
+ t.string :refresh_token
31
+ t.integer :expires_in
32
+ t.datetime :revoked_at
33
+ t.datetime :created_at, :null => false
34
+ t.string :scopes
35
+ end
36
+
37
+ add_index :oauth_access_tokens, :token, :unique => true
38
+ add_index :oauth_access_tokens, :resource_owner_id
39
+ add_index :oauth_access_tokens, :refresh_token, :unique => true
40
+
41
+ end
42
+ end
@@ -0,0 +1,53 @@
1
+ # This migration comes from authentifyd (originally 20121120091659)
2
+ class CreateAuthentifydUsers < ActiveRecord::Migration
3
+ def change
4
+ create_table(:authentifyd_users) do |t|
5
+ ## Database authenticatable
6
+ t.string :email, :null => false, :default => ""
7
+ t.string :encrypted_password, :null => false, :default => ""
8
+
9
+ ## Recoverable
10
+ t.string :reset_password_token
11
+ t.datetime :reset_password_sent_at
12
+
13
+ ## Rememberable
14
+ t.datetime :remember_created_at
15
+
16
+ ## Trackable
17
+ t.integer :sign_in_count, :default => 0
18
+ t.datetime :current_sign_in_at
19
+ t.datetime :last_sign_in_at
20
+ t.string :current_sign_in_ip
21
+ t.string :last_sign_in_ip
22
+
23
+ ## Encryptable
24
+ t.string :password_salt
25
+
26
+ ## Confirmable
27
+ t.string :confirmation_token
28
+ t.datetime :confirmed_at
29
+ t.datetime :confirmation_sent_at
30
+ t.string :unconfirmed_email # Only if using reconfirmable
31
+
32
+ ## Lockable
33
+ t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
34
+ t.string :unlock_token # Only if unlock strategy is :email or :both
35
+ t.datetime :locked_at
36
+
37
+ # Token authenticatable
38
+ t.string :authentication_token
39
+
40
+ # custom
41
+ t.boolean :admin, :default => false
42
+
43
+ t.timestamps
44
+ end
45
+
46
+ add_index :authentifyd_users, :email, :unique => true
47
+ add_index :authentifyd_users, :reset_password_token, :unique => true
48
+ add_index :authentifyd_users, :confirmation_token, :unique => true
49
+ add_index :authentifyd_users, :unlock_token, :unique => true
50
+ add_index :authentifyd_users, :authentication_token, :unique => true
51
+ end
52
+
53
+ end
@@ -0,0 +1,12 @@
1
+ # This migration comes from authentifyd (originally 20121120091700)
2
+ class CreateAuthentifydAuthentications < ActiveRecord::Migration
3
+ def change
4
+ create_table :authentifyd_authentications do |t|
5
+ t.integer :user_id
6
+ t.string :provider
7
+ t.string :uid
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from authentifyd (originally 20130827085250)
2
+ class AddLanguageToUser < ActiveRecord::Migration
3
+ def change
4
+ add_column :authentifyd_users, :language, :string
5
+ end
6
+ end
@@ -0,0 +1,26 @@
1
+ require 'doorkeeper'
2
+ require 'authentifyd'
3
+
4
+ require "auth_passport_office/authentifyd_snippets/default_helpers"
5
+
6
+ require "auth_passport_office/engine"
7
+
8
+ module AuthPassportOffice
9
+ mattr_accessor :authentifyd_custom_head_snippet, :authentifyd_custom_bottom_snippet, :authentifyd_top_navbar_snippet
10
+
11
+ def self.authentifyd_custom_head_snippet
12
+ @@authentifyd_custom_head_snippet ||= AuthPassportOffice::AuthentifydSnippets::DefaultHelpers.authentifyd_custom_head_snippet
13
+ end
14
+
15
+ def self.authentifyd_custom_bottom_snippet
16
+ @@authentifyd_custom_bottom_snippet ||= AuthPassportOffice::AuthentifydSnippets::DefaultHelpers.authentifyd_custom_bottom_snippet
17
+ end
18
+
19
+ def self.authentifyd_top_navbar_snippet
20
+ @@authentifyd_top_navbar_snippet ||= AuthPassportOffice::AuthentifydSnippets::DefaultHelpers.authentifyd_top_navbar_snippet
21
+ end
22
+
23
+ def self.setup
24
+ yield self
25
+ end
26
+ end
@@ -0,0 +1,31 @@
1
+ module AuthPassportOffice
2
+ module AuthentifydSnippets
3
+ module DefaultHelpers
4
+
5
+ def self.authentifyd_custom_head_snippet
6
+ lambda{
7
+ <<eos
8
+ <title>Auth Passport Office</title>
9
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
10
+ <meta name="description" content="Auth Passport Office Login">
11
+ <meta name="author" content="NicoArbogast">
12
+ eos
13
+ }
14
+ end
15
+
16
+ def self.authentifyd_custom_bottom_snippet
17
+ lambda{
18
+ <<eos
19
+ eos
20
+ }
21
+ end
22
+
23
+ def self.authentifyd_top_navbar_snippet
24
+ lambda{
25
+ <<eos
26
+ eos
27
+ }
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,14 @@
1
+ module AuthPassportOffice
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace AuthPassportOffice
4
+
5
+ initializer "auth_passport_office.configure", :before => "authentifyd.configure" do |app|
6
+ app.config.authentifyd = {
7
+ :custom_head_snippet => AuthPassportOffice.authentifyd_custom_head_snippet,
8
+ :custom_bottom_snippet => AuthPassportOffice.authentifyd_custom_bottom_snippet,
9
+ :top_navbar_snippet => AuthPassportOffice.authentifyd_top_navbar_snippet
10
+ }
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ module AuthPassportOffice
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :auth_passport_office do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,136 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: auth_passport_office
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - NicoArbogast
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.13
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.13
27
+ - !ruby/object:Gem::Dependency
28
+ name: authentifyd
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.0.5
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.0.5
41
+ - !ruby/object:Gem::Dependency
42
+ name: doorkeeper
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.7.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.7.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: auth_origin_control
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.0.1
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 0.0.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: mysql2
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Devise + Doorkeeper + ApiAUth
84
+ email:
85
+ - nicolas@rbogast.me
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - app/assets/javascripts/auth_passport_office/application.js
91
+ - app/assets/stylesheets/auth_passport_office/application.css
92
+ - app/controllers/auth_passport_office/application_controller.rb
93
+ - app/controllers/auth_passport_office/users_controller.rb
94
+ - app/helpers/auth_passport_office/application_helper.rb
95
+ - app/views/layouts/auth_passport_office/application.html.erb
96
+ - config/initializers/auth_origin_client.rb
97
+ - config/initializers/authentifyd.rb
98
+ - config/initializers/devise.rb
99
+ - config/initializers/doorkeeper.rb
100
+ - config/routes.rb
101
+ - db/migrate/20130324233012_create_doorkeeper_tables.rb
102
+ - db/migrate/20130324233024_create_authentifyd_users.authentifyd.rb
103
+ - db/migrate/20130324233025_create_authentifyd_authentications.authentifyd.rb
104
+ - db/migrate/20130827140804_add_language_to_user.authentifyd.rb
105
+ - lib/auth_passport_office/authentifyd_snippets/default_helpers.rb
106
+ - lib/auth_passport_office/engine.rb
107
+ - lib/auth_passport_office/version.rb
108
+ - lib/auth_passport_office.rb
109
+ - lib/tasks/auth_passport_office_tasks.rake
110
+ - MIT-LICENSE
111
+ - Rakefile
112
+ - README.rdoc
113
+ homepage: https://github.com/NicoArbogast/auth_passport_office.git
114
+ licenses: []
115
+ metadata: {}
116
+ post_install_message:
117
+ rdoc_options: []
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ! '>='
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ requirements: []
131
+ rubyforge_project:
132
+ rubygems_version: 2.0.7
133
+ signing_key:
134
+ specification_version: 4
135
+ summary: Devise + Doorkeeper + ApiAUth
136
+ test_files: []