mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
* fb-998 - authn/z enabled in handlers (kitchen-sink ticket)
- authorization is enabled through the use of a bearer token (using header "Authorization")
- authorization may occur through the use of an "Authorization" header or "molecula-chip" cookie
- ui is updated for changes to handler
* fb-1131 - protect grpc endpoints
- GRPC endpoints now check authorization if auth is enabled
* fb-1129 - inter-node communication
- the following endpoints use the secretKey for authentication:
- /internal/cluster/message: POST
- /internal/translate/data: GET, POST
* added test to api_test.go (TestAuth_MultiNode) testing various auth/permissions stuff on a multi-node cluster
not included:
- fb-1130 - filter response of endpoints
- fb-1109 - improved audit logging
@jaffee [are you not entertained](https://www.youtube.com/watch?v=mutgotxrcqg)
Co-authored-by: souhailanoor <90720110+souhailanoor@users.noreply.github.com>
Co-authored-by: tgruben <tgruben@gmail.com>
Co-authored-by: 54mir <48686912+54mir@users.noreply.github.com>
Co-authored-by: kcrodgers24 <49999391+kcrodgers24@users.noreply.github.com>
40 lines
764 B
Go
40 lines
764 B
Go
package server
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
// unit tests for internal functions
|
|
func TestIsAllowed(t *testing.T) {
|
|
cases := []struct {
|
|
requested []string
|
|
allowed []string
|
|
expected bool
|
|
}{
|
|
{
|
|
requested: []string{"a", "b", "c"},
|
|
allowed: []string{"a", "b", "c", "d", "e"},
|
|
expected: true,
|
|
},
|
|
{
|
|
requested: []string{"a", "b", "c", "f"},
|
|
allowed: []string{"a", "b", "c", "d", "e"},
|
|
expected: false,
|
|
},
|
|
{
|
|
requested: []string{"a", "b", "c"},
|
|
allowed: []string{},
|
|
expected: false,
|
|
},
|
|
}
|
|
|
|
for i, test := range cases {
|
|
t.Run(fmt.Sprint(i), func(t *testing.T) {
|
|
if res := isAllowed(test.requested, test.allowed); res != test.expected {
|
|
t.Errorf("expected %v, got %v", test.expected, res)
|
|
}
|
|
})
|
|
}
|
|
|
|
}
|