wordjelly-auth 1.5.2 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/initializers/omniauth.rb +79 -2
- data/lib/auth/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f71e0dcebda1f38fdaab81b8f16b2336be897de9d09c544d11177b563ef3e86f
|
4
|
+
data.tar.gz: 7bd8cd9bbfe27efc9d4da172b1a45e0e5d0966e76d9dc45d88a300b31a7992a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97d49ac10bc8898169880557974f72481ae117043e3d09bf5b2087dc1534676f44fc342fa91f3bdc1723f04d2cb8b7aa25d931f87d4c32aa255420c1ae293856
|
7
|
+
data.tar.gz: acaa921dbd21a004f863c6c51fd24e95bf457cef6342d56c6086bbf6d1215c7252259e17ae9a0fd12e241e5dd19fb4acd0ffde935a16f6193a5e297cc8621784
|
@@ -385,14 +385,80 @@ end
|
|
385
385
|
|
386
386
|
module SimpleTokenAuthentication
|
387
387
|
module Configuration
|
388
|
+
|
388
389
|
mattr_accessor :additional_identifiers
|
390
|
+
|
391
|
+
=begin
|
392
|
+
########################################################
|
393
|
+
##
|
394
|
+
##
|
395
|
+
## STRUCTURE
|
396
|
+
##
|
397
|
+
##
|
398
|
+
########################################################
|
399
|
+
{
|
400
|
+
"controllers" :
|
401
|
+
{
|
402
|
+
"controller_name(demodularized)" : {
|
403
|
+
"actions" : [
|
404
|
+
{
|
405
|
+
"action_name" : "new",
|
406
|
+
"requires_authentication" : "yes",
|
407
|
+
"requires_authorization" : "no"
|
408
|
+
},
|
409
|
+
]
|
410
|
+
}
|
411
|
+
}
|
412
|
+
}
|
413
|
+
=end
|
414
|
+
mattr_accessor :permissions
|
415
|
+
|
389
416
|
@@additional_identifiers = {}
|
417
|
+
@@permissions = {}
|
418
|
+
|
390
419
|
end
|
391
420
|
|
392
421
|
## had to include option force true because otherwise devise does not throw a 401 if you try to do token_authentication inside a devise controller.
|
393
422
|
## took 3 hours to sort this mess out.
|
394
423
|
DeviseFallbackHandler.class_eval do
|
395
424
|
|
425
|
+
def permit_unauthenticated?(controller)
|
426
|
+
unless SimpleTokenAuthentication.permissions.blank?
|
427
|
+
unless SimpleTokenAuthentication.permissions["controllers"].blank?
|
428
|
+
unless SimpleTokenAuthentication.permissions["controllers"][controller.controller_name].blank?
|
429
|
+
unless SimpleTokenAuthentication.permissions["controllers"][controller.controller_name]["actions"].blank?
|
430
|
+
|
431
|
+
current_action = SimpleTokenAuthentication.permissions["controllers"][controller.controller_name]["actions"].select{|c|
|
432
|
+
|
433
|
+
c["action_name"] == controller.action_name
|
434
|
+
|
435
|
+
}
|
436
|
+
|
437
|
+
puts "the current action is:"
|
438
|
+
puts current_action.to_s
|
439
|
+
|
440
|
+
unless current_action.blank?
|
441
|
+
|
442
|
+
## so if requires authentication is either "optional" or "no", it will not fallback onto devise, and let the thing pass through.
|
443
|
+
## this has to be set in the initializers.
|
444
|
+
|
445
|
+
return current_action[0]["requires_authentication"] != "yes"
|
446
|
+
|
447
|
+
end
|
448
|
+
|
449
|
+
end
|
450
|
+
end
|
451
|
+
end
|
452
|
+
end
|
453
|
+
false
|
454
|
+
end
|
455
|
+
|
456
|
+
def fallback!(controller, entity)
|
457
|
+
unless permit_unauthenticated?(controller)
|
458
|
+
authenticate_entity!(controller, entity)
|
459
|
+
end
|
460
|
+
end
|
461
|
+
|
396
462
|
def authenticate_entity!(controller, entity)
|
397
463
|
controller.send("authenticate_#{entity.name_underscore}!".to_sym,{:force => true})
|
398
464
|
end
|
@@ -432,7 +498,11 @@ module SimpleTokenAuthentication
|
|
432
498
|
## so we will have to mod this to check for an accessor.
|
433
499
|
## otherwise it will screw up totally.
|
434
500
|
def ensure_authentication_token
|
501
|
+
|
502
|
+
puts "the skip authentication token is: #{self.skip_authentication_token_regeneration}"
|
503
|
+
|
435
504
|
regenerate_token if self.skip_authentication_token_regeneration.blank?
|
505
|
+
|
436
506
|
end
|
437
507
|
end
|
438
508
|
|
@@ -468,6 +538,7 @@ module SimpleTokenAuthentication
|
|
468
538
|
##then we should find
|
469
539
|
|
470
540
|
record = find_record_from_identifier(entity)
|
541
|
+
#puts "-------------!!!-----------!!!!"
|
471
542
|
#puts "record found is: #{record.to_s}"
|
472
543
|
|
473
544
|
if token_correct?(record, entity, token_comparator)
|
@@ -502,7 +573,7 @@ module SimpleTokenAuthentication
|
|
502
573
|
if token
|
503
574
|
|
504
575
|
## fails if the app id or user es is nil blank or empty
|
505
|
-
|
576
|
+
|
506
577
|
#puts "app id vlue is:"
|
507
578
|
#puts app_id_value.to_s
|
508
579
|
#puts "user es value is:"
|
@@ -533,7 +604,7 @@ module SimpleTokenAuthentication
|
|
533
604
|
|
534
605
|
if records.size > 0
|
535
606
|
#puts "the records size is:"
|
536
|
-
|
607
|
+
#puts records.size.to_s
|
537
608
|
#puts "found such a record.!!!!!!!!!!!!"
|
538
609
|
r = records.first
|
539
610
|
#puts r.attributes.to_s
|
@@ -546,8 +617,14 @@ module SimpleTokenAuthentication
|
|
546
617
|
end
|
547
618
|
|
548
619
|
def token_correct?(record, entity, token_comparator)
|
620
|
+
#puts "record is----------------------------000-0-0-0-0-0-0-0-0-:"
|
621
|
+
#puts record.to_s
|
549
622
|
return false unless record
|
550
623
|
token = entity.get_token_from_params_or_headers(self)
|
624
|
+
#puts "token from headers is: #{token}"
|
625
|
+
#puts "the encrypted authentication token:"
|
626
|
+
#puts record.encrypted_authentication_token.to_s
|
627
|
+
|
551
628
|
Devise::Encryptor.compare(record.class,record.encrypted_authentication_token,token)
|
552
629
|
end
|
553
630
|
end
|
data/lib/auth/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wordjelly-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bhargav
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|