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
a2063077
Commit
a2063077
authored
Jan 30, 2020
by
David Venhoek
Committed by
Sietse Ringers
Dec 11, 2020
Browse files
Updated keyshareserver authorization header parsing to strip "Bearer " when present.
parent
39434646
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/keyshareserver/server.go
View file @
a2063077
...
...
@@ -127,6 +127,9 @@ func (s *Server) handleCommitments(w http.ResponseWriter, r *http.Request) {
// Extract username and authorization from request
username
:=
r
.
Header
.
Get
(
"X-IRMA-Keyshare-Username"
)
authorization
:=
r
.
Header
.
Get
(
"Authorization"
)
if
strings
.
HasPrefix
(
authorization
,
"Bearer "
)
{
authorization
=
authorization
[
7
:
]
}
user
,
err
:=
s
.
db
.
User
(
username
)
if
err
!=
nil
{
...
...
@@ -187,6 +190,9 @@ func (s *Server) handleResponse(w http.ResponseWriter, r *http.Request) {
// Extract username and authorization from request
username
:=
r
.
Header
.
Get
(
"X-IRMA-Keyshare-Username"
)
authorization
:=
r
.
Header
.
Get
(
"Authorization"
)
if
strings
.
HasPrefix
(
authorization
,
"Bearer "
)
{
authorization
=
authorization
[
7
:
]
}
// Fetch user
user
,
err
:=
s
.
db
.
User
(
username
)
...
...
@@ -235,6 +241,9 @@ func (s *Server) handleValidate(w http.ResponseWriter, r *http.Request) {
// Extract username and authorization from request
username
:=
r
.
Header
.
Get
(
"X-IRMA-Keyshare-Username"
)
authorization
:=
r
.
Header
.
Get
(
"Authorization"
)
if
strings
.
HasPrefix
(
authorization
,
"Bearer "
)
{
authorization
=
authorization
[
7
:
]
}
// Fetch user
user
,
err
:=
s
.
db
.
User
(
username
)
...
...
Write
Preview
Supports
Markdown
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