artsy-auth 0.1.8 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7a2f2591b274cf4eba66d78b563365f51341cbaf
4
- data.tar.gz: 38ba2fbbfe919ef424cfa0c1f8a8b7e07d11fc8c
2
+ SHA256:
3
+ metadata.gz: 3ba60006edb2e37220a6ba341de9ac26e26e3b4bcec129775a7f08552d40627a
4
+ data.tar.gz: da6c9ececb084317e0a8745a128e1c0a24ef3c680fb79b3b086c8c1830ff6d5d
5
5
  SHA512:
6
- metadata.gz: b35055a3b5ab3b5e3de9f1a6e0454d5d45fda0977c2f117a620c0b2e057979fba571c621306117ec1215358c91dc48206a009a13a5c3a97c9e86cfca6e963088
7
- data.tar.gz: df30a0ef5f1c67da6ae1635967043770191712fc3118f2ba0ed0d6f4bd91283a911ebced4ba82912f04255579cd4f30efd03ec247457969995a0f0a504690cbb
6
+ metadata.gz: cb51d56f276740c9268942c544452e2d82f5b07781a1e471a49ae05df13366fe3095c9e6fc926bf196e1287c249af9e89f6fd27f5b86199f4d7db766a393807c
7
+ data.tar.gz: cab76d066dddfd593a6670bdc56921d744c97173728e156304bbd5f209534b055eb24791c0dfeee6f19372b5ecc738d5785674906e9926461039b5c317649ddb
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Artsy Authentication [![Build Status](https://travis-ci.org/artsy/artsy-auth.svg?branch=master)](https://travis-ci.org/artsy/artsy-auth)
1
+ # Artsy Authentication [![CircleCI](https://circleci.com/gh/artsy/artsy-auth/tree/master.svg?style=shield)](https://circleci.com/gh/artsy/artsy-auth/tree/master)
2
2
 
3
3
  Ruby Gem for adding Artsy's omniauth based authentication to your app.
4
4
 
@@ -17,7 +17,7 @@ Add `artsy_auth.rb` under `config/initializers`. We need to configure `ArtsyAuth
17
17
  `callback_url` defines after a successful omniauth handshake, where should we get redirected to.
18
18
 
19
19
  ```ruby
20
- # config/initalizers/artsy_auth.rb
20
+ # config/initializers/artsy_auth.rb
21
21
  ArtsyAuth.configure do |config|
22
22
  config.artsy_api_url = 'https://stagingapi.artsy.net' # required
23
23
  config.callback_url = '/admin' # optional
@@ -34,7 +34,7 @@ mount ArtsyAuth::Engine => '/'
34
34
 
35
35
  In order to force authentication, you need to include 'ArtsyAuth::Authenticated' in your controller, you also need to add (override) `authorized_artsy_token?` method there which gets a token and in your app you need to define how do you authorize that token, for example:
36
36
  ```ruby
37
- class ApplicationController < ArtsyAuth::ApplicationController
37
+ class ApplicationController < ActionController::Base
38
38
  # Prevent CSRF attacks by raising an exception.
39
39
  protect_from_forgery with: :exception
40
40
 
@@ -51,6 +51,13 @@ class ApplicationController < ArtsyAuth::ApplicationController
51
51
  end
52
52
  ```
53
53
 
54
+ # Decoding the JWT
55
+
56
+ The JWT is signed using a different secret from the client secret for OAuth. For Artsy engineers: get it from the `internal_secret` on your corresponding `ClientApplication` model.
57
+
58
+ The JWT contains user information that you can get from an API call to get the `me` user account, you can work around not having the secret by making a request for that against the API.
59
+
60
+
54
61
  # Update From Version < 0.1.7
55
62
  In previous versions you would change your `ApplicationController` to inherit from `ArtsyAuth::ApplicationController`, with versions > `0.1.7` you need to `include ArtsyAuth::Authenticated` like the example above.
56
63
 
@@ -0,0 +1,20 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Artsy Auth</title>
6
+ </head>
7
+ <body>
8
+ <p id="placeholder" style="visibility: hidden; text-align: center;">Authenticating...</p>
9
+ <div style="display: none;">
10
+ <%= button_to 'Log in via Artsy', '/auth/artsy', form: { id: 'artsy-auth-login-form' } %>
11
+ </div>
12
+
13
+ <script>
14
+ document.getElementById("artsy-auth-login-form").submit();
15
+ setTimeout(function() {
16
+ document.getElementById("placeholder").style.visibility = "visible";
17
+ }, 1000);
18
+ </script>
19
+ </body>
20
+ </html>
data/config/routes.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  ArtsyAuth::Engine.routes.draw do
2
2
  get '/auth/:provider/callback', to: 'sessions#create'
3
+ get '/auth/:provider/new', to: 'sessions#new'
3
4
  get '/sign_out', to: 'sessions#destroy'
4
5
  end
data/lib/artsy-auth.rb CHANGED
@@ -3,6 +3,7 @@ require 'artsy-auth/config'
3
3
  require 'artsy-auth/engine'
4
4
  require 'artsy-auth/session_controller'
5
5
  require 'artsy-auth/version'
6
+ require 'omniauth/rails_csrf_protection'
6
7
 
7
8
  module ArtsyAuth
8
9
  end
@@ -19,7 +19,7 @@ module ArtsyAuth
19
19
  def clear_session_and_reauth!
20
20
  reset_session
21
21
  session[:redirect_to] = request.url
22
- redirect_to '/auth/artsy'
22
+ redirect_to '/auth/artsy/new'
23
23
  end
24
24
 
25
25
  def authorized_artsy_token?(token)
@@ -1,5 +1,7 @@
1
1
  module ArtsyAuth
2
2
  class SessionsController < ActionController::Base
3
+ def new; end
4
+
3
5
  def create
4
6
  session[:user_id] = auth_hash['uid']
5
7
  session[:email] = auth_hash['info']['raw_info']['email']
@@ -1,3 +1,3 @@
1
1
  module ArtsyAuth
2
- VERSION = '0.1.8'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artsy-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artsy
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-07 00:00:00.000000000 Z
11
+ date: 2021-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth-artsy
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.4.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.4.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: omniauth-oauth2
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -25,19 +39,19 @@ dependencies:
25
39
  - !ruby/object:Gem::Version
26
40
  version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
- name: omniauth-artsy
42
+ name: omniauth-rails_csrf_protection
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - ">="
32
46
  - !ruby/object:Gem::Version
33
- version: 0.2.2
47
+ version: 1.0.0
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - ">="
39
53
  - !ruby/object:Gem::Version
40
- version: 0.2.2
54
+ version: 1.0.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rails
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +67,21 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: 4.2.0
55
69
  - !ruby/object:Gem::Dependency
56
- name: rspec
70
+ name: capybara
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
+ - !ruby/object:Gem::Dependency
84
+ name: guard-rubocop
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
87
  - - ">="
@@ -80,6 +108,20 @@ dependencies:
80
108
  - - ">="
81
109
  - !ruby/object:Gem::Version
82
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
83
125
  - !ruby/object:Gem::Dependency
84
126
  name: rspec-rails
85
127
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +151,21 @@ dependencies:
109
151
  - !ruby/object:Gem::Version
110
152
  version: '0'
111
153
  - !ruby/object:Gem::Dependency
112
- name: guard-rubocop
154
+ name: selenium-webdriver
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: webdrivers
113
169
  requirement: !ruby/object:Gem::Requirement
114
170
  requirements:
115
171
  - - ">="
@@ -131,6 +187,7 @@ extra_rdoc_files: []
131
187
  files:
132
188
  - README.md
133
189
  - Rakefile
190
+ - app/views/artsy_auth/sessions/new.erb
134
191
  - config/initializers/omniauth.rb
135
192
  - config/routes.rb
136
193
  - lib/artsy-auth.rb
@@ -139,10 +196,10 @@ files:
139
196
  - lib/artsy-auth/engine.rb
140
197
  - lib/artsy-auth/session_controller.rb
141
198
  - lib/artsy-auth/version.rb
142
- homepage: http://artsy.net
199
+ homepage: https://www.artsy.net
143
200
  licenses: []
144
201
  metadata: {}
145
- post_install_message:
202
+ post_install_message:
146
203
  rdoc_options: []
147
204
  require_paths:
148
205
  - lib
@@ -157,10 +214,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
214
  - !ruby/object:Gem::Version
158
215
  version: '0'
159
216
  requirements: []
160
- rubyforge_project:
161
- rubygems_version: 2.4.8
162
- signing_key:
217
+ rubygems_version: 3.2.23
218
+ signing_key:
163
219
  specification_version: 4
164
- summary: ArtsyAuth is a rails based gem that adds Artsy authentication with authorization
220
+ summary: ArtsyAuth is a Rails engine that adds Artsy authentication with authorization
165
221
  to your app.
166
222
  test_files: []