zaikio-oauth_client 0.3.7 → 0.3.8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fa2e5f7ed7f309196e150d97aeabd9bf9480fc9d434a97df1bd3f24c12ea10f
|
4
|
+
data.tar.gz: acabd48829a55be6e5f358ff62136cdee973dd2e3e71fb17af4f3dff1b0bf9e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a6fc57330881a9c13164aedf78bb9138f7baa6b8a062e17ff674ada1527e291314177c65fc81eb02e4a563d29c7f8c8018854ef9613545666a07bbecd793057
|
7
|
+
data.tar.gz: ffda5ec35029860201e0c42b50c2dc303f78f9b5e726c19282dd2f023c684516cb3f2ea6a5c092b359b9e8f6c3a03a5d5d91226e0170760ca288752368ac89c3
|
data/README.md
CHANGED
@@ -26,6 +26,8 @@ This will create the tables:
|
|
26
26
|
|
27
27
|
### 2. Mount routes
|
28
28
|
|
29
|
+
Add this to `config/routes.rb`:
|
30
|
+
|
29
31
|
```rb
|
30
32
|
mount Zaikio::OAuthClient::Engine => "/zaikio"
|
31
33
|
```
|
@@ -65,6 +67,28 @@ Zaikio::OAuthClient.configure do |config|
|
|
65
67
|
end
|
66
68
|
```
|
67
69
|
|
70
|
+
|
71
|
+
### 4. Clean up outdated access tokens (recommended)
|
72
|
+
|
73
|
+
To avoid keeping all expired oath and refresh tokens in your database, we recommend to implement their scheduled deletion. We recommend therefore to use a schedule gems such as [sidekiq](https://github.com/mperham/sidekiq) and [sidekiq-scheduler](https://github.com/moove-it/sidekiq-scheduler).
|
74
|
+
|
75
|
+
Simply add the following to your Gemfile:
|
76
|
+
|
77
|
+
```rb
|
78
|
+
gem "sidekiq"
|
79
|
+
gem "sidekiq-scheduler"
|
80
|
+
```
|
81
|
+
Then run `bundle install`.
|
82
|
+
|
83
|
+
Configure sidekiq scheduler in `config/sidekiq.yml`:
|
84
|
+
```yaml
|
85
|
+
:schedule:
|
86
|
+
cleanup_acces_tokens_job:
|
87
|
+
cron: '0 3 * * *' # This will delete all expired tokens every day at 3am.
|
88
|
+
class: 'Zaikio::CleanupAccessTokensJob'
|
89
|
+
```
|
90
|
+
|
91
|
+
|
68
92
|
## Usage
|
69
93
|
|
70
94
|
### OAuth Flow
|
@@ -28,6 +28,9 @@ module Zaikio
|
|
28
28
|
where("expires_at > :now", now: Time.current)
|
29
29
|
.where.not(id: Zaikio::JWTAuth.blacklisted_token_ids)
|
30
30
|
}
|
31
|
+
scope :with_invalid_refresh_token, lambda {
|
32
|
+
where("created_at <= ?", Time.current - Zaikio::AccessToken.refresh_token_valid_for)
|
33
|
+
}
|
31
34
|
scope :valid_refresh, lambda {
|
32
35
|
where("expires_at <= :now AND created_at > :created_at_max",
|
33
36
|
now: Time.current,
|
@@ -5,11 +5,11 @@ module Zaikio
|
|
5
5
|
module OAuthClient
|
6
6
|
class Configuration
|
7
7
|
HOSTS = {
|
8
|
-
development: "http://
|
9
|
-
test: "http://
|
8
|
+
development: "http://hub.zaikio.test",
|
9
|
+
test: "http://hub.zaikio.test",
|
10
10
|
staging: "https://directory.staging.zaikio.com",
|
11
11
|
sandbox: "https://directory.sandbox.zaikio.com",
|
12
|
-
production: "https://
|
12
|
+
production: "https://hub.zaikio.com"
|
13
13
|
}.freeze
|
14
14
|
|
15
15
|
attr_accessor :host
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zaikio-oauth_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zaikio GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -42,16 +42,22 @@ dependencies:
|
|
42
42
|
name: zaikio-jwt_auth
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.2.1
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 0.4.0
|
48
51
|
type: :runtime
|
49
52
|
prerelease: false
|
50
53
|
version_requirements: !ruby/object:Gem::Requirement
|
51
54
|
requirements:
|
52
|
-
- - "
|
55
|
+
- - ">="
|
53
56
|
- !ruby/object:Gem::Version
|
54
57
|
version: 0.2.1
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 0.4.0
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: pg
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,6 +104,7 @@ files:
|
|
98
104
|
- app/controllers/zaikio/oauth_client/sessions_controller.rb
|
99
105
|
- app/helpers/zaikio/application_helper.rb
|
100
106
|
- app/jobs/zaikio/application_job.rb
|
107
|
+
- app/jobs/zaikio/cleanup_access_tokens_job.rb
|
101
108
|
- app/models/zaikio/access_token.rb
|
102
109
|
- config/initializers/inflections.rb
|
103
110
|
- config/locales/en.yml
|