cognito-sync-service 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +135 -35
- data/.env.example +0 -7
- data/.gitignore +0 -15
- data/.rspec +0 -3
- data/.rubocop.yml +0 -58
- data/.travis.yml +0 -7
- data/CODE_OF_CONDUCT.md +0 -74
- data/CONTRIBUTING.md +0 -1
- data/DEVELOPMENT.md +0 -4
- data/Gemfile +0 -30
- data/Gemfile.lock +0 -138
- data/LICENSE.txt +0 -21
- data/README.md +0 -68
- data/Rakefile +0 -8
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/cognito-sync-service-0.1.0.gem +0 -0
- data/cognito_sync_service.gemspec +0 -42
- data/doc/ca_create!.md +0 -37
- data/doc/ca_delete!.md +0 -23
- data/doc/ca_disable!.md +0 -23
- data/doc/ca_find!.md +0 -50
- data/doc/ca_update!.md +0 -41
- data/lib/cognito_attributes_converter.rb +0 -68
- data/lib/cognito_pools_initializer.rb +0 -17
- data/lib/cognito_provider.rb +0 -29
- data/lib/cognito_sync_service.rb +0 -46
- data/lib/cognito_sync_service/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ada4cb1326f8e0c551dd5fbf675d088ae0cc75c93a8c018e8df9efe1fe3a542d
|
4
|
+
data.tar.gz: eaa6059eafec71b0b385f1d2e0c5548f576a999045cacbae4212bbe326ba0aca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c990a5a8b21e05fa2dc1dcf5edae3199cd6fd117a799141611a7150d7d6cd64c64ec73eab328743d09432640d84351b1808f7f72e0af158f305f9c5ef59dcc6
|
7
|
+
data.tar.gz: 2a00f6e46c734347de22669ae39c3117af7763888ca822134b3756f47fb458d320f49b410a95e03e514dc35c57e0d7a0262201fd5a21f83992b05151548447d7
|
metadata
CHANGED
@@ -1,15 +1,141 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cognito-sync-service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Osipenko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: aws-sdk-cognitoidentity
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: aws-sdk-cognitoidentityprovider
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.12'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.12'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: aws-sdk-cognitosync
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.6'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: aws-sdk-ec2
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: aws-sdk-s3
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: aws-sdk-ses
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.6'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.6'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.10'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.10'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry-byebug
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.4'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.4'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry-doc
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 1.0.0
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.0.0
|
13
139
|
- !ruby/object:Gem::Dependency
|
14
140
|
name: bundler
|
15
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,47 +178,21 @@ dependencies:
|
|
52
178
|
- - "~>"
|
53
179
|
- !ruby/object:Gem::Version
|
54
180
|
version: '3.0'
|
55
|
-
description:
|
181
|
+
description: 'With this gem you can implement: CRUD functionality from you application,
|
182
|
+
synchronize you database users with user_pools, handling authorization'
|
56
183
|
email:
|
57
184
|
- mark.osipenko@gmail.com
|
58
185
|
executables: []
|
59
186
|
extensions: []
|
60
187
|
extra_rdoc_files: []
|
61
|
-
files:
|
62
|
-
|
63
|
-
- ".gitignore"
|
64
|
-
- ".rspec"
|
65
|
-
- ".rubocop.yml"
|
66
|
-
- ".travis.yml"
|
67
|
-
- CODE_OF_CONDUCT.md
|
68
|
-
- CONTRIBUTING.md
|
69
|
-
- DEVELOPMENT.md
|
70
|
-
- Gemfile
|
71
|
-
- Gemfile.lock
|
72
|
-
- LICENSE.txt
|
73
|
-
- README.md
|
74
|
-
- Rakefile
|
75
|
-
- bin/console
|
76
|
-
- bin/setup
|
77
|
-
- cognito-sync-service-0.1.0.gem
|
78
|
-
- cognito_sync_service.gemspec
|
79
|
-
- doc/ca_create!.md
|
80
|
-
- doc/ca_delete!.md
|
81
|
-
- doc/ca_disable!.md
|
82
|
-
- doc/ca_find!.md
|
83
|
-
- doc/ca_update!.md
|
84
|
-
- lib/cognito_attributes_converter.rb
|
85
|
-
- lib/cognito_pools_initializer.rb
|
86
|
-
- lib/cognito_provider.rb
|
87
|
-
- lib/cognito_sync_service.rb
|
88
|
-
- lib/cognito_sync_service/version.rb
|
89
|
-
homepage: https://github.com/MarkOsipenko/cognito-sync-service
|
188
|
+
files: []
|
189
|
+
homepage: https://github.com/7DevsApps/cognito-sync-service
|
90
190
|
licenses:
|
91
191
|
- MIT
|
92
192
|
metadata:
|
93
|
-
homepage_uri: https://github.com/
|
94
|
-
source_code_uri: https://github.com/
|
95
|
-
changelog_uri: https://github.com/
|
193
|
+
homepage_uri: https://github.com/7DevsApps/cognito-sync-service
|
194
|
+
source_code_uri: https://github.com/7DevsApps/cognito-sync-service
|
195
|
+
changelog_uri: https://github.com/7DevsApps/cognito-sync-service
|
96
196
|
post_install_message:
|
97
197
|
rdoc_options: []
|
98
198
|
require_paths:
|
data/.env.example
DELETED
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
Exclude:
|
3
|
-
- 'bin/*'
|
4
|
-
- '*.gemspec'
|
5
|
-
- 'Rakefile'
|
6
|
-
|
7
|
-
ModuleLength:
|
8
|
-
Enabled: false
|
9
|
-
|
10
|
-
LineLength:
|
11
|
-
Enabled: false
|
12
|
-
|
13
|
-
StringLiterals:
|
14
|
-
EnforcedStyle: single_quotes
|
15
|
-
Enabled: false
|
16
|
-
|
17
|
-
Layout/DotPosition:
|
18
|
-
EnforcedStyle: leading
|
19
|
-
Enabled: true
|
20
|
-
|
21
|
-
Documentation:
|
22
|
-
Enabled: false
|
23
|
-
|
24
|
-
Naming/MemoizedInstanceVariableName:
|
25
|
-
Enabled: false
|
26
|
-
|
27
|
-
Metrics/AbcSize:
|
28
|
-
Max: 40
|
29
|
-
Enabled: true
|
30
|
-
|
31
|
-
Metrics/BlockLength:
|
32
|
-
CountComments: false
|
33
|
-
Max: 300
|
34
|
-
Enabled: true
|
35
|
-
|
36
|
-
Metrics/ClassLength:
|
37
|
-
CountComments: false
|
38
|
-
Max: 320
|
39
|
-
Enabled: true
|
40
|
-
|
41
|
-
Metrics/PerceivedComplexity:
|
42
|
-
Max: 12
|
43
|
-
Enabled: true
|
44
|
-
|
45
|
-
Metrics/CyclomaticComplexity:
|
46
|
-
Max: 12
|
47
|
-
Enabled: true
|
48
|
-
|
49
|
-
Metrics/ParameterLists:
|
50
|
-
Max: 10
|
51
|
-
|
52
|
-
Metrics/MethodLength:
|
53
|
-
CountComments: false
|
54
|
-
Max: 30
|
55
|
-
Enabled: true
|
56
|
-
|
57
|
-
Naming/UncommunicativeMethodParamName:
|
58
|
-
Enabled: false
|
data/.travis.yml
DELETED
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at mark.osipenko@gmail.com. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: http://contributor-covenant.org
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
data/CONTRIBUTING.md
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
run `spec` and `rubocop`
|
data/DEVELOPMENT.md
DELETED
@@ -1,4 +0,0 @@
|
|
1
|
-
|
2
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
3
|
-
|
4
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
data/Gemfile
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source 'https://rubygems.org'
|
4
|
-
|
5
|
-
group :development, :test do
|
6
|
-
# aws
|
7
|
-
gem 'aws-sdk-cognitoidentity', '~> 1.0.0.rc7'
|
8
|
-
gem 'aws-sdk-cognitoidentityprovider', '~> 1.12'
|
9
|
-
gem 'aws-sdk-cognitosync', '~> 1.6'
|
10
|
-
gem 'aws-sdk-ec2', '~> 1'
|
11
|
-
gem 'aws-sdk-s3', '~> 1'
|
12
|
-
gem 'aws-sdk-ses', '~> 1.6'
|
13
|
-
|
14
|
-
gem 'pry', '~> 0.10', require: false
|
15
|
-
gem 'pry-byebug', '~> 3.4'
|
16
|
-
gem 'pry-doc', '~> 1.0.0', require: false
|
17
|
-
gem 'rb-readline'
|
18
|
-
|
19
|
-
gem 'factory_bot', '~> 4.8'
|
20
|
-
gem 'rspec', '~> 3.6'
|
21
|
-
gem 'rubocop', require: false
|
22
|
-
gem 'rubocop-rspec', require: false
|
23
|
-
end
|
24
|
-
|
25
|
-
group :test do
|
26
|
-
gem 'rspec-its', '~> 1.2'
|
27
|
-
gem 'rspec-simplecov', '~> 0.2'
|
28
|
-
gem 'simplecov', '~> 0.14'
|
29
|
-
gem 'simplecov-console'
|
30
|
-
end
|
data/Gemfile.lock
DELETED
@@ -1,138 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
activesupport (5.2.3)
|
5
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
|
-
i18n (>= 0.7, < 2)
|
7
|
-
minitest (~> 5.1)
|
8
|
-
tzinfo (~> 1.1)
|
9
|
-
ansi (1.5.0)
|
10
|
-
ast (2.4.0)
|
11
|
-
aws-eventstream (1.0.3)
|
12
|
-
aws-partitions (1.190.0)
|
13
|
-
aws-sdk-cognitoidentity (1.0.1)
|
14
|
-
aws-sdk-core (~> 3)
|
15
|
-
aws-sigv4 (~> 1.0)
|
16
|
-
aws-sdk-cognitoidentityprovider (1.24.0)
|
17
|
-
aws-sdk-core (~> 3, >= 3.58.0)
|
18
|
-
aws-sigv4 (~> 1.1)
|
19
|
-
aws-sdk-cognitosync (1.14.0)
|
20
|
-
aws-sdk-core (~> 3, >= 3.58.0)
|
21
|
-
aws-sigv4 (~> 1.1)
|
22
|
-
aws-sdk-core (3.59.0)
|
23
|
-
aws-eventstream (~> 1.0, >= 1.0.2)
|
24
|
-
aws-partitions (~> 1.0)
|
25
|
-
aws-sigv4 (~> 1.1)
|
26
|
-
jmespath (~> 1.0)
|
27
|
-
aws-sdk-ec2 (1.99.0)
|
28
|
-
aws-sdk-core (~> 3, >= 3.58.0)
|
29
|
-
aws-sigv4 (~> 1.1)
|
30
|
-
aws-sdk-kms (1.23.0)
|
31
|
-
aws-sdk-core (~> 3, >= 3.58.0)
|
32
|
-
aws-sigv4 (~> 1.1)
|
33
|
-
aws-sdk-s3 (1.45.0)
|
34
|
-
aws-sdk-core (~> 3, >= 3.58.0)
|
35
|
-
aws-sdk-kms (~> 1)
|
36
|
-
aws-sigv4 (~> 1.1)
|
37
|
-
aws-sdk-ses (1.24.0)
|
38
|
-
aws-sdk-core (~> 3, >= 3.58.0)
|
39
|
-
aws-sigv4 (~> 1.1)
|
40
|
-
aws-sigv4 (1.1.0)
|
41
|
-
aws-eventstream (~> 1.0, >= 1.0.2)
|
42
|
-
byebug (11.0.1)
|
43
|
-
coderay (1.1.2)
|
44
|
-
concurrent-ruby (1.1.5)
|
45
|
-
diff-lcs (1.3)
|
46
|
-
docile (1.3.2)
|
47
|
-
factory_bot (4.11.1)
|
48
|
-
activesupport (>= 3.0.0)
|
49
|
-
i18n (1.6.0)
|
50
|
-
concurrent-ruby (~> 1.0)
|
51
|
-
jaro_winkler (1.5.3)
|
52
|
-
jmespath (1.4.0)
|
53
|
-
json (2.2.0)
|
54
|
-
method_source (0.9.2)
|
55
|
-
minitest (5.11.3)
|
56
|
-
parallel (1.17.0)
|
57
|
-
parser (2.6.3.0)
|
58
|
-
ast (~> 2.4.0)
|
59
|
-
pry (0.12.2)
|
60
|
-
coderay (~> 1.1.0)
|
61
|
-
method_source (~> 0.9.0)
|
62
|
-
pry-byebug (3.7.0)
|
63
|
-
byebug (~> 11.0)
|
64
|
-
pry (~> 0.10)
|
65
|
-
pry-doc (1.0.0)
|
66
|
-
pry (~> 0.11)
|
67
|
-
yard (~> 0.9.11)
|
68
|
-
rainbow (3.0.0)
|
69
|
-
rb-readline (0.5.5)
|
70
|
-
rspec (3.8.0)
|
71
|
-
rspec-core (~> 3.8.0)
|
72
|
-
rspec-expectations (~> 3.8.0)
|
73
|
-
rspec-mocks (~> 3.8.0)
|
74
|
-
rspec-core (3.8.2)
|
75
|
-
rspec-support (~> 3.8.0)
|
76
|
-
rspec-expectations (3.8.4)
|
77
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
78
|
-
rspec-support (~> 3.8.0)
|
79
|
-
rspec-its (1.3.0)
|
80
|
-
rspec-core (>= 3.0.0)
|
81
|
-
rspec-expectations (>= 3.0.0)
|
82
|
-
rspec-mocks (3.8.1)
|
83
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
84
|
-
rspec-support (~> 3.8.0)
|
85
|
-
rspec-simplecov (0.2.2)
|
86
|
-
rspec-support (3.8.2)
|
87
|
-
rubocop (0.73.0)
|
88
|
-
jaro_winkler (~> 1.5.1)
|
89
|
-
parallel (~> 1.10)
|
90
|
-
parser (>= 2.6)
|
91
|
-
rainbow (>= 2.2.2, < 4.0)
|
92
|
-
ruby-progressbar (~> 1.7)
|
93
|
-
unicode-display_width (>= 1.4.0, < 1.7)
|
94
|
-
rubocop-rspec (1.33.0)
|
95
|
-
rubocop (>= 0.60.0)
|
96
|
-
ruby-progressbar (1.10.1)
|
97
|
-
simplecov (0.17.0)
|
98
|
-
docile (~> 1.1)
|
99
|
-
json (>= 1.8, < 3)
|
100
|
-
simplecov-html (~> 0.10.0)
|
101
|
-
simplecov-console (0.5.0)
|
102
|
-
ansi
|
103
|
-
simplecov
|
104
|
-
terminal-table
|
105
|
-
simplecov-html (0.10.2)
|
106
|
-
terminal-table (1.8.0)
|
107
|
-
unicode-display_width (~> 1.1, >= 1.1.1)
|
108
|
-
thread_safe (0.3.6)
|
109
|
-
tzinfo (1.2.5)
|
110
|
-
thread_safe (~> 0.1)
|
111
|
-
unicode-display_width (1.6.0)
|
112
|
-
yard (0.9.20)
|
113
|
-
|
114
|
-
PLATFORMS
|
115
|
-
ruby
|
116
|
-
|
117
|
-
DEPENDENCIES
|
118
|
-
aws-sdk-cognitoidentity (~> 1.0.0.rc7)
|
119
|
-
aws-sdk-cognitoidentityprovider (~> 1.12)
|
120
|
-
aws-sdk-cognitosync (~> 1.6)
|
121
|
-
aws-sdk-ec2 (~> 1)
|
122
|
-
aws-sdk-s3 (~> 1)
|
123
|
-
aws-sdk-ses (~> 1.6)
|
124
|
-
factory_bot (~> 4.8)
|
125
|
-
pry (~> 0.10)
|
126
|
-
pry-byebug (~> 3.4)
|
127
|
-
pry-doc (~> 1.0.0)
|
128
|
-
rb-readline
|
129
|
-
rspec (~> 3.6)
|
130
|
-
rspec-its (~> 1.2)
|
131
|
-
rspec-simplecov (~> 0.2)
|
132
|
-
rubocop
|
133
|
-
rubocop-rspec
|
134
|
-
simplecov (~> 0.14)
|
135
|
-
simplecov-console
|
136
|
-
|
137
|
-
BUNDLED WITH
|
138
|
-
2.0.1
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2019 Mark Osipenko
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
# CognitoSyncService
|
2
|
-
|
3
|
-
Aws Cognito user pool synchronizer
|
4
|
-
|
5
|
-
- [CognitoSyncService](#cognitoSyncService)
|
6
|
-
- [Installation](#installation)
|
7
|
-
- [Usage](#usage)
|
8
|
-
- [Development](#development)
|
9
|
-
- [Contributing](#contributing)
|
10
|
-
- [Contacts](#contacts)
|
11
|
-
- [License](#license)
|
12
|
-
- [Status](#status)
|
13
|
-
|
14
|
-
## Installation
|
15
|
-
|
16
|
-
Add this line to your application's Gemfile:
|
17
|
-
|
18
|
-
```ruby
|
19
|
-
gem 'cognito-sync-service'
|
20
|
-
```
|
21
|
-
|
22
|
-
And then execute:
|
23
|
-
|
24
|
-
$ bundle
|
25
|
-
|
26
|
-
Or install it yourself as:
|
27
|
-
|
28
|
-
$ gem install cognito-sync-service
|
29
|
-
|
30
|
-
## Usage
|
31
|
-
|
32
|
-
[AWS Cognito](https://aws.amazon.com/ru/cognito/) let use [list of methods](https://docs.aws.amazon.com/cli/latest/reference/cognito-idp/index.html) or this [SDK methods for ruby](https://docs.aws.amazon.com/sdkforruby/api/Aws/CognitoIdentity/Client.html).
|
33
|
-
|
34
|
-
In common case you need __CRUD__ functionality, __synchronization__, between you DB and Cognito pools and __handling authorization__.
|
35
|
-
|
36
|
-
#### With this gem you can implement:
|
37
|
-
1. __CRUD__ functionality from you application
|
38
|
-
2. `(WIP)` __Synchronize__ you database users with user_pools
|
39
|
-
3. `(WIP)`__Handling authorization__
|
40
|
-
*methods naming:*
|
41
|
-
|
42
|
-
`ca`_action => `cognito_admin`_action
|
43
|
-
|
44
|
-
`c`_action => `cognito`_action
|
45
|
-
|
46
|
-
## Development
|
47
|
-
|
48
|
-
See [DEVELOPMENT.md](https://github.com/MarkOsipenko/cognito-sync-service/blob/master/DEVELOPMENT.md).
|
49
|
-
|
50
|
-
## Contributing
|
51
|
-
|
52
|
-
See [CONTRIBUTING.md](https://github.com/MarkOsipenko/cognito-sync-service/blob/master/CONTRIBUTING.md).
|
53
|
-
|
54
|
-
## License
|
55
|
-
|
56
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
57
|
-
|
58
|
-
## Code of Conduct
|
59
|
-
|
60
|
-
Everyone interacting in the CognitoSyncService project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/MarkOsipenko/cognito_sync_service/blob/master/CODE_OF_CONDUCT.md).
|
61
|
-
## Contacts
|
62
|
-
|
63
|
-
https://t.me/hakmatmao
|
64
|
-
|
65
|
-
|
66
|
-
## Status
|
67
|
-
[![Maintainability](https://api.codeclimate.com/v1/badges/b90c232e049a226e25d9/maintainability)](https://codeclimate.com/github/MarkOsipenko/cognito-sync-service/maintainability)
|
68
|
-
[![Test Coverage](https://api.codeclimate.com/v1/badges/b90c232e049a226e25d9/test_coverage)](https://codeclimate.com/github/MarkOsipenko/cognito-sync-service/test_coverage)
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'bundler/setup'
|
5
|
-
require 'cognito_sync_service'
|
6
|
-
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
9
|
-
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
# require "pry"
|
12
|
-
# Pry.start
|
13
|
-
|
14
|
-
require 'irb'
|
15
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
Binary file
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
lib = File.expand_path('lib', __dir__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require 'cognito_sync_service/version'
|
6
|
-
|
7
|
-
Gem::Specification.new do |spec|
|
8
|
-
spec.name = 'cognito-sync-service'
|
9
|
-
spec.version = CognitoSyncService::VERSION
|
10
|
-
spec.authors = ['Mark Osipenko']
|
11
|
-
spec.email = ['mark.osipenko@gmail.com']
|
12
|
-
|
13
|
-
spec.summary = 'Aws Cognito user pool synchronizer'
|
14
|
-
spec.description = 'Aws Cognito user pool synchronizer'
|
15
|
-
spec.homepage = 'https://github.com/MarkOsipenko/cognito-sync-service'
|
16
|
-
spec.license = 'MIT'
|
17
|
-
|
18
|
-
# Prevent pushing this gem to RubyGems.org.
|
19
|
-
# To allow pushes either set the 'allowed_push_host'
|
20
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
21
|
-
if spec.respond_to?(:metadata)
|
22
|
-
spec.metadata['homepage_uri'] = spec.homepage
|
23
|
-
spec.metadata['source_code_uri'] = 'https://github.com/MarkOsipenko/cognito-sync-service'
|
24
|
-
spec.metadata['changelog_uri'] = 'https://github.com/MarkOsipenko/cognito-sync-service'
|
25
|
-
else
|
26
|
-
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
27
|
-
'public gem pushes.'
|
28
|
-
end
|
29
|
-
|
30
|
-
# Specify which files should be added to the gem when it is released.
|
31
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
32
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
33
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
34
|
-
end
|
35
|
-
spec.bindir = 'exe'
|
36
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
37
|
-
spec.require_paths = ['lib']
|
38
|
-
|
39
|
-
spec.add_development_dependency 'bundler', '~> 2.0'
|
40
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
41
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
42
|
-
end
|
data/doc/ca_create!.md
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# CognitoSyncService
|
2
|
-
|
3
|
-
__*#ca_create!(username)*__
|
4
|
-
|
5
|
-
> In order to create user on Cognito
|
6
|
-
> - Username should be equal __email/phone_number/random_uniq_string__ depend on you cognito user pool settings - [cognito username attribute doc](https://docs.aws.amazon.com/en_us/cognito/latest/developerguide/user-pool-settings-attributes.html#user-pool-settings-usernames)
|
7
|
-
>
|
8
|
-
> Also check this doc [admin-create-user](https://docs.aws.amazon.com/cli/latest/reference/cognito-idp/admin-create-user.html) method
|
9
|
-
|
10
|
-
## Usage
|
11
|
-
|
12
|
-
```ruby
|
13
|
-
class UserExample
|
14
|
-
extend ::CognitoSyncService
|
15
|
-
end
|
16
|
-
|
17
|
-
attrs = {
|
18
|
-
{ email: 'useremail@example.com' },
|
19
|
-
{ phone_number: '+1111111111' }
|
20
|
-
}
|
21
|
-
|
22
|
-
UserExample.ca_create!(attrs, attrs[:phone_number])
|
23
|
-
```
|
24
|
-
|
25
|
-
__Output__
|
26
|
-
|
27
|
-
```ruby
|
28
|
-
{
|
29
|
-
"username"=>"fd99f027-bebf-4f43-abf9-24829f45107f",
|
30
|
-
"user_create_date"=>2019-07-26 16:27:14 +0300,
|
31
|
-
"user_last_modified_date"=>2019-07-26 16:27:14 +0300,
|
32
|
-
"enabled"=>true,
|
33
|
-
"user_status"=>"FORCE_CHANGE_PASSWORD",
|
34
|
-
"phone_number"=>"+3333333333"
|
35
|
-
}
|
36
|
-
|
37
|
-
```
|
data/doc/ca_delete!.md
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# CognitoSyncService
|
2
|
-
|
3
|
-
__*#ca_delete!(username)*__
|
4
|
-
|
5
|
-
> Delete user from cognito pool.
|
6
|
-
>
|
7
|
-
> Also check this doc [admin-delete-user](https://docs.aws.amazon.com/cli/latest/reference/cognito-idp/admin-delete-user.html) method
|
8
|
-
|
9
|
-
## Usage
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
class UserExample
|
13
|
-
extend ::CognitoSyncService
|
14
|
-
end
|
15
|
-
|
16
|
-
UserExample.ca_delete!(username) =>
|
17
|
-
```
|
18
|
-
|
19
|
-
__Output__
|
20
|
-
|
21
|
-
```ruby
|
22
|
-
{}
|
23
|
-
```
|
data/doc/ca_disable!.md
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# CognitoSyncService
|
2
|
-
|
3
|
-
__*#ca_disable!(username)*__
|
4
|
-
|
5
|
-
> Disable user in cognito pool.
|
6
|
-
>
|
7
|
-
> Also check this doc [admin-disable-user](https://docs.aws.amazon.com/cli/latest/reference/cognito-idp/admin-disable-user.html) method
|
8
|
-
|
9
|
-
## Usage
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
class UserExample
|
13
|
-
extend ::CognitoSyncService
|
14
|
-
end
|
15
|
-
|
16
|
-
UserExample.ca_disable!(username) =>
|
17
|
-
```
|
18
|
-
|
19
|
-
__Output__
|
20
|
-
|
21
|
-
```ruby
|
22
|
-
{}
|
23
|
-
```
|
data/doc/ca_find!.md
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
# CognitoSyncService
|
2
|
-
|
3
|
-
__*#ca_find!(username)*__
|
4
|
-
|
5
|
-
> In order to find user on Cognito pool
|
6
|
-
> - Username should be equal __email/phone_number/random_uniq_string__ depend on you cognito user pool settings - [cognito username attribute doc](https://docs.aws.amazon.com/en_us/cognito/latest/developerguide/user-pool-settings-attributes.html#user-pool-settings-usernames)
|
7
|
-
|
8
|
-
Cognito return data in format with __user_attributes__ key
|
9
|
-
# cognito-idp example
|
10
|
-
```
|
11
|
-
<struct Aws::CognitoIdentityProvider::Types::AdminGetUserResponse
|
12
|
-
username="98fa7330-a5bb-4aed-a89a-17eed002f238",
|
13
|
-
user_attributes= [
|
14
|
-
#<struct Aws::CognitoIdentityProvider::Types::AttributeType name="sub", value="98fa7330-a5bb-4aed-a89a-17eed002f238">,
|
15
|
-
#<struct Aws::CognitoIdentityProvider::Types::AttributeType name="phone_number", value="+3333333333">
|
16
|
-
],
|
17
|
-
user_create_date=2019-07-29 13:06:30 +0300,
|
18
|
-
user_last_modified_date=2019-07-29 13:06:30 +0300,
|
19
|
-
enabled=true,
|
20
|
-
user_status="FORCE_CHANGE_PASSWORD",
|
21
|
-
mfa_options=nil,
|
22
|
-
preferred_mfa_setting=nil,
|
23
|
-
user_mfa_setting_list=nil>
|
24
|
-
|
25
|
-
```
|
26
|
-
>
|
27
|
-
>
|
28
|
-
> Also check this doc [admin-get-user](https://docs.aws.amazon.com/cli/latest/reference/cognito-idp/admin-get-user.html) method
|
29
|
-
|
30
|
-
## Usage
|
31
|
-
|
32
|
-
```ruby
|
33
|
-
class UserExample
|
34
|
-
extend CognitoSyncService
|
35
|
-
end
|
36
|
-
|
37
|
-
UserExample.ca_find!('+123456789')
|
38
|
-
```
|
39
|
-
|
40
|
-
__Output__
|
41
|
-
|
42
|
-
```ruby
|
43
|
-
{
|
44
|
-
"enabled"=>true,
|
45
|
-
"phone_number"=>"+123456789",
|
46
|
-
"user_create_date"=>2019-07-26 15:48:06.130000114 +0300,
|
47
|
-
"user_status"=>"FORCE_CHANGE_PASSWORD",
|
48
|
-
"username"=>"dae4900d-0984-4ac0-9ab0-14505e52d50c"
|
49
|
-
}
|
50
|
-
```
|
data/doc/ca_update!.md
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
# CognitoSyncService
|
2
|
-
|
3
|
-
__*#ca_update!(username)*__
|
4
|
-
|
5
|
-
> In order to update user on Cognito
|
6
|
-
> - Username should be equal __email/phone_number/random_uniq_string__ depend on you cognito user pool settings - [cognito username attribute doc](https://docs.aws.amazon.com/en_us/cognito/latest/developerguide/user-pool-settings-attributes.html#user-pool-settings-usernames)
|
7
|
-
>
|
8
|
-
> Also check this doc [admin-update-user-attributes](https://docs.aws.amazon.com/cli/latest/reference/cognito-idp/admin-update-user-attributes.html) method
|
9
|
-
|
10
|
-
## Usage
|
11
|
-
|
12
|
-
`Attention!!!`
|
13
|
-
changing username (alias for you login) not tested yet
|
14
|
-
|
15
|
-
```ruby
|
16
|
-
class UserExample
|
17
|
-
extend ::CognitoSyncService
|
18
|
-
end
|
19
|
-
|
20
|
-
attrs = {
|
21
|
-
{ email: 'usernewemail@example.com' },
|
22
|
-
{ phone_number: '+1111111111' }
|
23
|
-
}
|
24
|
-
|
25
|
-
UserExample.ca_update!(attrs, attrs[:phone_number])
|
26
|
-
```
|
27
|
-
|
28
|
-
__Output__
|
29
|
-
|
30
|
-
```ruby
|
31
|
-
{
|
32
|
-
"email"=>"example2@gmail.com",
|
33
|
-
"username"=>"01f29e86-f9ff-4b30-a8d6-977e07d07abb",
|
34
|
-
"user_create_date"=>2019-07-29 17:14:44 +0300,
|
35
|
-
"user_last_modified_date"=>2019-07-29 17:15:04 +0300,
|
36
|
-
"enabled"=>true,
|
37
|
-
"user_status"=>"FORCE_CHANGE_PASSWORD",
|
38
|
-
"phone_number"=>"+111111111"
|
39
|
-
}
|
40
|
-
|
41
|
-
```
|
@@ -1,68 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module CognitoAttributesConverter
|
4
|
-
def convert_to_cognito(attrs)
|
5
|
-
cognito_attrs = attrs.map { |k, v| [k, v] }.to_h
|
6
|
-
|
7
|
-
cognito_attrs.map do |k, v|
|
8
|
-
{ name: cognito_key_name(k), value: v } if cognito_key?(k) && v
|
9
|
-
end.compact
|
10
|
-
end
|
11
|
-
|
12
|
-
# name of attribute in cognito pool
|
13
|
-
def cognito_key_name(key)
|
14
|
-
return "custom:#{key}" if list_cognito_custom_attr_keys.include?(key.to_s)
|
15
|
-
|
16
|
-
key.to_s
|
17
|
-
end
|
18
|
-
|
19
|
-
def convert_from_cognito(user_struct)
|
20
|
-
cognito_attrs = user_struct.to_h
|
21
|
-
|
22
|
-
user_attributes(cognito_attrs)
|
23
|
-
end
|
24
|
-
|
25
|
-
def user_attributes(cognito_attrs)
|
26
|
-
if cognito_attrs.key?(:user_attributes)
|
27
|
-
user_attrs = cognito_attrs.delete(:user_attributes)
|
28
|
-
common_attrs = cognito_attrs
|
29
|
-
elsif cognito_attrs.key?(:attributes)
|
30
|
-
user_attrs = cognito_attrs.delete(:attributes)
|
31
|
-
common_attrs = cognito_attrs
|
32
|
-
end
|
33
|
-
|
34
|
-
list_cognito_attr_keys.map do |key|
|
35
|
-
(user_attrs.find do |a|
|
36
|
-
common_attrs[key.to_s] = a[:value] if a[:name] == cognito_key_name(key)
|
37
|
-
end)
|
38
|
-
end
|
39
|
-
|
40
|
-
Hash[common_attrs.map { |k, v| [k.to_s, v] }]
|
41
|
-
end
|
42
|
-
|
43
|
-
def cognito_key?(key)
|
44
|
-
list_cognito_attr_keys.include?(key.to_s)
|
45
|
-
end
|
46
|
-
|
47
|
-
def list_cognito_attr_keys
|
48
|
-
list_cognito_default_attr_keys + list_cognito_custom_attr_keys
|
49
|
-
end
|
50
|
-
|
51
|
-
def list_cognito_default_attr_keys
|
52
|
-
cognito_default_attr_keys.map(&:to_s)
|
53
|
-
end
|
54
|
-
|
55
|
-
def list_cognito_custom_attr_keys
|
56
|
-
cognito_custom_attr_keys.map(&:to_s)
|
57
|
-
end
|
58
|
-
|
59
|
-
# redefine this methods in you model if you want to store special attributes
|
60
|
-
def cognito_default_attr_keys
|
61
|
-
%w[email phone_number]
|
62
|
-
end
|
63
|
-
|
64
|
-
# redefine this methods in you model if you want to store special custom attributes
|
65
|
-
def cognito_custom_attr_keys
|
66
|
-
%w[]
|
67
|
-
end
|
68
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# TODO: add to credentials
|
4
|
-
# aws:
|
5
|
-
# development:
|
6
|
-
# web_pool: "web_pool_id"
|
7
|
-
# web_client_id: "web_client_id"
|
8
|
-
|
9
|
-
module CognitoPoolsInitializer
|
10
|
-
def web_pool_id(env_key = 'development')
|
11
|
-
@web_pool_id ||= ENV[env_key]['aws']['web_pool']
|
12
|
-
end
|
13
|
-
|
14
|
-
def web_client_id(env_key = 'development')
|
15
|
-
@web_client_id ||= ENV[env_key]['aws']['web_client_id']
|
16
|
-
end
|
17
|
-
end
|
data/lib/cognito_provider.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# TODO: add to credentials on ENV
|
4
|
-
# development:
|
5
|
-
# aws:
|
6
|
-
# access_key_id: "access_key_id"
|
7
|
-
# secret_access_key: "secret_access_key"
|
8
|
-
# region: "region"
|
9
|
-
|
10
|
-
require 'aws-sdk-cognitoidentityprovider'
|
11
|
-
|
12
|
-
module CognitoProvider
|
13
|
-
def cognito_provider(env_key = 'development')
|
14
|
-
::Aws::CognitoIdentityProvider::Client.new(
|
15
|
-
access_key_id: ENV[env_key]['aws']['access_key_id'],
|
16
|
-
secret_access_key: ENV[env_key]['aws']['secret_access_key'],
|
17
|
-
region: ENV[env_key]['aws']['region']
|
18
|
-
)
|
19
|
-
end
|
20
|
-
# If you store you env variables in credentials file for rails you should redefine cognito_provider like example bellow
|
21
|
-
|
22
|
-
# def cognito_provider
|
23
|
-
# ::Aws::CognitoIdentityProvider::Client.new(
|
24
|
-
# access_key_id: Rails.application.credentials.dig(:aws, :access_key_id),
|
25
|
-
# secret_access_key: Rails.application.credentials.dig(:aws, :secret_access_key),
|
26
|
-
# region: Rails.application.credentials.dig(:aws, Rails.env.to_sym, :region)
|
27
|
-
# )
|
28
|
-
# end
|
29
|
-
end
|
data/lib/cognito_sync_service.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'cognito_sync_service/version'
|
4
|
-
require 'cognito_attributes_converter.rb'
|
5
|
-
require 'cognito_pools_initializer.rb'
|
6
|
-
require 'cognito_provider.rb'
|
7
|
-
|
8
|
-
module CognitoSyncService
|
9
|
-
include ::CognitoAttributesConverter
|
10
|
-
include ::CognitoPoolsInitializer
|
11
|
-
include ::CognitoProvider
|
12
|
-
|
13
|
-
# username - can be email, phone_number or custom string depend on you cognito pool settings
|
14
|
-
# attrs - hash of user attributes which will be saved in cognito pool
|
15
|
-
# attrs = { email: 'qwe@qwe,com', phone_number: '+12......0'}
|
16
|
-
def ca_create!(attrs, username)
|
17
|
-
c_attributes = convert_to_cognito(attrs)
|
18
|
-
user = cognito_provider.admin_create_user(user_pool_id: web_pool_id, username: username, user_attributes: c_attributes).user
|
19
|
-
convert_from_cognito(user)
|
20
|
-
end
|
21
|
-
|
22
|
-
# user can be delete by email or phone_number depend on cognito pool settings
|
23
|
-
def ca_delete!(username)
|
24
|
-
cognito_provider.admin_delete_user(user_pool_id: web_pool_id, username: username)
|
25
|
-
end
|
26
|
-
|
27
|
-
# user can be find by email or phone_number depend on cognito pool settings
|
28
|
-
def ca_find!(username)
|
29
|
-
user = cognito_provider.admin_get_user(user_pool_id: web_pool_id, username: username)
|
30
|
-
convert_from_cognito(user)
|
31
|
-
end
|
32
|
-
|
33
|
-
# username - can be email, phone_number or custom string depend on you cognito pool settings
|
34
|
-
# attrs - hash of user attributes which will be saved in cognito pool
|
35
|
-
# attrs = { email: 'qwe@qwe,com', phone_number: '+12......0'}
|
36
|
-
def ca_update!(attrs, username)
|
37
|
-
c_attributes = convert_to_cognito(attrs)
|
38
|
-
cognito_provider.admin_update_user_attributes(user_pool_id: web_pool_id, username: username, user_attributes: c_attributes)
|
39
|
-
ca_find!(username)
|
40
|
-
end
|
41
|
-
|
42
|
-
# user can be disable by email or phone_number depend on cognito pool settings
|
43
|
-
def ca_disable!(username)
|
44
|
-
cognito_provider.admin_disable_user(user_pool_id: web_pool_id, username: username)
|
45
|
-
end
|
46
|
-
end
|