mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47:50 +00:00
Get user from request and put in authz attribs.
Added integration tests for user-based auth.
This commit is contained in:
@@ -16,10 +16,14 @@ limitations under the License.
|
||||
|
||||
package authorizer
|
||||
|
||||
import (
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/auth/user"
|
||||
)
|
||||
|
||||
// Attributes is an interface used by an Authorizer to get information about a request
|
||||
// that is used to make an authorization decision.
|
||||
type Attributes interface {
|
||||
// TODO: add attribute getter functions, e.g. GetUserName(), per #1430.
|
||||
GetUserName() string
|
||||
}
|
||||
|
||||
// Authorizer makes an authorization decision based on information gained by making
|
||||
@@ -28,3 +32,12 @@ type Attributes interface {
|
||||
type Authorizer interface {
|
||||
Authorize(a Attributes) (err error)
|
||||
}
|
||||
|
||||
// AttributesRecord implements Attributes interface.
|
||||
type AttributesRecord struct {
|
||||
User user.Info
|
||||
}
|
||||
|
||||
func (a *AttributesRecord) GetUserName() string {
|
||||
return a.User.GetName()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user