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
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 68861062675878ab005187f8c31ef75fa06b1ae8b245a23582aea8367903f42b
|
4
|
+
data.tar.gz: 1a37dc1abb46923297f8f572f823d84ec791b4f7c00c4ed8a12d8b52b00753fa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 69629782263e5039bb6c6381262415fe2b63479717cc8c10d91e5f95281498ff70149df73d77becdae83255213f77cf1ed2066ff4a3c85e001b1b38160757b51
|
7
|
+
data.tar.gz: c383cafc45c02693cc1b38f99f19ac5f5ac30d499d22556b887f4179d930da314138d9bb3151f74d0ad06896aebe3dcab374d71a520dccef9cbc8fe2c68fd901
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## [0.7.1] (2018-06-19)
|
4
|
+
|
5
|
+
**Implemented enhancements:**
|
6
|
+
|
7
|
+
none
|
8
|
+
|
9
|
+
**Fixed defects:**
|
10
|
+
|
11
|
+
none
|
12
|
+
|
13
|
+
**Dependencies and packaging:**
|
14
|
+
|
15
|
+
- separated into own project/repo/package [WEBAPI-138]
|
16
|
+
|
17
|
+
**Merged pull requests:**
|
18
|
+
|
19
|
+
none
|
20
|
+
|
21
|
+
## END OF CHANGE LOG
|
22
|
+
|
data/LICENSE
ADDED
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
# ######################################################################## #
|
5
|
+
#
|
6
|
+
# Main module/entry files for the Login Microservice
|
7
|
+
#
|
8
|
+
# Copyright (c) 2017 Razor Risk Technologies Pty Limited. All rights reserved.
|
9
|
+
#
|
10
|
+
# ######################################################################## #
|
11
|
+
|
12
|
+
|
13
|
+
# ##########################################################################
|
14
|
+
# requires
|
15
|
+
|
16
|
+
require 'razor_risk/cassini/diagnostics/zeroth_include'
|
17
|
+
|
18
|
+
require 'razor_risk/cassini/applications/microservices/login'
|
19
|
+
require 'razor_risk/cassini/main'
|
20
|
+
|
21
|
+
|
22
|
+
# ##########################################################################
|
23
|
+
# includes
|
24
|
+
|
25
|
+
include ::RazorRisk::Cassini::Applications::Microservices
|
26
|
+
|
27
|
+
|
28
|
+
# ##########################################################################
|
29
|
+
# constants
|
30
|
+
|
31
|
+
PROGRAM_VERSION = ::RazorRisk::Cassini::Applications::Microservices::Login::VERSION
|
32
|
+
|
33
|
+
|
34
|
+
# ##########################################################################
|
35
|
+
# main section
|
36
|
+
|
37
|
+
TheApp = Login::LoginApp
|
38
|
+
|
39
|
+
|
40
|
+
# ############################## end of file ############################# #
|
41
|
+
|
42
|
+
|
@@ -0,0 +1,207 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# ######################################################################## #
|
4
|
+
#
|
5
|
+
# Login Microservice app.
|
6
|
+
#
|
7
|
+
# Copyright (c) 2019 Razor Risk Technologies Pty Limited. All rights reserved.
|
8
|
+
#
|
9
|
+
# ######################################################################## #
|
10
|
+
|
11
|
+
|
12
|
+
# ##########################################################################
|
13
|
+
|
14
|
+
# Microservices: Login (login)
|
15
|
+
#
|
16
|
+
# Supported:
|
17
|
+
#
|
18
|
+
# - [POST] /do-login {Unsecured}
|
19
|
+
#
|
20
|
+
# NOTE: this server is able to perform authorisation using the following
|
21
|
+
# schemes:
|
22
|
+
#
|
23
|
+
# - None (:none) - always returns an empty document with 200;
|
24
|
+
# - Basic (:basic) - Basic Authentication (as described in
|
25
|
+
# https://tools.ietf.org/html/rfc1945#section-11.1), which requires receipt
|
26
|
+
# of "Authorization" header with the value "Basic <user-pass-64>" where
|
27
|
+
# <user-pass-64> is the Base-64 encoded form of "<username>:<password>".
|
28
|
+
# The client must present this same header (and value) with each request;
|
29
|
+
# - Authorisation-only (:authorisation_only) - Razor Risk's proprietary
|
30
|
+
# extension auth scheme, which requires receipt of "Authorization
|
31
|
+
# header with the value "RazorRisk.Razor.AuthorisationOnly <ident-64>",
|
32
|
+
# where <ident-64> is the Base-64 encoded form of "<username>". The client
|
33
|
+
# must present this same header (and value) with each request;
|
34
|
+
# - JWT (:jwt) - JWT-based authentication, which requires receipt of
|
35
|
+
# "Authorization" header with the value "Bearer <jwt-64>" where <jwt-64>
|
36
|
+
# is the Base-64 encoded form of a JWT that is obtained from this Login
|
37
|
+
# service via its do-login route with the POST verb and a body containing
|
38
|
+
# username and password name-value pairs (hence the header
|
39
|
+
|
40
|
+
|
41
|
+
# ##########################################################################
|
42
|
+
# requires
|
43
|
+
|
44
|
+
require 'razor_risk/cassini/applications/rest_framework/route_verb_dispatcher'
|
45
|
+
require 'razor_risk/cassini/applications/route_verb_adaptors/login'
|
46
|
+
|
47
|
+
require 'razor_risk/cassini/applications/securable_microservice'
|
48
|
+
require 'razor_risk/cassini/authorisation'
|
49
|
+
|
50
|
+
require 'razor_risk/razor/connectivity/razor_3/entity_connectors/system_status_connector'
|
51
|
+
require 'razor_risk/razor/connectivity/razor_3/entity_connectors/sessions_connector'
|
52
|
+
|
53
|
+
require 'razor_risk/razor/connectivity/razor_3/message_map'
|
54
|
+
require 'razor_risk/razor/connectivity/razor_3/razor_requester'
|
55
|
+
|
56
|
+
require 'razor_risk/core/diagnostics/logger'
|
57
|
+
|
58
|
+
require 'pantheios'
|
59
|
+
|
60
|
+
# ##########################################################################
|
61
|
+
# modules
|
62
|
+
|
63
|
+
module RazorRisk
|
64
|
+
module Cassini
|
65
|
+
module Applications
|
66
|
+
module Microservices
|
67
|
+
module Login
|
68
|
+
|
69
|
+
|
70
|
+
# ##########################################################################
|
71
|
+
# includes
|
72
|
+
|
73
|
+
include ::RazorRisk::Cassini::Applications
|
74
|
+
|
75
|
+
|
76
|
+
# ##########################################################################
|
77
|
+
# application
|
78
|
+
|
79
|
+
# Razor Web Sercies Login Microservice.
|
80
|
+
class LoginApp < SecurableMicroservice
|
81
|
+
|
82
|
+
include RouteVerbAdaptors::Login
|
83
|
+
include RESTFramework::RouteVerbDispatch
|
84
|
+
|
85
|
+
include ::RazorRisk::Cassini::Authorisation::SecurityModelHelpers
|
86
|
+
|
87
|
+
include ::RazorRisk::Razor::Connectivity::Razor3::EntityConnectors
|
88
|
+
include ::RazorRisk::Razor::Connectivity::Razor3
|
89
|
+
|
90
|
+
include ::Pantheios
|
91
|
+
include ::RazorRisk::Core::Diagnostics::Logger
|
92
|
+
|
93
|
+
# Microservice long name.
|
94
|
+
FULL_DESIGNATION = 'Login'
|
95
|
+
# Microservice short name.
|
96
|
+
SHORT_DESIGNATION = 'login'
|
97
|
+
# Service type.
|
98
|
+
SERVICE_TYPE = :microservice
|
99
|
+
# Supported Content Types.
|
100
|
+
HTTP_ACCEPTS = [
|
101
|
+
'application/xml',
|
102
|
+
'text/xml',
|
103
|
+
'application/json',
|
104
|
+
'text/plain',
|
105
|
+
'*/*'
|
106
|
+
]
|
107
|
+
# Supported features, used for generating CLI options.
|
108
|
+
PROGRAM_FEATURES = {
|
109
|
+
has_web_server: true,
|
110
|
+
has_host_and_port: true,
|
111
|
+
has_razor_connectivity: true,
|
112
|
+
authentication: true,
|
113
|
+
copyright_year: 2017,
|
114
|
+
}
|
115
|
+
|
116
|
+
private
|
117
|
+
HTTP_AUTHORIZATION = ::RazorRisk::Cassini::Constants::HTTP_AUTHORIZATION
|
118
|
+
|
119
|
+
public
|
120
|
+
|
121
|
+
# Executed when the mircoservice is initialized.
|
122
|
+
#
|
123
|
+
# @option options [#send_request] :razor_requester The Razor Requester to
|
124
|
+
# be used to send requests to the Razor application.
|
125
|
+
# @option options [Hash] :message_map The message map used to route razor
|
126
|
+
# requests.
|
127
|
+
def self.on_init_service options
|
128
|
+
|
129
|
+
trace ParamNames[ :options ], options
|
130
|
+
|
131
|
+
check_option options, :razor_requester
|
132
|
+
check_option options, :message_map, type: MessageMap, allow_nil: true
|
133
|
+
|
134
|
+
set :razor_requester, options[:razor_requester]
|
135
|
+
set :message_map, (options[:message_map] || MessageMap::DefaultInstance)
|
136
|
+
end
|
137
|
+
|
138
|
+
set(:auth_scheme) do |*schemes|
|
139
|
+
condition do
|
140
|
+
schemes.any? { |s| s == settings.authentication_scheme }
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
post '/*/?', :auth_scheme => :none do
|
145
|
+
|
146
|
+
trace ParamNames[ :request, :params ], request, params
|
147
|
+
|
148
|
+
log :critical, 'You must use a security model'
|
149
|
+
error 500, 'Oops! Something went wrong!'
|
150
|
+
end
|
151
|
+
|
152
|
+
get '/systemstatus/?' do
|
153
|
+
trace ParamNames[ :request, :params ], request, params
|
154
|
+
dispatch BasicLogin
|
155
|
+
end
|
156
|
+
|
157
|
+
post '/do-login/?', :auth_scheme => :basic do
|
158
|
+
|
159
|
+
trace ParamNames[ :request, :params ], request, params
|
160
|
+
|
161
|
+
dispatch BasicLogin
|
162
|
+
end
|
163
|
+
|
164
|
+
post '/do-login/?', :auth_scheme => :authorisation_only do
|
165
|
+
|
166
|
+
trace ParamNames[ :request, :params ], request, params
|
167
|
+
|
168
|
+
dispatch AuthOnlyLogin
|
169
|
+
end
|
170
|
+
|
171
|
+
post '/do-login/?', :auth_scheme => :jwt do
|
172
|
+
|
173
|
+
trace ParamNames[ :request, :params ], request, params
|
174
|
+
|
175
|
+
dispatch JWTLogin
|
176
|
+
end
|
177
|
+
|
178
|
+
post '/do-logout/?', :auth_scheme => [:basic, :authorisation_only] do
|
179
|
+
|
180
|
+
trace ParamNames[ :request, :params ], request, params
|
181
|
+
|
182
|
+
validate_accept request, HTTP_ACCEPTS
|
183
|
+
status 204
|
184
|
+
end
|
185
|
+
|
186
|
+
post '/do-logout/?', :auth_scheme => :jwt do
|
187
|
+
|
188
|
+
trace ParamNames[ :request, :params ], request, params
|
189
|
+
|
190
|
+
dispatch JWTLogout
|
191
|
+
end
|
192
|
+
|
193
|
+
define_catch_all_handlers
|
194
|
+
end
|
195
|
+
|
196
|
+
# ##########################################################################
|
197
|
+
# modules
|
198
|
+
|
199
|
+
end # module Login
|
200
|
+
end # module Microservices
|
201
|
+
end # module Applications
|
202
|
+
end # module Cassini
|
203
|
+
end # module RazorRisk
|
204
|
+
|
205
|
+
# ############################## end of file ############################# #
|
206
|
+
|
207
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# ######################################################################## #
|
4
|
+
#
|
5
|
+
# Login Microservice compatability checking.
|
6
|
+
#
|
7
|
+
# Copyright (c) 2019 Razor Risk Technologies Pty Limited. All rights reserved.
|
8
|
+
#
|
9
|
+
# ######################################################################## #
|
10
|
+
|
11
|
+
|
12
|
+
# ##########################################################
|
13
|
+
# requires
|
14
|
+
|
15
|
+
require 'razor_risk/cassini/util/version_util'
|
16
|
+
require 'razor_risk/cassini/common/version'
|
17
|
+
require 'razor_risk/razor/connectivity/version'
|
18
|
+
require 'libclimate/version'
|
19
|
+
require 'pantheios/version'
|
20
|
+
|
21
|
+
|
22
|
+
# ##########################################################################
|
23
|
+
# modules
|
24
|
+
|
25
|
+
module RazorRisk
|
26
|
+
module Cassini
|
27
|
+
module Applications
|
28
|
+
module Microservices
|
29
|
+
module Login
|
30
|
+
|
31
|
+
# ##########################################################################
|
32
|
+
# includes
|
33
|
+
|
34
|
+
include ::RazorRisk::Cassini::Util::VersionUtil
|
35
|
+
|
36
|
+
|
37
|
+
# ##########################################################################
|
38
|
+
# compatibility checks
|
39
|
+
|
40
|
+
check_version_compatibility ::RazorRisk::Cassini::Common, [ 0, 21 ], 'RazorRisk.Cassini.Common'
|
41
|
+
check_version_compatibility ::RazorRisk::Razor::Connectivity, [ 0, 11, 2 ], 'RazorRisk.Razor.Connectivity'
|
42
|
+
check_version_compatibility ::LibCLImate, '0.10'
|
43
|
+
check_version_compatibility ::Pantheios, '0.20'
|
44
|
+
|
45
|
+
|
46
|
+
# ##########################################################################
|
47
|
+
# modules
|
48
|
+
|
49
|
+
end # module Login
|
50
|
+
end # module Microservices
|
51
|
+
end # module Applications
|
52
|
+
end # module Cassini
|
53
|
+
end # module RazorRisk
|
54
|
+
|
55
|
+
# ############################## end of file ############################# #
|
56
|
+
|
57
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# ##########################################################################
|
4
|
+
#
|
5
|
+
# Version for RazorRisk.Cassini.Microservices.Login library
|
6
|
+
#
|
7
|
+
# Copyright (c) 2019 Razor Risk Technologies Pty Limited. All rights reserved.
|
8
|
+
#
|
9
|
+
# ##########################################################################
|
10
|
+
|
11
|
+
module RazorRisk
|
12
|
+
module Cassini
|
13
|
+
module Applications
|
14
|
+
module Microservices
|
15
|
+
|
16
|
+
module Login
|
17
|
+
|
18
|
+
# Current version of the RazorRisk.Cassini.Microservices.RESTful.Login library
|
19
|
+
VERSION = '0.7.11'
|
20
|
+
|
21
|
+
private
|
22
|
+
VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
|
23
|
+
public
|
24
|
+
# Major version of the RazorRisk.Cassini.Microservices.RESTful.Login library
|
25
|
+
VERSION_MAJOR = VERSION_PARTS_[0] # :nodoc:
|
26
|
+
# Minor version of the RazorRisk.Cassini.Microservices.RESTful.Login library
|
27
|
+
VERSION_MINOR = VERSION_PARTS_[1] # :nodoc:
|
28
|
+
# Patch version of the RazorRisk.Cassini.Microservices.RESTful.Login library
|
29
|
+
VERSION_PATCH = VERSION_PARTS_[2] # :nodoc:
|
30
|
+
# Commit version of the RazorRisk.Cassini.Microservices.RESTful.Login library
|
31
|
+
VERSION_COMMIT = VERSION_PARTS_[3] || 0 # :nodoc:
|
32
|
+
|
33
|
+
|
34
|
+
# The description of the framework
|
35
|
+
DESCRIPTION = "Razor Risk's Cassini Web-framework's Login microservice"
|
36
|
+
|
37
|
+
# @deprecated use {DESCRIPTION} instead.
|
38
|
+
FRAMEWORK_DESCRIPTION = DESCRIPTION
|
39
|
+
end # module Login
|
40
|
+
|
41
|
+
end # module Microservices
|
42
|
+
end # module Applications
|
43
|
+
end # module Cassini
|
44
|
+
end # module RazorRisk
|
45
|
+
|
46
|
+
# ############################## end of file ############################# #
|
47
|
+
|
48
|
+
|
@@ -0,0 +1,19 @@
|
|
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/cassini/applications/microservices/login/version'
|
13
|
+
require 'razor_risk/cassini/applications/microservices/login/app'
|
14
|
+
require 'razor_risk/cassini/applications/microservices/login/compatability'
|
15
|
+
|
16
|
+
|
17
|
+
# ############################## end of file ############################# #
|
18
|
+
|
19
|
+
|
@@ -0,0 +1,165 @@
|
|
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/cassini/applications/rest_framework/verb_handler'
|
13
|
+
require 'razor_risk/cassini/applications/route_verb_adaptors/utils/call_system_status'
|
14
|
+
require 'razor_risk/cassini/authorisation'
|
15
|
+
require 'razor_risk/cassini/header_functions'
|
16
|
+
require 'razor_risk/cassini/util/conversion_util'
|
17
|
+
|
18
|
+
require 'razor_risk/razor/connectivity/entity_connectors/exceptions'
|
19
|
+
|
20
|
+
require 'razor_risk/core/diagnostics/logger'
|
21
|
+
|
22
|
+
require 'pantheios'
|
23
|
+
|
24
|
+
|
25
|
+
# ##########################################################
|
26
|
+
# module
|
27
|
+
|
28
|
+
module RazorRisk
|
29
|
+
module Cassini
|
30
|
+
module Applications
|
31
|
+
module RouteVerbAdaptors
|
32
|
+
module Login
|
33
|
+
|
34
|
+
|
35
|
+
# ##########################################################
|
36
|
+
# AuthOnlyLogin
|
37
|
+
|
38
|
+
# Handler for Authorisation Only Login.
|
39
|
+
class AuthOnlyLogin < RESTFramework::VerbHandler
|
40
|
+
|
41
|
+
# ##########################################################
|
42
|
+
# includes
|
43
|
+
|
44
|
+
include ::RazorRisk::Cassini::Applications::RouteVerbAdaptors::Utils
|
45
|
+
include ::RazorRisk::Cassini::Authorisation::SecurityModelHelpers
|
46
|
+
include ::RazorRisk::Cassini::Authorisation::HeaderHelpers
|
47
|
+
include ::RazorRisk::Cassini::HeaderFunctions
|
48
|
+
include ::RazorRisk::Cassini::Util::ConversionUtil
|
49
|
+
|
50
|
+
include ::RazorRisk::Razor::Connectivity::EntityConnectors::Exceptions
|
51
|
+
include ::RazorRisk::Razor::Connectivity::Razor3::EntityConnectors
|
52
|
+
|
53
|
+
include ::Pantheios
|
54
|
+
include ::RazorRisk::Core::Diagnostics::Logger
|
55
|
+
|
56
|
+
# ##########################################################
|
57
|
+
# constants
|
58
|
+
|
59
|
+
private
|
60
|
+
HTTP_AUTHORIZATION = ::RazorRisk::Cassini::Constants::HTTP_AUTHORIZATION
|
61
|
+
|
62
|
+
public
|
63
|
+
# Supported Content Types.
|
64
|
+
HTTP_ACCEPTS = %w{
|
65
|
+
application/xml
|
66
|
+
application/json
|
67
|
+
text/xml
|
68
|
+
}
|
69
|
+
# Supported HTTP Verb .
|
70
|
+
HTTP_VERB = :post
|
71
|
+
# Supported query parameters.
|
72
|
+
QUERY_PARAMETERS = %w{}
|
73
|
+
# Supported route variables.
|
74
|
+
ROUTE_VARIABLES = %w{}
|
75
|
+
|
76
|
+
|
77
|
+
# ##########################################################
|
78
|
+
# handler
|
79
|
+
|
80
|
+
# Handles an authorisation only login request.
|
81
|
+
#
|
82
|
+
# @param env [::Hash] The Rack request environment (@see
|
83
|
+
# Rack::Request#env).
|
84
|
+
# @param params [::Hash] Validated query parameters (@see
|
85
|
+
# ValidateQueryParametersHelper#validate_query_parameters)
|
86
|
+
# @param request [::Sinatra::Request] The request to be handled.
|
87
|
+
# @param response [::Sinatra::Response] The response object that will be
|
88
|
+
# used for the HTTP response.
|
89
|
+
def handle env, params, request, response
|
90
|
+
|
91
|
+
trace(
|
92
|
+
ParamNames[ :env, :params, :request, :response ],
|
93
|
+
env, params, request, response
|
94
|
+
)
|
95
|
+
|
96
|
+
auth_scheme = settings.authentication_scheme
|
97
|
+
auth = env[HTTP_AUTHORIZATION]
|
98
|
+
|
99
|
+
unless auth
|
100
|
+
halt 401, make_WWW_auth_header(auth_scheme), 'Missing or invalid authenticate header'
|
101
|
+
end
|
102
|
+
|
103
|
+
username, _ = credentials_from_AuthorisationOnly auth
|
104
|
+
|
105
|
+
unless username
|
106
|
+
halt 401, make_WWW_auth_header(auth_scheme), 'Missing or invalid authenticate header'
|
107
|
+
end
|
108
|
+
|
109
|
+
# All we do here is issue a Razor Request for system-status -
|
110
|
+
# since it's arbitrary, really - and verify that it worked
|
111
|
+
|
112
|
+
options = {
|
113
|
+
auth_test_mode: settings.auth_test_mode,
|
114
|
+
auth_scheme: auth_scheme,
|
115
|
+
razor_requester: settings.razor_requester,
|
116
|
+
message_map: settings.message_map,
|
117
|
+
}
|
118
|
+
|
119
|
+
cr = razor_requester_credentials_options(
|
120
|
+
auth_scheme,
|
121
|
+
[ username, nil, nil ],
|
122
|
+
**options
|
123
|
+
)
|
124
|
+
call_system_status(cr, **options)
|
125
|
+
|
126
|
+
status 200
|
127
|
+
|
128
|
+
if request.accept? 'text/plain'
|
129
|
+
|
130
|
+
content_type 'text/plain'
|
131
|
+
''
|
132
|
+
elsif request.accept?('text/xml')
|
133
|
+
|
134
|
+
content_type 'text/xml'
|
135
|
+
%Q{<?xml version="1.0"?><response result="success"/>}
|
136
|
+
elsif request.accept?('application/xml')
|
137
|
+
|
138
|
+
content_type 'application/xml'
|
139
|
+
%Q{<?xml version="1.0"?><response result="success"/>}
|
140
|
+
elsif request.accept? 'application/json'
|
141
|
+
|
142
|
+
content_type 'application/json'
|
143
|
+
'{}'
|
144
|
+
else
|
145
|
+
|
146
|
+
log :violation, 'Invalid accept type'
|
147
|
+
halt 500, {}, 'Oops! Something went wrong!'
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
end # class AuthOnlyLogin
|
152
|
+
|
153
|
+
|
154
|
+
# ##########################################################
|
155
|
+
# module
|
156
|
+
|
157
|
+
end # module Login
|
158
|
+
end # module RouteVerbAdaptors
|
159
|
+
end # module Applications
|
160
|
+
end # module Cassini
|
161
|
+
end # module RazorRisk
|
162
|
+
|
163
|
+
# ############################## end of file ############################# #
|
164
|
+
|
165
|
+
|