oauth_im 0.1.1 → 0.5.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f30ba9108e81c20be50aac65117a6b9cded7d96dd52fe9fcec17d2ec6b9ab2af
4
- data.tar.gz: a71b00b75aee0dce818b377e7c5d8b08d09c129ff7147aba5e823d0cbbb7d075
3
+ metadata.gz: 3cbef449e4e7e3cb7c22930c0a5a7688d00bd137a955d8ff548542d4f2875572
4
+ data.tar.gz: 528c74b6cd08deb54536029b2e883d4949ac99c1abe2c56b421bbe76a70aa22a
5
5
  SHA512:
6
- metadata.gz: 84a9bfaa94c718c7c43dec3e5fdac4737e42ee6703023548ea8515dd13d0817ce1df8f25a14bb4373b16b65bd46d2de40dd019e1b13e67c7a3433c98d9c10aba
7
- data.tar.gz: 7c3ffcaba09344862292def9e8db21ff6772b98d9233f4885e58c882196c867fad7990bce2cac8250bb1cf0eb4086d12f7a017c28a3bae4a60ba41852d7151bf
6
+ metadata.gz: 63bfab0ceb921a9b129277030914e1dfe1bef673b79b2b27fe9042f0d6fb369059dd4a4221862a73dbb18be7ac1d423802bcb8d6ba6e7aaeac20be284261fea6
7
+ data.tar.gz: 98b94db5ac85de15989d3faa7512e63f80535c22dd8562439f439fa143f81dd462cb9e32999f1ea227c8d8b4fc58b7b04436ef48fe6a32ef63442b4c920a35af
data/README.md CHANGED
@@ -8,7 +8,7 @@ apps.
8
8
  Add this line to your application's Gemfile:
9
9
 
10
10
  ```ruby
11
- gem 'oauth_im'
11
+ gem 'oauth_im', '0.x.y' # e.g., '0.1.2'
12
12
  ```
13
13
 
14
14
  Then run:
@@ -54,10 +54,13 @@ end
54
54
  ### Helpers for Logging in and Out
