microservices-login 0.7.11
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 +7 -0
- data/CHANGELOG.md +22 -0
- data/LICENSE +5 -0
- data/README.md +2 -0
- data/bin/razorrisk-microservice-login +42 -0
- data/lib/razor_risk/cassini/applications/microservices/login/app.rb +207 -0
- data/lib/razor_risk/cassini/applications/microservices/login/compatability.rb +57 -0
- data/lib/razor_risk/cassini/applications/microservices/login/version.rb +48 -0
- data/lib/razor_risk/cassini/applications/microservices/login.rb +19 -0
- data/lib/razor_risk/cassini/applications/route_verb_adaptors/login/auth_only_login.rb +165 -0
- data/lib/razor_risk/cassini/applications/route_verb_adaptors/login/basic_login.rb +171 -0
- data/lib/razor_risk/cassini/applications/route_verb_adaptors/login/jwt_login.rb +194 -0
- data/lib/razor_risk/cassini/applications/route_verb_adaptors/login/jwt_logout.rb +149 -0
- data/lib/razor_risk/cassini/applications/route_verb_adaptors/login.rb +20 -0
- data/lib/razor_risk/cassini/applications/route_verb_adaptors/utils/call_system_status.rb +85 -0
- data/lib/razor_risk/cassini/applications/route_verb_adaptors/utils/close_session.rb +87 -0
- data/lib/razor_risk/cassini/applications/route_verb_adaptors/utils/open_session.rb +96 -0
- metadata +251 -0
@@ -0,0 +1,96 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# ##########################################################################
|
4
|
+
#
|
5
|
+
# Copyright (c) 2019 Razor Risk Technologies Pty Limited. All rights reserved.
|
6
|
+
#
|
7
|
+
# ##########################################################################
|
8
|
+
|
9
|
+
# ##########################################################################
|
10
|
+
# requires
|
11
|
+
|
12
|
+
require 'razor_risk/razor/connectivity/entity_connectors/exceptions'
|
13
|
+
require 'razor_risk/razor/connectivity/razor_3/entity_connectors/system_status_connector'
|
14
|
+
|
15
|
+
require 'razor_risk/core/diagnostics/logger'
|
16
|
+
|
17
|
+
require 'pantheios'
|
18
|
+
|
19
|
+
|
20
|
+
# ##########################################################################
|
21
|
+
# module
|
22
|
+
|
23
|
+
module RazorRisk
|
24
|
+
module Cassini
|
25
|
+
module Applications
|
26
|
+
module RouteVerbAdaptors
|
27
|
+
module Utils
|
28
|
+
|
29
|
+
# ##########################################################
|
30
|
+
# inludes
|
31
|
+
|
32
|
+
include ::RazorRisk::Razor::Connectivity::Razor3::EntityConnectors
|
33
|
+
include ::RazorRisk::Razor::Connectivity::Razor3
|
34
|
+
|
35
|
+
include ::Pantheios
|
36
|
+
|
37
|
+
include ::RazorRisk::Core::Diagnostics::Logger
|
38
|
+
|
39
|
+
# ##########################################################
|
40
|
+
# Open Session
|
41
|
+
|
42
|
+
# Opens a Razor session. Will halt the request if the provided credentials
|
43
|
+
# are invalid with a 403 status.
|
44
|
+
#
|
45
|
+
# @param cr [Hash] A hash of credentials.
|
46
|
+
#
|
47
|
+
# @option options [#send_request] :razor_requester The Razor Requester to be
|
48
|
+
# used to send requests to the Razor application.
|
49
|
+
# @option options [Hash] :message_map The message map used to route razor
|
50
|
+
# requests.
|
51
|
+
def open_session cr, **options
|
52
|
+
|
53
|
+
trace ParamNames[ :cr, :options ], cr, options
|
54
|
+
|
55
|
+
ec = SessionsConnector.new(
|
56
|
+
options[:razor_requester],
|
57
|
+
message_map: options[:message_map],
|
58
|
+
credentials: cr
|
59
|
+
)
|
60
|
+
|
61
|
+
begin
|
62
|
+
qr = ec.open_session indicate_result_by: :qualified_result
|
63
|
+
rescue RazorRequester::InvalidCredentialsException
|
64
|
+
halt 403, {}, 'Invalid credentials'
|
65
|
+
rescue => x
|
66
|
+
log :violation, "unexpected exception (#{x.class}): '#{x.message}': #{x.backtrace}"
|
67
|
+
raise
|
68
|
+
end
|
69
|
+
|
70
|
+
halt 500, {}, 'Oops! Something went wrong!' unless qr.succeeded?
|
71
|
+
|
72
|
+
begin
|
73
|
+
[
|
74
|
+
qr.result.at_xpath('@id').value,
|
75
|
+
qr.result.at_xpath('userId').text,
|
76
|
+
qr.result.at_xpath('userProfile/longName').text,
|
77
|
+
]
|
78
|
+
rescue => x
|
79
|
+
log :critical, "Could not extract user information from new session (#{x.class}): '#{x.message}': #{x.backtrace}"
|
80
|
+
halt 500, {}, 'Oops! Something went wrong!'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
# ##########################################################
|
86
|
+
# module
|
87
|
+
|
88
|
+
end # module Utils
|
89
|
+
end # module RouteVerbAdaptors
|
90
|
+
end # module Applications
|
91
|
+
end # module Cassini
|
92
|
+
end # module RazorRisk
|
93
|
+
|
94
|
+
# ############################## end of file ############################# #
|
95
|
+
|
96
|
+
|
metadata
ADDED
@@ -0,0 +1,251 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: microservices-login
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.11
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Razor Risk
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-06-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: razorrisk-cassini-common
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.26.22
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '1.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.26.22
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '1.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: razorrisk-razor-connectivity
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 0.14.5
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '1.0'
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.14.5
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '1.0'
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: razorrisk-razor-connectivity-entityconnectors
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.26.9
|
60
|
+
- - "<"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.26.9
|
70
|
+
- - "<"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '1.0'
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: razorrisk-core-diagnostics-extensions
|
75
|
+
requirement: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0.2'
|
80
|
+
type: :runtime
|
81
|
+
prerelease: false
|
82
|
+
version_requirements: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - "~>"
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0.2'
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: activesupport
|
89
|
+
requirement: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - "~>"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '4.0'
|
94
|
+
type: :runtime
|
95
|
+
prerelease: false
|
96
|
+
version_requirements: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - "~>"
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '4.0'
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: clasp-ruby
|
103
|
+
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - "~>"
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0.14'
|
108
|
+
type: :runtime
|
109
|
+
prerelease: false
|
110
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - "~>"
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0.14'
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: json
|
117
|
+
requirement: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - "~>"
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '1.8'
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.8.3
|
125
|
+
type: :runtime
|
126
|
+
prerelease: false
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.8'
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: 1.8.3
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: libclimate-ruby
|
137
|
+
requirement: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - "~>"
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0.10'
|
142
|
+
type: :runtime
|
143
|
+
prerelease: false
|
144
|
+
version_requirements: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - "~>"
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0.10'
|
149
|
+
- !ruby/object:Gem::Dependency
|
150
|
+
name: nokogiri
|
151
|
+
requirement: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - "~>"
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '1.6'
|
156
|
+
type: :runtime
|
157
|
+
prerelease: false
|
158
|
+
version_requirements: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
160
|
+
- - "~>"
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '1.6'
|
163
|
+
- !ruby/object:Gem::Dependency
|
164
|
+
name: pantheios-ruby
|
165
|
+
requirement: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - "~>"
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: 0.20.2
|
170
|
+
type: :runtime
|
171
|
+
prerelease: false
|
172
|
+
version_requirements: !ruby/object:Gem::Requirement
|
173
|
+
requirements:
|
174
|
+
- - "~>"
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: 0.20.2
|
177
|
+
- !ruby/object:Gem::Dependency
|
178
|
+
name: sinatra
|
179
|
+
requirement: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - "~>"
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: 1.4.8
|
184
|
+
type: :runtime
|
185
|
+
prerelease: false
|
186
|
+
version_requirements: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - "~>"
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: 1.4.8
|
191
|
+
- !ruby/object:Gem::Dependency
|
192
|
+
name: xqsr3
|
193
|
+
requirement: !ruby/object:Gem::Requirement
|
194
|
+
requirements:
|
195
|
+
- - "~>"
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '0.30'
|
198
|
+
type: :runtime
|
199
|
+
prerelease: false
|
200
|
+
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
requirements:
|
202
|
+
- - "~>"
|
203
|
+
- !ruby/object:Gem::Version
|
204
|
+
version: '0.30'
|
205
|
+
description: Razor Risk's Cassini Web-framework's Login microservice
|
206
|
+
email: operations@razor-risk.com
|
207
|
+
executables:
|
208
|
+
- razorrisk-microservice-login
|
209
|
+
extensions: []
|
210
|
+
extra_rdoc_files: []
|
211
|
+
files:
|
212
|
+
- CHANGELOG.md
|
213
|
+
- LICENSE
|
214
|
+
- README.md
|
215
|
+
- bin/razorrisk-microservice-login
|
216
|
+
- lib/razor_risk/cassini/applications/microservices/login.rb
|
217
|
+
- lib/razor_risk/cassini/applications/microservices/login/app.rb
|
218
|
+
- lib/razor_risk/cassini/applications/microservices/login/compatability.rb
|
219
|
+
- lib/razor_risk/cassini/applications/microservices/login/version.rb
|
220
|
+
- lib/razor_risk/cassini/applications/route_verb_adaptors/login.rb
|
221
|
+
- lib/razor_risk/cassini/applications/route_verb_adaptors/login/auth_only_login.rb
|
222
|
+
- lib/razor_risk/cassini/applications/route_verb_adaptors/login/basic_login.rb
|
223
|
+
- lib/razor_risk/cassini/applications/route_verb_adaptors/login/jwt_login.rb
|
224
|
+
- lib/razor_risk/cassini/applications/route_verb_adaptors/login/jwt_logout.rb
|
225
|
+
- lib/razor_risk/cassini/applications/route_verb_adaptors/utils/call_system_status.rb
|
226
|
+
- lib/razor_risk/cassini/applications/route_verb_adaptors/utils/close_session.rb
|
227
|
+
- lib/razor_risk/cassini/applications/route_verb_adaptors/utils/open_session.rb
|
228
|
+
homepage: https://razor-risk.com/
|
229
|
+
licenses:
|
230
|
+
- Nonstandard
|
231
|
+
metadata: {}
|
232
|
+
post_install_message:
|
233
|
+
rdoc_options: []
|
234
|
+
require_paths:
|
235
|
+
- lib
|
236
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
237
|
+
requirements:
|
238
|
+
- - "~>"
|
239
|
+
- !ruby/object:Gem::Version
|
240
|
+
version: '2.0'
|
241
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
242
|
+
requirements:
|
243
|
+
- - ">="
|
244
|
+
- !ruby/object:Gem::Version
|
245
|
+
version: '0'
|
246
|
+
requirements: []
|
247
|
+
rubygems_version: 3.2.3
|
248
|
+
signing_key:
|
249
|
+
specification_version: 4
|
250
|
+
summary: Razor Risk Cassini Login microservice
|
251
|
+
test_files: []
|