mirror of
https://github.com/sigmasternchen/threadule
synced 2025-03-15 08:09:01 +00:00
fix(auth): the header is called Authorization not Authentication
This commit is contained in:
parent
bb350e6c2d
commit
ad9bbed9be
2 changed files with 19 additions and 2 deletions
17
backend/internal/presentation/account.go
Normal file
17
backend/internal/presentation/account.go
Normal file
|
@ -0,0 +1,17 @@
|
|||
package presentation
|
||||
|
||||
import "threadule/backend/internal/web"
|
||||
|
||||
func GetAccounts(ctx *web.Context) {
|
||||
accounts, err := ctx.AppCtx.Logic.GetAccounts(ctx.Session.User)
|
||||
if err != nil {
|
||||
ErrorResponse(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
err = ctx.WriteJSON(accounts)
|
||||
if err != nil {
|
||||
ErrorResponse(ctx, err)
|
||||
return
|
||||
}
|
||||
}
|
|
@ -11,9 +11,9 @@ const authPrefix = "Bearer "
|
|||
|
||||
func authenticated(next web.Handler) web.Handler {
|
||||
return func(ctx *web.Context) {
|
||||
authHeader := ctx.Request.Header.Get("Authentication")
|
||||
authHeader := ctx.Request.Header.Get("Authorization")
|
||||
if !strings.HasPrefix(authHeader, authPrefix) {
|
||||
StatusResponse(ctx, http.StatusBadRequest, "Authentication header missing or malformed")
|
||||
StatusResponse(ctx, http.StatusBadRequest, "Authorization header missing or malformed")
|
||||
return
|
||||
}
|
||||
authHeader = strings.TrimPrefix(authHeader, authPrefix)
|
||||
|
|
Loading…
Reference in a new issue