artsy-auth 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/artsy-auth/config.rb +4 -4
- data/lib/artsy-auth/session_controller.rb +1 -1
- data/lib/artsy-auth/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3a31a866abd792a5c58653213d24593b9930d5e
|
4
|
+
data.tar.gz: fdcc19637bc045820e591222e195cf46ec815d6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4b2a50200544255fc2ebbf5d646286a65934baef8a2c6598ac7c0d600a1b75385c495ad9ae04d760aa3d35ffa6d8f4a8bd29b7e9829e002d0ecc0211bff0434
|
7
|
+
data.tar.gz: 392c45f7b799b6c880a22f113314912bf311145b9bf085d2723480a75efa359db2462ec45d2ae4221bc38b07d28ee4165458db916061752ad9e23982640b7641
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Artsy Authentication
|
1
|
+
# Artsy Authentication [](https://travis-ci.org/artsy/artsy-auth)
|
2
2
|
|
3
3
|
Ruby Gem for adding Artsy's omniauth based authentication to your app.
|
4
4
|
|
@@ -13,7 +13,7 @@ gem 'artsy-auth'
|
|
13
13
|
Artsy Auth is based on [`Rails::Engine`](http://api.rubyonrails.org/classes/Rails/Engine.html).
|
14
14
|
|
15
15
|
### Configure
|
16
|
-
Add `artsy_auth.rb` under `config/
|
16
|
+
Add `artsy_auth.rb` under `config/initializers`. We need to configure `ArtsyAuth` to use proper Artsy `application_id` and `application_secret`. Also it needs `artsy_url` which will be used to redirect `sign_out` to proper location.
|
17
17
|
`callback_url` defines after a successful omniauth handshake, where should we get redirected to.
|
18
18
|
|
19
19
|
```ruby
|
@@ -30,7 +30,7 @@ You also need to mount session related endpoints to your app, in your `config/ro
|
|
30
30
|
mount ArtsyAuth::Engine => '/'
|
31
31
|
```
|
32
32
|
|
33
|
-
In order to force
|
33
|
+
In order to force authentication, you need to change your `ApplicationController` to inherit from ` ArtsyAuth::ApplicationController`, you also need to add (override) `authorize?` method there which gets a token and in your app you need to define how do you authorize that token, for example:
|
34
34
|
```ruby
|
35
35
|
class ApplicationController < ArtsyAuth::ApplicationController
|
36
36
|
# Prevent CSRF attacks by raising an exception.
|
@@ -43,7 +43,7 @@ class ApplicationController < ArtsyAuth::ApplicationController
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
```
|
46
|
-
Note that this will add
|
46
|
+
Note that this will add authentication to all of your controllers, if you want to skip Artsy's authentication for specific controller you can skip it in your controller by adding:
|
47
47
|
```ruby
|
48
48
|
class TestController
|
49
49
|
skip_before_action :require_artsy_authentication
|
data/lib/artsy-auth/config.rb
CHANGED
@@ -3,8 +3,8 @@ module ArtsyAuth
|
|
3
3
|
end
|
4
4
|
|
5
5
|
ArtsyAuth.config = OpenStruct.new(
|
6
|
-
artsy_url:
|
7
|
-
callback_url:
|
8
|
-
application_id:
|
9
|
-
application_secret:
|
6
|
+
artsy_url: nil,
|
7
|
+
callback_url: '/',
|
8
|
+
application_id: nil,
|
9
|
+
application_secret: nil
|
10
10
|
)
|
@@ -5,7 +5,7 @@ module ArtsyAuth
|
|
5
5
|
session[:user_id] = auth_hash['uid']
|
6
6
|
session[:email] = auth_hash['info']['raw_info']['email']
|
7
7
|
session[:access_token] = auth_hash['credentials']['token']
|
8
|
-
redirect_to
|
8
|
+
redirect_to ArtsyAuth.config[:callback_url]
|
9
9
|
end
|
10
10
|
|
11
11
|
def destroy
|
data/lib/artsy-auth/version.rb
CHANGED