Commit d14a7d11 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Switch to correct HTTP header when using API tokens for requestor authentication

parent 453acca7
Pipeline #19079 passed with stages
in 7 minutes and 31 seconds
......@@ -150,7 +150,7 @@ func postRequest(serverurl string, request irma.RequestorRequest, name, authmeth
case "none":
err = transport.Post("session", qr, request)
case "token":
transport.SetHeader("Authentication", key)
transport.SetHeader("Authorization", key)
err = transport.Post("session", qr, request)
case "hmac", "rsa":
var jwtstr string
......
......@@ -58,7 +58,7 @@ var authenticators map[AuthenticationMethod]Authenticator
func (NilAuthenticator) Authenticate(
headers http.Header, body []byte,
) (bool, irma.RequestorRequest, string, *irma.RemoteError) {
if headers.Get("Authentication") != "" || !strings.HasPrefix(headers.Get("Content-Type"), "application/json") {
if headers.Get("Authorization") != "" || !strings.HasPrefix(headers.Get("Content-Type"), "application/json") {
return false, nil, "", nil
}
request, err := server.ParseSessionRequest(body)
......@@ -119,7 +119,7 @@ func (pkauth *PublicKeyAuthenticator) Initialize(name string, requestor Requesto
func (pskauth *PresharedKeyAuthenticator) Authenticate(
headers http.Header, body []byte,
) (bool, irma.RequestorRequest, string, *irma.RemoteError) {
auth := headers.Get("Authentication")
auth := headers.Get("Authorization")
if auth == "" || !strings.HasPrefix(headers.Get("Content-Type"), "application/json") {
return false, nil, "", nil
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment