rodauth-omniauth 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bcd1857e0bfd2329c4df0476d8f5091bac5f45c9bd47de6c8c3ef53a99bf0a64
4
- data.tar.gz: 57ddd4e9b6e8baf00b66da1f580b01762a0c118f7c962f520a026f6ef94bbfc3
3
+ metadata.gz: dad995353c13952f65bb35c561c82d755f2319318ac2409adc948b4b95fd6171
4
+ data.tar.gz: 30bdc64ac42ad66ff6003e5d95ffd5123ce9564661157ffb25f0f496e2772a3e
5
5
  SHA512:
6
- metadata.gz: 9bebec705884e246bd20bee55771711d3fff5d82c9c7f711099e09ac1196e2af8ce0c5d9e1456035da429e33c7439d7ae8c2350b6b33c6081c54f74a93992b74
7
- data.tar.gz: 53be14c4e20dff0c17e988b46cc7e0c700b810c6fc7a4440eb94a63abeee9659f9ad880427ce7205dd0fe9c6757b6e48a6e1e99411b1304dba8f011327936246
6
+ metadata.gz: '099007ffbf1e055d03625fbe9d90d3b032c27a83803a900e8f3b859dc2b8f350cc10fca07e92668dd49543c1e612a01bc4b0ba582066b633ef147883715a27fa'
7
+ data.tar.gz: 699b0e8890e5b117c69bf6b7a6aa89e140aebea976ec56455feaee688ef260e7dc71bb9cbc7bc05397ffef6a40f6c4d1260ef5f7885958e6213e4adc7541e270
data/README.md CHANGED
@@ -88,6 +88,15 @@ account.identities #=> [#<Account::Identity ...>, ...]
88
88
 
89
89
  Currently, provider login is required to return the user's email address, and account creation is assumed not to require additional fields that need to be entered manually. There is currently also no built-in functionality for connecting/removing external identities when signed in. Both features are planned for future versions.
90
90
 
91
+ ### Timestamps
92
+
93
+ If you'll be adding created/updated timestamps to the identities table, also add these lines to your Rodauth configuration:
94
+
95
+ ```rb
96
+ omniauth_identity_insert_hash { super().merge(created_at: Time.now) }
97
+ omniauth_identity_update_hash { { updated_at: Time.now } }
98
+ ```
99
+
91
100
  ### Login
92
101
 
93
102
  After provider login, you can perform custom logic at the start of the callback request:
@@ -148,6 +157,12 @@ rodauth.omniauth_request_path(:google, action: "login") #=> "/auth/github?action
148
157
  omniauth_create_account? { omniauth_params["action"] != "login" }
149
158
  ```
150
159
 
160
+ You can change the default error message for when existing account wasn't found in case automatic account creation is disabled:
161
+
162
+ ```rb
163
+ omniauth_login_no_matching_account_error_flash "No existing account found"
164
+ ```
165
+
151
166
  ### Identity data
152
167
 
153
168
  You can also store extra data on the external identities. For example, we could override the update hash to store `info`, `credentials`, and `extra` data from the auth hash into separate columns:
@@ -193,6 +208,16 @@ omniauth_identities_provider_column :provider
193
208
  omniauth_identities_uid_column :uid
194
209
  ```
195
210
 
211
+ ### Audit logging
212
+
213
+ If you're using the `audit_logging` feature, it can be useful to include the external provider name in the `login` audit logs:
214
+
215
+ ```rb
216
+ audit_log_metadata_for :login do
217
+ { "provider" => omniauth_provider } if authenticated_by.include?("omniauth")
218
+ end
219
+ ```
220
+
196
221
  ## Base
197
222
 
198
223
  The `omniauth` feature builds on top of the `omniauth_base` feature, which sets up OmniAuth and routes its requests, but has no interaction with the database. So, if you would prefer to handle external logins differently, you can load just the `omniauth_base` feature, and implement your own callback phase.
@@ -126,7 +126,7 @@ module Rodauth
126
126
 
127
127
  def possible_authentication_methods
128
128
  methods = super
129
- methods << "omniauth" unless methods.include?("password") || omniauth_account_identities_ds.empty?
129
+ methods << "omniauth" unless methods.include?("password") || (features.include?(:email_auth) && allow_email_auth?) || omniauth_account_identities_ds.empty?
130
130
  methods
131
131
  end
132
132
 
@@ -142,10 +142,6 @@ module Rodauth
142
142
  remove_omniauth_identities
143
143
  end
144
144
 
145
- def allow_email_auth?
146
- (defined?(super) ? super : true) && omniauth_account_identities_ds.empty?
147
- end
148
-
149
145
  attr_reader :omniauth_identity
150
146
 
151
147
  def omniauth_verify_account?
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "rodauth-omniauth"
3
- spec.version = "0.5.0"
3
+ spec.version = "0.5.1"
4
4
  spec.authors = ["Janko Marohnić"]
5
5
  spec.email = ["janko@hey.com"]
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodauth-omniauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-10 00:00:00.000000000 Z
11
+ date: 2024-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rodauth