lockie 0.2.9 → 0.2.14

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: 25ba87a9c9345cf549912647fb08b4bb35abdfae8904a89d83ae44a38bc4c164
4
- data.tar.gz: 616b9774aacd68d28d44123455e961f27ae37b635eea411a82e1747f99afbd9a
3
+ metadata.gz: 2fbe268cb9149d19e62b0e508449c3c805f735162911db10c1e14469ce4598ea
4
+ data.tar.gz: 8192dc9af5ca2a778be648bbe364b1ed005a8fd5b13edf966662056acb387877
5
5
  SHA512:
6
- metadata.gz: 9087e1aca2a0185747150a72253ccb0a75b13a2ad4ec6be51d2148d33ae1a6fcb913cf1299bf35789cf0c081c499028ca04adf3b38c4b835d94fe8bc1570004b
7
- data.tar.gz: a91cdaf0387442309b0cf7f7544ea4fc9da6646205309d3d83a0d6379db5dcd5bf94f3ea596b608f4882e953a00c3f29877f4a8c3cccb2dc6537116d7bfcfed8
6
+ metadata.gz: 8820f4ffe9b93814b235eab3faea5f110c2d13d5f339a62e1b22476ceb8cb4c43bd5907f1e1b1e04cab6558e05a01a09f2c233100f25b146bfeb87022286506d
7
+ data.tar.gz: ab3109f87d1f6204a455c50b38dcf4895e48ca2c205fa2407e839f427e689a7ad1cffdca5cbb074db84bb989713b55f137ef403afab7e17b929b52bd964091d2
data/README.md CHANGED
@@ -9,7 +9,7 @@ A drop-in, none assuming warden based Password and JWT authentication for Rails
9
9
  Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'lockie', '~> 0.2.8'
12
+ gem 'lockie', '~> 0.2.14'
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -89,11 +89,35 @@ Lockie.configure do |c|
89
89
  # set custom scopes
90
90
  c.scopes = [
91
91
  [:api, { store: false, strategies: [:jwt]}],
92
- [:web, { store: true, strategies: [:email_password]}]
92
+ [:web, { store: true, strategies: [:email_password]}],
93
+ [:admin, { store: true, strategies: [:email_password], unauthenticated_path: "/login-admin" }]
93
94
  ]
94
95
  end
95
96
  ```
96
97
 
98
+ ## Testing
99
+
100
+ Using `Warden::Test::Helpers` https://github.com/wardencommunity/warden/wiki/testing testing is simple and straight forward
101
+
102
+ ```
103
+ include Warden::Test::Helpers
104
+
105
+ setup do
106
+ @user = users(:one)
107
+ login_as @user
108
+
109
+ end
110
+ teardown { Warden.test_reset! }
111
+ ```
112
+
113
+ ### Testing JSON Api with token
114
+
115
+ ```
116
+ get articles_url(format: :json), headers: {
117
+ Authorization: "Bearer #{ @user.create_token }"
118
+ }
119
+ ```
120
+
97
121
  ## Contributing
98
122
  Contribution directions go here.
99
123
 
@@ -35,7 +35,7 @@ module Lockie
35
35
  self.status = 302
36
36
  if Lockie.config.callback_url
37
37
  callback_url = request.base_url + request.original_fullpath
38
- uri = URI(Lockie.config.unauthenticated_path)
38
+ uri = URI(warden_options[:unauthenticated_path] || Lockie.config.unauthenticated_path)
39
39
  uri.query = (uri.query.to_s.split("&") << "callback_url=#{ callback_url }").join("&")
40
40
  redirect_to uri.to_s
41
41
  else
@@ -56,7 +56,7 @@ module Lockie
56
56
  end
57
57
 
58
58
  def warden
59
- env['warden']
59
+ request.env['warden']
60
60
  end
61
61
 
62
62
  end
@@ -1,3 +1,3 @@
1
1
  module Lockie
2
- VERSION = '0.2.9'
2
+ VERSION = '0.2.14'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lockie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Melvin Sembrano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-27 00:00:00.000000000 Z
11
+ date: 2020-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -81,19 +81,19 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: 3.1.7
83
83
  - !ruby/object:Gem::Dependency
84
- name: pry
84
+ name: byebug
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.12'
89
+ version: 11.1.3
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.12'
96
+ version: 11.1.3
97
97
  description: Drop in password and JWT token authentication for Ruby on Rails
98
98
  email:
99
99
  - melvinsembrano@gmail.com