Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getAuthorization: function (options, callback) {
// TODO 这里根据自己业务需要做好放行判断
if (!allowScope()) {
console.log('deny Scope');
return;
}
// 获取临时密钥
var policy = STS.getPolicy(options.Scope);
STS.getCredential({
secretId: config.SecretId,
secretKey: config.SecretKey,
policy: policy,
// durationSeconds: 1800,
proxy: '',
region: 'ap-guangzhou'
}, function (err, data) {
if (err) {
console.error(err);
} else {
console.log(data);
var credentials = data.credentials;
callback({
TmpSecretId: credentials.tmpSecretId,
TmpSecretKey: credentials.tmpSecretKey,
XCosSecurityToken: credentials.sessionToken,
getAuthorization: function (options, callback) {
// TODO 这里根据自己业务需要做好放行判断
if (!allowScope()) {
console.log('deny Scope');
return;
}
// 获取临时密钥
var policy = STS.getPolicy(options.Scope);
STS.getCredential({
secretId: config.SecretId,
secretKey: config.SecretKey,
policy: policy,
// durationSeconds: 1800,
proxy: '',
region: 'ap-guangzhou'
}, function (err, data) {
if (err) {
console.error(err);
} else {
console.log(data);
var credentials = data.credentials;
callback({
TmpSecretId: credentials.tmpSecretId,
TmpSecretKey: credentials.tmpSecretKey,
getAuthorization: function (options, callback) {
STS.getCredential({
secretId: config.SecretId,
secretKey: config.SecretKey,
policy: policy,
durationSeconds: 7200,
proxy: '',
region: 'ap-guangzhou'
}, function (err, data) {
if (err) {
console.error(err);
} else {
var credentials = data.credentials;
callback({
TmpSecretId: credentials.tmpSecretId,
TmpSecretKey: credentials.tmpSecretKey,
XCosSecurityToken: credentials.sessionToken,
ExpiredTime: data.expiredTime,