groovestack-auth 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.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +1 -0
  3. data/.rubocop.yml +51 -0
  4. data/Gemfile +12 -0
  5. data/Gemfile.lock +194 -0
  6. data/config/initializers/core_config.rb +41 -0
  7. data/config/initializers/devise.rb +314 -0
  8. data/config/initializers/devise_token_auth.rb +72 -0
  9. data/config/initializers/graphql_devise.rb +58 -0
  10. data/config/initializers/omniauth.rb +69 -0
  11. data/config/routes.rb +11 -0
  12. data/config.ru +12 -0
  13. data/db/migrate/20231103172517_create_users.rb +54 -0
  14. data/db/migrate/20231103174037_create_identities.rb +19 -0
  15. data/docs/apple-oauth-local-dev.adoc +67 -0
  16. data/groovestack-auth.gemspec +41 -0
  17. data/lib/fabricators/user_fabricator.rb +17 -0
  18. data/lib/graphql/identity/filter.rb +13 -0
  19. data/lib/graphql/identity/mutations.rb +27 -0
  20. data/lib/graphql/identity/queries.rb +25 -0
  21. data/lib/graphql/identity/type.rb +22 -0
  22. data/lib/graphql/user/filter.rb +15 -0
  23. data/lib/graphql/user/mutations.rb +63 -0
  24. data/lib/graphql/user/queries.rb +40 -0
  25. data/lib/graphql/user/type.rb +30 -0
  26. data/lib/groovestack/auth/action_cable.rb +29 -0
  27. data/lib/groovestack/auth/authenticated_api_controller.rb +13 -0
  28. data/lib/groovestack/auth/omniauth_callbacks_controller.rb +111 -0
  29. data/lib/groovestack/auth/provider.rb +59 -0
  30. data/lib/groovestack/auth/providers/apple.rb +26 -0
  31. data/lib/groovestack/auth/providers/email.rb +15 -0
  32. data/lib/groovestack/auth/providers/google.rb +17 -0
  33. data/lib/groovestack/auth/providers/omni_auth.rb +47 -0
  34. data/lib/groovestack/auth/railtie.rb +64 -0
  35. data/lib/groovestack/auth/schema_plugin.rb +19 -0
  36. data/lib/groovestack/auth/version.rb +7 -0
  37. data/lib/groovestack/auth.rb +108 -0
  38. data/lib/identity.rb +31 -0
  39. data/lib/user.rb +53 -0
  40. data/lib/users/roles.rb +42 -0
  41. data/readme.adoc +52 -0
  42. metadata +144 -0
