~bigbes/core-go

7be038e742a010f4532a9cb1072a1ec95ce158f1 — Drew DeVault 5 years ago 6bcaea6
Make authorization errors more specific
1 files changed, 2 insertions(+), 2 deletions(-)

M server/directives.go
M server/directives.go => server/directives.go +2 -2
@@ 13,7 13,7 @@ func Internal(ctx context.Context, obj interface{},
	next graphql.Resolver) (interface{}, error) {

	if auth.ForContext(ctx).AuthMethod != auth.AUTH_INTERNAL {
		return nil, fmt.Errorf("Access denied")
		return nil, fmt.Errorf("Internal auth access denied")
	}

	return next(ctx)


@@ 47,5 47,5 @@ func Access(ctx context.Context, obj interface{}, next graphql.Resolver,
		panic(fmt.Errorf("Unknown auth method for access check"))
	}

	return nil, fmt.Errorf("Access denied")
	return nil, fmt.Errorf("Access denied for invalid auth method")
}