arkaan 0.5.7 → 0.5.8

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: a717f0bef44b378a3208b435b394af28bbbc9e8a
4
- data.tar.gz: bbbe7049150eb2ec195cb3af5f343bdc5862f005
3
+ metadata.gz: 82ee7964343babf536cf19a69c722969b5d22e10
4
+ data.tar.gz: 15bc5ff8dfd971385ceb02bc027b1aaad9ee348c
5
5
  SHA512:
6
- metadata.gz: 19dc0d167af5df2e6812117b0bb34cc611a03bec1f0a1e5299dbf42fc6ef7f40e9b7f233d2b4534b764c1fbe614b070969d388ff3d151c451d24f0dc63e99371
7
- data.tar.gz: 289875757787eb1a8c4c15e0fc7a50a86b5eb90085f9460aadf213cf3ce2fc37baf80137b78e471f1c43192c30517f84d5a17f4088ded45ff40232154cc92fff
6
+ metadata.gz: c4e968e8158d51290d2e3172b864e5df82d010b34539222080b734ae24cc012fa81039ec7c5ba92812d6861e37d22e4f1322cb66ff687892ec9243d87e4935df
7
+ data.tar.gz: 124bef470de7ea4010abd02b1d65cff7e930275a61a1a7200d02450a00c86ed76880762c151615ed8484145bea83517c20f03f97a80542285db3746896d98841
@@ -5,9 +5,10 @@ require 'active_support'
5
5
  # Main module of the application, holding all the subsequent classes.
6
6
  # @author Vincent Courtois <courtois.vincent@outlook.com>
7
7
  module Arkaan
8
- autoload :Account , 'arkaan/account'
9
- autoload :Permissions, 'arkaan/permissions'
10
- autoload :Concerns , 'arkaan/concerns'
11
- autoload :OAuth , 'arkaan/oauth'
12
- autoload :Monitoring , 'arkaan/monitoring'
8
+ autoload :Account , 'arkaan/account'
9
+ autoload :Authentication, 'arkaan/authentication'
10
+ autoload :Concerns , 'arkaan/concerns'
11
+ autoload :Monitoring , 'arkaan/monitoring'
12
+ autoload :OAuth , 'arkaan/oauth'
13
+ autoload :Permissions , 'arkaan/permissions'
13
14
  end
@@ -44,6 +44,8 @@ module Arkaan
44
44
  # @return [Array<Arkaan::Monitoring::Service] the services created by this user.
45
45
  has_many :services, class_name: 'Arkaan::Monitoring::Service', inverse_of: :creator
46
46
 
47
+ has_many :sessions, class_name: 'Arkaan::Authentication::Session', inverse_of: :account
48
+
47
49
  attr_readonly :password_digest
48
50
 
49
51
  validates :username,
@@ -0,0 +1,5 @@
1
+ module Arkaan
2
+ module Authentication
3
+ autoload :Session, 'arkaan/authentication/session'
4
+ end
5
+ end
@@ -0,0 +1,22 @@
1
+ module Arkaan
2
+ module Authentication
3
+ class Session
4
+ include Mongoid::Document
5
+ include Mongoid::Timestamps
6
+
7
+ field :token, type: String
8
+
9
+ field :expiration, type: Integer, default: 0
10
+
11
+ belongs_to :account, class_name: 'Arkaan::Account', inverse_of: :sessions
12
+
13
+ validates :token,
14
+ presence: {message: 'session.token.blank'},
15
+ uniqueness: {message: 'session.token.uniq', if: :token?},
16
+ length: {minimum: 10, message: 'session.token.short', if: :token?}
17
+
18
+ validates :expiration,
19
+ presence: {message: 'session.expiration.blank'}
20
+ end
21
+ end
22
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arkaan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Courtois
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-30 00:00:00.000000000 Z
11
+ date: 2017-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -158,6 +158,8 @@ extra_rdoc_files: []
158
158
  files:
159
159
  - lib/arkaan.rb
160
160
  - lib/arkaan/account.rb
161
+ - lib/arkaan/authentication.rb
162
+ - lib/arkaan/authentication/session.rb
161
163
  - lib/arkaan/concerns.rb
162
164
  - lib/arkaan/concerns/activable.rb
163
165
  - lib/arkaan/concerns/diagnosticable.rb