Files
teleport/lib/srv/db/snowflake/cache.go
T
Jakub NyckowskiandMarek Smoliński 9c046930ff Snowflake integration (#12564)
Add Snowflake integration.

Co-authored-by: Marek Smoliński <marek@goteleport.com>
2022-06-06 17:49:38 +00:00

41 lines
1.1 KiB
Go

/*
Copyright 2022 Gravitational, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package snowflake
// tokenCache is a simple in memory map between Teleport WebSession ID and Snowflake tokens.
type tokenCache struct {
tokens map[string]string
}
func newTokenCache() tokenCache {
return tokenCache{tokens: make(map[string]string)}
}
func (t *tokenCache) getToken(sessionID string) string {
return t.tokens[sessionID]
}
func (t *tokenCache) setToken(sessionID, snowflakeToken string) {
t.tokens[sessionID] = snowflakeToken
}
func (t *tokenCache) reset() {
t.tokens = make(map[string]string)
}