55
55
  The engine provides [two endpoints](https://github.com/illustrativemathematics/oauth_im/blob/main/config/routes.rb#L5-L6) for logging in and out, and exposes
56
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
57
 
60
- Note that the helpers are namespaced to the engine.
58
+ | path | url |
59
+ |------|-----|
60
+ | `oauth_im.login_path` | `oauth_im.login_url` |
61
+ | `oauth_im.logout_path` | `oauth_im.logout_url` |
62
+
63
+ * Note that the helpers are namespaced to the engine.
61
64
 
62
65
  The [controller actions](https://github.com/illustrativemathematics/oauth_im/blob/main/app/controllers/oauth_im/client_controller.rb#L14-L21) for these routes are provided and should "just
63
66
  work." Note that there are no view templates associated with these
@@ -71,4 +74,42 @@ exposes [two helper methods](https://github.com/illustrativemathematics/oauth_im
71
74
  * `email`: returns the current user's authenticated email address.
72
75
 
73
76
  You can include this concern in your app's `ApplicationController` or
74
- some other appropriate location.
77
+ some other appropriate location, e.g.:
78
+ ``` ruby
79
+ class ApplicationController < ActionController::Base
80
+ include OauthIm::Authenticable
81
+
82
+ # etc. etc. etc.
83
+ end
84
+
85
+ ```
86
+
87
+ ## Gem Maintenance
88
+ After many false starts, this repo includes two (seemingly functional) github workflows.
89
+
90
+ 1. Thanks to [this workflow](https://github.com/illustrativemathematics/oauth_im/blob/main/.github/workflows/ci.yml),
91
+ largely copied from the CMS, the specs should run automatically when a PR is issued.
92
+ 2. Thanks to [this workflow](https://github.com/illustrativemathematics/oauth_im/blob/main/.github/workflows/release.yml)
93
+ based on [this blog post](https://andrewm.codes/blog/automating-ruby-gem-releases-with-github-actions/)
94
+ and using [this release phase action](https://github.com/illustrativemathematics/oauth_im/blob/main/.github/workflows/release.yml),
95
+ certain so-called [conventional commits](https://github.com/google-github-actions/release-please-action#how-should-i-write-my-commits)
96
+ will result in a so-called **release PR**.
97
+ * Per the above documentation, to issue such a commit, use the following format for your commit message:
98
+ * `fix: a comment about a minor change that corresponds to a SemVar patch`
99
+ * `feat: a comment about a feature change that corresponds to a SemVar minor`
100
+ * `fix!: a comment about a breaking change that corresponds to a Semvar major`
101
+ * `feat!: ditto`
102
+ * Once a release PR is accepted and merged, a new PR is created that does several things:
103
+ * The gem is versioned by updating [the version file](https://github.com/illustrativemathematics/oauth_im/blob/main/lib/oauth_im/version.rb#L4).
104
+ * The new PR also includes auto-generated updates to [CHANGELOG.md](https://github.com/illustrativemathematics/oauth_im/blob/main/CHANGELOG.md).
105
+ * If this new PR is accepted and merged, several other things happened:
106
+ * A new tag and github release are created.
107
+ * The new gem version is automatically pushed up to Rubygems.
108
+
109
+ ### Notes
110
+ * Because the above process adds new commits to the repository, you
111
+ should remember to pull them.
112
+ * At Rubygems it is difficult to reuse version numbers for gems. For
113
+ this reason, you shouldn't try to force-push updates to gem version
114
+ numbers. Instead, let the automatic process manage versioning for
115
+ you.
@@ -5,7 +5,6 @@ module OauthIm
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- before_action :auth_uid
9
8
  helper_method :authenticated?
10
9
  helper_method :email
11
10
  end
@@ -20,10 +19,6 @@ module OauthIm
20
19
  @email ||= jwt_token['email']
21
20
  end
22
21
 
23
- def auth_uid
24
- gon.user_id = session[:user_jwt]['value'].first['jti'] if authenticated?
25
- end
26
-
27
22
  def user_jwt
28
23
  @user_jwt ||= session[:user_jwt] || {}
29
24
  end
@@ -48,7 +43,11 @@ module OauthIm
48
43
  end
49
44
 
50
45
  def logged_in?
51
- current_user.present?
46
+ current_user.present? || local_login?
47
+ end
48
+
49
+ def local_login?
50
+ session[:userinfo].present?
52
51
  end
53
52
  end
54
53
  end
@@ -21,7 +21,7 @@ module OauthIm
21
21
  end
22
22
 
23
23
  def local_login
24
- raise 'Disallowed' unless Rails.env.development?
24
+ raise 'Disallowed' if Rails.env.production?
25
25
 
26
26
  session[:userinfo] = { info: { email: 'local_login@example.com' } }
27
27
  redirect_back(fallback_location: main_app.root_path)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OauthIm
4
- VERSION = '0.1.1'
4
+ VERSION = '0.5.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oauth_im
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Connally
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-09 00:00:00.000000000 Z
11
+ date: 2022-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -66,6 +66,48 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 1.23.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 1.23.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.21'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.21'
69
111
  description: Include this gem in Gemfile, add an initializer, and you are good to
70
112
  go.
71
113
  email:
@@ -95,10 +137,11 @@ homepage: https://github.com/illustrativemathematics/oauth_im
95
137
  licenses:
96
138
  - BSD-3-Clause
97
139
  metadata:
140
+ changelog_uri: https://github.com/illustrativemathematics/oauth_im
98
141
  homepage_uri: https://github.com/illustrativemathematics/oauth_im
99
142
  source_code_uri: https://github.com/illustrativemathematics/oauth_im
100
- changelog_uri: https://github.com/illustrativemathematics/oauth_im
101
- post_install_message:
143
+ rubygems_mfa_required: 'true'
144
+ post_install_message:
102
145
  rdoc_options: []
103
146
  require_paths:
104
147
  - lib
@@ -114,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
157
  version: '0'
115
158
  requirements: []
116
159
  rubygems_version: 3.0.3
117
- signing_key:
160
+ signing_key:
118
161
  specification_version: 4
119
162
  summary: Provide oauth functionality for IM apps.
120
163
  test_files: []