simple_jwt_auth 0.1.0 → 0.1.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: a5a1802af998b4df147f2580d95a5a0887f8f9eecbe1b35e6fd46a202afe7827
4
- data.tar.gz: bc5d1fa7f4f92b1517e13d4dc77918272dd1218e97229bfd24296094708248d5
3
+ metadata.gz: 3f3410eb7555c21ab78d237f49cd7ae8d70867936b4c5d123fddc950cacabd37
4
+ data.tar.gz: 981dc01478eeaad45523accb7420de4f8f563b610060e8d9d658e8652ea8e292
5
5
  SHA512:
6
- metadata.gz: 1c374ffc47c8eb076300aebc7c006386b786f75349775dcd39d9684400c6017ab8f7280e8d1e4a432d2fdf1d115fec232112b429b0dfdac01eec286196c51f88
7
- data.tar.gz: 62ad01454f025183264ce3991bdfadba0ff895ca545305843f06115316a52ae0d45766b918940633b7329edc64d9fa6acb36287a50fea0095da4143cb021a186
6
+ metadata.gz: d38cc551e81b6df1b8b20a4fbe4d9c2f143e85cbd552fe16778a7b7b875bf23ed1bb80b6a5e0da5e952e4dd47dcfae618e9fe92830a047fc5dbf38fd126ae288
7
+ data.tar.gz: 54c254551ec766af5892b5e090f359e8c44189c5d219beef6ac23fed19ed48c996f8556992efbf2346c2dbc64cf2a57bd7641c7e5427ece9555cac83210feee8
data/README.md CHANGED
@@ -1,8 +1,5 @@
1
1
  # SimpleJwtAuth
2
- Short description and motivation.
3
-
4
- ## Usage
5
- How to use my plugin.
2
+ This gem provides simple jwt authorization for rails API projects by giving you access to POST for users and sessions. Aswell as a current_user helper method.
6
3
 
7
4
  ## Installation
8
5
  Add this line to your application's Gemfile:
@@ -21,24 +18,36 @@ Or install it yourself as:
21
18
  $ gem install simple_jwt_auth
22
19
  ```
23
20
 
24
- in order to create updated migrations run
21
+ ## Usage
22
+ ### Models
23
+ After installation run
25
24
  ```bash
26
25
  $ rails simple_jwt_auth:install:migrations
27
26
  ```
27
+ this will create a user model in your rails application.
28
28
 
29
29
  then run
30
30
  ```bash
31
31
  $ rails db:migrate
32
32
  ```
33
-
33
+ ### Routes
34
34
  in order to access gems provided routes add
35
-
36
- mount SimpleJwtAuth::Engine, at: "/auth"
37
-
38
- to top of routes in your rails project
39
-
40
- ## Contributing
41
- Contribution directions go here.
35
+ ```bash
36
+ mount SimpleJwtAuth::Engine, at: "/auth"
37
+ ```
38
+ to the top of your routes in your rails project
39
+ ### Creating Users
40
+ Users can be created by making a POST request to
41
+ https://localhost:3000/auth/users
42
+ With name, email, password, and password_confirmation as params
43
+
44
+ ### Creating Sessions
45
+ Sessions can be created by making a POST request to
46
+ https://localhost:3000/auth/sessions
47
+ with email and password as params.
48
+
49
+ #### Logged in
50
+ Add header called "Authorization" and set it to "Bearer <your jwt token here>" include this in any request you want the user to be logged in for.
42
51
 
43
52
  ## License
44
53
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -23,9 +23,7 @@ module SimpleJwtAuth
23
23
  private
24
24
 
25
25
  def session_params
26
- params
27
- .require(:session)
28
- .permit(:email, :password)
26
+ params.permit(:email, :password)
29
27
  end
30
28
  end
31
29
  end
@@ -2,7 +2,6 @@ require_dependency "simple_jwt_auth/application_controller"
2
2
 
3
3
  module SimpleJwtAuth
4
4
  class UsersController < ApplicationController
5
- wrap_parameters :user, include: [:name, :email, :password, :password_confirmation]
6
5
 
7
6
  def create
8
7
  user = User.new(user_params)
@@ -17,9 +16,7 @@ module SimpleJwtAuth
17
16
  private
18
17
 
19
18
  def user_params
20
- params
21
- .require(:user)
22
- .permit(:name, :email, :password, :password_confirmation)
19
+ params.permit(:name, :email, :password, :password_confirmation)
23
20
  end
24
21
  end
25
22
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleJwtAuth
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_jwt_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - brye