mirror of
https://github.com/genuinetools/reg.git
synced 2024-09-12 06:11:03 -04:00
26 lines
796 B
Go
26 lines
796 B
Go
package impersonation
|
|
|
|
import "github.com/docker/cli/kubernetes/compose/clone"
|
|
|
|
// Config contains the data required to impersonate a user.
|
|
type Config struct {
|
|
// UserName is the username to impersonate on each request.
|
|
UserName string
|
|
// Groups are the groups to impersonate on each request.
|
|
Groups []string
|
|
// Extra is a free-form field which can be used to link some authentication information
|
|
// to authorization information. This field allows you to impersonate it.
|
|
Extra map[string][]string
|
|
}
|
|
|
|
// Clone clones the impersonation config
|
|
func (ic *Config) Clone() *Config {
|
|
if ic == nil {
|
|
return nil
|
|
}
|
|
result := new(Config)
|
|
result.UserName = ic.UserName
|
|
result.Groups = clone.SliceOfString(ic.Groups)
|
|
result.Extra = clone.MapOfStringToSliceOfString(ic.Extra)
|
|
return result
|
|
}
|