authorize: use atomic state for properties (#1290)

This commit is contained in:
Caleb Doxsey 2020-08-17 14:24:06 -06:00 committed by GitHub
parent c0e230acbb
commit 6dee647a16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 131 additions and 90 deletions

View file

@ -116,15 +116,15 @@ func TestAuthorize_getJWTClaimHeaders(t *testing.T) {
}},
}},
}
a := &Authorize{currentOptions: config.NewAtomicOptions()}
a := &Authorize{currentOptions: config.NewAtomicOptions(), state: newAtomicAuthorizeState(new(authorizeState))}
encoder, _ := jws.NewHS256Signer([]byte{0, 0, 0, 0}, "")
a.currentEncoder.Store(encoder)
a.state.Load().encoder = encoder
a.currentOptions.Store(opt)
a.store = evaluator.NewStore()
pe, err := newPolicyEvaluator(opt, a.store)
require.NoError(t, err)
a.pe = pe
signedJWT, _ := a.pe.SignedJWT(a.pe.JWTPayload(&evaluator.Request{
a.state.Load().evaluator = pe
signedJWT, _ := pe.SignedJWT(pe.JWTPayload(&evaluator.Request{
DataBrokerData: evaluator.DataBrokerData{
"type.googleapis.com/session.Session": map[string]interface{}{
"SESSION_ID": &session.Session{