Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM cgr.dev/chainguard/go:latest AS builder
ARG TARGETOS TARGETARCH

WORKDIR /app
# dependencies, add local,dependant package here
# dependencies, add local, dependent package here
COPY protocol/ protocol/
COPY sdk/ sdk/
COPY lib/ lib/
Expand Down
2 changes: 1 addition & 1 deletion docs/grpc/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/openapi/authorization/authorization.openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/openapi/authorization/v2/authorization.openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/openapi/policy/actions/actions.openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/openapi/policy/attributes/attributes.openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/openapi/policy/namespaces/namespaces.openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/openapi/policy/objects.openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/openapi/policy/obligations/obligations.openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/openapi/policy/unsafe/unsafe.openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 28 additions & 15 deletions examples/cmd/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ func listAttributes(cmd *cobra.Command) error {
if err != nil {
return err
}
slog.Info("found attributes in namespace",
slog.Info(
"found attributes in namespace",
slog.Int("count", len(lsr.GetAttributes())),
slog.String("ns", n),
)
Expand All @@ -136,7 +137,8 @@ func listAttributes(cmd *cobra.Command) error {
func nsuuid(ctx context.Context, s *sdk.SDK, u string) (string, error) {
url, err := url.Parse(u)
if err != nil {
slog.Error("namespace url.Parse",
slog.Error(
"namespace url.Parse",
slog.String("url", u),
slog.Any("error", err),
)
Expand Down Expand Up @@ -169,7 +171,7 @@ func attruuid(ctx context.Context, s *sdk.SDK, nsu, fqn string) (string, error)
return a.GetId(), nil
}
}
return "", fmt.Errorf("%w: unable to find attibute [%s]", ErrNotFound, fqn)
return "", fmt.Errorf("%w: unable to find attribute [%s]", ErrNotFound, fqn)
}

func avuuid(ctx context.Context, s *sdk.SDK, auuid, vs string) (string, error) {
Expand All @@ -183,7 +185,7 @@ func avuuid(ctx context.Context, s *sdk.SDK, auuid, vs string) (string, error) {
return v.GetId(), nil
}
}
return "", fmt.Errorf("%w: unable to find attibute value [%s]", ErrNotFound, vs)
return "", fmt.Errorf("%w: unable to find attribute value [%s]", ErrNotFound, vs)
}

func addNamespace(ctx context.Context, s *sdk.SDK, u string) (string, error) {
Expand Down Expand Up @@ -224,7 +226,8 @@ func addAttribute(cmd *cobra.Command) error {
}
attrEl, err := url.PathUnescape(m[2])
if err != nil {
slog.Error("url.PathUnescape(attr)",
slog.Error(
"url.PathUnescape(attr)",
slog.String("attr", m[2]),
slog.Any("error", err),
)
Expand All @@ -234,7 +237,8 @@ func addAttribute(cmd *cobra.Command) error {
if err != nil {
return err
}
slog.Info("created attribute",
slog.Info(
"created attribute",
slog.String("passedin", attrEl),
slog.String("id", aid),
)
Expand Down Expand Up @@ -270,13 +274,15 @@ func removeAttribute(cmd *cobra.Command) error {
Fqn: strings.ToLower(attr),
})
if err != nil {
slog.Error("failed to UnsafeDeleteAttribute",
slog.Error(
"failed to UnsafeDeleteAttribute",
slog.String("id", auuid),
slog.Any("error", err),
)
return err
}
slog.Info("deleted attribute",
slog.Info(
"deleted attribute",
slog.String("attr", attr),
slog.Any("resp", resp),
)
Expand All @@ -286,13 +292,15 @@ func removeAttribute(cmd *cobra.Command) error {
Id: auuid,
})
if err != nil {
slog.Error("failed to DeactivateAttribute",
slog.Error(
"failed to DeactivateAttribute",
slog.String("id", auuid),
slog.Any("error", err),
)
return err
}
slog.Info("deactivated attribute",
slog.Info(
"deactivated attribute",
slog.String("attr", attr),
slog.Any("resp", resp),
)
Expand All @@ -310,13 +318,15 @@ func removeAttribute(cmd *cobra.Command) error {
Fqn: strings.ToLower(attr + "/value/" + url.PathEscape(v)),
})
if err != nil {
slog.Error("failed to UnsafeDeleteAttributeValue",
slog.Error(
"failed to UnsafeDeleteAttributeValue",
slog.Any("error", err),
slog.String("id", avu),
)
return err
}
slog.Info("deactivated attribute value",
slog.Info(
"deactivated attribute value",
slog.String("attr", attr),
slog.String("value", v),
slog.Any("resp", r),
Expand All @@ -326,13 +336,15 @@ func removeAttribute(cmd *cobra.Command) error {
Id: avu,
})
if err != nil {
slog.Error("failed to DeactivateAttributeValue",
slog.Error(
"failed to DeactivateAttributeValue",
slog.String("id", avu),
slog.Any("error", err),
)
return err
}
slog.Info("deactivated attribute value",
slog.Info(
"deactivated attribute value",
slog.String("attr", attr),
slog.String("value", v),
slog.Any("resp", r),
Expand Down Expand Up @@ -364,7 +376,8 @@ func upsertAttr(ctx context.Context, s *sdk.SDK, auth, name string, values []str
})
if err != nil {
//nolint:sloglint // safe to log auth in examples
slog.Error("failed to CreateAttribute",
slog.Error(
"failed to CreateAttribute",
slog.String("auth", auth),
slog.String("name", name),
slog.Any("values", values),
Expand Down
17 changes: 11 additions & 6 deletions lib/fixtures/keycloak.go
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,8 @@ func getRealmRolesByList(ctx context.Context, realmName string, tm *TokenManager
ctx,
token.AccessToken,
realmName,
roleName)
roleName,
)
if err != nil {
slog.Error("error getting realm role for realm",
slog.String("role", roleName),
Expand Down Expand Up @@ -1217,7 +1218,7 @@ func createCertExchange(ctx context.Context, connectParams *KeycloakConnectParam

authExecutions, err := client.GetAuthenticationExecutions(ctx, token.AccessToken, connectParams.Realm, topLevelFlowName)
if err != nil {
slog.Error("error gettings executions", slog.Any("error", err))
slog.Error("error getting executions", slog.Any("error", err))
return err
}
if len(authExecutions) != 1 {
Expand Down Expand Up @@ -1251,7 +1252,8 @@ func createCertExchange(ctx context.Context, connectParams *KeycloakConnectParam
config["x509-cert-auth.certificate-policy-mode"] = "All"
executionConfig["config"] = config
if err := updateExecutionConfig(ctx, client, execution, connectParams, token.AccessToken, executionConfig); err != nil {
slog.Error("error updating x509 auth flow configs",
slog.Error(
"error updating x509 auth flow configs",
slog.String("client_id", clientID),
slog.Any("error", err),
)
Expand All @@ -1260,7 +1262,8 @@ func createCertExchange(ctx context.Context, connectParams *KeycloakConnectParam

execution.Requirement = &requiredRequirement
if err := client.UpdateAuthenticationExecution(ctx, token.AccessToken, connectParams.Realm, topLevelFlowName, *execution); err != nil {
slog.Error("error updating x509 auth flow requjirement",
slog.Error(
"error updating x509 auth flow requjirement",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The typo requjirement was missed during reformatting. It should be corrected to requirement.

Suggested change
"error updating x509 auth flow requjirement",
"error updating x509 auth flow requirement",

slog.String("client_id", clientID),
slog.Any("error", err),
)
Expand Down Expand Up @@ -1295,15 +1298,17 @@ func createCertExchange(ctx context.Context, connectParams *KeycloakConnectParam
flowBindings["direct_grant"] = *flowID
updatedClient.AuthenticationFlowBindingOverrides = &flowBindings
if err := client.UpdateClient(ctx, token.AccessToken, connectParams.Realm, *updatedClient); err != nil {
slog.Error("error updating client auth flow binding overrides",
slog.Error(
"error updating client auth flow binding overrides",
slog.String("client_id", clientID),
slog.Any("error", err),
)
return err
}

//nolint:sloglint // allow existing emojis
slog.Info("✅ created Cert Exchange Authentication",
slog.Info(
"✅ created Cert Exchange Authentication",
slog.String("flow_id", *flowID),
)

Expand Down
2 changes: 1 addition & 1 deletion otdfctl/e2e/registered-resources.bats
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ teardown_file() {
assert_failure
assert_output --partial "Either 'id' or 'fqn' must be provided"

# invalud id
# invalid id
run_otdfctl_reg_res_values get --id 'not_a_uuid'
assert_failure
assert_output --partial "must be a valid UUID"
Expand Down
14 changes: 7 additions & 7 deletions otdfctl/pkg/handlers/kas-registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ type KasIdentifier struct {
URI string
}

func (h Handler) GetKasRegistryEntry(ctx context.Context, identifer KasIdentifier) (*policy.KeyAccessServer, error) {
func (h Handler) GetKasRegistryEntry(ctx context.Context, identifier KasIdentifier) (*policy.KeyAccessServer, error) {
req := &kasregistry.GetKeyAccessServerRequest{}
switch {
case identifer.ID != "":
case identifier.ID != "":
req.Identifier = &kasregistry.GetKeyAccessServerRequest_KasId{
KasId: identifer.ID,
KasId: identifier.ID,
}
case identifer.Name != "":
case identifier.Name != "":
req.Identifier = &kasregistry.GetKeyAccessServerRequest_Name{
Name: identifer.Name,
Name: identifier.Name,
}
case identifer.URI != "":
case identifier.URI != "":
req.Identifier = &kasregistry.GetKeyAccessServerRequest_Uri{
Uri: identifer.URI,
Uri: identifier.URI,
}
default:
return nil, errors.New("id, name or uri must be provided")
Expand Down
2 changes: 1 addition & 1 deletion protocol/go/policy/objects.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading