osso 0.0.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/.DS_Store +0 -0
  3. data/.buildkite/hooks/environment +9 -0
  4. data/.buildkite/hooks/pre-command +7 -0
  5. data/.buildkite/pipeline.yml +3 -0
  6. data/.buildkite/template.yml +5 -0
  7. data/.gitignore +9 -0
  8. data/.rspec +1 -0
  9. data/.rubocop.yml +82 -0
  10. data/CODE_OF_CONDUCT.md +130 -0
  11. data/Gemfile +18 -0
  12. data/Gemfile.lock +174 -0
  13. data/LICENSE +111 -0
  14. data/README.md +2 -0
  15. data/Rakefile +14 -0
  16. data/bin/console +7 -0
  17. data/bin/setup +8 -0
  18. data/config/database.yml +14 -0
  19. data/lib/.DS_Store +0 -0
  20. data/lib/osso/Rakefile +13 -0
  21. data/lib/osso/db/migrate/20190909230109_enable_uuid.rb +7 -0
  22. data/lib/osso/db/migrate/20200328135750_create_users.rb +12 -0
  23. data/lib/osso/db/migrate/20200328143303_create_oauth_tables.rb +57 -0
  24. data/lib/osso/db/migrate/20200411144528_create_saml_providers.rb +13 -0
  25. data/lib/osso/db/migrate/20200411184535_add_provider_id_to_users.rb +7 -0
  26. data/lib/osso/db/migrate/20200411192645_create_enterprise_accounts.rb +15 -0
  27. data/lib/osso/db/migrate/20200413132407_add_oauth_clients.rb +13 -0
  28. data/lib/osso/db/migrate/20200413142511_create_authorization_codes.rb +15 -0
  29. data/lib/osso/db/migrate/20200413153029_add_oauth_client_reference_to_saml_providers.rb +5 -0
  30. data/lib/osso/db/migrate/20200413163451_create_access_tokens.rb +13 -0
  31. data/lib/osso/db/migrate/20200501203026_drop_null_constraints_from_saml_provider.rb +7 -0
  32. data/lib/osso/db/migrate/20200501204047_drop_acs_url.rb +5 -0
  33. data/lib/osso/db/migrate/20200502120616_create_redirect_uris_and_drop_from_oauth_clients.rb +13 -0
  34. data/lib/osso/db/migrate/20200502135008_add_oauth_client_id_to_enterprise_account.rb +5 -0
  35. data/lib/osso/db/migrate/20200601131227_drop_null_constraint_from_saml_providers_provider.rb +7 -0
  36. data/lib/osso/db/schema.rb +132 -0
  37. data/lib/osso/helpers/auth.rb +67 -0
  38. data/lib/osso/helpers/helpers.rb +6 -0
  39. data/lib/osso/lib/app_config.rb +20 -0
  40. data/lib/osso/lib/oauth2_token.rb +38 -0
  41. data/lib/osso/models/access_token.rb +29 -0
  42. data/lib/osso/models/authorization_code.rb +14 -0
  43. data/lib/osso/models/enterprise_account.rb +28 -0
  44. data/lib/osso/models/models.rb +16 -0
  45. data/lib/osso/models/oauth_client.rb +32 -0
  46. data/lib/osso/models/redirect_uri.rb +20 -0
  47. data/lib/osso/models/saml_provider.rb +52 -0
  48. data/lib/osso/models/saml_providers/azure_saml_provider.rb +22 -0
  49. data/lib/osso/models/saml_providers/okta_saml_provider.rb +23 -0
  50. data/lib/osso/models/user.rb +24 -0
  51. data/lib/osso/rake.rb +4 -0
  52. data/lib/osso/routes/admin.rb +42 -0
  53. data/lib/osso/routes/auth.rb +64 -0
  54. data/lib/osso/routes/oauth.rb +57 -0
  55. data/lib/osso/routes/routes.rb +10 -0
  56. data/lib/osso/routes/views/error.erb +1 -0
  57. data/lib/osso/routes/views/multiple_providers.erb +1 -0
  58. data/lib/osso/version.rb +5 -0
  59. data/lib/osso.rb +9 -0
  60. data/lib/tasks/bootstrap.rake +17 -0
  61. data/osso-rb.gemspec +40 -0
  62. data/spec/factories/authorization_code.rb +10 -0
  63. data/spec/factories/enterprise_account.rb +45 -0
  64. data/spec/factories/oauth_client.rb +12 -0
  65. data/spec/factories/redirect_uri.rb +14 -0
  66. data/spec/factories/saml_providers.rb +46 -0
  67. data/spec/factories/user.rb +18 -0
  68. data/spec/models/azure_saml_provider_spec.rb +19 -0
  69. data/spec/models/okta_saml_provider_spec.rb +20 -0
  70. data/spec/models/saml_provider_spec.rb +31 -0
  71. data/spec/routes/admin_spec.rb +57 -0
  72. data/spec/routes/app_spec.rb +6 -0
  73. data/spec/routes/auth_spec.rb +112 -0
  74. data/spec/routes/oauth_spec.rb +134 -0
  75. data/spec/spec_helper.rb +65 -0
  76. data/spec/support/vcr_cassettes/okta_saml_callback.yml +59 -0
  77. metadata +302 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ceef442a19c2833e4209dc505d521efae52f9c16416841929125e6b084075a3c
4
+ data.tar.gz: 3be3b7863223c124a41d830c074b92e58c83dc8bee6795152a8f37bf7b6a68b7
5
+ SHA512:
6
+ metadata.gz: 0ce9317d0d5489baa6d4fb47f0c20f15816d120ea56708959b0fdd4dd580359ddfd46bd929b4028d77d8eef8f4d45b24fb9a95f75fe04100094b814cd6a3b56f
7
+ data.tar.gz: ba3ec1f44299d0576a2a3de1fa9e89dc331b063ffadcca5dde2e3bbf9e445d5d826f3e526f07c0870410e3c517ff7cee8af21b2ca39d721fa37a15af7efb4fa2
data/.DS_Store ADDED
Binary file
@@ -0,0 +1,9 @@
1
+ #!/bin/bash
2
+
3
+ set -eu
4
+
5
+ echo '--- RBENV'
6
+
7
+ export PATH="$HOME/.rbenv/bin:$PATH"
8
+
9
+ eval "$(rbenv init -)"
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ set -eu
4
+
5
+ export PATH="$HOME/.rbenv/bin:$PATH"
6
+
7
+ eval "$(rbenv init -)"
@@ -0,0 +1,3 @@
1
+ steps:
2
+ - name: ":rspec:"
3
+ command: "bundle install --path vendor/bundle --with development test && RACK_ENV=test bundle exec rake db:migrate && bundle exec rspec"
@@ -0,0 +1,5 @@
1
+ # Used by the 'Add to Buildkite' button in the readme
2
+ name: "Ruby rbenv Example"
3
+ steps:
4
+ - label: ":pipeline:"
5
+ command: "buildkite-agent pipeline upload"
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.gem
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,82 @@
1
+ AllCops:
2
+ Exclude:
3
+ - client/**/*
4
+ - db/**/*
5
+ - node_modules/**/*
6
+
7
+ # New rules must be explicitly opted into / out of
8
+ Lint/RaiseException:
9
+ Enabled: true
10
+ Lint/StructNewOverride:
11
+ Enabled: true
12
+ Style/HashEachMethods:
13
+ Enabled: true
14
+ Style/HashTransformKeys:
15
+ Enabled: true
16
+ Style/HashTransformValues:
17
+ Enabled: true
18
+ Layout/SpaceAroundMethodCallOperator:
19
+ Enabled: true
20
+ Style/ExponentialNotation:
21
+ Enabled: true
22
+
23
+ Style/TrailingCommaInArguments:
24
+ Description: "Checks for trailing comma in argument lists."
25
+ StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas"
26
+ EnforcedStyleForMultiline: comma
27
+ SupportedStylesForMultiline:
28
+ - comma
29
+ - consistent_comma
30
+ - no_comma
31
+ Enabled: true
32
+
33
+ Style/TrailingCommaInArrayLiteral:
34
+ Description: "Checks for trailing comma in array literals."
35
+ StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas"
36
+ EnforcedStyleForMultiline: comma
37
+ SupportedStylesForMultiline:
38
+ - comma
39
+ - consistent_comma
40
+ - no_comma
41
+ Enabled: true
42
+
43
+ Style/TrailingCommaInHashLiteral:
44
+ Description: "Checks for trailing comma in hash literals."
45
+ StyleGuide: "https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas"
46
+ EnforcedStyleForMultiline: comma
47
+ SupportedStylesForMultiline:
48
+ - comma
49
+ - consistent_comma
50
+ - no_comma
51
+ Enabled: true
52
+
53
+ Layout/MultilineMethodCallIndentation:
54
+ EnforcedStyle: indented
55
+
56
+ Layout/MultilineOperationIndentation:
57
+ EnforcedStyle: indented
58
+
59
+ Layout/ArgumentAlignment:
60
+ EnforcedStyle: with_fixed_indentation
61
+
62
+ Layout/DotPosition:
63
+ Description: "Checks the position of the dot in multi-line method calls."
64
+ StyleGuide: "https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains"
65
+ EnforcedStyle: trailing
66
+
67
+ Layout/LineLength:
68
+ Exclude:
69
+ - 'spec/**/**.*'
70
+
71
+ Metrics/BlockLength:
72
+ Exclude:
73
+ - 'spec/**/*'
74
+
75
+ Metrics/AbcSize:
76
+ Max: 20
77
+
78
+ Style/Documentation:
79
+ Enabled: false
80
+ Exclude:
81
+ - 'spec/**/*'
82
+ - 'db/**.*'
@@ -0,0 +1,130 @@
1
+
2
+ # Contributor Covenant Code of Conduct
3
+
4
+ ## Our Pledge
5
+
6
+ We as members, contributors, and leaders pledge to make participation in our
7
+ community a harassment-free experience for everyone, regardless of age, body
8
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
9
+ identity and expression, level of experience, education, socio-economic status,
10
+ nationality, personal appearance, race, religion, or sexual identity
11
+ and orientation.
12
+
13
+ We pledge to act and interact in ways that contribute to an open, welcoming,
14
+ diverse, inclusive, and healthy community.
15
+
16
+ ## Our Standards
17
+
18
+ Examples of behavior that contributes to a positive environment for our
19
+ community include:
20
+
21
+ * Demonstrating empathy and kindness toward other people
22
+ * Being respectful of differing opinions, viewpoints, and experiences
23
+ * Giving and gracefully accepting constructive feedback
24
+ * Accepting responsibility and apologizing to those affected by our mistakes,
25
+ and learning from the experience
26
+ * Focusing on what is best not just for us as individuals, but for the
27
+ overall community
28
+
29
+ Examples of unacceptable behavior include:
30
+
31
+ * The use of sexualized language or imagery, and sexual attention or
32
+ advances of any kind
33
+ * Trolling, insulting or derogatory comments, and personal or political attacks
34
+ * Public or private harassment
35
+ * Publishing others' private information, such as a physical or email
36
+ address, without their explicit permission
37
+ * Other conduct which could reasonably be considered inappropriate in a
38
+ professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our standards of
43
+ acceptable behavior and will take appropriate and fair corrective action in
44
+ response to any behavior that they deem inappropriate, threatening, offensive,
45
+ or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit, or reject
48
+ comments, commits, code, wiki edits, issues, and other contributions that are
49
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
50
+ decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces, and also applies when
55
+ an individual is officially representing the community in public spaces.
56
+ Examples of representing our community include using an official e-mail address,
57
+ posting via an official social media account, or acting as an appointed
58
+ representative at an online or offline event.
59
+
60
+ ## Enforcement
61
+
62
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
+ reported to the community leaders responsible for enforcement at
64
+ sbauch@gmail.com.
65
+ All complaints will be reviewed and investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of the
68
+ reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in determining
73
+ the consequences for any action they deem in violation of this Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact**: Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence**: A private, written warning from community leaders, providing
81
+ clarity around the nature of the violation and an explanation of why the
82
+ behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
85
+
86
+ **Community Impact**: A violation through a single incident or series
87
+ of actions.
88
+
89
+ **Consequence**: A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external channels
93
+ like social media. Violating these terms may lead to a temporary or
94
+ permanent ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact**: A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence**: A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public or
103
+ private interaction with the people involved, including unsolicited interaction
104
+ with those enforcing the Code of Conduct, is allowed during this period.
105
+ Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact**: Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence**: A permanent ban from any sort of public interaction within
114
+ the community.
115
+
116
+ ## Attribution
117
+
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.0, available at
120
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
121
+
122
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
123
+ enforcement ladder](https://github.com/mozilla/diversity).
124
+
125
+ [homepage]: https://www.contributor-covenant.org
126
+
127
+ For answers to common questions about this code of conduct, see the FAQ at
128
+ https://www.contributor-covenant.org/faq. Translations are available at
129
+ https://www.contributor-covenant.org/translations.
130
+
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ group :test do
8
+ gem 'database_cleaner-active_record'
9
+ gem 'factory_bot'
10
+ gem 'faker'
11
+ gem 'pg'
12
+ gem 'rack-test'
13
+ gem 'rspec', '~> 3.2'
14
+ gem 'rubocop'
15
+ gem 'webmock', '~> 3.0'
16
+ end
17
+
18
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,174 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ osso (0.0.2.8)
5
+ activesupport (>= 6.0.3.2)
6
+ jwt
7
+ omniauth-multi-provider
8
+ omniauth-saml
9
+ rack (>= 2.1.4)
10
+ rack-contrib
11
+ rack-oauth2
12
+ rake
13
+ sinatra
14
+ sinatra-activerecord
15
+ sinatra-contrib
16
+
17
+ GEM
18
+ remote: https://rubygems.org/
19
+ specs:
20
+ activemodel (6.0.3.2)
21
+ activesupport (= 6.0.3.2)
22
+ activerecord (6.0.3.2)
23
+ activemodel (= 6.0.3.2)
24
+ activesupport (= 6.0.3.2)
25
+ activesupport (6.0.3.2)
26
+ concurrent-ruby (~> 1.0, >= 1.0.2)
27
+ i18n (>= 0.7, < 2)
28
+ minitest (~> 5.1)
29
+ tzinfo (~> 1.1)
30
+ zeitwerk (~> 2.2, >= 2.2.2)
31
+ addressable (2.7.0)
32
+ public_suffix (>= 2.0.2, < 5.0)
33
+ aes_key_wrap (1.0.1)
34
+ ast (2.4.1)
35
+ attr_required (1.0.1)
36
+ backports (3.18.1)
37
+ bindata (2.4.7)
38
+ coderay (1.1.3)
39
+ concurrent-ruby (1.1.6)
40
+ crack (0.4.3)
41
+ safe_yaml (~> 1.0.0)
42
+ database_cleaner (1.8.5)
43
+ database_cleaner-active_record (1.8.0)
44
+ activerecord
45
+ database_cleaner (~> 1.8.0)
46
+ diff-lcs (1.4.4)
47
+ factory_bot (6.0.2)
48
+ activesupport (>= 5.0.0)
49
+ faker (2.13.0)
50
+ i18n (>= 1.6, < 2)
51
+ hashdiff (1.0.1)
52
+ hashie (4.1.0)
53
+ httpclient (2.8.3)
54
+ i18n (1.8.3)
55
+ concurrent-ruby (~> 1.0)
56
+ json-jwt (1.13.0)
57
+ activesupport (>= 4.2)
58
+ aes_key_wrap
59
+ bindata
60
+ jwt (2.2.1)
61
+ method_source (1.0.0)
62
+ mini_portile2 (2.4.0)
63
+ minitest (5.14.1)
64
+ multi_json (1.14.1)
65
+ mustermann (1.1.1)
66
+ ruby2_keywords (~> 0.0.1)
67
+ nokogiri (1.10.9)
68
+ mini_portile2 (~> 2.4.0)
69
+ omniauth (1.9.1)
70
+ hashie (>= 3.4.6)
71
+ rack (>= 1.6.2, < 3)
72
+ omniauth-multi-provider (0.2.1)
73
+ omniauth
74
+ omniauth-saml (1.10.1)
75
+ omniauth (~> 1.3, >= 1.3.2)
76
+ ruby-saml (~> 1.7)
77
+ parallel (1.19.2)
78
+ parser (2.7.1.4)
79
+ ast (~> 2.4.1)
80
+ pg (1.2.3)
81
+ pry (0.13.1)
82
+ coderay (~> 1.1)
83
+ method_source (~> 1.0)
84
+ public_suffix (4.0.5)
85
+ rack (2.2.3)
86
+ rack-contrib (2.2.0)
87
+ rack (~> 2.0)
88
+ rack-oauth2 (1.14.0)
89
+ activesupport
90
+ attr_required
91
+ httpclient
92
+ json-jwt (>= 1.11.0)
93
+ rack (>= 2.1.0)
94
+ rack-protection (2.0.8.1)
95
+ rack
96
+ rack-test (1.1.0)
97
+ rack (>= 1.0, < 3)
98
+ rainbow (3.0.0)
99
+ rake (13.0.1)
100
+ regexp_parser (1.7.1)
101
+ rexml (3.2.4)
102
+ rspec (3.9.0)
103
+ rspec-core (~> 3.9.0)
104
+ rspec-expectations (~> 3.9.0)
105
+ rspec-mocks (~> 3.9.0)
106
+ rspec-core (3.9.2)
107
+ rspec-support (~> 3.9.3)
108
+ rspec-expectations (3.9.2)
109
+ diff-lcs (>= 1.2.0, < 2.0)
110
+ rspec-support (~> 3.9.0)
111
+ rspec-mocks (3.9.1)
112
+ diff-lcs (>= 1.2.0, < 2.0)
113
+ rspec-support (~> 3.9.0)
114
+ rspec-support (3.9.3)
115
+ rubocop (0.86.0)
116
+ parallel (~> 1.10)
117
+ parser (>= 2.7.0.1)
118
+ rainbow (>= 2.2.2, < 4.0)
119
+ regexp_parser (>= 1.7)
120
+ rexml
121
+ rubocop-ast (>= 0.0.3, < 1.0)
122
+ ruby-progressbar (~> 1.7)
123
+ unicode-display_width (>= 1.4.0, < 2.0)
124
+ rubocop-ast (0.1.0)
125
+ parser (>= 2.7.0.1)
126
+ ruby-progressbar (1.10.1)
127
+ ruby-saml (1.11.0)
128
+ nokogiri (>= 1.5.10)
129
+ ruby2_keywords (0.0.2)
130
+ safe_yaml (1.0.5)
131
+ sinatra (2.0.8.1)
132
+ mustermann (~> 1.0)
133
+ rack (~> 2.0)
134
+ rack-protection (= 2.0.8.1)
135
+ tilt (~> 2.0)
136
+ sinatra-activerecord (2.0.18)
137
+ activerecord (>= 4.1)
138
+ sinatra (>= 1.0)
139
+ sinatra-contrib (2.0.8.1)
140
+ backports (>= 2.8.2)
141
+ multi_json
142
+ mustermann (~> 1.0)
143
+ rack-protection (= 2.0.8.1)
144
+ sinatra (= 2.0.8.1)
145
+ tilt (~> 2.0)
146
+ thread_safe (0.3.6)
147
+ tilt (2.0.10)
148
+ tzinfo (1.2.7)
149
+ thread_safe (~> 0.1)
150
+ unicode-display_width (1.7.0)
151
+ webmock (3.8.3)
152
+ addressable (>= 2.3.6)
153
+ crack (>= 0.3.2)
154
+ hashdiff (>= 0.4.0, < 2.0.0)
155
+ zeitwerk (2.3.1)
156
+
157
+ PLATFORMS
158
+ ruby
159
+
160
+ DEPENDENCIES
161
+ bundler (~> 2.1)
162
+ database_cleaner-active_record
163
+ factory_bot
164
+ faker
165
+ osso!
166
+ pg
167
+ pry
168
+ rack-test
169
+ rspec (~> 3.2)
170
+ rubocop
171
+ webmock (~> 3.0)
172
+
173
+ BUNDLED WITH
174
+ 2.1.4
data/LICENSE ADDED
@@ -0,0 +1,111 @@
1
+ Business Source License 1.1
2
+
3
+ Parameters
4
+
5
+ Licensor: Samuel Bauch
6
+ Licensed Work: osso-rb
7
+ The Licensed Work is (c) 2020 Samuel Bauch.
8
+ Additional Use Grant: You may make use of the Licensed Work, provided that you do
9
+ not use the Licensed Work in a Single Sign On Management
10
+ Service.
11
+
12
+ A "Single Sign On Management Service" is an offering
13
+ (be it free or commercial) that uses the Licensed Work
14
+ to allow third parties (other than your employees and
15
+ contractors) to access the functionality of the
16
+ Licensed Work such that any fourth parties directly
17
+ benefit from the authentication, configuration, or
18
+ documentation features of the Licensed Work.
19
+
20
+ You thus may only use the Licensed Work in a manner
21
+ whereby parties who directly benefit from the
22
+ authentication, configuration, or documentation features
23
+ of the Licensed Work are yourself, your employees or
24
+ contractors, and your customers or partners.
25
+
26
+ Change Date: 2023-05-01
27
+
28
+ Change License: Apache License, Version 2.0
29
+
30
+ For information about alternative licensing arrangements for the Software,
31
+ contact: hello@enterprise-oss.dev
32
+
33
+ Notice
34
+
35
+ The Business Source License (this document, or the "License") is not an Open
36
+ Source license. However, the Licensed Work will eventually be made available
37
+ under an Open Source License, as stated in this License.
38
+
39
+ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
40
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
41
+
42
+ -----------------------------------------------------------------------------
43
+
44
+ Business Source License 1.1
45
+
46
+ Terms
47
+
48
+ The Licensor hereby grants you the right to copy, modify, create derivative
49
+ works, redistribute, and make non-production use of the Licensed Work. The
50
+ Licensor may make an Additional Use Grant, above, permitting limited
51
+ production use.
52
+
53
+ Effective on the Change Date, or the fourth anniversary of the first publicly
54
+ available distribution of a specific version of the Licensed Work under this
55
+ License, whichever comes first, the Licensor hereby grants you rights under
56
+ the terms of the Change License, and the rights granted in the paragraph
57
+ above terminate.
58
+
59
+ If your use of the Licensed Work does not comply with the requirements
60
+ currently in effect as described in this License, you must purchase a
61
+ commercial license from the Licensor, its affiliated entities, or authorized
62
+ resellers, or you must refrain from using the Licensed Work.
63
+
64
+ All copies of the original and modified Licensed Work, and derivative works
65
+ of the Licensed Work, are subject to this License. This License applies
66
+ separately for each version of the Licensed Work and the Change Date may vary
67
+ for each version of the Licensed Work released by Licensor.
68
+
69
+ You must conspicuously display this License on each original or modified copy
70
+ of the Licensed Work. If you receive the Licensed Work in original or
71
+ modified form from a third party, the terms and conditions set forth in this
72
+ License apply to your use of that work.
73
+
74
+ Any use of the Licensed Work in violation of this License will automatically
75
+ terminate your rights under this License for the current and all other
76
+ versions of the Licensed Work.
77
+
78
+ This License does not grant you any right in any trademark or logo of
79
+ Licensor or its affiliates (provided that you may use a trademark or logo of
80
+ Licensor as expressly required by this License).
81
+
82
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
83
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
84
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
85
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
86
+ TITLE.
87
+
88
+ MariaDB hereby grants you permission to use this License’s text to license
89
+ your works, and to refer to it using the trademark "Business Source License",
90
+ as long as you comply with the Covenants of Licensor below.
91
+
92
+ Covenants of Licensor
93
+
94
+ In consideration of the right to use this License’s text and the "Business
95
+ Source License" name and trademark, Licensor covenants to MariaDB, and to all
96
+ other recipients of the licensed work to be provided by Licensor:
97
+
98
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
99
+ or a license that is compatible with GPL Version 2.0 or a later version,
100
+ where "compatible" means that software provided under the Change License can
101
+ be included in a program with software provided under GPL Version 2.0 or a
102
+ later version. Licensor may specify additional Change Licenses without
103
+ limitation.
104
+
105
+ 2. To either: (a) specify an additional grant of rights to use that does not
106
+ impose any additional restriction on the right granted in this License, as
107
+ the Additional Use Grant; or (b) insert the text "None".
108
+
109
+ 3. To specify a Change Date.
110
+
111
+ 4. Not to modify this License in any other way.
data/README.md ADDED
@@ -0,0 +1,2 @@
1
+ [![Maintainability](https://api.codeclimate.com/v1/badges/2b04828dc45bcb5abcb1/maintainability)](https://codeclimate.com/github/enterprise-oss/osso-rb/maintainability)
2
+ [![Build status](https://badge.buildkite.com/0e01845bdd51be4131b9cbd496d9caa39cd48f171fc2d9a9ca.svg)](https://buildkite.com/enterpriseoss/osso-rb)
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This Rakefile is used in gem development in order
4
+ # to tell ActiveRecord where to find the database
5
+ # schema and migrations
6
+
7
+ require 'bundler/gem_tasks'
8
+ require 'sinatra/activerecord/rake'
9
+ require './lib/osso'
10
+
11
+ ActiveRecord::Migrator.migrations_paths = ['./lib/osso/db/migrate']
12
+ Dir.glob('lib/tasks/*.rake').each { |r| load r }
13
+
14
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "osso"
5
+
6
+ require "irb"
7
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,14 @@
1
+ development:
2
+ adapter: postgresql
3
+ encoding: unicode
4
+ pool: 5
5
+ database: osso
6
+ host: ''
7
+ port: 5432
8
+ test:
9
+ adapter: postgresql
10
+ encoding: unicode
11
+ pool: 5
12
+ database: osso-test
13
+ host: ''
14
+ port: 5432
data/lib/.DS_Store ADDED
Binary file
data/lib/osso/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'osso'
4
+
5
+ path = File.expand_path(__dir__)
6
+ Dir.glob("#{path}/tasks/**/*.rake").each { |f| import f }
7
+
8
+ namespace :db do
9
+ task :load_config do
10
+ osso_migrations = File.expand_path('./db/migrate', __dir__)
11
+ ActiveRecord::Migrator.migrations_paths << osso_migrations
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class EnableUuid < ActiveRecord::Migration[6.0]
4
+ def change
5
+ enable_extension 'pgcrypto'
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateUsers < ActiveRecord::Migration[6.0]
4
+ def change
5
+ create_table :users, id: :uuid do |t|
6
+ t.string :email, null: false
7
+ t.string :idp_id, null: false
8
+ end
9
+
10
+ add_index :users, %i[email idp_id], unique: true
11
+ end
12
+ end