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
IRMA
Github mirrors
irmago
Commits
bad853a1
Commit
bad853a1
authored
Feb 04, 2020
by
Leon
Committed by
David Venhoek
Mar 03, 2020
Browse files
Server emits specific error in case the requests's Content-Type is not properly set
parent
3d1f7cde
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/requestorserver/server.go
View file @
bad853a1
...
...
@@ -312,9 +312,12 @@ func (s *Server) handleCreate(w http.ResponseWriter, r *http.Request) {
return
}
if
!
applies
{
s
.
conf
.
Logger
.
Warnf
(
"Session request uses unknown authentication method, HTTP headers: %s, HTTP POST body: %s"
,
server
.
ToJson
(
r
.
Header
),
string
(
body
))
server
.
WriteError
(
w
,
server
.
ErrorInvalidRequest
,
"Request could not be authorized"
)
if
r
.
Header
.
Get
(
"Content-Type"
)
!=
"application/json"
{
server
.
WriteError
(
w
,
server
.
ErrorInvalidRequest
,
"Content-Type is not
\"
application/json
\"
"
)
return
}
s
.
conf
.
Logger
.
Warnf
(
"Session request uses unknown authentication method, HTTP headers: %s, HTTP POST body: %s"
,
server
.
ToJson
(
r
.
Header
),
string
(
body
))
server
.
WriteError
(
w
,
server
.
ErrorInvalidRequest
,
"Request could not be authenticated"
)
return
}
...
...
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