Fix caching problem (#22473)

This commit is contained in:
Erik Sundell 2020-03-10 14:10:48 +01:00 committed by GitHub
parent 65370c5443
commit cd012bdfb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -28,7 +28,7 @@ var awsCredentialCache = make(map[string]cache)
var credentialCacheLock sync.RWMutex var credentialCacheLock sync.RWMutex
func GetCredentials(dsInfo *DatasourceInfo) (*credentials.Credentials, error) { func GetCredentials(dsInfo *DatasourceInfo) (*credentials.Credentials, error) {
cacheKey := dsInfo.AccessKey + ":" + dsInfo.Profile + ":" + dsInfo.AssumeRoleArn cacheKey := fmt.Sprintf("%s:%s:%s:%s", dsInfo.AuthType, dsInfo.AccessKey, dsInfo.Profile, dsInfo.AssumeRoleArn)
credentialCacheLock.RLock() credentialCacheLock.RLock()
if _, ok := awsCredentialCache[cacheKey]; ok { if _, ok := awsCredentialCache[cacheKey]; ok {
if awsCredentialCache[cacheKey].expiration != nil && if awsCredentialCache[cacheKey].expiration != nil &&

View File

@ -130,7 +130,12 @@ export class ConfigEditor extends PureComponent<Props, State> {
value={authProviderOptions.find(authProvider => authProvider.value === options.jsonData.authType)} value={authProviderOptions.find(authProvider => authProvider.value === options.jsonData.authType)}
options={authProviderOptions} options={authProviderOptions}
defaultValue={options.jsonData.authType} defaultValue={options.jsonData.authType}
onChange={onUpdateDatasourceJsonDataOptionSelect(this.props, 'authType')} onChange={option => {
if (options.jsonData.authType === 'arn' && option.value !== 'arn') {
delete this.props.options.jsonData.assumeRoleArn;
}
onUpdateDatasourceJsonDataOptionSelect(this.props, 'authType')(option);
}}
/> />
</div> </div>
</div> </div>