id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
24,200
gravitational/teleport
lib/httplib/httplib.go
SafeRedirect
func SafeRedirect(w http.ResponseWriter, r *http.Request, redirectURL string) error { parsedURL, err := url.Parse(redirectURL) if err != nil { return trace.Wrap(err) } http.Redirect(w, r, parsedURL.RequestURI(), http.StatusFound) return nil }
go
func SafeRedirect(w http.ResponseWriter, r *http.Request, redirectURL string) error { parsedURL, err := url.Parse(redirectURL) if err != nil { return trace.Wrap(err) } http.Redirect(w, r, parsedURL.RequestURI(), http.StatusFound) return nil }
[ "func", "SafeRedirect", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "redirectURL", "string", ")", "error", "{", "parsedURL", ",", "err", ":=", "url", ".", "Parse", "(", "redirectURL", ")", "\n", "if", "err", "!=...
// SafeRedirect performs a relative redirect to the URI part of the provided redirect URL
[ "SafeRedirect", "performs", "a", "relative", "redirect", "to", "the", "URI", "part", "of", "the", "provided", "redirect", "URL" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/httplib/httplib.go#L161-L168
24,201
gravitational/teleport
lib/srv/ctx.go
CreateOrJoinSession
func (c *ServerContext) CreateOrJoinSession(reg *SessionRegistry) error { // As SSH conversation progresses, at some point a session will be created and // its ID will be added to the environment ssid, found := c.GetEnv(sshutils.SessionEnvVar) if !found { return nil } // make sure whatever session is requested ...
go
func (c *ServerContext) CreateOrJoinSession(reg *SessionRegistry) error { // As SSH conversation progresses, at some point a session will be created and // its ID will be added to the environment ssid, found := c.GetEnv(sshutils.SessionEnvVar) if !found { return nil } // make sure whatever session is requested ...
[ "func", "(", "c", "*", "ServerContext", ")", "CreateOrJoinSession", "(", "reg", "*", "SessionRegistry", ")", "error", "{", "// As SSH conversation progresses, at some point a session will be created and", "// its ID will be added to the environment", "ssid", ",", "found", ":=",...
// CreateOrJoinSession will look in the SessionRegistry for the session ID. If // no session is found, a new one is created. If one is found, it is returned.
[ "CreateOrJoinSession", "will", "look", "in", "the", "SessionRegistry", "for", "the", "session", "ID", ".", "If", "no", "session", "is", "found", "a", "new", "one", "is", "created", ".", "If", "one", "is", "found", "it", "is", "returned", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/ctx.go#L332-L360
24,202
gravitational/teleport
lib/srv/ctx.go
UpdateClientActivity
func (c *ServerContext) UpdateClientActivity() { c.Lock() defer c.Unlock() c.clientLastActive = c.srv.GetClock().Now().UTC() }
go
func (c *ServerContext) UpdateClientActivity() { c.Lock() defer c.Unlock() c.clientLastActive = c.srv.GetClock().Now().UTC() }
[ "func", "(", "c", "*", "ServerContext", ")", "UpdateClientActivity", "(", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "c", ".", "clientLastActive", "=", "c", ".", "srv", ".", "GetClock", "(", ")", ".", ...
// UpdateClientActivity sets last recorded client activity associated with this context // either channel or session
[ "UpdateClientActivity", "sets", "last", "recorded", "client", "activity", "associated", "with", "this", "context", "either", "channel", "or", "session" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/ctx.go#L371-L375
24,203
gravitational/teleport
lib/srv/ctx.go
GetAgent
func (c *ServerContext) GetAgent() agent.Agent { c.RLock() defer c.RUnlock() return c.agent }
go
func (c *ServerContext) GetAgent() agent.Agent { c.RLock() defer c.RUnlock() return c.agent }
[ "func", "(", "c", "*", "ServerContext", ")", "GetAgent", "(", ")", "agent", ".", "Agent", "{", "c", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "RUnlock", "(", ")", "\n", "return", "c", ".", "agent", "\n", "}" ]
// GetAgent returns a agent.Agent which represents the capabilities of an SSH agent.
[ "GetAgent", "returns", "a", "agent", ".", "Agent", "which", "represents", "the", "capabilities", "of", "an", "SSH", "agent", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/ctx.go#L386-L390
24,204
gravitational/teleport
lib/srv/ctx.go
GetAgentChannel
func (c *ServerContext) GetAgentChannel() ssh.Channel { c.RLock() defer c.RUnlock() return c.agentChannel }
go
func (c *ServerContext) GetAgentChannel() ssh.Channel { c.RLock() defer c.RUnlock() return c.agentChannel }
[ "func", "(", "c", "*", "ServerContext", ")", "GetAgentChannel", "(", ")", "ssh", ".", "Channel", "{", "c", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "RUnlock", "(", ")", "\n", "return", "c", ".", "agentChannel", "\n", "}" ]
// GetAgentChannel returns the channel over which communication with the agent occurs.
[ "GetAgentChannel", "returns", "the", "channel", "over", "which", "communication", "with", "the", "agent", "occurs", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/ctx.go#L393-L397
24,205
gravitational/teleport
lib/srv/ctx.go
SetAgent
func (c *ServerContext) SetAgent(a agent.Agent, channel ssh.Channel) { c.Lock() defer c.Unlock() if c.agentChannel != nil { c.Infof("closing previous agent channel") c.agentChannel.Close() } c.agentChannel = channel c.agent = a }
go
func (c *ServerContext) SetAgent(a agent.Agent, channel ssh.Channel) { c.Lock() defer c.Unlock() if c.agentChannel != nil { c.Infof("closing previous agent channel") c.agentChannel.Close() } c.agentChannel = channel c.agent = a }
[ "func", "(", "c", "*", "ServerContext", ")", "SetAgent", "(", "a", "agent", ".", "Agent", ",", "channel", "ssh", ".", "Channel", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "if", "c", ".", "agentChanne...
// SetAgent sets the agent and channel over which communication with the agent occurs.
[ "SetAgent", "sets", "the", "agent", "and", "channel", "over", "which", "communication", "with", "the", "agent", "occurs", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/ctx.go#L400-L409
24,206
gravitational/teleport
lib/srv/ctx.go
GetTerm
func (c *ServerContext) GetTerm() Terminal { c.RLock() defer c.RUnlock() return c.term }
go
func (c *ServerContext) GetTerm() Terminal { c.RLock() defer c.RUnlock() return c.term }
[ "func", "(", "c", "*", "ServerContext", ")", "GetTerm", "(", ")", "Terminal", "{", "c", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "RUnlock", "(", ")", "\n\n", "return", "c", ".", "term", "\n", "}" ]
// GetTerm returns a Terminal.
[ "GetTerm", "returns", "a", "Terminal", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/ctx.go#L412-L417
24,207
gravitational/teleport
lib/srv/ctx.go
SetTerm
func (c *ServerContext) SetTerm(t Terminal) { c.Lock() defer c.Unlock() c.term = t }
go
func (c *ServerContext) SetTerm(t Terminal) { c.Lock() defer c.Unlock() c.term = t }
[ "func", "(", "c", "*", "ServerContext", ")", "SetTerm", "(", "t", "Terminal", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n\n", "c", ".", "term", "=", "t", "\n", "}" ]
// SetTerm set a Terminal.
[ "SetTerm", "set", "a", "Terminal", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/ctx.go#L420-L425
24,208
gravitational/teleport
lib/srv/ctx.go
SetEnv
func (c *ServerContext) SetEnv(key, val string) { c.env[key] = val }
go
func (c *ServerContext) SetEnv(key, val string) { c.env[key] = val }
[ "func", "(", "c", "*", "ServerContext", ")", "SetEnv", "(", "key", ",", "val", "string", ")", "{", "c", ".", "env", "[", "key", "]", "=", "val", "\n", "}" ]
// SetEnv sets a environment variable within this context.
[ "SetEnv", "sets", "a", "environment", "variable", "within", "this", "context", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/ctx.go#L428-L430
24,209
gravitational/teleport
lib/srv/ctx.go
GetEnv
func (c *ServerContext) GetEnv(key string) (string, bool) { val, ok := c.env[key] return val, ok }
go
func (c *ServerContext) GetEnv(key string) (string, bool) { val, ok := c.env[key] return val, ok }
[ "func", "(", "c", "*", "ServerContext", ")", "GetEnv", "(", "key", "string", ")", "(", "string", ",", "bool", ")", "{", "val", ",", "ok", ":=", "c", ".", "env", "[", "key", "]", "\n", "return", "val", ",", "ok", "\n", "}" ]
// GetEnv returns a environment variable within this context.
[ "GetEnv", "returns", "a", "environment", "variable", "within", "this", "context", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/ctx.go#L433-L436
24,210
gravitational/teleport
lib/srv/ctx.go
SendExecResult
func (c *ServerContext) SendExecResult(r ExecResult) { select { case c.ExecResultCh <- r: default: log.Infof("blocked on sending exec result %v", r) } }
go
func (c *ServerContext) SendExecResult(r ExecResult) { select { case c.ExecResultCh <- r: default: log.Infof("blocked on sending exec result %v", r) } }
[ "func", "(", "c", "*", "ServerContext", ")", "SendExecResult", "(", "r", "ExecResult", ")", "{", "select", "{", "case", "c", ".", "ExecResultCh", "<-", "r", ":", "default", ":", "log", ".", "Infof", "(", "\"", "\"", ",", "r", ")", "\n", "}", "\n", ...
// SendExecResult sends the result of execution of the "exec" command over the // ExecResultCh.
[ "SendExecResult", "sends", "the", "result", "of", "execution", "of", "the", "exec", "command", "over", "the", "ExecResultCh", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/ctx.go#L520-L526
24,211
gravitational/teleport
lib/srv/ctx.go
SendSubsystemResult
func (c *ServerContext) SendSubsystemResult(r SubsystemResult) { select { case c.SubsystemResultCh <- r: default: c.Infof("blocked on sending subsystem result") } }
go
func (c *ServerContext) SendSubsystemResult(r SubsystemResult) { select { case c.SubsystemResultCh <- r: default: c.Infof("blocked on sending subsystem result") } }
[ "func", "(", "c", "*", "ServerContext", ")", "SendSubsystemResult", "(", "r", "SubsystemResult", ")", "{", "select", "{", "case", "c", ".", "SubsystemResultCh", "<-", "r", ":", "default", ":", "c", ".", "Infof", "(", "\"", "\"", ")", "\n", "}", "\n", ...
// SendSubsystemResult sends the result of running the subsystem over the // SubsystemResultCh.
[ "SendSubsystemResult", "sends", "the", "result", "of", "running", "the", "subsystem", "over", "the", "SubsystemResultCh", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/ctx.go#L530-L536
24,212
gravitational/teleport
lib/srv/ctx.go
ProxyPublicAddress
func (c *ServerContext) ProxyPublicAddress() string { proxyHost := "<proxyhost>:3080" if c.srv == nil { return proxyHost } proxies, err := c.srv.GetAccessPoint().GetProxies() if err != nil { c.Errorf("Unable to retrieve proxy list: %v", err) } if len(proxies) > 0 { proxyHost = proxies[0].GetPublicAddr()...
go
func (c *ServerContext) ProxyPublicAddress() string { proxyHost := "<proxyhost>:3080" if c.srv == nil { return proxyHost } proxies, err := c.srv.GetAccessPoint().GetProxies() if err != nil { c.Errorf("Unable to retrieve proxy list: %v", err) } if len(proxies) > 0 { proxyHost = proxies[0].GetPublicAddr()...
[ "func", "(", "c", "*", "ServerContext", ")", "ProxyPublicAddress", "(", ")", "string", "{", "proxyHost", ":=", "\"", "\"", "\n\n", "if", "c", ".", "srv", "==", "nil", "{", "return", "proxyHost", "\n", "}", "\n\n", "proxies", ",", "err", ":=", "c", "....
// ProxyPublicAddress tries to get the public address from the first // available proxy. if public_address is not set, fall back to the hostname // of the first proxy we get back.
[ "ProxyPublicAddress", "tries", "to", "get", "the", "public", "address", "from", "the", "first", "available", "proxy", ".", "if", "public_address", "is", "not", "set", "fall", "back", "to", "the", "hostname", "of", "the", "first", "proxy", "we", "get", "back"...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/ctx.go#L541-L562
24,213
gravitational/teleport
lib/srv/ctx.go
NewTrackingReader
func NewTrackingReader(ctx *ServerContext, r io.Reader) *TrackingReader { return &TrackingReader{ctx: ctx, r: r} }
go
func NewTrackingReader(ctx *ServerContext, r io.Reader) *TrackingReader { return &TrackingReader{ctx: ctx, r: r} }
[ "func", "NewTrackingReader", "(", "ctx", "*", "ServerContext", ",", "r", "io", ".", "Reader", ")", "*", "TrackingReader", "{", "return", "&", "TrackingReader", "{", "ctx", ":", "ctx", ",", "r", ":", "r", "}", "\n", "}" ]
// NewTrackingReader returns a new instance of // activity tracking reader.
[ "NewTrackingReader", "returns", "a", "new", "instance", "of", "activity", "tracking", "reader", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/ctx.go#L595-L597
24,214
gravitational/teleport
lib/srv/ctx.go
Read
func (a *TrackingReader) Read(b []byte) (int, error) { a.ctx.UpdateClientActivity() return a.r.Read(b) }
go
func (a *TrackingReader) Read(b []byte) (int, error) { a.ctx.UpdateClientActivity() return a.r.Read(b) }
[ "func", "(", "a", "*", "TrackingReader", ")", "Read", "(", "b", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "a", ".", "ctx", ".", "UpdateClientActivity", "(", ")", "\n", "return", "a", ".", "r", ".", "Read", "(", "b", ")", "\n", ...
// Read passes the read through to internal // reader, and updates activity of the server context
[ "Read", "passes", "the", "read", "through", "to", "internal", "reader", "and", "updates", "activity", "of", "the", "server", "context" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/srv/ctx.go#L609-L612
24,215
gravitational/teleport
lib/pam/config.go
CheckDefaults
func (c *Config) CheckDefaults() error { if c.ServiceName == "" { return trace.BadParameter("required parameter ServiceName missing") } if c.Username == "" { return trace.BadParameter("required parameter Username missing") } if c.Stdin == nil { return trace.BadParameter("required parameter Stdin missing") }...
go
func (c *Config) CheckDefaults() error { if c.ServiceName == "" { return trace.BadParameter("required parameter ServiceName missing") } if c.Username == "" { return trace.BadParameter("required parameter Username missing") } if c.Stdin == nil { return trace.BadParameter("required parameter Stdin missing") }...
[ "func", "(", "c", "*", "Config", ")", "CheckDefaults", "(", ")", "error", "{", "if", "c", ".", "ServiceName", "==", "\"", "\"", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "c", ".", "Username", "==", ...
// CheckDefaults makes sure the Config structure has minimum required values.
[ "CheckDefaults", "makes", "sure", "the", "Config", "structure", "has", "minimum", "required", "values", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/pam/config.go#L53-L71
24,216
gravitational/teleport
lib/auth/permissions.go
NewAdminContext
func NewAdminContext() (*AuthContext, error) { authContext, err := contextForBuiltinRole("", nil, teleport.RoleAdmin, fmt.Sprintf("%v", teleport.RoleAdmin)) if err != nil { return nil, trace.Wrap(err) } return authContext, nil }
go
func NewAdminContext() (*AuthContext, error) { authContext, err := contextForBuiltinRole("", nil, teleport.RoleAdmin, fmt.Sprintf("%v", teleport.RoleAdmin)) if err != nil { return nil, trace.Wrap(err) } return authContext, nil }
[ "func", "NewAdminContext", "(", ")", "(", "*", "AuthContext", ",", "error", ")", "{", "authContext", ",", "err", ":=", "contextForBuiltinRole", "(", "\"", "\"", ",", "nil", ",", "teleport", ".", "RoleAdmin", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ...
// NewAdminContext returns new admin auth context
[ "NewAdminContext", "returns", "new", "admin", "auth", "context" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/permissions.go#L31-L37
24,217
gravitational/teleport
lib/auth/permissions.go
NewRoleAuthorizer
func NewRoleAuthorizer(clusterName string, clusterConfig services.ClusterConfig, r teleport.Role) (Authorizer, error) { authContext, err := contextForBuiltinRole(clusterName, clusterConfig, r, fmt.Sprintf("%v", r)) if err != nil { return nil, trace.Wrap(err) } return &contextAuthorizer{authContext: *authContext},...
go
func NewRoleAuthorizer(clusterName string, clusterConfig services.ClusterConfig, r teleport.Role) (Authorizer, error) { authContext, err := contextForBuiltinRole(clusterName, clusterConfig, r, fmt.Sprintf("%v", r)) if err != nil { return nil, trace.Wrap(err) } return &contextAuthorizer{authContext: *authContext},...
[ "func", "NewRoleAuthorizer", "(", "clusterName", "string", ",", "clusterConfig", "services", ".", "ClusterConfig", ",", "r", "teleport", ".", "Role", ")", "(", "Authorizer", ",", "error", ")", "{", "authContext", ",", "err", ":=", "contextForBuiltinRole", "(", ...
// NewRoleAuthorizer authorizes everyone as predefined role, used in tests
[ "NewRoleAuthorizer", "authorizes", "everyone", "as", "predefined", "role", "used", "in", "tests" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/permissions.go#L40-L46
24,218
gravitational/teleport
lib/auth/permissions.go
NewUserAuthorizer
func NewUserAuthorizer(username string, identity services.UserGetter, access services.Access) (Authorizer, error) { authContext, err := contextForLocalUser(username, identity, access) if err != nil { return nil, trace.Wrap(err) } return &contextAuthorizer{authContext: *authContext}, nil }
go
func NewUserAuthorizer(username string, identity services.UserGetter, access services.Access) (Authorizer, error) { authContext, err := contextForLocalUser(username, identity, access) if err != nil { return nil, trace.Wrap(err) } return &contextAuthorizer{authContext: *authContext}, nil }
[ "func", "NewUserAuthorizer", "(", "username", "string", ",", "identity", "services", ".", "UserGetter", ",", "access", "services", ".", "Access", ")", "(", "Authorizer", ",", "error", ")", "{", "authContext", ",", "err", ":=", "contextForLocalUser", "(", "user...
// NewUserAuthorizer authorizes everyone as predefined local user
[ "NewUserAuthorizer", "authorizes", "everyone", "as", "predefined", "local", "user" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/permissions.go#L60-L66
24,219
gravitational/teleport
lib/auth/permissions.go
NewAuthorizer
func NewAuthorizer(access services.Access, identity services.UserGetter, trust services.Trust) (Authorizer, error) { if access == nil { return nil, trace.BadParameter("missing parameter access") } if identity == nil { return nil, trace.BadParameter("missing parameter identity") } if trust == nil { return nil...
go
func NewAuthorizer(access services.Access, identity services.UserGetter, trust services.Trust) (Authorizer, error) { if access == nil { return nil, trace.BadParameter("missing parameter access") } if identity == nil { return nil, trace.BadParameter("missing parameter identity") } if trust == nil { return nil...
[ "func", "NewAuthorizer", "(", "access", "services", ".", "Access", ",", "identity", "services", ".", "UserGetter", ",", "trust", "services", ".", "Trust", ")", "(", "Authorizer", ",", "error", ")", "{", "if", "access", "==", "nil", "{", "return", "nil", ...
// NewAuthorizer returns new authorizer using backends
[ "NewAuthorizer", "returns", "new", "authorizer", "using", "backends" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/permissions.go#L69-L80
24,220
gravitational/teleport
lib/auth/permissions.go
authorizeLocalUser
func (a *authorizer) authorizeLocalUser(u LocalUser) (*AuthContext, error) { return contextForLocalUser(u.Username, a.identity, a.access) }
go
func (a *authorizer) authorizeLocalUser(u LocalUser) (*AuthContext, error) { return contextForLocalUser(u.Username, a.identity, a.access) }
[ "func", "(", "a", "*", "authorizer", ")", "authorizeLocalUser", "(", "u", "LocalUser", ")", "(", "*", "AuthContext", ",", "error", ")", "{", "return", "contextForLocalUser", "(", "u", ".", "Username", ",", "a", ".", "identity", ",", "a", ".", "access", ...
// authorizeLocalUser returns authz context based on the username
[ "authorizeLocalUser", "returns", "authz", "context", "based", "on", "the", "username" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/permissions.go#L124-L126
24,221
gravitational/teleport
lib/auth/permissions.go
authorizeRemoteUser
func (a *authorizer) authorizeRemoteUser(u RemoteUser) (*AuthContext, error) { ca, err := a.trust.GetCertAuthority(services.CertAuthID{Type: services.UserCA, DomainName: u.ClusterName}, false) if err != nil { return nil, trace.Wrap(err) } roleNames, err := ca.CombinedMapping().Map(u.RemoteRoles) if err != nil { ...
go
func (a *authorizer) authorizeRemoteUser(u RemoteUser) (*AuthContext, error) { ca, err := a.trust.GetCertAuthority(services.CertAuthID{Type: services.UserCA, DomainName: u.ClusterName}, false) if err != nil { return nil, trace.Wrap(err) } roleNames, err := ca.CombinedMapping().Map(u.RemoteRoles) if err != nil { ...
[ "func", "(", "a", "*", "authorizer", ")", "authorizeRemoteUser", "(", "u", "RemoteUser", ")", "(", "*", "AuthContext", ",", "error", ")", "{", "ca", ",", "err", ":=", "a", ".", "trust", ".", "GetCertAuthority", "(", "services", ".", "CertAuthID", "{", ...
// authorizeRemoteUser returns checker based on cert authority roles
[ "authorizeRemoteUser", "returns", "checker", "based", "on", "cert", "authority", "roles" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/permissions.go#L129-L170
24,222
gravitational/teleport
lib/auth/permissions.go
authorizeBuiltinRole
func (a *authorizer) authorizeBuiltinRole(r BuiltinRole) (*AuthContext, error) { config, err := r.GetClusterConfig() if err != nil { return nil, trace.Wrap(err) } return contextForBuiltinRole(r.ClusterName, config, r.Role, r.Username) }
go
func (a *authorizer) authorizeBuiltinRole(r BuiltinRole) (*AuthContext, error) { config, err := r.GetClusterConfig() if err != nil { return nil, trace.Wrap(err) } return contextForBuiltinRole(r.ClusterName, config, r.Role, r.Username) }
[ "func", "(", "a", "*", "authorizer", ")", "authorizeBuiltinRole", "(", "r", "BuiltinRole", ")", "(", "*", "AuthContext", ",", "error", ")", "{", "config", ",", "err", ":=", "r", ".", "GetClusterConfig", "(", ")", "\n", "if", "err", "!=", "nil", "{", ...
// authorizeBuiltinRole authorizes builtin role
[ "authorizeBuiltinRole", "authorizes", "builtin", "role" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/permissions.go#L173-L179
24,223
gravitational/teleport
tool/tctl/common/user_command.go
Initialize
func (u *UserCommand) Initialize(app *kingpin.Application, config *service.Config) { u.config = config users := app.Command("users", "Manage user accounts") u.userAdd = users.Command("add", "Generate a user invitation token") u.userAdd.Arg("account", "Teleport user account name").Required().StringVar(&u.login) u....
go
func (u *UserCommand) Initialize(app *kingpin.Application, config *service.Config) { u.config = config users := app.Command("users", "Manage user accounts") u.userAdd = users.Command("add", "Generate a user invitation token") u.userAdd.Arg("account", "Teleport user account name").Required().StringVar(&u.login) u....
[ "func", "(", "u", "*", "UserCommand", ")", "Initialize", "(", "app", "*", "kingpin", ".", "Application", ",", "config", "*", "service", ".", "Config", ")", "{", "u", ".", "config", "=", "config", "\n", "users", ":=", "app", ".", "Command", "(", "\"",...
// Initialize allows UserCommand to plug itself into the CLI parser
[ "Initialize", "allows", "UserCommand", "to", "plug", "itself", "into", "the", "CLI", "parser" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tctl/common/user_command.go#L57-L84
24,224
gravitational/teleport
tool/tctl/common/user_command.go
Add
func (u *UserCommand) Add(client auth.ClientI) error { // if no local logins were specified, default to 'login' if u.allowedLogins == "" { u.allowedLogins = u.login } var kubeGroups []string if u.kubeGroups != "" { kubeGroups = strings.Split(u.kubeGroups, ",") } user := services.UserV1{ Name: u.lo...
go
func (u *UserCommand) Add(client auth.ClientI) error { // if no local logins were specified, default to 'login' if u.allowedLogins == "" { u.allowedLogins = u.login } var kubeGroups []string if u.kubeGroups != "" { kubeGroups = strings.Split(u.kubeGroups, ",") } user := services.UserV1{ Name: u.lo...
[ "func", "(", "u", "*", "UserCommand", ")", "Add", "(", "client", "auth", ".", "ClientI", ")", "error", "{", "// if no local logins were specified, default to 'login'", "if", "u", ".", "allowedLogins", "==", "\"", "\"", "{", "u", ".", "allowedLogins", "=", "u",...
// Add creates a new sign-up token and prints a token URL to stdout. // A user is not created until he visits the sign-up URL and completes the process
[ "Add", "creates", "a", "new", "sign", "-", "up", "token", "and", "prints", "a", "token", "URL", "to", "stdout", ".", "A", "user", "is", "not", "created", "until", "he", "visits", "the", "sign", "-", "up", "URL", "and", "completes", "the", "process" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tctl/common/user_command.go#L105-L126
24,225
gravitational/teleport
tool/tctl/common/user_command.go
PrintSignupURL
func (u *UserCommand) PrintSignupURL(client auth.ClientI, token string, ttl time.Duration, format string) error { signupURL, proxyHost := web.CreateSignupLink(client, token) if format == teleport.Text { fmt.Printf("Signup token has been created and is valid for %v hours. Share this URL with the user:\n%v\n\n", ...
go
func (u *UserCommand) PrintSignupURL(client auth.ClientI, token string, ttl time.Duration, format string) error { signupURL, proxyHost := web.CreateSignupLink(client, token) if format == teleport.Text { fmt.Printf("Signup token has been created and is valid for %v hours. Share this URL with the user:\n%v\n\n", ...
[ "func", "(", "u", "*", "UserCommand", ")", "PrintSignupURL", "(", "client", "auth", ".", "ClientI", ",", "token", "string", ",", "ttl", "time", ".", "Duration", ",", "format", "string", ")", "error", "{", "signupURL", ",", "proxyHost", ":=", "web", ".", ...
// PrintSignupURL prints signup URL
[ "PrintSignupURL", "prints", "signup", "URL" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tctl/common/user_command.go#L129-L144
24,226
gravitational/teleport
tool/tctl/common/user_command.go
Update
func (u *UserCommand) Update(client auth.ClientI) error { user, err := client.GetUser(u.login) if err != nil { return trace.Wrap(err) } roles := strings.Split(u.roles, ",") for _, role := range roles { if _, err := client.GetRole(role); err != nil { return trace.Wrap(err) } } user.SetRoles(roles) if er...
go
func (u *UserCommand) Update(client auth.ClientI) error { user, err := client.GetUser(u.login) if err != nil { return trace.Wrap(err) } roles := strings.Split(u.roles, ",") for _, role := range roles { if _, err := client.GetRole(role); err != nil { return trace.Wrap(err) } } user.SetRoles(roles) if er...
[ "func", "(", "u", "*", "UserCommand", ")", "Update", "(", "client", "auth", ".", "ClientI", ")", "error", "{", "user", ",", "err", ":=", "client", ".", "GetUser", "(", "u", ".", "login", ")", "\n", "if", "err", "!=", "nil", "{", "return", "trace", ...
// Update updates existing user
[ "Update", "updates", "existing", "user" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tctl/common/user_command.go#L147-L164
24,227
gravitational/teleport
tool/tctl/common/user_command.go
List
func (u *UserCommand) List(client auth.ClientI) error { users, err := client.GetUsers() if err != nil { return trace.Wrap(err) } if u.format == teleport.Text { if len(users) == 0 { fmt.Println("No users found") return nil } t := asciitable.MakeTable([]string{"User", "Allowed logins"}) for _, u := ra...
go
func (u *UserCommand) List(client auth.ClientI) error { users, err := client.GetUsers() if err != nil { return trace.Wrap(err) } if u.format == teleport.Text { if len(users) == 0 { fmt.Println("No users found") return nil } t := asciitable.MakeTable([]string{"User", "Allowed logins"}) for _, u := ra...
[ "func", "(", "u", "*", "UserCommand", ")", "List", "(", "client", "auth", ".", "ClientI", ")", "error", "{", "users", ",", "err", ":=", "client", ".", "GetUsers", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "trace", ".", "Wrap", "(", ...
// List prints all existing user accounts
[ "List", "prints", "all", "existing", "user", "accounts" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/tool/tctl/common/user_command.go#L167-L191
24,228
gravitational/teleport
lib/teleagent/agent.go
ListenUnixSocket
func (a *AgentServer) ListenUnixSocket(path string, uid, gid int, mode os.FileMode) error { l, err := net.Listen("unix", path) if err != nil { return trace.Wrap(err) } if err := os.Chown(path, uid, gid); err != nil { l.Close() return trace.ConvertSystemError(err) } if err := os.Chmod(path, mode); err != nil...
go
func (a *AgentServer) ListenUnixSocket(path string, uid, gid int, mode os.FileMode) error { l, err := net.Listen("unix", path) if err != nil { return trace.Wrap(err) } if err := os.Chown(path, uid, gid); err != nil { l.Close() return trace.ConvertSystemError(err) } if err := os.Chmod(path, mode); err != nil...
[ "func", "(", "a", "*", "AgentServer", ")", "ListenUnixSocket", "(", "path", "string", ",", "uid", ",", "gid", "int", ",", "mode", "os", ".", "FileMode", ")", "error", "{", "l", ",", "err", ":=", "net", ".", "Listen", "(", "\"", "\"", ",", "path", ...
// ListenUnixSocket starts listening and serving agent assuming that
[ "ListenUnixSocket", "starts", "listening", "and", "serving", "agent", "assuming", "that" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/teleagent/agent.go#L30-L46
24,229
gravitational/teleport
lib/teleagent/agent.go
Serve
func (a *AgentServer) Serve() error { if a.listener == nil { return trace.BadParameter("Serve needs a Listen call first") } var tempDelay time.Duration // how long to sleep on accept failure for { conn, err := a.listener.Accept() if err != nil { neterr, ok := err.(net.Error) if !ok { return trace.Wr...
go
func (a *AgentServer) Serve() error { if a.listener == nil { return trace.BadParameter("Serve needs a Listen call first") } var tempDelay time.Duration // how long to sleep on accept failure for { conn, err := a.listener.Accept() if err != nil { neterr, ok := err.(net.Error) if !ok { return trace.Wr...
[ "func", "(", "a", "*", "AgentServer", ")", "Serve", "(", ")", "error", "{", "if", "a", ".", "listener", "==", "nil", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ")", "\n", "}", "\n", "var", "tempDelay", "time", ".", "Duration", "/...
// Serve starts serving on the listener, assumes that Listen was called before
[ "Serve", "starts", "serving", "on", "the", "listener", "assumes", "that", "Listen", "was", "called", "before" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/teleagent/agent.go#L49-L88
24,230
gravitational/teleport
lib/teleagent/agent.go
ListenAndServe
func (a *AgentServer) ListenAndServe(addr utils.NetAddr) error { l, err := net.Listen(addr.AddrNetwork, addr.Addr) if err != nil { return trace.Wrap(err) } a.listener = l return a.Serve() }
go
func (a *AgentServer) ListenAndServe(addr utils.NetAddr) error { l, err := net.Listen(addr.AddrNetwork, addr.Addr) if err != nil { return trace.Wrap(err) } a.listener = l return a.Serve() }
[ "func", "(", "a", "*", "AgentServer", ")", "ListenAndServe", "(", "addr", "utils", ".", "NetAddr", ")", "error", "{", "l", ",", "err", ":=", "net", ".", "Listen", "(", "addr", ".", "AddrNetwork", ",", "addr", ".", "Addr", ")", "\n", "if", "err", "!...
// ListenAndServe is similar http.ListenAndServe
[ "ListenAndServe", "is", "similar", "http", ".", "ListenAndServe" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/teleagent/agent.go#L91-L98
24,231
gravitational/teleport
lib/teleagent/agent.go
Close
func (a *AgentServer) Close() error { var errors []error if a.listener != nil { log.Debugf("AgentServer(%v) is closing", a.listener.Addr()) if err := a.listener.Close(); err != nil { errors = append(errors, trace.ConvertSystemError(err)) } } if a.path != "" { if err := os.Remove(a.path); err != nil { ...
go
func (a *AgentServer) Close() error { var errors []error if a.listener != nil { log.Debugf("AgentServer(%v) is closing", a.listener.Addr()) if err := a.listener.Close(); err != nil { errors = append(errors, trace.ConvertSystemError(err)) } } if a.path != "" { if err := os.Remove(a.path); err != nil { ...
[ "func", "(", "a", "*", "AgentServer", ")", "Close", "(", ")", "error", "{", "var", "errors", "[", "]", "error", "\n", "if", "a", ".", "listener", "!=", "nil", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "a", ".", "listener", ".", "Addr", "...
// Close closes listener and stops serving agent
[ "Close", "closes", "listener", "and", "stops", "serving", "agent" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/teleagent/agent.go#L101-L115
24,232
gravitational/teleport
lib/httplib/csrf/csrf.go
VerifyHTTPHeader
func VerifyHTTPHeader(r *http.Request) error { token := r.Header.Get(HeaderName) if len(token) == 0 { return trace.BadParameter("cannot retrieve CSRF token from HTTP header %q", HeaderName) } err := VerifyToken(token, r) if err != nil { return trace.Wrap(err) } return nil }
go
func VerifyHTTPHeader(r *http.Request) error { token := r.Header.Get(HeaderName) if len(token) == 0 { return trace.BadParameter("cannot retrieve CSRF token from HTTP header %q", HeaderName) } err := VerifyToken(token, r) if err != nil { return trace.Wrap(err) } return nil }
[ "func", "VerifyHTTPHeader", "(", "r", "*", "http", ".", "Request", ")", "error", "{", "token", ":=", "r", ".", "Header", ".", "Get", "(", "HeaderName", ")", "\n", "if", "len", "(", "token", ")", "==", "0", "{", "return", "trace", ".", "BadParameter",...
// VerifyHTTPHeader checks if HTTP header value matches the cookie.
[ "VerifyHTTPHeader", "checks", "if", "HTTP", "header", "value", "matches", "the", "cookie", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/httplib/csrf/csrf.go#L56-L68
24,233
gravitational/teleport
lib/httplib/csrf/csrf.go
VerifyToken
func VerifyToken(token string, r *http.Request) error { realToken, err := ExtractTokenFromCookie(r) if err != nil { return trace.Wrap(err, "unable to extract CSRF token from cookie") } decodedTokenA, err := decode(token) if err != nil { return trace.Wrap(err, "unable to decode CSRF token") } decodedTokenB,...
go
func VerifyToken(token string, r *http.Request) error { realToken, err := ExtractTokenFromCookie(r) if err != nil { return trace.Wrap(err, "unable to extract CSRF token from cookie") } decodedTokenA, err := decode(token) if err != nil { return trace.Wrap(err, "unable to decode CSRF token") } decodedTokenB,...
[ "func", "VerifyToken", "(", "token", "string", ",", "r", "*", "http", ".", "Request", ")", "error", "{", "realToken", ",", "err", ":=", "ExtractTokenFromCookie", "(", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "trace", ".", "Wrap", "(", ...
// VerifyToken validates given token based on HTTP request cookie
[ "VerifyToken", "validates", "given", "token", "based", "on", "HTTP", "request", "cookie" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/httplib/csrf/csrf.go#L71-L92
24,234
gravitational/teleport
lib/httplib/csrf/csrf.go
ExtractTokenFromCookie
func ExtractTokenFromCookie(r *http.Request) (string, error) { cookie, err := r.Cookie(CookieName) if err != nil { return "", trace.Wrap(err) } return cookie.Value, nil }
go
func ExtractTokenFromCookie(r *http.Request) (string, error) { cookie, err := r.Cookie(CookieName) if err != nil { return "", trace.Wrap(err) } return cookie.Value, nil }
[ "func", "ExtractTokenFromCookie", "(", "r", "*", "http", ".", "Request", ")", "(", "string", ",", "error", ")", "{", "cookie", ",", "err", ":=", "r", ".", "Cookie", "(", "CookieName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ...
// ExtractTokenFromCookie retrieves a CSRF token from the session cookie.
[ "ExtractTokenFromCookie", "retrieves", "a", "CSRF", "token", "from", "the", "session", "cookie", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/httplib/csrf/csrf.go#L95-L102
24,235
gravitational/teleport
lib/httplib/csrf/csrf.go
save
func save(encodedToken string, w http.ResponseWriter) string { cookie := &http.Cookie{ Name: CookieName, Value: encodedToken, MaxAge: defaultMaxAge, HttpOnly: true, Secure: true, Path: "/", } // write the authenticated cookie to the response. http.SetCookie(w, cookie) w.Header().Add("Va...
go
func save(encodedToken string, w http.ResponseWriter) string { cookie := &http.Cookie{ Name: CookieName, Value: encodedToken, MaxAge: defaultMaxAge, HttpOnly: true, Secure: true, Path: "/", } // write the authenticated cookie to the response. http.SetCookie(w, cookie) w.Header().Add("Va...
[ "func", "save", "(", "encodedToken", "string", ",", "w", "http", ".", "ResponseWriter", ")", "string", "{", "cookie", ":=", "&", "http", ".", "Cookie", "{", "Name", ":", "CookieName", ",", "Value", ":", "encodedToken", ",", "MaxAge", ":", "defaultMaxAge", ...
// save stores encoded CSRF token in the session cookie.
[ "save", "stores", "encoded", "CSRF", "token", "in", "the", "session", "cookie", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/httplib/csrf/csrf.go#L124-L138
24,236
gravitational/teleport
lib/auth/oidc.go
ValidateOIDCAuthCallback
func (a *AuthServer) ValidateOIDCAuthCallback(q url.Values) (*OIDCAuthResponse, error) { re, err := a.validateOIDCAuthCallback(q) if err != nil { a.EmitAuditEvent(events.UserSSOLoginFailure, events.EventFields{ events.LoginMethod: events.LoginMethodOIDC, events.AuthAttemptSuccess: false, // log the ...
go
func (a *AuthServer) ValidateOIDCAuthCallback(q url.Values) (*OIDCAuthResponse, error) { re, err := a.validateOIDCAuthCallback(q) if err != nil { a.EmitAuditEvent(events.UserSSOLoginFailure, events.EventFields{ events.LoginMethod: events.LoginMethodOIDC, events.AuthAttemptSuccess: false, // log the ...
[ "func", "(", "a", "*", "AuthServer", ")", "ValidateOIDCAuthCallback", "(", "q", "url", ".", "Values", ")", "(", "*", "OIDCAuthResponse", ",", "error", ")", "{", "re", ",", "err", ":=", "a", ".", "validateOIDCAuthCallback", "(", "q", ")", "\n", "if", "e...
// ValidateOIDCAuthCallback is called by the proxy to check OIDC query parameters // returned by OIDC Provider, if everything checks out, auth server // will respond with OIDCAuthResponse, otherwise it will return error
[ "ValidateOIDCAuthCallback", "is", "called", "by", "the", "proxy", "to", "check", "OIDC", "query", "parameters", "returned", "by", "OIDC", "Provider", "if", "everything", "checks", "out", "auth", "server", "will", "respond", "with", "OIDCAuthResponse", "otherwise", ...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/oidc.go#L128-L145
24,237
gravitational/teleport
lib/auth/oidc.go
buildOIDCRoles
func (a *AuthServer) buildOIDCRoles(connector services.OIDCConnector, claims jose.Claims) ([]string, error) { roles := connector.MapClaims(claims) if len(roles) == 0 { return nil, trace.AccessDenied("unable to map claims to role for connector: %v", connector.GetName()) } return roles, nil }
go
func (a *AuthServer) buildOIDCRoles(connector services.OIDCConnector, claims jose.Claims) ([]string, error) { roles := connector.MapClaims(claims) if len(roles) == 0 { return nil, trace.AccessDenied("unable to map claims to role for connector: %v", connector.GetName()) } return roles, nil }
[ "func", "(", "a", "*", "AuthServer", ")", "buildOIDCRoles", "(", "connector", "services", ".", "OIDCConnector", ",", "claims", "jose", ".", "Claims", ")", "(", "[", "]", "string", ",", "error", ")", "{", "roles", ":=", "connector", ".", "MapClaims", "(",...
// buildOIDCRoles takes a connector and claims and returns a slice of roles.
[ "buildOIDCRoles", "takes", "a", "connector", "and", "claims", "and", "returns", "a", "slice", "of", "roles", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/oidc.go#L301-L308
24,238
gravitational/teleport
lib/auth/oidc.go
claimsToTraitMap
func claimsToTraitMap(claims jose.Claims) map[string][]string { traits := make(map[string][]string) for claimName := range claims { claimValue, ok, _ := claims.StringClaim(claimName) if ok { traits[claimName] = []string{claimValue} } claimValues, ok, _ := claims.StringsClaim(claimName) if ok { traits...
go
func claimsToTraitMap(claims jose.Claims) map[string][]string { traits := make(map[string][]string) for claimName := range claims { claimValue, ok, _ := claims.StringClaim(claimName) if ok { traits[claimName] = []string{claimValue} } claimValues, ok, _ := claims.StringsClaim(claimName) if ok { traits...
[ "func", "claimsToTraitMap", "(", "claims", "jose", ".", "Claims", ")", "map", "[", "string", "]", "[", "]", "string", "{", "traits", ":=", "make", "(", "map", "[", "string", "]", "[", "]", "string", ")", "\n\n", "for", "claimName", ":=", "range", "cl...
// claimsToTraitMap extracts all string claims and creates a map of traits // that can be used to populate role variables.
[ "claimsToTraitMap", "extracts", "all", "string", "claims", "and", "creates", "a", "map", "of", "traits", "that", "can", "be", "used", "to", "populate", "role", "variables", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/oidc.go#L312-L327
24,239
gravitational/teleport
lib/auth/oidc.go
claimsFromIDToken
func claimsFromIDToken(oidcClient *oidc.Client, idToken string) (jose.Claims, error) { jwt, err := jose.ParseJWT(idToken) if err != nil { return nil, trace.Wrap(err) } err = oidcClient.VerifyJWT(jwt) if err != nil { return nil, trace.Wrap(err) } log.Debugf("Extracting OIDC claims from ID token.") claims,...
go
func claimsFromIDToken(oidcClient *oidc.Client, idToken string) (jose.Claims, error) { jwt, err := jose.ParseJWT(idToken) if err != nil { return nil, trace.Wrap(err) } err = oidcClient.VerifyJWT(jwt) if err != nil { return nil, trace.Wrap(err) } log.Debugf("Extracting OIDC claims from ID token.") claims,...
[ "func", "claimsFromIDToken", "(", "oidcClient", "*", "oidc", ".", "Client", ",", "idToken", "string", ")", "(", "jose", ".", "Claims", ",", "error", ")", "{", "jwt", ",", "err", ":=", "jose", ".", "ParseJWT", "(", "idToken", ")", "\n", "if", "err", "...
// claimsFromIDToken extracts claims from the ID token.
[ "claimsFromIDToken", "extracts", "claims", "from", "the", "ID", "token", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/oidc.go#L422-L441
24,240
gravitational/teleport
lib/auth/oidc.go
fetchGroups
func (g *gsuiteClient) fetchGroups() (jose.Claims, error) { count := 0 var groups []string var nextPageToken string collect: for { if count > MaxPages { warningMessage := "Truncating list of teams used to populate claims: " + "hit maximum number pages that can be fetched from GSuite." // Print warning ...
go
func (g *gsuiteClient) fetchGroups() (jose.Claims, error) { count := 0 var groups []string var nextPageToken string collect: for { if count > MaxPages { warningMessage := "Truncating list of teams used to populate claims: " + "hit maximum number pages that can be fetched from GSuite." // Print warning ...
[ "func", "(", "g", "*", "gsuiteClient", ")", "fetchGroups", "(", ")", "(", "jose", ".", "Claims", ",", "error", ")", "{", "count", ":=", "0", "\n", "var", "groups", "[", "]", "string", "\n", "var", "nextPageToken", "string", "\n", "collect", ":", "for...
// fetchGroups fetches GSuite groups a user belongs to and returns // "groups" claim with
[ "fetchGroups", "fetches", "GSuite", "groups", "a", "user", "belongs", "to", "and", "returns", "groups", "claim", "with" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/oidc.go#L545-L575
24,241
gravitational/teleport
lib/auth/oidc.go
mergeClaims
func mergeClaims(a jose.Claims, b jose.Claims) (jose.Claims, error) { for k, v := range b { _, ok := a[k] if !ok { a[k] = v } } return a, nil }
go
func mergeClaims(a jose.Claims, b jose.Claims) (jose.Claims, error) { for k, v := range b { _, ok := a[k] if !ok { a[k] = v } } return a, nil }
[ "func", "mergeClaims", "(", "a", "jose", ".", "Claims", ",", "b", "jose", ".", "Claims", ")", "(", "jose", ".", "Claims", ",", "error", ")", "{", "for", "k", ",", "v", ":=", "range", "b", "{", "_", ",", "ok", ":=", "a", "[", "k", "]", "\n", ...
// mergeClaims merges b into a.
[ "mergeClaims", "merges", "b", "into", "a", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/oidc.go#L635-L644
24,242
gravitational/teleport
lib/auth/oidc.go
validateACRValues
func (a *AuthServer) validateACRValues(acrValue string, identityProvider string, claims jose.Claims) error { switch identityProvider { case teleport.NetIQ: log.Debugf("Validating OIDC ACR values with '%v' rules.", identityProvider) tokenAcr, ok := claims["acr"] if !ok { return trace.BadParameter("acr not fo...
go
func (a *AuthServer) validateACRValues(acrValue string, identityProvider string, claims jose.Claims) error { switch identityProvider { case teleport.NetIQ: log.Debugf("Validating OIDC ACR values with '%v' rules.", identityProvider) tokenAcr, ok := claims["acr"] if !ok { return trace.BadParameter("acr not fo...
[ "func", "(", "a", "*", "AuthServer", ")", "validateACRValues", "(", "acrValue", "string", ",", "identityProvider", "string", ",", "claims", "jose", ".", "Claims", ")", "error", "{", "switch", "identityProvider", "{", "case", "teleport", ".", "NetIQ", ":", "l...
// validateACRValues validates that we get an appropriate response for acr values. By default // we expect the same value we send, but this function also handles Identity Provider specific // forms of validation.
[ "validateACRValues", "validates", "that", "we", "get", "an", "appropriate", "response", "for", "acr", "values", ".", "By", "default", "we", "expect", "the", "same", "value", "we", "send", "but", "this", "function", "also", "handles", "Identity", "Provider", "s...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/auth/oidc.go#L733-L787
24,243
gravitational/teleport
lib/client/bench.go
Benchmark
func (tc *TeleportClient) Benchmark(ctx context.Context, bench Benchmark) (*BenchmarkResult, error) { tc.Stdout = ioutil.Discard tc.Stderr = ioutil.Discard tc.Stdin = &bytes.Buffer{} ctx, cancel := context.WithTimeout(ctx, bench.Duration) defer cancel() requestC := make(chan *benchMeasure) responseC := make(ch...
go
func (tc *TeleportClient) Benchmark(ctx context.Context, bench Benchmark) (*BenchmarkResult, error) { tc.Stdout = ioutil.Discard tc.Stderr = ioutil.Discard tc.Stdin = &bytes.Buffer{} ctx, cancel := context.WithTimeout(ctx, bench.Duration) defer cancel() requestC := make(chan *benchMeasure) responseC := make(ch...
[ "func", "(", "tc", "*", "TeleportClient", ")", "Benchmark", "(", "ctx", "context", ".", "Context", ",", "bench", "Benchmark", ")", "(", "*", "BenchmarkResult", ",", "error", ")", "{", "tc", ".", "Stdout", "=", "ioutil", ".", "Discard", "\n", "tc", ".",...
// Benchmark connects to remote server and executes requests in parallel according // to benchmark spec. It returns benchmark result when completed. // This is a blocking function that can be cancelled via context argument.
[ "Benchmark", "connects", "to", "remote", "server", "and", "executes", "requests", "in", "parallel", "according", "to", "benchmark", "spec", ".", "It", "returns", "benchmark", "result", "when", "completed", ".", "This", "is", "a", "blocking", "function", "that", ...
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/bench.go#L60-L147
24,244
gravitational/teleport
lib/utils/conn.go
NewCloserConn
func NewCloserConn(conn net.Conn, closers ...io.Closer) *CloserConn { return &CloserConn{ Conn: conn, closers: closers, } }
go
func NewCloserConn(conn net.Conn, closers ...io.Closer) *CloserConn { return &CloserConn{ Conn: conn, closers: closers, } }
[ "func", "NewCloserConn", "(", "conn", "net", ".", "Conn", ",", "closers", "...", "io", ".", "Closer", ")", "*", "CloserConn", "{", "return", "&", "CloserConn", "{", "Conn", ":", "conn", ",", "closers", ":", "closers", ",", "}", "\n", "}" ]
// NewCloserConn returns new connection wrapper that // when closed will also close passed closers
[ "NewCloserConn", "returns", "new", "connection", "wrapper", "that", "when", "closed", "will", "also", "close", "passed", "closers" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/conn.go#L33-L38
24,245
gravitational/teleport
lib/client/interfaces.go
ClientTLSConfig
func (k *Key) ClientTLSConfig() (*tls.Config, error) { // Because Teleport clients can't be configured (yet), they take the default // list of cipher suites from Go. tlsConfig := utils.TLSConfig(nil) pool := x509.NewCertPool() for _, ca := range k.TrustedCA { for _, certPEM := range ca.TLSCertificates { if !...
go
func (k *Key) ClientTLSConfig() (*tls.Config, error) { // Because Teleport clients can't be configured (yet), they take the default // list of cipher suites from Go. tlsConfig := utils.TLSConfig(nil) pool := x509.NewCertPool() for _, ca := range k.TrustedCA { for _, certPEM := range ca.TLSCertificates { if !...
[ "func", "(", "k", "*", "Key", ")", "ClientTLSConfig", "(", ")", "(", "*", "tls", ".", "Config", ",", "error", ")", "{", "// Because Teleport clients can't be configured (yet), they take the default", "// list of cipher suites from Go.", "tlsConfig", ":=", "utils", ".", ...
// TLSConfig returns client TLS configuration used // to authenticate against API servers
[ "TLSConfig", "returns", "client", "TLS", "configuration", "used", "to", "authenticate", "against", "API", "servers" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/interfaces.go#L62-L82
24,246
gravitational/teleport
lib/client/interfaces.go
CertUsername
func (k *Key) CertUsername() (string, error) { pubKey, _, _, _, err := ssh.ParseAuthorizedKey(k.Cert) if err != nil { return "", trace.Wrap(err) } cert, ok := pubKey.(*ssh.Certificate) if !ok { return "", trace.BadParameter("expected SSH certificate, got public key") } return cert.KeyId, nil }
go
func (k *Key) CertUsername() (string, error) { pubKey, _, _, _, err := ssh.ParseAuthorizedKey(k.Cert) if err != nil { return "", trace.Wrap(err) } cert, ok := pubKey.(*ssh.Certificate) if !ok { return "", trace.BadParameter("expected SSH certificate, got public key") } return cert.KeyId, nil }
[ "func", "(", "k", "*", "Key", ")", "CertUsername", "(", ")", "(", "string", ",", "error", ")", "{", "pubKey", ",", "_", ",", "_", ",", "_", ",", "err", ":=", "ssh", ".", "ParseAuthorizedKey", "(", "k", ".", "Cert", ")", "\n", "if", "err", "!=",...
// CertUsername returns the name of the Teleport user encoded in the SSH certificate.
[ "CertUsername", "returns", "the", "name", "of", "the", "Teleport", "user", "encoded", "in", "the", "SSH", "certificate", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/interfaces.go#L85-L95
24,247
gravitational/teleport
lib/client/interfaces.go
CertPrincipals
func (k *Key) CertPrincipals() ([]string, error) { publicKey, _, _, _, err := ssh.ParseAuthorizedKey(k.Cert) if err != nil { return nil, trace.Wrap(err) } cert, ok := publicKey.(*ssh.Certificate) if !ok { return nil, trace.BadParameter("no certificate found") } return cert.ValidPrincipals, nil }
go
func (k *Key) CertPrincipals() ([]string, error) { publicKey, _, _, _, err := ssh.ParseAuthorizedKey(k.Cert) if err != nil { return nil, trace.Wrap(err) } cert, ok := publicKey.(*ssh.Certificate) if !ok { return nil, trace.BadParameter("no certificate found") } return cert.ValidPrincipals, nil }
[ "func", "(", "k", "*", "Key", ")", "CertPrincipals", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "publicKey", ",", "_", ",", "_", ",", "_", ",", "err", ":=", "ssh", ".", "ParseAuthorizedKey", "(", "k", ".", "Cert", ")", "\n", "if...
// CertPrincipals returns the principals listed on the SSH certificate.
[ "CertPrincipals", "returns", "the", "principals", "listed", "on", "the", "SSH", "certificate", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/interfaces.go#L98-L108
24,248
gravitational/teleport
lib/client/interfaces.go
EqualsTo
func (k *Key) EqualsTo(other *Key) bool { if k == other { return true } return bytes.Equal(k.Cert, other.Cert) && bytes.Equal(k.Priv, other.Priv) && bytes.Equal(k.Pub, other.Pub) && bytes.Equal(k.TLSCert, other.TLSCert) }
go
func (k *Key) EqualsTo(other *Key) bool { if k == other { return true } return bytes.Equal(k.Cert, other.Cert) && bytes.Equal(k.Priv, other.Priv) && bytes.Equal(k.Pub, other.Pub) && bytes.Equal(k.TLSCert, other.TLSCert) }
[ "func", "(", "k", "*", "Key", ")", "EqualsTo", "(", "other", "*", "Key", ")", "bool", "{", "if", "k", "==", "other", "{", "return", "true", "\n", "}", "\n", "return", "bytes", ".", "Equal", "(", "k", ".", "Cert", ",", "other", ".", "Cert", ")",...
// EqualsTo returns true if this key is the same as the other. // Primarily used in tests
[ "EqualsTo", "returns", "true", "if", "this", "key", "is", "the", "same", "as", "the", "other", ".", "Primarily", "used", "in", "tests" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/interfaces.go#L173-L181
24,249
gravitational/teleport
lib/client/interfaces.go
TLSCertValidBefore
func (k *Key) TLSCertValidBefore() (t time.Time, err error) { cert, err := tlsca.ParseCertificatePEM(k.TLSCert) if err != nil { return t, trace.Wrap(err) } return cert.NotAfter, nil }
go
func (k *Key) TLSCertValidBefore() (t time.Time, err error) { cert, err := tlsca.ParseCertificatePEM(k.TLSCert) if err != nil { return t, trace.Wrap(err) } return cert.NotAfter, nil }
[ "func", "(", "k", "*", "Key", ")", "TLSCertValidBefore", "(", ")", "(", "t", "time", ".", "Time", ",", "err", "error", ")", "{", "cert", ",", "err", ":=", "tlsca", ".", "ParseCertificatePEM", "(", "k", ".", "TLSCert", ")", "\n", "if", "err", "!=", ...
// TLSCertValidBefore returns the time of the TLS cert expiration
[ "TLSCertValidBefore", "returns", "the", "time", "of", "the", "TLS", "cert", "expiration" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/interfaces.go#L184-L190
24,250
gravitational/teleport
lib/client/interfaces.go
CertValidBefore
func (k *Key) CertValidBefore() (t time.Time, err error) { pcert, _, _, _, err := ssh.ParseAuthorizedKey(k.Cert) if err != nil { return t, trace.Wrap(err) } cert, ok := pcert.(*ssh.Certificate) if !ok { return t, trace.Errorf("not supported certificate type") } return time.Unix(int64(cert.ValidBefore), 0), n...
go
func (k *Key) CertValidBefore() (t time.Time, err error) { pcert, _, _, _, err := ssh.ParseAuthorizedKey(k.Cert) if err != nil { return t, trace.Wrap(err) } cert, ok := pcert.(*ssh.Certificate) if !ok { return t, trace.Errorf("not supported certificate type") } return time.Unix(int64(cert.ValidBefore), 0), n...
[ "func", "(", "k", "*", "Key", ")", "CertValidBefore", "(", ")", "(", "t", "time", ".", "Time", ",", "err", "error", ")", "{", "pcert", ",", "_", ",", "_", ",", "_", ",", "err", ":=", "ssh", ".", "ParseAuthorizedKey", "(", "k", ".", "Cert", ")",...
// CertValidBefore returns the time of the cert expiration
[ "CertValidBefore", "returns", "the", "time", "of", "the", "cert", "expiration" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/interfaces.go#L193-L203
24,251
gravitational/teleport
lib/client/interfaces.go
AsAuthMethod
func (k *Key) AsAuthMethod() (ssh.AuthMethod, error) { keys, err := k.AsAgentKeys() if err != nil { return nil, trace.Wrap(err) } signer, err := ssh.NewSignerFromKey(keys[0].PrivateKey) if err != nil { return nil, trace.Wrap(err) } if signer, err = ssh.NewCertSigner(keys[0].Certificate, signer); err != nil {...
go
func (k *Key) AsAuthMethod() (ssh.AuthMethod, error) { keys, err := k.AsAgentKeys() if err != nil { return nil, trace.Wrap(err) } signer, err := ssh.NewSignerFromKey(keys[0].PrivateKey) if err != nil { return nil, trace.Wrap(err) } if signer, err = ssh.NewCertSigner(keys[0].Certificate, signer); err != nil {...
[ "func", "(", "k", "*", "Key", ")", "AsAuthMethod", "(", ")", "(", "ssh", ".", "AuthMethod", ",", "error", ")", "{", "keys", ",", "err", ":=", "k", ".", "AsAgentKeys", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "trace", ...
// AsAuthMethod returns an "auth method" interface, a common abstraction // used by Golang SSH library. This is how you actually use a Key to feed // it into the SSH lib.
[ "AsAuthMethod", "returns", "an", "auth", "method", "interface", "a", "common", "abstraction", "used", "by", "Golang", "SSH", "library", ".", "This", "is", "how", "you", "actually", "use", "a", "Key", "to", "feed", "it", "into", "the", "SSH", "lib", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/interfaces.go#L208-L221
24,252
gravitational/teleport
lib/client/interfaces.go
CheckCert
func (k *Key) CheckCert() error { key, _, _, _, err := ssh.ParseAuthorizedKey(k.Cert) if err != nil { return trace.Wrap(err) } cert, ok := key.(*ssh.Certificate) if !ok { return trace.BadParameter("found key, not certificate") } if len(cert.ValidPrincipals) == 0 { return trace.BadParameter("principals are...
go
func (k *Key) CheckCert() error { key, _, _, _, err := ssh.ParseAuthorizedKey(k.Cert) if err != nil { return trace.Wrap(err) } cert, ok := key.(*ssh.Certificate) if !ok { return trace.BadParameter("found key, not certificate") } if len(cert.ValidPrincipals) == 0 { return trace.BadParameter("principals are...
[ "func", "(", "k", "*", "Key", ")", "CheckCert", "(", ")", "error", "{", "key", ",", "_", ",", "_", ",", "_", ",", "err", ":=", "ssh", ".", "ParseAuthorizedKey", "(", "k", ".", "Cert", ")", "\n", "if", "err", "!=", "nil", "{", "return", "trace",...
// CheckCert makes sure the SSH certificate is valid.
[ "CheckCert", "makes", "sure", "the", "SSH", "certificate", "is", "valid", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/client/interfaces.go#L224-L247
24,253
gravitational/teleport
lib/backend/dynamo/shards.go
collectActiveShards
func (b *DynamoDBBackend) collectActiveShards(ctx context.Context, streamArn *string) ([]*dynamodbstreams.Shard, error) { var out []*dynamodbstreams.Shard input := &dynamodbstreams.DescribeStreamInput{ StreamArn: streamArn, } for { streamInfo, err := b.streams.DescribeStreamWithContext(ctx, input) if err != ...
go
func (b *DynamoDBBackend) collectActiveShards(ctx context.Context, streamArn *string) ([]*dynamodbstreams.Shard, error) { var out []*dynamodbstreams.Shard input := &dynamodbstreams.DescribeStreamInput{ StreamArn: streamArn, } for { streamInfo, err := b.streams.DescribeStreamWithContext(ctx, input) if err != ...
[ "func", "(", "b", "*", "DynamoDBBackend", ")", "collectActiveShards", "(", "ctx", "context", ".", "Context", ",", "streamArn", "*", "string", ")", "(", "[", "]", "*", "dynamodbstreams", ".", "Shard", ",", "error", ")", "{", "var", "out", "[", "]", "*",...
// collectActiveShards collects shards
[ "collectActiveShards", "collects", "shards" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/dynamo/shards.go#L202-L219
24,254
gravitational/teleport
lib/backend/dynamo/dynamodbbk.go
GetRange
func (b *DynamoDBBackend) GetRange(ctx context.Context, startKey []byte, endKey []byte, limit int) (*backend.GetResult, error) { if len(startKey) == 0 { return nil, trace.BadParameter("missing parameter startKey") } if len(endKey) == 0 { return nil, trace.BadParameter("missing parameter endKey") } result, err ...
go
func (b *DynamoDBBackend) GetRange(ctx context.Context, startKey []byte, endKey []byte, limit int) (*backend.GetResult, error) { if len(startKey) == 0 { return nil, trace.BadParameter("missing parameter startKey") } if len(endKey) == 0 { return nil, trace.BadParameter("missing parameter endKey") } result, err ...
[ "func", "(", "b", "*", "DynamoDBBackend", ")", "GetRange", "(", "ctx", "context", ".", "Context", ",", "startKey", "[", "]", "byte", ",", "endKey", "[", "]", "byte", ",", "limit", "int", ")", "(", "*", "backend", ".", "GetResult", ",", "error", ")", ...
// GetRange returns range of elements
[ "GetRange", "returns", "range", "of", "elements" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/dynamo/dynamodbbk.go#L302-L325
24,255
gravitational/teleport
lib/backend/dynamo/dynamodbbk.go
CompareAndSwap
func (b *DynamoDBBackend) CompareAndSwap(ctx context.Context, expected backend.Item, replaceWith backend.Item) (*backend.Lease, error) { if len(expected.Key) == 0 { return nil, trace.BadParameter("missing parameter Key") } if len(replaceWith.Key) == 0 { return nil, trace.BadParameter("missing parameter Key") } ...
go
func (b *DynamoDBBackend) CompareAndSwap(ctx context.Context, expected backend.Item, replaceWith backend.Item) (*backend.Lease, error) { if len(expected.Key) == 0 { return nil, trace.BadParameter("missing parameter Key") } if len(replaceWith.Key) == 0 { return nil, trace.BadParameter("missing parameter Key") } ...
[ "func", "(", "b", "*", "DynamoDBBackend", ")", "CompareAndSwap", "(", "ctx", "context", ".", "Context", ",", "expected", "backend", ".", "Item", ",", "replaceWith", "backend", ".", "Item", ")", "(", "*", "backend", ".", "Lease", ",", "error", ")", "{", ...
// CompareAndSwap compares and swap values in atomic operation // CompareAndSwap compares item with existing item // and replaces is with replaceWith item
[ "CompareAndSwap", "compares", "and", "swap", "values", "in", "atomic", "operation", "CompareAndSwap", "compares", "item", "with", "existing", "item", "and", "replaces", "is", "with", "replaceWith", "item" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/dynamo/dynamodbbk.go#L413-L460
24,256
gravitational/teleport
lib/backend/dynamo/dynamodbbk.go
Close
func (b *DynamoDBBackend) Close() error { b.setClosed() b.cancel() return b.buf.Close() }
go
func (b *DynamoDBBackend) Close() error { b.setClosed() b.cancel() return b.buf.Close() }
[ "func", "(", "b", "*", "DynamoDBBackend", ")", "Close", "(", ")", "error", "{", "b", ".", "setClosed", "(", ")", "\n", "b", ".", "cancel", "(", ")", "\n", "return", "b", ".", "buf", ".", "Close", "(", ")", "\n", "}" ]
// Close closes the DynamoDB driver // and releases associated resources
[ "Close", "closes", "the", "DynamoDB", "driver", "and", "releases", "associated", "resources" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/dynamo/dynamodbbk.go#L530-L534
24,257
gravitational/teleport
lib/backend/dynamo/dynamodbbk.go
deleteTable
func (b *DynamoDBBackend) deleteTable(ctx context.Context, tableName string, wait bool) error { tn := aws.String(tableName) _, err := b.svc.DeleteTable(&dynamodb.DeleteTableInput{TableName: tn}) if err != nil { return trace.Wrap(err) } if wait { return trace.Wrap( b.svc.WaitUntilTableNotExists(&dynamodb.Des...
go
func (b *DynamoDBBackend) deleteTable(ctx context.Context, tableName string, wait bool) error { tn := aws.String(tableName) _, err := b.svc.DeleteTable(&dynamodb.DeleteTableInput{TableName: tn}) if err != nil { return trace.Wrap(err) } if wait { return trace.Wrap( b.svc.WaitUntilTableNotExists(&dynamodb.Des...
[ "func", "(", "b", "*", "DynamoDBBackend", ")", "deleteTable", "(", "ctx", "context", ".", "Context", ",", "tableName", "string", ",", "wait", "bool", ")", "error", "{", "tn", ":=", "aws", ".", "String", "(", "tableName", ")", "\n", "_", ",", "err", "...
// deleteTable deletes DynamoDB table with a given name
[ "deleteTable", "deletes", "DynamoDB", "table", "with", "a", "given", "name" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/dynamo/dynamodbbk.go#L637-L648
24,258
gravitational/teleport
lib/backend/dynamo/dynamodbbk.go
getRecords
func (b *DynamoDBBackend) getRecords(ctx context.Context, startKey, endKey string, limit int, lastEvaluatedKey map[string]*dynamodb.AttributeValue) (*getResult, error) { query := "HashKey = :hashKey AND FullPath BETWEEN :fullPath AND :rangeEnd" attrV := map[string]interface{}{ ":fullPath": startKey, ":hashKey": ...
go
func (b *DynamoDBBackend) getRecords(ctx context.Context, startKey, endKey string, limit int, lastEvaluatedKey map[string]*dynamodb.AttributeValue) (*getResult, error) { query := "HashKey = :hashKey AND FullPath BETWEEN :fullPath AND :rangeEnd" attrV := map[string]interface{}{ ":fullPath": startKey, ":hashKey": ...
[ "func", "(", "b", "*", "DynamoDBBackend", ")", "getRecords", "(", "ctx", "context", ".", "Context", ",", "startKey", ",", "endKey", "string", ",", "limit", "int", ",", "lastEvaluatedKey", "map", "[", "string", "]", "*", "dynamodb", ".", "AttributeValue", "...
// getRecords retrieves all keys by path
[ "getRecords", "retrieves", "all", "keys", "by", "path" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/dynamo/dynamodbbk.go#L659-L700
24,259
gravitational/teleport
lib/backend/buffer.go
NewCircularBuffer
func NewCircularBuffer(ctx context.Context, size int) (*CircularBuffer, error) { if size <= 0 { return nil, trace.BadParameter("circular buffer size should be > 0") } ctx, cancel := context.WithCancel(ctx) buf := &CircularBuffer{ Entry: log.WithFields(log.Fields{ trace.Component: teleport.ComponentBuffer, ...
go
func NewCircularBuffer(ctx context.Context, size int) (*CircularBuffer, error) { if size <= 0 { return nil, trace.BadParameter("circular buffer size should be > 0") } ctx, cancel := context.WithCancel(ctx) buf := &CircularBuffer{ Entry: log.WithFields(log.Fields{ trace.Component: teleport.ComponentBuffer, ...
[ "func", "NewCircularBuffer", "(", "ctx", "context", ".", "Context", ",", "size", "int", ")", "(", "*", "CircularBuffer", ",", "error", ")", "{", "if", "size", "<=", "0", "{", "return", "nil", ",", "trace", ".", "BadParameter", "(", "\"", "\"", ")", "...
// NewCircularBuffer returns a new instance of circular buffer
[ "NewCircularBuffer", "returns", "a", "new", "instance", "of", "circular", "buffer" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/buffer.go#L48-L66
24,260
gravitational/teleport
lib/backend/buffer.go
Reset
func (c *CircularBuffer) Reset() { c.Lock() defer c.Unlock() // could close mulitple times c.watchers.walk(func(w *BufferWatcher) { w.Close() }) c.watchers = newWatcherTree() c.start = -1 c.end = -1 c.size = 0 for i := 0; i < len(c.events); i++ { c.events[i] = Event{} } }
go
func (c *CircularBuffer) Reset() { c.Lock() defer c.Unlock() // could close mulitple times c.watchers.walk(func(w *BufferWatcher) { w.Close() }) c.watchers = newWatcherTree() c.start = -1 c.end = -1 c.size = 0 for i := 0; i < len(c.events); i++ { c.events[i] = Event{} } }
[ "func", "(", "c", "*", "CircularBuffer", ")", "Reset", "(", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "// could close mulitple times", "c", ".", "watchers", ".", "walk", "(", "func", "(", "w", "*", "Bu...
// Reset resets all events from the queue // and closes all active watchers
[ "Reset", "resets", "all", "events", "from", "the", "queue", "and", "closes", "all", "active", "watchers" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/buffer.go#L70-L84
24,261
gravitational/teleport
lib/backend/buffer.go
Events
func (c *CircularBuffer) Events() []Event { c.Lock() defer c.Unlock() return c.eventsCopy() }
go
func (c *CircularBuffer) Events() []Event { c.Lock() defer c.Unlock() return c.eventsCopy() }
[ "func", "(", "c", "*", "CircularBuffer", ")", "Events", "(", ")", "[", "]", "Event", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "return", "c", ".", "eventsCopy", "(", ")", "\n", "}" ]
// Events returns a copy of records as arranged from start to end
[ "Events", "returns", "a", "copy", "of", "records", "as", "arranged", "from", "start", "to", "end" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/buffer.go#L99-L103
24,262
gravitational/teleport
lib/backend/buffer.go
eventsCopy
func (c *CircularBuffer) eventsCopy() []Event { if c.size == 0 { return nil } var out []Event for i := 0; i < c.size; i++ { index := (c.start + i) % len(c.events) if out == nil { out = make([]Event, 0, c.size) } out = append(out, c.events[index]) } return out }
go
func (c *CircularBuffer) eventsCopy() []Event { if c.size == 0 { return nil } var out []Event for i := 0; i < c.size; i++ { index := (c.start + i) % len(c.events) if out == nil { out = make([]Event, 0, c.size) } out = append(out, c.events[index]) } return out }
[ "func", "(", "c", "*", "CircularBuffer", ")", "eventsCopy", "(", ")", "[", "]", "Event", "{", "if", "c", ".", "size", "==", "0", "{", "return", "nil", "\n", "}", "\n", "var", "out", "[", "]", "Event", "\n", "for", "i", ":=", "0", ";", "i", "<...
// eventsCopy returns a copy of events as arranged from start to end
[ "eventsCopy", "returns", "a", "copy", "of", "events", "as", "arranged", "from", "start", "to", "end" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/buffer.go#L106-L119
24,263
gravitational/teleport
lib/backend/buffer.go
PushBatch
func (c *CircularBuffer) PushBatch(events []Event) { c.Lock() defer c.Unlock() for i := range events { c.push(events[i]) } }
go
func (c *CircularBuffer) PushBatch(events []Event) { c.Lock() defer c.Unlock() for i := range events { c.push(events[i]) } }
[ "func", "(", "c", "*", "CircularBuffer", ")", "PushBatch", "(", "events", "[", "]", "Event", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n\n", "for", "i", ":=", "range", "events", "{", "c", ".", "push", ...
// PushBatch pushes elements to the queue as a batch
[ "PushBatch", "pushes", "elements", "to", "the", "queue", "as", "a", "batch" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/buffer.go#L122-L129
24,264
gravitational/teleport
lib/backend/buffer.go
Push
func (c *CircularBuffer) Push(r Event) { c.Lock() defer c.Unlock() c.push(r) }
go
func (c *CircularBuffer) Push(r Event) { c.Lock() defer c.Unlock() c.push(r) }
[ "func", "(", "c", "*", "CircularBuffer", ")", "Push", "(", "r", "Event", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "c", ".", "push", "(", "r", ")", "\n", "}" ]
// Push pushes elements to the queue
[ "Push", "pushes", "elements", "to", "the", "queue" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/buffer.go#L132-L136
24,265
gravitational/teleport
lib/backend/buffer.go
NewWatcher
func (c *CircularBuffer) NewWatcher(ctx context.Context, watch Watch) (Watcher, error) { c.Lock() defer c.Unlock() select { case <-c.ctx.Done(): return nil, trace.BadParameter("buffer is closed") default: } if watch.QueueSize == 0 { watch.QueueSize = len(c.events) } if len(watch.Prefixes) == 0 { // if...
go
func (c *CircularBuffer) NewWatcher(ctx context.Context, watch Watch) (Watcher, error) { c.Lock() defer c.Unlock() select { case <-c.ctx.Done(): return nil, trace.BadParameter("buffer is closed") default: } if watch.QueueSize == 0 { watch.QueueSize = len(c.events) } if len(watch.Prefixes) == 0 { // if...
[ "func", "(", "c", "*", "CircularBuffer", ")", "NewWatcher", "(", "ctx", "context", ".", "Context", ",", "watch", "Watch", ")", "(", "Watcher", ",", "error", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n\n", ...
// NewWatcher adds a new watcher to the events buffer
[ "NewWatcher", "adds", "a", "new", "watcher", "to", "the", "events", "buffer" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/buffer.go#L203-L247
24,266
gravitational/teleport
lib/backend/buffer.go
String
func (w *BufferWatcher) String() string { return fmt.Sprintf("Watcher(name=%v, prefixes=%v, capacity=%v, size=%v)", w.Name, string(bytes.Join(w.Prefixes, []byte(", "))), w.capacity, len(w.eventsC)) }
go
func (w *BufferWatcher) String() string { return fmt.Sprintf("Watcher(name=%v, prefixes=%v, capacity=%v, size=%v)", w.Name, string(bytes.Join(w.Prefixes, []byte(", "))), w.capacity, len(w.eventsC)) }
[ "func", "(", "w", "*", "BufferWatcher", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "w", ".", "Name", ",", "string", "(", "bytes", ".", "Join", "(", "w", ".", "Prefixes", ",", "[", "]", "byte", ...
// String returns user-friendly representation // of the buffer watcher
[ "String", "returns", "user", "-", "friendly", "representation", "of", "the", "buffer", "watcher" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/buffer.go#L268-L270
24,267
gravitational/teleport
lib/backend/buffer.go
add
func (t *watcherTree) add(w *BufferWatcher) { for _, p := range w.Prefixes { prefix := string(p) val, ok := t.Tree.Get(prefix) var watchers []*BufferWatcher if ok { watchers = val.([]*BufferWatcher) } watchers = append(watchers, w) t.Tree.Insert(prefix, watchers) } }
go
func (t *watcherTree) add(w *BufferWatcher) { for _, p := range w.Prefixes { prefix := string(p) val, ok := t.Tree.Get(prefix) var watchers []*BufferWatcher if ok { watchers = val.([]*BufferWatcher) } watchers = append(watchers, w) t.Tree.Insert(prefix, watchers) } }
[ "func", "(", "t", "*", "watcherTree", ")", "add", "(", "w", "*", "BufferWatcher", ")", "{", "for", "_", ",", "p", ":=", "range", "w", ".", "Prefixes", "{", "prefix", ":=", "string", "(", "p", ")", "\n", "val", ",", "ok", ":=", "t", ".", "Tree",...
// add adds buffer watcher to the tree
[ "add", "adds", "buffer", "watcher", "to", "the", "tree" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/buffer.go#L300-L311
24,268
gravitational/teleport
lib/backend/buffer.go
rm
func (t *watcherTree) rm(w *BufferWatcher) bool { if w == nil { return false } var found bool for _, p := range w.Prefixes { prefix := string(p) val, ok := t.Tree.Get(prefix) if !ok { continue } buffers := val.([]*BufferWatcher) prevLen := len(buffers) for i := range buffers { if buffers[i] ==...
go
func (t *watcherTree) rm(w *BufferWatcher) bool { if w == nil { return false } var found bool for _, p := range w.Prefixes { prefix := string(p) val, ok := t.Tree.Get(prefix) if !ok { continue } buffers := val.([]*BufferWatcher) prevLen := len(buffers) for i := range buffers { if buffers[i] ==...
[ "func", "(", "t", "*", "watcherTree", ")", "rm", "(", "w", "*", "BufferWatcher", ")", "bool", "{", "if", "w", "==", "nil", "{", "return", "false", "\n", "}", "\n", "var", "found", "bool", "\n", "for", "_", ",", "p", ":=", "range", "w", ".", "Pr...
// rm removes the buffer watcher from the prefix tree
[ "rm", "removes", "the", "buffer", "watcher", "from", "the", "prefix", "tree" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/buffer.go#L314-L341
24,269
gravitational/teleport
lib/backend/buffer.go
walkPath
func (t *watcherTree) walkPath(key string, fn walkFn) { t.Tree.WalkPath(key, func(prefix string, val interface{}) bool { watchers := val.([]*BufferWatcher) for _, w := range watchers { fn(w) } return false }) }
go
func (t *watcherTree) walkPath(key string, fn walkFn) { t.Tree.WalkPath(key, func(prefix string, val interface{}) bool { watchers := val.([]*BufferWatcher) for _, w := range watchers { fn(w) } return false }) }
[ "func", "(", "t", "*", "watcherTree", ")", "walkPath", "(", "key", "string", ",", "fn", "walkFn", ")", "{", "t", ".", "Tree", ".", "WalkPath", "(", "key", ",", "func", "(", "prefix", "string", ",", "val", "interface", "{", "}", ")", "bool", "{", ...
// walkPath walks the tree above the longest matching prefix // and calls fn callback for every buffer watcher
[ "walkPath", "walks", "the", "tree", "above", "the", "longest", "matching", "prefix", "and", "calls", "fn", "callback", "for", "every", "buffer", "watcher" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/buffer.go#L348-L356
24,270
gravitational/teleport
lib/backend/buffer.go
walk
func (t *watcherTree) walk(fn walkFn) { t.Tree.Walk(func(prefix string, val interface{}) bool { watchers := val.([]*BufferWatcher) for _, w := range watchers { fn(w) } return false }) }
go
func (t *watcherTree) walk(fn walkFn) { t.Tree.Walk(func(prefix string, val interface{}) bool { watchers := val.([]*BufferWatcher) for _, w := range watchers { fn(w) } return false }) }
[ "func", "(", "t", "*", "watcherTree", ")", "walk", "(", "fn", "walkFn", ")", "{", "t", ".", "Tree", ".", "Walk", "(", "func", "(", "prefix", "string", ",", "val", "interface", "{", "}", ")", "bool", "{", "watchers", ":=", "val", ".", "(", "[", ...
// walk calls fn for every matching leaf of the tree
[ "walk", "calls", "fn", "for", "every", "matching", "leaf", "of", "the", "tree" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/backend/buffer.go#L359-L367
24,271
gravitational/teleport
lib/kube/client/kubeclient.go
UpdateKubeconfig
func UpdateKubeconfig(tc *client.TeleportClient) error { config, err := LoadKubeConfig() if err != nil { return trace.Wrap(err) } clusterName, proxyPort := tc.KubeProxyHostPort() var clusterAddr string if tc.SiteName != "" { // In case of a remote cluster, use SNI subdomain to "point" to a remote cluster nam...
go
func UpdateKubeconfig(tc *client.TeleportClient) error { config, err := LoadKubeConfig() if err != nil { return trace.Wrap(err) } clusterName, proxyPort := tc.KubeProxyHostPort() var clusterAddr string if tc.SiteName != "" { // In case of a remote cluster, use SNI subdomain to "point" to a remote cluster nam...
[ "func", "UpdateKubeconfig", "(", "tc", "*", "client", ".", "TeleportClient", ")", "error", "{", "config", ",", "err", ":=", "LoadKubeConfig", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "trace", ".", "Wrap", "(", "err", ")", "\n", "}", "...
// UpdateKubeconfig adds Teleport configuration to kubeconfig.
[ "UpdateKubeconfig", "adds", "Teleport", "configuration", "to", "kubeconfig", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/kube/client/kubeclient.go#L26-L73
24,272
gravitational/teleport
lib/kube/client/kubeclient.go
RemoveKubeconifg
func RemoveKubeconifg(tc *client.TeleportClient, clusterName string) error { // Load existing kubeconfig from disk. config, err := LoadKubeConfig() if err != nil { return trace.Wrap(err) } // Remove Teleport related AuthInfos, Clusters, and Contexts from kubeconfig. delete(config.AuthInfos, clusterName) delet...
go
func RemoveKubeconifg(tc *client.TeleportClient, clusterName string) error { // Load existing kubeconfig from disk. config, err := LoadKubeConfig() if err != nil { return trace.Wrap(err) } // Remove Teleport related AuthInfos, Clusters, and Contexts from kubeconfig. delete(config.AuthInfos, clusterName) delet...
[ "func", "RemoveKubeconifg", "(", "tc", "*", "client", ".", "TeleportClient", ",", "clusterName", "string", ")", "error", "{", "// Load existing kubeconfig from disk.", "config", ",", "err", ":=", "LoadKubeConfig", "(", ")", "\n", "if", "err", "!=", "nil", "{", ...
// RemoveKubeconifg removes Teleport configuration from kubeconfig.
[ "RemoveKubeconifg", "removes", "Teleport", "configuration", "from", "kubeconfig", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/kube/client/kubeclient.go#L76-L100
24,273
gravitational/teleport
lib/kube/client/kubeclient.go
LoadKubeConfig
func LoadKubeConfig() (*clientcmdapi.Config, error) { filename, err := utils.EnsureLocalPath( kubeconfigFromEnv(), teleport.KubeConfigDir, teleport.KubeConfigFile) if err != nil { return nil, trace.Wrap(err) } config, err := clientcmd.LoadFromFile(filename) if err != nil && !os.IsNotExist(err) { return n...
go
func LoadKubeConfig() (*clientcmdapi.Config, error) { filename, err := utils.EnsureLocalPath( kubeconfigFromEnv(), teleport.KubeConfigDir, teleport.KubeConfigFile) if err != nil { return nil, trace.Wrap(err) } config, err := clientcmd.LoadFromFile(filename) if err != nil && !os.IsNotExist(err) { return n...
[ "func", "LoadKubeConfig", "(", ")", "(", "*", "clientcmdapi", ".", "Config", ",", "error", ")", "{", "filename", ",", "err", ":=", "utils", ".", "EnsureLocalPath", "(", "kubeconfigFromEnv", "(", ")", ",", "teleport", ".", "KubeConfigDir", ",", "teleport", ...
// LoadKubeconfig tries to read a kubeconfig file and if it can't, returns an error. // One exception, missing files result in empty configs, not an error.
[ "LoadKubeconfig", "tries", "to", "read", "a", "kubeconfig", "file", "and", "if", "it", "can", "t", "returns", "an", "error", ".", "One", "exception", "missing", "files", "result", "in", "empty", "configs", "not", "an", "error", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/kube/client/kubeclient.go#L104-L121
24,274
gravitational/teleport
lib/kube/client/kubeclient.go
SaveKubeConfig
func SaveKubeConfig(config clientcmdapi.Config) error { filename, err := utils.EnsureLocalPath( kubeconfigFromEnv(), teleport.KubeConfigDir, teleport.KubeConfigFile) if err != nil { return trace.Wrap(err) } err = clientcmd.WriteToFile(config, filename) if err != nil { return trace.ConvertSystemError(err...
go
func SaveKubeConfig(config clientcmdapi.Config) error { filename, err := utils.EnsureLocalPath( kubeconfigFromEnv(), teleport.KubeConfigDir, teleport.KubeConfigFile) if err != nil { return trace.Wrap(err) } err = clientcmd.WriteToFile(config, filename) if err != nil { return trace.ConvertSystemError(err...
[ "func", "SaveKubeConfig", "(", "config", "clientcmdapi", ".", "Config", ")", "error", "{", "filename", ",", "err", ":=", "utils", ".", "EnsureLocalPath", "(", "kubeconfigFromEnv", "(", ")", ",", "teleport", ".", "KubeConfigDir", ",", "teleport", ".", "KubeConf...
// SaveKubeConfig saves updated config to location specified by environment variable or // default location
[ "SaveKubeConfig", "saves", "updated", "config", "to", "location", "specified", "by", "environment", "variable", "or", "default", "location" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/kube/client/kubeclient.go#L125-L139
24,275
gravitational/teleport
lib/kube/client/kubeclient.go
kubeconfigFromEnv
func kubeconfigFromEnv() string { kubeconfig := os.Getenv(teleport.EnvKubeConfig) // The KUBECONFIG environment variable is a list. On Windows it's // semicolon-delimited. On Linux and macOS it's colon-delimited. var parts []string switch runtime.GOOS { case teleport.WindowsOS: parts = strings.Split(kubeconfig...
go
func kubeconfigFromEnv() string { kubeconfig := os.Getenv(teleport.EnvKubeConfig) // The KUBECONFIG environment variable is a list. On Windows it's // semicolon-delimited. On Linux and macOS it's colon-delimited. var parts []string switch runtime.GOOS { case teleport.WindowsOS: parts = strings.Split(kubeconfig...
[ "func", "kubeconfigFromEnv", "(", ")", "string", "{", "kubeconfig", ":=", "os", ".", "Getenv", "(", "teleport", ".", "EnvKubeConfig", ")", "\n\n", "// The KUBECONFIG environment variable is a list. On Windows it's", "// semicolon-delimited. On Linux and macOS it's colon-delimited...
// kubeconfigFromEnv extracts location of kubeconfig from the environment.
[ "kubeconfigFromEnv", "extracts", "location", "of", "kubeconfig", "from", "the", "environment", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/kube/client/kubeclient.go#L142-L163
24,276
gravitational/teleport
lib/events/filelog.go
CheckAndSetDefaults
func (cfg *FileLogConfig) CheckAndSetDefaults() error { if cfg.Dir == "" { return trace.BadParameter("missing parameter Dir") } if !utils.IsDir(cfg.Dir) { return trace.BadParameter("path %q does not exist or is not a directory", cfg.Dir) } if cfg.SymlinkDir == "" { cfg.SymlinkDir = cfg.Dir } if !utils.IsDi...
go
func (cfg *FileLogConfig) CheckAndSetDefaults() error { if cfg.Dir == "" { return trace.BadParameter("missing parameter Dir") } if !utils.IsDir(cfg.Dir) { return trace.BadParameter("path %q does not exist or is not a directory", cfg.Dir) } if cfg.SymlinkDir == "" { cfg.SymlinkDir = cfg.Dir } if !utils.IsDi...
[ "func", "(", "cfg", "*", "FileLogConfig", ")", "CheckAndSetDefaults", "(", ")", "error", "{", "if", "cfg", ".", "Dir", "==", "\"", "\"", "{", "return", "trace", ".", "BadParameter", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "!", "utils", ".", "I...
// CheckAndSetDefaults checks and sets config defaults
[ "CheckAndSetDefaults", "checks", "and", "sets", "config", "defaults" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/filelog.go#L60-L86
24,277
gravitational/teleport
lib/events/filelog.go
NewFileLog
func NewFileLog(cfg FileLogConfig) (*FileLog, error) { if err := cfg.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } f := &FileLog{ FileLogConfig: cfg, Entry: log.WithFields(log.Fields{ trace.Component: teleport.ComponentAuditLog, }), } return f, nil }
go
func NewFileLog(cfg FileLogConfig) (*FileLog, error) { if err := cfg.CheckAndSetDefaults(); err != nil { return nil, trace.Wrap(err) } f := &FileLog{ FileLogConfig: cfg, Entry: log.WithFields(log.Fields{ trace.Component: teleport.ComponentAuditLog, }), } return f, nil }
[ "func", "NewFileLog", "(", "cfg", "FileLogConfig", ")", "(", "*", "FileLog", ",", "error", ")", "{", "if", "err", ":=", "cfg", ".", "CheckAndSetDefaults", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "trace", ".", "Wrap", "(", "err",...
// NewFileLog returns a new instance of a file log
[ "NewFileLog", "returns", "a", "new", "instance", "of", "a", "file", "log" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/filelog.go#L89-L100
24,278
gravitational/teleport
lib/events/filelog.go
EmitAuditEvent
func (l *FileLog) EmitAuditEvent(event Event, fields EventFields) error { // see if the log needs to be rotated err := l.rotateLog() if err != nil { log.Error(err) } err = UpdateEventFields(event, fields, l.Clock, l.UIDGenerator) if err != nil { log.Error(err) } // line is the text to be logged line, err :...
go
func (l *FileLog) EmitAuditEvent(event Event, fields EventFields) error { // see if the log needs to be rotated err := l.rotateLog() if err != nil { log.Error(err) } err = UpdateEventFields(event, fields, l.Clock, l.UIDGenerator) if err != nil { log.Error(err) } // line is the text to be logged line, err :...
[ "func", "(", "l", "*", "FileLog", ")", "EmitAuditEvent", "(", "event", "Event", ",", "fields", "EventFields", ")", "error", "{", "// see if the log needs to be rotated", "err", ":=", "l", ".", "rotateLog", "(", ")", "\n", "if", "err", "!=", "nil", "{", "lo...
// EmitAuditEvent adds a new event to the log. Part of auth.IFileLog interface.
[ "EmitAuditEvent", "adds", "a", "new", "event", "to", "the", "log", ".", "Part", "of", "auth", ".", "IFileLog", "interface", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/filelog.go#L117-L137
24,279
gravitational/teleport
lib/events/filelog.go
Close
func (l *FileLog) Close() error { l.Lock() defer l.Unlock() var err error if l.file != nil { err = l.file.Close() l.file = nil } return err }
go
func (l *FileLog) Close() error { l.Lock() defer l.Unlock() var err error if l.file != nil { err = l.file.Close() l.file = nil } return err }
[ "func", "(", "l", "*", "FileLog", ")", "Close", "(", ")", "error", "{", "l", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "Unlock", "(", ")", "\n\n", "var", "err", "error", "\n", "if", "l", ".", "file", "!=", "nil", "{", "err", "=", "l", ...
// Close closes the audit log, which inluces closing all file handles and releasing // all session loggers
[ "Close", "closes", "the", "audit", "log", "which", "inluces", "closing", "all", "file", "handles", "and", "releasing", "all", "session", "loggers" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/filelog.go#L230-L240
24,280
gravitational/teleport
lib/events/filelog.go
rotateLog
func (l *FileLog) rotateLog() (err error) { l.Lock() defer l.Unlock() // determine the timestamp for the current log file fileTime := l.Clock.Now().In(time.UTC) // truncate time to the resolution of one day, cutting at the day end boundary fileTime = time.Date(fileTime.Year(), fileTime.Month(), fileTime.Day(), ...
go
func (l *FileLog) rotateLog() (err error) { l.Lock() defer l.Unlock() // determine the timestamp for the current log file fileTime := l.Clock.Now().In(time.UTC) // truncate time to the resolution of one day, cutting at the day end boundary fileTime = time.Date(fileTime.Year(), fileTime.Month(), fileTime.Day(), ...
[ "func", "(", "l", "*", "FileLog", ")", "rotateLog", "(", ")", "(", "err", "error", ")", "{", "l", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "Unlock", "(", ")", "\n\n", "// determine the timestamp for the current log file", "fileTime", ":=", "l", "....
// rotateLog checks if the current log file is older than a given duration, // and if it is, closes it and opens a new one.
[ "rotateLog", "checks", "if", "the", "current", "log", "file", "is", "older", "than", "a", "given", "duration", "and", "if", "it", "is", "closes", "it", "and", "opens", "a", "new", "one", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/filelog.go#L292-L342
24,281
gravitational/teleport
lib/events/filelog.go
matchingFiles
func (l *FileLog) matchingFiles(fromUTC, toUTC time.Time) ([]eventFile, error) { var dirs []string var err error if l.SearchDirs != nil { dirs, err = l.SearchDirs() if err != nil { return nil, trace.Wrap(err) } } else { dirs = []string{l.Dir} } var filtered []eventFile for _, dir := range dirs { //...
go
func (l *FileLog) matchingFiles(fromUTC, toUTC time.Time) ([]eventFile, error) { var dirs []string var err error if l.SearchDirs != nil { dirs, err = l.SearchDirs() if err != nil { return nil, trace.Wrap(err) } } else { dirs = []string{l.Dir} } var filtered []eventFile for _, dir := range dirs { //...
[ "func", "(", "l", "*", "FileLog", ")", "matchingFiles", "(", "fromUTC", ",", "toUTC", "time", ".", "Time", ")", "(", "[", "]", "eventFile", ",", "error", ")", "{", "var", "dirs", "[", "]", "string", "\n", "var", "err", "error", "\n", "if", "l", "...
// matchingFiles returns files matching the time restrictions of the query // across multiple auth servers, returns a list of file names
[ "matchingFiles", "returns", "files", "matching", "the", "time", "restrictions", "of", "the", "query", "across", "multiple", "auth", "servers", "returns", "a", "list", "of", "file", "names" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/filelog.go#L346-L398
24,282
gravitational/teleport
lib/events/filelog.go
parseFileTime
func parseFileTime(filename string) (time.Time, error) { base := strings.TrimSuffix(filename, filepath.Ext(filename)) return time.Parse(defaults.AuditLogTimeFormat, base) }
go
func parseFileTime(filename string) (time.Time, error) { base := strings.TrimSuffix(filename, filepath.Ext(filename)) return time.Parse(defaults.AuditLogTimeFormat, base) }
[ "func", "parseFileTime", "(", "filename", "string", ")", "(", "time", ".", "Time", ",", "error", ")", "{", "base", ":=", "strings", ".", "TrimSuffix", "(", "filename", ",", "filepath", ".", "Ext", "(", "filename", ")", ")", "\n", "return", "time", ".",...
// parseFileTime parses file's timestamp encoded into filename
[ "parseFileTime", "parses", "file", "s", "timestamp", "encoded", "into", "filename" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/filelog.go#L401-L404
24,283
gravitational/teleport
lib/events/filelog.go
getTime
func getTime(v interface{}) time.Time { sval, ok := v.(string) if !ok { return time.Time{} } t, err := time.Parse(time.RFC3339, sval) if err != nil { return time.Time{} } return t }
go
func getTime(v interface{}) time.Time { sval, ok := v.(string) if !ok { return time.Time{} } t, err := time.Parse(time.RFC3339, sval) if err != nil { return time.Time{} } return t }
[ "func", "getTime", "(", "v", "interface", "{", "}", ")", "time", ".", "Time", "{", "sval", ",", "ok", ":=", "v", ".", "(", "string", ")", "\n", "if", "!", "ok", "{", "return", "time", ".", "Time", "{", "}", "\n", "}", "\n", "t", ",", "err", ...
// getTime converts json time to string
[ "getTime", "converts", "json", "time", "to", "string" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/events/filelog.go#L501-L511
24,284
gravitational/teleport
lib/utils/equals.go
StringMapsEqual
func StringMapsEqual(a, b map[string]string) bool { if len(a) != len(b) { return false } for key := range a { if a[key] != b[key] { return false } } return true }
go
func StringMapsEqual(a, b map[string]string) bool { if len(a) != len(b) { return false } for key := range a { if a[key] != b[key] { return false } } return true }
[ "func", "StringMapsEqual", "(", "a", ",", "b", "map", "[", "string", "]", "string", ")", "bool", "{", "if", "len", "(", "a", ")", "!=", "len", "(", "b", ")", "{", "return", "false", "\n", "}", "\n", "for", "key", ":=", "range", "a", "{", "if", ...
// StringMapsEqual returns true if two strings maps are equal
[ "StringMapsEqual", "returns", "true", "if", "two", "strings", "maps", "are", "equal" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/equals.go#L33-L43
24,285
gravitational/teleport
lib/utils/equals.go
StringMapSlicesEqual
func StringMapSlicesEqual(a, b map[string][]string) bool { if len(a) != len(b) { return false } for key := range a { if !StringSlicesEqual(a[key], b[key]) { return false } } return true }
go
func StringMapSlicesEqual(a, b map[string][]string) bool { if len(a) != len(b) { return false } for key := range a { if !StringSlicesEqual(a[key], b[key]) { return false } } return true }
[ "func", "StringMapSlicesEqual", "(", "a", ",", "b", "map", "[", "string", "]", "[", "]", "string", ")", "bool", "{", "if", "len", "(", "a", ")", "!=", "len", "(", "b", ")", "{", "return", "false", "\n", "}", "\n", "for", "key", ":=", "range", "...
// StringMapSlicesEqual returns true if two maps of string slices are equal
[ "StringMapSlicesEqual", "returns", "true", "if", "two", "maps", "of", "string", "slices", "are", "equal" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/utils/equals.go#L59-L69
24,286
gravitational/teleport
lib/services/saml.go
NewSAMLConnector
func NewSAMLConnector(name string, spec SAMLConnectorSpecV2) SAMLConnector { return &SAMLConnectorV2{ Kind: KindSAMLConnector, Version: V2, Metadata: Metadata{ Name: name, Namespace: defaults.Namespace, }, Spec: spec, } }
go
func NewSAMLConnector(name string, spec SAMLConnectorSpecV2) SAMLConnector { return &SAMLConnectorV2{ Kind: KindSAMLConnector, Version: V2, Metadata: Metadata{ Name: name, Namespace: defaults.Namespace, }, Spec: spec, } }
[ "func", "NewSAMLConnector", "(", "name", "string", ",", "spec", "SAMLConnectorSpecV2", ")", "SAMLConnector", "{", "return", "&", "SAMLConnectorV2", "{", "Kind", ":", "KindSAMLConnector", ",", "Version", ":", "V2", ",", "Metadata", ":", "Metadata", "{", "Name", ...
// NewSAMLConnector returns a new SAMLConnector based off a name and SAMLConnectorSpecV2.
[ "NewSAMLConnector", "returns", "a", "new", "SAMLConnector", "based", "off", "a", "name", "and", "SAMLConnectorSpecV2", "." ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/saml.go#L110-L120
24,287
gravitational/teleport
lib/services/saml.go
UnmarshalSAMLConnector
func (*TeleportSAMLConnectorMarshaler) UnmarshalSAMLConnector(bytes []byte, opts ...MarshalOption) (SAMLConnector, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } var h ResourceHeader err = utils.FastUnmarshal(bytes, &h) if err != nil { return nil, trace.Wrap(err) } s...
go
func (*TeleportSAMLConnectorMarshaler) UnmarshalSAMLConnector(bytes []byte, opts ...MarshalOption) (SAMLConnector, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } var h ResourceHeader err = utils.FastUnmarshal(bytes, &h) if err != nil { return nil, trace.Wrap(err) } s...
[ "func", "(", "*", "TeleportSAMLConnectorMarshaler", ")", "UnmarshalSAMLConnector", "(", "bytes", "[", "]", "byte", ",", "opts", "...", "MarshalOption", ")", "(", "SAMLConnector", ",", "error", ")", "{", "cfg", ",", "err", ":=", "collectOptions", "(", "opts", ...
// UnmarshalSAMLConnector unmarshals connector from
[ "UnmarshalSAMLConnector", "unmarshals", "connector", "from" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/saml.go#L155-L193
24,288
gravitational/teleport
lib/services/saml.go
MarshalSAMLConnector
func (*TeleportSAMLConnectorMarshaler) MarshalSAMLConnector(c SAMLConnector, opts ...MarshalOption) ([]byte, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } type connv2 interface { V2() *SAMLConnectorV2 } version := cfg.GetVersion() switch version { case V2: v, ok :...
go
func (*TeleportSAMLConnectorMarshaler) MarshalSAMLConnector(c SAMLConnector, opts ...MarshalOption) ([]byte, error) { cfg, err := collectOptions(opts) if err != nil { return nil, trace.Wrap(err) } type connv2 interface { V2() *SAMLConnectorV2 } version := cfg.GetVersion() switch version { case V2: v, ok :...
[ "func", "(", "*", "TeleportSAMLConnectorMarshaler", ")", "MarshalSAMLConnector", "(", "c", "SAMLConnector", ",", "opts", "...", "MarshalOption", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "cfg", ",", "err", ":=", "collectOptions", "(", "opts", ")", ...
// MarshalUser marshals SAML connector into JSON
[ "MarshalUser", "marshals", "SAML", "connector", "into", "JSON" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/saml.go#L196-L223
24,289
gravitational/teleport
lib/services/saml.go
Equals
func (o *SAMLConnectorV2) Equals(other SAMLConnector) bool { if o.GetName() != other.GetName() { return false } if o.GetCert() != other.GetCert() { return false } if o.GetAudience() != other.GetAudience() { return false } if o.GetEntityDescriptor() != other.GetEntityDescriptor() { return false } if o.E...
go
func (o *SAMLConnectorV2) Equals(other SAMLConnector) bool { if o.GetName() != other.GetName() { return false } if o.GetCert() != other.GetCert() { return false } if o.GetAudience() != other.GetAudience() { return false } if o.GetEntityDescriptor() != other.GetEntityDescriptor() { return false } if o.E...
[ "func", "(", "o", "*", "SAMLConnectorV2", ")", "Equals", "(", "other", "SAMLConnector", ")", "bool", "{", "if", "o", ".", "GetName", "(", ")", "!=", "other", ".", "GetName", "(", ")", "{", "return", "false", "\n", "}", "\n", "if", "o", ".", "GetCer...
// Equals returns true if the connectors are identical
[ "Equals", "returns", "true", "if", "the", "connectors", "are", "identical" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/saml.go#L340-L389
24,290
gravitational/teleport
lib/services/saml.go
GetAttributes
func (o *SAMLConnectorV2) GetAttributes() []string { var out []string for _, mapping := range o.Spec.AttributesToRoles { out = append(out, mapping.Name) } return utils.Deduplicate(out) }
go
func (o *SAMLConnectorV2) GetAttributes() []string { var out []string for _, mapping := range o.Spec.AttributesToRoles { out = append(out, mapping.Name) } return utils.Deduplicate(out) }
[ "func", "(", "o", "*", "SAMLConnectorV2", ")", "GetAttributes", "(", ")", "[", "]", "string", "{", "var", "out", "[", "]", "string", "\n", "for", "_", ",", "mapping", ":=", "range", "o", ".", "Spec", ".", "AttributesToRoles", "{", "out", "=", "append...
// GetAttributes returns list of attributes expected by mappings
[ "GetAttributes", "returns", "list", "of", "attributes", "expected", "by", "mappings" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/saml.go#L470-L476
24,291
gravitational/teleport
lib/services/saml.go
MapAttributes
func (o *SAMLConnectorV2) MapAttributes(assertionInfo saml2.AssertionInfo) []string { var roles []string for _, mapping := range o.Spec.AttributesToRoles { for _, attr := range assertionInfo.Values { if attr.Name != mapping.Name { continue } mappingLoop: for _, value := range attr.Values { for _,...
go
func (o *SAMLConnectorV2) MapAttributes(assertionInfo saml2.AssertionInfo) []string { var roles []string for _, mapping := range o.Spec.AttributesToRoles { for _, attr := range assertionInfo.Values { if attr.Name != mapping.Name { continue } mappingLoop: for _, value := range attr.Values { for _,...
[ "func", "(", "o", "*", "SAMLConnectorV2", ")", "MapAttributes", "(", "assertionInfo", "saml2", ".", "AssertionInfo", ")", "[", "]", "string", "{", "var", "roles", "[", "]", "string", "\n", "for", "_", ",", "mapping", ":=", "range", "o", ".", "Spec", "....
// MapClaims maps SAML attributes to roles
[ "MapClaims", "maps", "SAML", "attributes", "to", "roles" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/saml.go#L479-L508
24,292
gravitational/teleport
lib/services/saml.go
GetAttributeNames
func GetAttributeNames(attributes map[string]types.Attribute) []string { var out []string for _, attr := range attributes { out = append(out, attr.Name) } return out }
go
func GetAttributeNames(attributes map[string]types.Attribute) []string { var out []string for _, attr := range attributes { out = append(out, attr.Name) } return out }
[ "func", "GetAttributeNames", "(", "attributes", "map", "[", "string", "]", "types", ".", "Attribute", ")", "[", "]", "string", "{", "var", "out", "[", "]", "string", "\n", "for", "_", ",", "attr", ":=", "range", "attributes", "{", "out", "=", "append",...
// GetAttributeNames returns a list of claim names from the claim values
[ "GetAttributeNames", "returns", "a", "list", "of", "claim", "names", "from", "the", "claim", "values" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/saml.go#L792-L798
24,293
gravitational/teleport
lib/services/presence.go
NewNamespace
func NewNamespace(name string) Namespace { return Namespace{ Kind: KindNamespace, Version: V2, Metadata: Metadata{ Name: name, }, } }
go
func NewNamespace(name string) Namespace { return Namespace{ Kind: KindNamespace, Version: V2, Metadata: Metadata{ Name: name, }, } }
[ "func", "NewNamespace", "(", "name", "string", ")", "Namespace", "{", "return", "Namespace", "{", "Kind", ":", "KindNamespace", ",", "Version", ":", "V2", ",", "Metadata", ":", "Metadata", "{", "Name", ":", "name", ",", "}", ",", "}", "\n", "}" ]
// NewNamespace returns new namespace
[ "NewNamespace", "returns", "new", "namespace" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/presence.go#L159-L167
24,294
gravitational/teleport
lib/services/resource.go
AddOptions
func AddOptions(opts []MarshalOption, add ...MarshalOption) []MarshalOption { out := make([]MarshalOption, len(opts), len(opts)+len(add)) copy(out, opts) return append(opts, add...) }
go
func AddOptions(opts []MarshalOption, add ...MarshalOption) []MarshalOption { out := make([]MarshalOption, len(opts), len(opts)+len(add)) copy(out, opts) return append(opts, add...) }
[ "func", "AddOptions", "(", "opts", "[", "]", "MarshalOption", ",", "add", "...", "MarshalOption", ")", "[", "]", "MarshalOption", "{", "out", ":=", "make", "(", "[", "]", "MarshalOption", ",", "len", "(", "opts", ")", ",", "len", "(", "opts", ")", "+...
// AddOptions adds marshal options and returns a new copy
[ "AddOptions", "adds", "marshal", "options", "and", "returns", "a", "new", "copy" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/resource.go#L254-L258
24,295
gravitational/teleport
lib/services/resource.go
WithResourceID
func WithResourceID(id int64) MarshalOption { return func(c *MarshalConfig) error { c.ID = id return nil } }
go
func WithResourceID(id int64) MarshalOption { return func(c *MarshalConfig) error { c.ID = id return nil } }
[ "func", "WithResourceID", "(", "id", "int64", ")", "MarshalOption", "{", "return", "func", "(", "c", "*", "MarshalConfig", ")", "error", "{", "c", ".", "ID", "=", "id", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithResourceID assigns ID to the resource
[ "WithResourceID", "assigns", "ID", "to", "the", "resource" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/resource.go#L261-L266
24,296
gravitational/teleport
lib/services/resource.go
WithExpires
func WithExpires(expires time.Time) MarshalOption { return func(c *MarshalConfig) error { c.Expires = expires return nil } }
go
func WithExpires(expires time.Time) MarshalOption { return func(c *MarshalConfig) error { c.Expires = expires return nil } }
[ "func", "WithExpires", "(", "expires", "time", ".", "Time", ")", "MarshalOption", "{", "return", "func", "(", "c", "*", "MarshalConfig", ")", "error", "{", "c", ".", "Expires", "=", "expires", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithExpires assigns expiry value
[ "WithExpires", "assigns", "expiry", "value" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/resource.go#L269-L274
24,297
gravitational/teleport
lib/services/resource.go
WithVersion
func WithVersion(v string) MarshalOption { return func(c *MarshalConfig) error { switch v { case V1, V2: c.Version = v return nil default: return trace.BadParameter("version '%v' is not supported", v) } } }
go
func WithVersion(v string) MarshalOption { return func(c *MarshalConfig) error { switch v { case V1, V2: c.Version = v return nil default: return trace.BadParameter("version '%v' is not supported", v) } } }
[ "func", "WithVersion", "(", "v", "string", ")", "MarshalOption", "{", "return", "func", "(", "c", "*", "MarshalConfig", ")", "error", "{", "switch", "v", "{", "case", "V1", ",", "V2", ":", "c", ".", "Version", "=", "v", "\n", "return", "nil", "\n", ...
// WithVersion sets marshal version
[ "WithVersion", "sets", "marshal", "version" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/resource.go#L280-L290
24,298
gravitational/teleport
lib/services/resource.go
SetTTL
func (h *ResourceHeader) SetTTL(clock clockwork.Clock, ttl time.Duration) { h.Metadata.SetTTL(clock, ttl) }
go
func (h *ResourceHeader) SetTTL(clock clockwork.Clock, ttl time.Duration) { h.Metadata.SetTTL(clock, ttl) }
[ "func", "(", "h", "*", "ResourceHeader", ")", "SetTTL", "(", "clock", "clockwork", ".", "Clock", ",", "ttl", "time", ".", "Duration", ")", "{", "h", ".", "Metadata", ".", "SetTTL", "(", "clock", ",", "ttl", ")", "\n", "}" ]
// SetTTL sets Expires header using current clock
[ "SetTTL", "sets", "Expires", "header", "using", "current", "clock" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/resource.go#L394-L396
24,299
gravitational/teleport
lib/services/resource.go
UnmarshalJSON
func (u *UnknownResource) UnmarshalJSON(raw []byte) error { var h ResourceHeader if err := json.Unmarshal(raw, &h); err != nil { return trace.Wrap(err) } u.Raw = make([]byte, len(raw)) u.ResourceHeader = h copy(u.Raw, raw) return nil }
go
func (u *UnknownResource) UnmarshalJSON(raw []byte) error { var h ResourceHeader if err := json.Unmarshal(raw, &h); err != nil { return trace.Wrap(err) } u.Raw = make([]byte, len(raw)) u.ResourceHeader = h copy(u.Raw, raw) return nil }
[ "func", "(", "u", "*", "UnknownResource", ")", "UnmarshalJSON", "(", "raw", "[", "]", "byte", ")", "error", "{", "var", "h", "ResourceHeader", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "raw", ",", "&", "h", ")", ";", "err", "!=", "nil...
// UnmarshalJSON unmarshals header and captures raw state
[ "UnmarshalJSON", "unmarshals", "header", "and", "captures", "raw", "state" ]
d5243dbe8d36bba44bf640c08f1c49185ed2c8a4
https://github.com/gravitational/teleport/blob/d5243dbe8d36bba44bf640c08f1c49185ed2c8a4/lib/services/resource.go#L419-L428