Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
9b38eaf9
Commit
9b38eaf9
authored
Jan 04, 2017
by
xilabao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
omit the reason if we don't have an error when using rbac
parent
f95362f9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
errors.go
pkg/genericapiserver/api/handlers/responsewriters/errors.go
+6
-1
rbac.go
plugin/pkg/auth/authorizer/rbac/rbac.go
+5
-1
No files found.
pkg/genericapiserver/api/handlers/responsewriters/errors.go
View file @
9b38eaf9
...
...
@@ -38,7 +38,12 @@ func Forbidden(attributes authorizer.Attributes, w http.ResponseWriter, req *htt
w
.
Header
()
.
Set
(
"Content-Type"
,
"text/plain"
)
w
.
Header
()
.
Set
(
"X-Content-Type-Options"
,
"nosniff"
)
w
.
WriteHeader
(
http
.
StatusForbidden
)
fmt
.
Fprintf
(
w
,
"%s: %q"
,
msg
,
reason
)
if
len
(
reason
)
==
0
{
fmt
.
Fprintf
(
w
,
"%s"
,
msg
)
}
else
{
fmt
.
Fprintf
(
w
,
"%s: %q"
,
msg
,
reason
)
}
}
func
forbiddenMessage
(
attributes
authorizer
.
Attributes
)
string
{
...
...
plugin/pkg/auth/authorizer/rbac/rbac.go
View file @
9b38eaf9
...
...
@@ -48,7 +48,11 @@ func (r *RBACAuthorizer) Authorize(requestAttributes authorizer.Attributes) (boo
glog
.
V
(
2
)
.
Infof
(
"RBAC DENY: user %q groups %v cannot %q on
\"
%v.%v/%v
\"
"
,
requestAttributes
.
GetUser
()
.
GetName
(),
requestAttributes
.
GetUser
()
.
GetGroups
(),
requestAttributes
.
GetVerb
(),
requestAttributes
.
GetResource
(),
requestAttributes
.
GetAPIGroup
(),
requestAttributes
.
GetSubresource
())
return
false
,
fmt
.
Sprintf
(
"%v"
,
ruleResolutionError
),
nil
reason
:=
""
if
ruleResolutionError
!=
nil
{
reason
=
fmt
.
Sprintf
(
"%v"
,
ruleResolutionError
)
}
return
false
,
reason
,
nil
}
func
New
(
roles
validation
.
RoleGetter
,
roleBindings
validation
.
RoleBindingLister
,
clusterRoles
validation
.
ClusterRoleGetter
,
clusterRoleBindings
validation
.
ClusterRoleBindingLister
)
*
RBACAuthorizer
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment