Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
immerda
Immerda Apps
iapi
Commits
b894e415
Commit
b894e415
authored
Oct 03, 2021
by
mh
Browse files
Merge branch 'unsigned_requests' into 'master'
Unsigned requests See merge request
!57
parents
24c0692f
0d657ef2
Pipeline
#8939
passed with stage
in 2 minutes and 32 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/iapi/managers/saml_manager.rb
View file @
b894e415
...
...
@@ -38,26 +38,31 @@ class SamlManager
return
end
attributes
[
:certs
].
each
do
|
fp
,
cert
|
if
document
.
valid_signature?
(
fp
)
saml_request
.
service_provider
.
cert
=
cert
saml_request
.
service_provider
.
fingerprint
=
fp
end
end
# For unsigned requests the default cert1 will always be used to encrypt
# the response, since we cannot tell from the request, which one is
# the currently active one
unless
attributes
[
:allow_unsigned_requests
]
unless
saml_request
.
service_provider
.
attributes
[
:validate_signature
]
IApiLog
.
warn
(
"SP
#{
saml_request
.
issuer
}
is misconfigured. we are "
+
"not sure it has to sign"
)
unless
saml_request
.
service_provider
.
cert
if
attributes
[
:allow_unsigned_requests
]
(
fp
,
cert
)
=
attributes
[
:certs
].
first
saml_request
.
service_provider
.
cert
=
cert
saml_request
.
service_provider
.
fingerprint
=
fp
else
IApiLog
.
warn
(
"SP
#{
saml_request
.
issuer
}
did not sign the request."
)
return
end
attributes
[
:certs
].
each
do
|
fp
,
cert
|
if
document
.
valid_signature?
(
fp
)
saml_request
.
service_provider
.
cert
=
cert
saml_request
.
service_provider
.
fingerprint
=
fp
end
end
end
unless
saml_request
.
valid?
IApiLog
.
warn
(
"Got a SAML request from
#{
saml_request
.
issuer
}
with an "
+
"invalid
(or missing)
signature"
)
"invalid signature"
)
return
end
...
...
lib/iapi/routes/auth.rb
View file @
b894e415
...
...
@@ -24,7 +24,7 @@ class IApi < Sinatra::Base
user
=
AuthManager
.
auth
(
email
,
parsed_body
,
false
,
unlock:
parsed_body
[
'unlock'
],
master_pw:
info
[
:needs_master_pw
],
master_pw:
info
&&
info
[
:needs_master_pw
],
trusted:
true
,
totp:
parsed_body
[
'totp'
],
webauthn:
parsed_body
[
'webauthn'
],
...
...
lib/iapi/saml.rb
View file @
b894e415
...
...
@@ -35,6 +35,7 @@ class IApiSamlConfig
api_access:
params
[
'api_access'
],
max_reissue_time:
params
[
'max_reissue_time'
],
max_reissue_time_2fa:
params
[
'max_reissue_time_2fa'
],
allow_unsigned_requests:
params
[
'allow_unsigned_requests'
],
}
aliases
.
each
do
|
a
|
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment