oauth_im 0.1.0.beta2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +58 -12
- data/lib/oauth_im/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cea835a658b25b83322e5bf443c18fec7df3a3382af3258a84b7d27d433a7e7b
|
4
|
+
data.tar.gz: dcf5682ded36d2d2436da87e07125f8425fdc6cf18cf0c281efedde34e781657
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ec95cfd4cecd4af9298296c615425985d0a35cdf2a22125220b5a788c7819c6beda8b3cebcb8905273fab6f48670058a5c6f5c1618866005e49b1f37110c7a9
|
7
|
+
data.tar.gz: fcc583866ca9264cd45b2ed05efeaeb36ab188e93c1f11036d010f30c59508ce632027bd8b10a79ec38966a65f34f04c6e49eabbbe2eb4ff496f47a9357785f8
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# OauthIm
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
The IIAB apps use an OAuth service provider (currently FusionAuth). This gem
|
3
|
+
serves to standardize integration with this service. The hope is that,
|
4
|
+
at some point, we can add this service to the CMS, Kamaji, and related
|
5
|
+
apps.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
Add this line to your application's Gemfile:
|
@@ -11,18 +11,64 @@ Add this line to your application's Gemfile:
|
|
11
11
|
gem 'oauth_im'
|
12
12
|
```
|
13
13
|
|
14
|
-
|
14
|
+
Then run:
|
15
15
|
```bash
|
16
16
|
$ bundle
|
17
17
|
```
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
## Configuration
|
20
|
+
Once the gem is installed, add an initializer. Here is an example:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
# config/initializers/oauth_im.rb
|
24
|
+
module OauthIm
|
25
|
+
configure do |config|
|
26
|
+
config.api_key = ENV['FUSION_AUTH_API_KEY']
|
27
|
+
config.callback_path = ENV['FUSION_CALLBACK_PATH'] || DEFAULT_CALLBACK_PATH
|
28
|
+
config.client_id = ENV['FUSION_AUTH_CLIENT_ID']
|
29
|
+
config.client_secret = ENV['FUSION_AUTH_CLIENT_SECRET']
|
30
|
+
config.domain = ENV['FUSION_AUTH_DOMAIN']
|
31
|
+
config.hmac = ENV['FUSION_AUTH_HMAC']
|
32
|
+
config.iss_domain = ENV['FUSION_AUTH_ISS_DOMAIN']
|
33
|
+
config.tenant_id = ENV['FUSION_AUTH_TENANT_ID']
|
34
|
+
config.authorize_url = ENV['FUSION_AUTH_AUTHORIZE_URL'] || DEFAULT_AUTHORIZE_URL
|
35
|
+
config.token_url = ENV['FUSION_AUTH_TOKEN_URL'] || DEFAULT_TOKEN_URL
|
36
|
+
end
|
37
|
+
end
|
22
38
|
```
|
23
39
|
|
24
|
-
|
25
|
-
|
40
|
+
* The `ENV` variable values can be obtained from the OAuth provider.
|
41
|
+
* The `callback_path` setting is used in two related ways:
|
42
|
+
* It defines a route to the `OAuthIm::ClientController#callback`
|
43
|
+
action.
|
44
|
+
* It defines a callback URL used by the OAuth provider.
|
45
|
+
* Note that this callback URL must be whitelisted at the provider.
|
46
|
+
At FusionAuth, this is done under the `Applications|OAuth` tab.
|
47
|
+
* For instance, for the app `staging-kh-iiab.herokuapp.com`, if
|
48
|
+
`config.callback_path` is set to `callback` (the default), then
|
49
|
+
the URL `https://staging-kh-iiab.herokuapp.com/oauth_im/callback`
|
50
|
+
must be entered in the OAuth provider's list of authorized
|
51
|
+
redirect URLs.
|
52
|
+
|
53
|
+
## Usage
|
54
|
+
### Helpers for Logging in and Out
|
55
|
+
The engine provides two endpoints for logging in and out, and exposes
|
56
|
+
corresponding view helpers. These are accessible from the main app as:
|
57
|
+
* `oauth_im.login_path` or `oauth_im.login_url`
|
58
|
+
* `oauth_im.logout_path` or `oauth_im.logout_url`
|
59
|
+
|
60
|
+
Note that the helpers are namespaced to the engine.
|
61
|
+
|
62
|
+
The controller actions for these routes are provided and should "just
|
63
|
+
work." Note that there are no view templates associated with these
|
64
|
+
actions, since requests to them are redirected to the OAuth provider.
|
65
|
+
|
66
|
+
### Helpers for User ID and Authentication
|
67
|
+
The gem provides a controller concern, `OauthIm::Authenticable`, that
|
68
|
+
exposes two helper methods for use in views:
|
69
|
+
* `authenticated?`: returns `true` if the user has been authenticated
|
70
|
+
by the OAuth service, false otherwise.
|
71
|
+
* `email`: returns the current user's authenticated email address.
|
26
72
|
|
27
|
-
|
28
|
-
|
73
|
+
You can include this concern in your app's `ApplicationController` or
|
74
|
+
some other appropriate location.
|
data/lib/oauth_im/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oauth_im
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Connally
|
@@ -109,9 +109,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: 2.6.6
|
110
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
111
|
requirements:
|
112
|
-
- - "
|
112
|
+
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
|
-
version:
|
114
|
+
version: '0'
|
115
115
|
requirements: []
|
116
116
|
rubygems_version: 3.0.3
|
117
117
|
signing_key:
|