user_management_rails 0.0.9 → 0.1.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4f481ea45ec0f1e4cba23c5055fd8be4defc9d3
|
4
|
+
data.tar.gz: d5787198c2dfd921f9cc40de9c540d7032c32f91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed049a5a39cc1444187875177b1face59df671d048aa748314012e131c6ae5c291744d024ecaefdd38d6a09a59093b2cf36f228b22db5af96f1c01b699db4713
|
7
|
+
data.tar.gz: 6dacf1b8a268316e59bb5f11e2d9f2afa757657fb72d0620ec1031874797f405491d3a0afb328ae2a0abbb4b62136dc31f8b01be7c9b03b188cb7c219b7990ed
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# UserManagementRails
|
2
2
|
Short description and motivation.
|
3
3
|
|
4
4
|
## Usage
|
@@ -12,6 +12,15 @@ Gem adds next endpoints to your application:
|
|
12
12
|
- `POST` - expects {"jwt": <jwt_signed by UM private key>}. It checks if jwt is valid and if so, then save it to the cookies called 'jwt'.
|
13
13
|
if jwt is not valid then it delete it from the cookies. When jwt was added to cookies than it will be sent with every request.
|
14
14
|
|
15
|
+
Gem provides current_user_hash method for your controller by adding next line to it:
|
16
|
+
```ruby
|
17
|
+
include UserManagementRails::Concerns::UserResource
|
18
|
+
```
|
19
|
+
How it works:
|
20
|
+
* If there is no jwt in cookies then return null
|
21
|
+
* If jwt is invalid throw error
|
22
|
+
* If jwt is expired throw error
|
23
|
+
* If there is valid and not expired jwt in cookies then it returns a hash of user details
|
15
24
|
|
16
25
|
## Installation
|
17
26
|
Add this line to your application's Gemfile:
|
@@ -44,8 +53,13 @@ If you already have a '/login' endpoint you can isolate it by
|
|
44
53
|
```
|
45
54
|
Then gems `/login` endpoint will be mounted on `domain.com/some_path/logins`
|
46
55
|
|
47
|
-
##
|
48
|
-
|
56
|
+
## Deploying new version of gem to rubygem repository
|
57
|
+
After you made changes and increment version of gem in(/lib/user_management_rails/version.rb)
|
58
|
+
you need to build new gem file:
|
59
|
+
```bash
|
60
|
+
gem build user_management_rails.gemspec
|
61
|
+
```
|
62
|
+
|
49
63
|
|
50
64
|
## License
|
51
65
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require_dependency 'user_management_rails/application_controller'
|
2
|
+
|
3
|
+
module UserManagementRails::Concerns::UserResource
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
def current_user_hash
|
7
|
+
user_jwt = cookies[:jwt]
|
8
|
+
return UserManagementRails.decode_user(user_jwt) if user_jwt
|
9
|
+
nil
|
10
|
+
end
|
11
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: user_management_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RingCaptcha
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activesupport
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: sqlite3
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -181,6 +195,7 @@ files:
|
|
181
195
|
- app/assets/stylesheets/jwt_handler_ruby/application.css
|
182
196
|
- app/assets/stylesheets/jwt_handler_ruby/logins.css
|
183
197
|
- app/controllers/user_management_rails/application_controller.rb
|
198
|
+
- app/controllers/user_management_rails/concerns/user_resource.rb
|
184
199
|
- app/controllers/user_management_rails/logins_controller.rb
|
185
200
|
- app/helpers/user_management_rails/application_helper.rb
|
186
201
|
- app/helpers/user_management_rails/logins_helper.rb
|