token_auth 0.3.1 → 0.3.2

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
  SHA1:
3
- metadata.gz: 6252bfa11b50c55c70e0c8dc59991fa071ee78fb
4
- data.tar.gz: d2fea9c3ae437c79b9ee345afa83861e7818a5a8
3
+ metadata.gz: 232244e546411d92fe37b5d62ce8dbd9102527af
4
+ data.tar.gz: cabdfa4d6502fb6608fd7c330eebb7d8b1a4d209
5
5
  SHA512:
6
- metadata.gz: e888b76edec9ff0d18296ba9fb8f1affb9257129645960b2b1910c88db064a6b88e064edd26085769750cd2efad5cad00068d3fbcc72454d911bfb1fccb2d385
7
- data.tar.gz: 512c09001531c69cf0d536f4ffd340908538334a4ff6d56ecb2a4cf3109b1cb1081e325345fb8cdc88ae026c23618227dc874164bc0020a54f663622bac7cd50
6
+ metadata.gz: 4d8efdc271760d000161832ad77bcea5f010f68d4b85f07e743d6c74b1dae2d075efffebfb6e0daab815992a69ce885689dea86e1f43656e38e5526f63320de8
7
+ data.tar.gz: b87481b89a919e9400ded097034c3ed145cd647adc01e7967838dff720f776df1a1177a4d01334915c237695e58a808795966932adc49f0d7d88b70f53fdf949
data/README.md CHANGED
@@ -84,6 +84,21 @@ module Api
84
84
  end
85
85
  ```
86
86
 
87
+ If you want to include content at the top of the token configuration
88
+ page or below it, define a `pre_content` or `post_content` method in a helper
89
+ with a `content_for` block that defines content for `:pre_content` or
90
+ `:post_content`:
91
+
92
+ ```ruby
93
+ module ApplicationHelper
94
+ def pre_content
95
+ content_for :pre_content do
96
+ "test food"
97
+ end
98
+ end
99
+ end
100
+ ```
101
+
87
102
  ## Testing
88
103
 
89
104
  After generating a configuration token, test authentication token generation:
@@ -92,6 +107,62 @@ After generating a configuration token, test authentication token generation:
92
107
  curl --data "data[clientUuid]=asdf&configurationToken=4C3LM9" http://localhost:3000/token_auth/api/authentication_tokens
93
108
  ```
94
109
 
110
+ ## Sample Set up with Harmonium
111
+
112
+ This gem is often used in conjunction with
113
+ [harmonium-ts](https://github.com/NU-CBITS/harmonium-ts/). Below is some more
114
+ specific examples of set up to work with both.
115
+
116
+ Every two minutes by default, Harmonium transmits changed (dirty) resources to
117
+ the server and then polls the server for new or updated resources.
118
+
119
+ The server requires some configurations that allow for these `GET` and `POST` requests:
120
+
121
+ * Install the gem [token_auth_server_rails](https://github.com/NU-CBITS/token_auth_server_rails),
122
+ * Update [Participant callback](./examples/harmonium_configurations/participant_callbacks.rb),
123
+ * Update [Participant class](./examples/harmonium_configurations/participant.rb)
124
+ , and
125
+ * Specify [syncable resources](./examples/harmonium_configurations/syncable_resources.rb)
126
+
127
+ On the server, each syncable class will need a `uuid` column. Add a before
128
+ validation such as [UuidCallbacks](./examples/harmonium_configurations/uuid_callbacks.rb)
129
+
130
+ ```ruby
131
+ class Foo < ApplicationRecord
132
+ before_validation UuidCallbacks
133
+
134
+ validates :uuid, presence: true
135
+ validates :uuid, uniqueness: true
136
+
137
+ belongs_to :participant
138
+ end
139
+ ```
140
+
141
+ You will also need to serialize the data. Specify what you need in the
142
+ `attributes` key and `id` key. An example is listed below.
143
+
144
+ ```ruby
145
+ class FooSerializer < ActiveModel::Serializer
146
+ attributes :uuid,
147
+ :client_created_at,
148
+ :client_updated_at,
149
+ :bar
150
+
151
+ attribute :uuid, key: :id
152
+
153
+ def bar
154
+ "hello world"
155
+ end
156
+ end
157
+ ```
158
+
159
+ These updates (adding the `uuid` column, serializing the data, and specifying
160
+ classes to the `pullable_resource_types` in
161
+ [Specify syncable resources](./examples/server_configurations/syncable_resources.rb))
162
+ will make these resources available for `GET` requests.
163
+
164
+ Example: `GET "/token_auth/api/payloads?filter[updated_at][gt]=DATETIME"`:
165
+
95
166
  ## Development
96
167
 
97
168
  Clone the repository and install dependencies:
@@ -1,5 +1,6 @@
1
1
  <h2><%= t(".manage_tokens_for", default: "Manage tokens for") %> <%= @entity || @entity_id %></h2>
2
-
2
+ <% pre_content if respond_to? :pre_content %>
3
+ <%= content_for :pre_content %>
3
4
  <table class="table">
4
5
  <% unless @authentication_token %>
5
6
  <tr id="config-token">
@@ -53,3 +54,5 @@
53
54
  </tr>
54
55
  <% end %>
55
56
  </table>
57
+ <% post_content if respond_to? :post_content %>
58
+ <%= content_for :post_content %>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  # Engine version.
3
3
  module TokenAuth
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: token_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Carty-Fickes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-09 00:00:00.000000000 Z
11
+ date: 2017-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -28,44 +28,58 @@ dependencies:
28
28
  name: actionpack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 5.0.X
33
+ version: 5.0.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 5.0.X
40
+ version: 5.0.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activerecord
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 5.0.X
47
+ version: 5.0.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 5.0.X
54
+ version: 5.0.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: railties
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 5.0.X
61
+ version: 5.0.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 5.0.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: sprockets-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 3.2.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
67
81
  - !ruby/object:Gem::Version
68
- version: 5.0.X
82
+ version: 3.2.0
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: pg
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -223,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
223
237
  version: '0'
224
238
  requirements: []
225
239
  rubyforge_project:
226
- rubygems_version: 2.6.8
240
+ rubygems_version: 2.6.10
227
241
  signing_key:
228
242
  specification_version: 4
229
243
  summary: Rails engine for authenticating clients anonymously.