omniauth-cognito-oauth2 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -4
- data/README.md +9 -9
- data/lib/omniauth/cognito_oauth2/version.rb +1 -1
- data/omniauth-cognito-oauth2.gemspec +2 -3
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccfc2a9eadb9415ed5bf9f8aa76b58271cad6d2cb29cb2ac890d66ef036d5c11
|
4
|
+
data.tar.gz: 199542db374d8e4a1c0d63e72019464b3466d48f1bb9a1ef3964147745124068
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2376ad15c359cba90e1761129828c4c0bad3a3faf9206154da62a00cd21796a13d59862a7b9dfb8923e2307c4981d944322a76ce816c99e28fdf8871a163e953
|
7
|
+
data.tar.gz: 2a96960e771fef29f5f55bfbfe480a02d96c2f2bc58dadf945b463af791a0bc2f125b8c28f0ce7cc2974fbb9948e74ba2e441fc1d998dc55a4835f2defb7b730
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
omniauth-cognito-oauth2 (0.1.
|
5
|
-
jwt (~> 2.2)
|
4
|
+
omniauth-cognito-oauth2 (0.1.1)
|
6
5
|
omniauth-oauth2 (~> 1.6)
|
7
6
|
|
8
7
|
GEM
|
@@ -38,7 +37,7 @@ GEM
|
|
38
37
|
pry (0.12.2)
|
39
38
|
coderay (~> 1.1.0)
|
40
39
|
method_source (~> 0.9.0)
|
41
|
-
rack (2.
|
40
|
+
rack (2.1.1)
|
42
41
|
rainbow (3.0.0)
|
43
42
|
rake (13.0.1)
|
44
43
|
rspec (3.9.0)
|
@@ -75,4 +74,4 @@ DEPENDENCIES
|
|
75
74
|
rubocop (~> 0.78)
|
76
75
|
|
77
76
|
BUNDLED WITH
|
78
|
-
2.1.
|
77
|
+
2.1.4
|
data/README.md
CHANGED
@@ -17,9 +17,9 @@ You will need:
|
|
17
17
|
|
18
18
|
- an AWS Cognito user pool
|
19
19
|
- a domain setup for your user pool
|
20
|
-
- an
|
21
|
-
-
|
22
|
-
-
|
20
|
+
- an App Client set up for your user pool, exposing at least `openid` and `email`. (Don't set up your App Client with a 'Client Secret' because at the moment they don't work and won't allow you to authenticate.)
|
21
|
+
- a config variable on your dev machine which contains your domain - something like `COGNITO_USER_POOL_DOMAIN=https://your_user_pool_domain.auth.us-west-1.amazoncognito.com` for your variable, and then `Rails.configuration.local_settings['COGNITO_USER_POOL_DOMAIN']` in your code (if using Rails of course)
|
22
|
+
- a config variable on your dev machine which contains your App Client ID - something like `COGNITO_CLIENT_ID=your_app_client_id` for your variable, and then `Rails.configuration.local_settings['COGNITO_CLIENT_ID']` in your code (if using Rails of course)
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
@@ -27,25 +27,25 @@ Here's an example for adding the middleware to a Rails app in `config/initialize
|
|
27
27
|
|
28
28
|
```ruby
|
29
29
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
30
|
-
provider :cognito_oauth2,
|
30
|
+
provider :cognito_oauth2, 'MY_COGNITO_CLIENT_ID', scope: [:openid, :email],
|
31
31
|
setup: lambda{ |env|
|
32
|
-
env['omniauth.strategy'].options[:client_options].site =
|
32
|
+
env['omniauth.strategy'].options[:client_options].site = 'MY_COGNITO_USER_POOL_DOMAIN'
|
33
33
|
}
|
34
34
|
end
|
35
35
|
```
|
36
36
|
|
37
|
-
Since Cognito has many different client sites, we are using a lambda to dynamically set the site that you wish to authenticate against. This will be the domain you have setup for your user pool.
|
37
|
+
Since Cognito has many different client sites, we are using a lambda to dynamically set the site that you wish to authenticate against. This will be the domain you have setup for your user pool. There is more info in the Authorization Code Grant section in the AWS docs [here](https://aws.amazon.com/blogs/mobile/understanding-amazon-cognito-user-pool-oauth-2-0-grants/).
|
38
38
|
|
39
39
|
You can now access the OmniAuth Cognito OAuth2 URL: `/auth/cognito_oauth2`
|
40
40
|
|
41
41
|
## Usage (Devise)
|
42
42
|
|
43
|
-
First define your
|
43
|
+
First define your client id and user pool domain in `config/initializers/devise.rb`.
|
44
44
|
|
45
45
|
```ruby
|
46
|
-
config.omniauth :cognito_oauth2,
|
46
|
+
config.omniauth :cognito_oauth2, 'MY_COGNITO_CLIENT_ID', scope: [:openid, :email],
|
47
47
|
setup: lambda{ |env|
|
48
|
-
env['omniauth.strategy'].options[:client_options].site =
|
48
|
+
env['omniauth.strategy'].options[:client_options].site = 'MY_COGNITO_USER_POOL_DOMAIN'
|
49
49
|
}
|
50
50
|
```
|
51
51
|
|
@@ -11,12 +11,12 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.authors = ['Adam Wenham']
|
12
12
|
spec.email = ['adamwenham64@gmail.com']
|
13
13
|
|
14
|
-
spec.summary = 'An Oauth2 strategy that plays well both alone and with devise, based on the google-oauth2 version'
|
14
|
+
spec.summary = 'An Oauth2 strategy for AWS Cognito that plays well both alone and with devise, based on the google-oauth2 version'
|
15
15
|
spec.homepage = 'https://gitlab.com/felixfortis/omniauth-cognito-oauth2'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
18
18
|
|
19
|
-
spec.metadata['allowed_push_host'] =
|
19
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
20
20
|
|
21
21
|
spec.metadata['homepage_uri'] = spec.homepage
|
22
22
|
spec.metadata['source_code_uri'] = spec.homepage
|
@@ -28,7 +28,6 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ['lib']
|
30
30
|
|
31
|
-
spec.add_runtime_dependency 'jwt', '~> 2.2'
|
32
31
|
spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.6'
|
33
32
|
|
34
33
|
spec.add_development_dependency 'pry', '~> 0.12'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-cognito-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Wenham
|
@@ -10,20 +10,6 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: jwt
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '2.2'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '2.2'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: omniauth-oauth2
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,6 +129,6 @@ requirements: []
|
|
143
129
|
rubygems_version: 3.0.6
|
144
130
|
signing_key:
|
145
131
|
specification_version: 4
|
146
|
-
summary: An Oauth2 strategy that plays well both alone and with devise,
|
147
|
-
google-oauth2 version
|
132
|
+
summary: An Oauth2 strategy for AWS Cognito that plays well both alone and with devise,
|
133
|
+
based on the google-oauth2 version
|
148
134
|
test_files: []
|