Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Rework OPA policies with go 'embed' #1018

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
apply review comments
Signed-off-by: denis-tingaikin <[email protected]>
denis-tingaikin committed Aug 18, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 919f3b9ee8958b68270b5010a3fcc65c68a0c33e
2 changes: 1 addition & 1 deletion pkg/networkservice/chains/endpoint/server.go
Original file line number Diff line number Diff line change
@@ -103,8 +103,8 @@ func NewServer(ctx context.Context, tokenGenerator token.GeneratorFunc, options
rv.NetworkServiceServer = chain.NewNamedNetworkServiceServer(
opts.name,
append([]networkservice.NetworkServiceServer{
serialize.NewServer(),
updatepath.NewServer(opts.name),
serialize.NewServer(),
updatetoken.NewServer(tokenGenerator),
opts.authorizeServer,
// `timeout` uses ctx as a context for the timeout Close and it closes only the subsequent chain, so
10 changes: 5 additions & 5 deletions pkg/tools/opa/policies.go
Original file line number Diff line number Diff line change
@@ -18,19 +18,19 @@ package opa

import _ "embed"

//go:embed policies/tokens_valid.opa
//go:embed policies/tokens_valid.rego
var tokensValidPolicySource string

//go:embed policies/prev_token_signed.opa
//go:embed policies/prev_token_signed.rego
var prevTokenSignedPolicySource string

//go:embed policies/curr_token_signed.opa
//go:embed policies/curr_token_signed.rego
var currTokenSignedPolicySource string

//go:embed policies/tokens_chained.opa
//go:embed policies/tokens_chained.rego
var tokensChainedPolicySource string

//go:embed policies/tokens_expired.opa
//go:embed policies/tokens_expired.rego
var tokensExpiredPolicySource string

// WithTokensValidPolicy returns default policy for checking that all tokens in the path can be decoded.
File renamed without changes.
File renamed without changes.
File renamed without changes.