summaryrefslogtreecommitdiff
path: root/pkg/authz/check_service.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/authz/check_service.go')
-rw-r--r--pkg/authz/check_service.go27
1 files changed, 3 insertions, 24 deletions
diff --git a/pkg/authz/check_service.go b/pkg/authz/check_service.go
index 4f079f9..55560f5 100644
--- a/pkg/authz/check_service.go
+++ b/pkg/authz/check_service.go
@@ -35,14 +35,11 @@ var public map[string]bool = map[string]bool{
}
type CheckService struct {
- client auth.AuthorizationClient
auth.UnimplementedAuthorizationServer
}
-func NewCheckService(client auth.AuthorizationClient) *CheckService {
- return &CheckService{
- client: client,
- }
+func NewCheckService() auth.AuthorizationServer {
+ return &CheckService{}
}
func (svc *CheckService) Check(ctx context.Context, request *auth.CheckRequest) (*auth.CheckResponse, error) {
@@ -57,31 +54,13 @@ func (svc *CheckService) isPublic(ctx context.Context, r *auth.CheckRequest) boo
return ok
}
-func (svc *CheckService) isAuthorized(ctx context.Context, r *auth.CheckRequest) bool {
- if x.IsZero(svc.client) {
- return false
- }
- response, err := svc.client.Check(ctx, r)
- if err != nil {
- pls.LogError(ctx, err)
- return false
- }
- if x.IsZero(response.Status) {
- return false
- }
- if response.Status.Code != int32(codes.OK) {
- return false
- }
- return true
-}
-
func (svc *CheckService) isAllowed(ctx context.Context, r *auth.CheckRequest) bool {
if !svc.validRequest(ctx, r) {
return false
}
log.WithFields(ctx, svc.fieldsFor(r))
- return svc.isAuthorized(ctx, r) || svc.isPublic(ctx, r) || svc.isLoggedIn(ctx, r)
+ return svc.isPublic(ctx, r) || svc.isLoggedIn(ctx, r)
}
func (svc *CheckService) validRequest(ctx context.Context, r *auth.CheckRequest) bool {