mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-21 21:17:13 +02:00
authorize: audit logging (#2050)
* authorize: add databroker server and record version to result, force sync via polling * authorize: audit logging
This commit is contained in:
parent
00e56212ec
commit
f4c4fe314a
18 changed files with 1395 additions and 1390 deletions
29
pkg/grpc/crypt/crypt_test.go
Normal file
29
pkg/grpc/crypt/crypt_test.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
package crypt
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestZerolog(t *testing.T) {
|
||||
var buf bytes.Buffer
|
||||
log := zerolog.New(&buf)
|
||||
log.Info().EmbedObject(&SealedMessage{
|
||||
KeyId: "KEY_ID",
|
||||
DataEncryptionKey: []byte("DATA_ENCRYPTION_KEY"),
|
||||
MessageType: "MESSAGE_TYPE",
|
||||
EncryptedMessage: []byte("ENCRYPTED_MESSAGE"),
|
||||
}).Msg("TEST")
|
||||
|
||||
var msg SealedMessage
|
||||
err := msg.UnmarshalFromRawZerolog(buf.Bytes())
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "KEY_ID", msg.GetKeyId())
|
||||
assert.Equal(t, []byte("DATA_ENCRYPTION_KEY"), msg.GetDataEncryptionKey())
|
||||
assert.Equal(t, "MESSAGE_TYPE", msg.GetMessageType())
|
||||
assert.Equal(t, []byte("ENCRYPTED_MESSAGE"), msg.GetEncryptedMessage())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue