Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
zbindenren committed Jun 18, 2024
1 parent 63478b6 commit a3d9985
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 60 deletions.
10 changes: 5 additions & 5 deletions internal/cmd/server/rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package server

import (
discoveryv1connect "github.com/postfinance/discovery/pkg/discoverypb/postfinance/discovery/v1/discoveryv1connect"
goauth "gitlab.pnet.ch/linux/go/auth"
"gitlab.pnet.ch/linux/go/auth"
)

func rbacConfig() []goauth.Config {
return []goauth.Config{
func rbacConfig() []auth.Config {
return []auth.Config{
{
Role: "cop_appl_linux",
Rules: []goauth.Rule{
Rules: []auth.Rule{
{
Service: discoveryv1connect.NamespaceAPIName,
Methods: []string{
Expand Down Expand Up @@ -46,7 +46,7 @@ func rbacConfig() []goauth.Config {
},
{
Role: "machine",
Rules: []goauth.Rule{
Rules: []auth.Rule{
{
Service: discoveryv1connect.NamespaceAPIName,
Methods: []string{
Expand Down
7 changes: 3 additions & 4 deletions internal/server/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
discoveryv1 "github.com/postfinance/discovery/pkg/discoverypb/postfinance/discovery/v1"
discoveryv1connect "github.com/postfinance/discovery/pkg/discoverypb/postfinance/discovery/v1/discoveryv1connect"
"gitlab.pnet.ch/linux/go/auth"
goauth "gitlab.pnet.ch/linux/go/auth"
"gitlab.pnet.ch/linux/go/auth/self"

Check failure on line 20 in internal/server/api.go

View workflow job for this annotation

GitHub Actions / test

unrecognized import path "gitlab.pnet.ch/linux/go/auth": https fetch: Get "https://gitlab.pnet.ch/linux/go/auth?go-get=1": dial tcp: lookup gitlab.pnet.ch on 127.0.0.53:53: no such host
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down Expand Up @@ -167,7 +166,7 @@ func (a *API) Create(_ context.Context, req *connect.Request[discoveryv1.CreateR
expiry = d
}

u := goauth.User{
u := auth.User{
Name: req.Msg.GetId(),
Roles: req.Msg.GetRoles(),
Data: req.Msg.GetNamespaces(),
Expand All @@ -194,7 +193,7 @@ func (a *API) Info(ctx context.Context, in *connect.Request[discoveryv1.InfoRequ

ns := []string{}

userNS := goauth.MustGetData[[]string](*u)
userNS := auth.MustGetData[[]string](*u)
if userNS != nil {
ns = *userNS
}
Expand Down Expand Up @@ -314,7 +313,7 @@ func (a *API) UnregisterNamespace(_ context.Context, req *connect.Request[discov
}

func verifyNamespace(ctx context.Context, namespace string) error {
u, ok := goauth.UserFromContext(ctx)
u, ok := auth.UserFromContext(ctx)
if !ok {
return status.Errorf(codes.Unauthenticated, "unauthententicated user")
}
Expand Down
51 changes: 0 additions & 51 deletions internal/server/log.go

This file was deleted.

0 comments on commit a3d9985

Please sign in to comment.