mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
Linux PAM reports "Authentication Failure" OpenPAM reports "authentication error" This resulted in forgejo reporting error 500 on FreeBSD when pam authentication failed. Add a sentinel error to make this portable: ErrInvalidCredentials Signed-off-by: Baptiste Daroussin <bapt@FreeBSD.org> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11296 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Baptiste Daroussin <bapt@FreeBSD.org> Co-committed-by: Baptiste Daroussin <bapt@FreeBSD.org>
20 lines
404 B
Go
20 lines
404 B
Go
//go:build pam
|
|
|
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package pam
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestPamAuth(t *testing.T) {
|
|
result, err := Auth("gitea", "user1", "false-pwd")
|
|
require.Error(t, err)
|
|
assert.ErrorIs(t, err, ErrInvalidCredentials)
|
|
assert.Len(t, result, 0)
|
|
}
|