Skip to content

Commit

Permalink
log trust values from configuration on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
johnabass committed Nov 22, 2024
1 parent 1989060 commit 356930f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions token/claimBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,13 @@ func NewClaimBuilders(n random.Noncer, client xhttpclient.Interface, o Options)
})
}

// NOTE: newClientCertificateClaimBuiler always returns a non-nil builder
if cb, err := newClientCertificateClaimBuiler(o.ClientCertificates); err == nil {
cb, err := newClientCertificateClaimBuiler(o.ClientCertificates)
if err == nil {
builders = append(
builders,
cb,
)
}

return builders, nil
return builders, err
}
8 changes: 8 additions & 0 deletions token/unmarshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import (
"github.com/xmidt-org/themis/xhttp/xhttpclient"

"go.uber.org/fx"
"go.uber.org/zap"
)

type TokenIn struct {
fx.In

Logger *zap.Logger
Noncer random.Noncer `optional:"true"`
Keys key.Registry
Unmarshaller config.Unmarshaller
Expand All @@ -38,6 +40,12 @@ func Unmarshal(configKey string, b ...RequestBuilder) func(TokenIn) (TokenOut, e
return TokenOut{}, err
}

if o.ClientCertificates != nil {
in.Logger.Info("trust settings", zap.Reflect("trust", o.ClientCertificates.Trust))
} else {
in.Logger.Info("trust settings", zap.Reflect("trust", Trust{}.enforceDefaults()))
}

cb, err := NewClaimBuilders(in.Noncer, in.Client, o)
if err != nil {
return TokenOut{}, err
Expand Down
2 changes: 2 additions & 0 deletions token/unmarshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package token
import (
"testing"

"github.com/xmidt-org/sallust"
"github.com/xmidt-org/themis/config"
"github.com/xmidt-org/themis/key"

Expand Down Expand Up @@ -146,6 +147,7 @@ func testUnmarshalSuccess(t *testing.T) {

app = fxtest.New(t,
fx.Provide(
sallust.Default,
config.ProvideViper(
config.Json(`
{
Expand Down

0 comments on commit 356930f

Please sign in to comment.