data/readme.adoc ADDED
@@ -0,0 +1,52 @@
1
+ = Groovestack Auth
2
+
3
+ == Introduction
4
+ Groovestack Auth is a https://talysto.com/tech/groovestack/[Groovestack] Groovestack gem that provides a token-based authentication solution for https://rubyonrails.org/[Ruby on Rails] / https://graphql-ruby.org/[GraphQL Ruby] applications. Groovestack Auth is built on top of
5
+
6
+ * https://github.com/graphql-devise/graphql_devise[graphql_devise] - https://graphql-ruby.org/[GraphQL Ruby] wrapper for https://github.com/lynndylanhurley/devise_token_auth[Devise Token Auth]
7
+ * https://github.com/omniauth/omniauth[OmniAuth] - Multi-Provider Authentication.
8
+
9
+ Groovestack Auth enables seamless authentication via email and password or through OAuth providers like Google and Apple. Users can connect and authenticate with multiple providers (i.e. email, google or apple). Groovestack Auth also integrates seemlessly with https://guides.rubyonrails.org/action_cable_overview.html[Action Cable].
10
+
11
+ === Configuration
12
+ Groovestack Auth ships with email and password authentication out of the box as well as easily configurable https://github.com/zquestz/omniauth-google-oauth2[Google] and https://github.com/nhosoya/omniauth-apple[Apple] OAuth providers.
13
+
14
+ ==== create-groovestack
15
+ When using the https://github.com/groovestack/create-groovestack[create-groovestack] utility to bootstrap a new Groovestack application, enabling OAuth providers is easy. Simply add the required third party keys to your Rails credentials file. For example, to enable Google OAuth, add the following to your Rails credentials file:
16
+
17
+ [source,yaml]
18
+ ----
19
+ GOOGLE_CLIENT_ID: YOUR_CLIENT_ID
20
+ GOOGLE_CLIENT_SECRET: YOUR_CLIENT_SECRET
21
+ ----
22
+
23
+ To enable Apple OAuth, add the following to your Rails credentials file:
24
+ [source,yaml]
25
+ ----
26
+ APPLE_CLIENT_ID: YOUR_CLIENT_ID
27
+ APPLE_KEY_ID: YOUR_KEY_ID
28
+ APPLE_PEM_CONTENT: YOUR_PEM_CONTENT
29
+ APPLE_TEAM_ID: YOUR_TEAM_ID
30
+ ----
31
+
32
+ For instructions on how to acquire the required keys, see the https://github.com/zquestz/omniauth-google-oauth2[omniauth-google-oauth2] and https://github.com/nhosoya/omniauth-apple[omniauth-apple] documentation.
33
+
34
+ Groovestack Auth ships with development and production environment https://edgeguides.rubyonrails.org/security.html#custom-credentials[rails credentials] out of the box. To edit your environment specific Rails credentials file, run
35
+ [source,shell]
36
+ ----
37
+ rails credentials:edit -e [environment]
38
+ ----
39
+ Credential master key files are located in the `config/credentials` directory but excluded from source control. When deploying your app to production, make sure you configure your production environment to include the `RAILS_MASTER_KEY` variable. For example, when deploying to Heroku, you can set the `RAILS_MASTER_KEY` variable by running:
40
+ [source,shell]
41
+ ----
42
+ heroku config:set RAILS_MASTER_KEY=`cat config/credentials/production.key`
43
+ ----
44
+
45
+ ===== Local Development with Apple OAuth
46
+
47
+ Sign-In with Apple does not allow `localhost` as a valid callback URL. It also requires SSL. This means that you won't be able to test your Apple OAuth integration out of the box. To enable local development with Apple OAuth in your bootstrapped Groovestack app, follow https://github.com/talysto/groovestack-core/tree/main/core-auth/docs/apple-oauth-local-dev.adoc[these instructions].
48
+
49
+ ==== Existing ROR & GraphQL Ruby Applications
50
+ #TODO
51
+
52
+
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: groovestack-auth
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Max Schridde
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2025-04-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: groovestack-base
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.7
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.7
27
+ - !ruby/object:Gem::Dependency
28
+ name: jsonb_accessor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.4'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: omniauth-apple
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: omniauth-google-oauth2
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Groovestack::Auth is an authentication extension for the Groovestack
70
+ Platform.
71
+ email:
72
+ - maxjschridde@gmail.com
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".rspec"
78
+ - ".rubocop.yml"
79
+ - Gemfile
80
+ - Gemfile.lock
81
+ - config.ru
82
+ - config/initializers/core_config.rb
83
+ - config/initializers/devise.rb
84
+ - config/initializers/devise_token_auth.rb
85
+ - config/initializers/graphql_devise.rb
86
+ - config/initializers/omniauth.rb
87
+ - config/routes.rb
88
+ - db/migrate/20231103172517_create_users.rb
89
+ - db/migrate/20231103174037_create_identities.rb
90
+ - docs/apple-oauth-local-dev.adoc
91
+ - groovestack-auth.gemspec
92
+ - lib/fabricators/user_fabricator.rb
93
+ - lib/graphql/identity/filter.rb
94
+ - lib/graphql/identity/mutations.rb
95
+ - lib/graphql/identity/queries.rb
96
+ - lib/graphql/identity/type.rb
97
+ - lib/graphql/user/filter.rb
98
+ - lib/graphql/user/mutations.rb
99
+ - lib/graphql/user/queries.rb
100
+ - lib/graphql/user/type.rb
101
+ - lib/groovestack/auth.rb
102
+ - lib/groovestack/auth/action_cable.rb
103
+ - lib/groovestack/auth/authenticated_api_controller.rb
104
+ - lib/groovestack/auth/omniauth_callbacks_controller.rb
105
+ - lib/groovestack/auth/provider.rb
106
+ - lib/groovestack/auth/providers/apple.rb
107
+ - lib/groovestack/auth/providers/email.rb
108
+ - lib/groovestack/auth/providers/google.rb
109
+ - lib/groovestack/auth/providers/omni_auth.rb
110
+ - lib/groovestack/auth/railtie.rb
111
+ - lib/groovestack/auth/schema_plugin.rb
112
+ - lib/groovestack/auth/version.rb
113
+ - lib/identity.rb
114
+ - lib/user.rb
115
+ - lib/users/roles.rb
116
+ - readme.adoc
117
+ homepage: https://github.com/talysto/groovestack-core/
118
+ licenses: []
119
+ metadata:
120
+ allowed_push_host: https://rubygems.org
121
+ homepage_uri: https://github.com/talysto/groovestack-core/
122
+ source_code_uri: https://github.com/talysto/groovestack-core/
123
+ changelog_uri: https://github.com/talysto/groovestack-core/
124
+ rubygems_mfa_required: 'true'
125
+ post_install_message: Groovestack::Auth installed
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: 3.1.0
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubygems_version: 3.3.26
141
+ signing_key:
142
+ specification_version: 4
143
+ summary: Groovestack extension for application authentication
144
+ test_files: []