Skip to content

Commit 1c00d53

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 92475a1 + 6870564 commit 1c00d53

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/scitokens_internal.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,14 +580,17 @@ scitokens::Enforcer::scope_validator(const jwt::claim &claim, void *myself) {
580580

581581
// If we are in compatibility mode and this is a WLCG token, then translate the authorization
582582
// names to utilize the SciToken-style names.
583+
std::string alt_authz;
583584
if (me->m_validate_profile == SciToken::Profile::COMPAT &&
584585
me->m_validator.get_profile() == SciToken::Profile::WLCG_1_0) {
585586
if (authz == "storage.read") {
586587
authz = "read";
587-
} else if (authz == "storage.write") {
588+
} else if (authz == "storage.create") {
588589
authz = "write";
590+
alt_authz = "create";
589591
} else if (authz == "storage.modify") {
590592
authz = "write";
593+
alt_authz = "modify";
591594
} else if (authz == "compute.read") {
592595
authz = "condor:/READ";
593596
} else if (authz == "compute.modify") {
@@ -601,7 +604,8 @@ scitokens::Enforcer::scope_validator(const jwt::claim &claim, void *myself) {
601604

602605
if (me->m_test_authz.empty()) {
603606
me->m_gen_acls.emplace_back(authz, path);
604-
} else if ((me->m_test_authz == authz) &&
607+
if (!alt_authz.empty()) me->m_gen_acls.emplace_back(alt_authz, path);
608+
} else if (((me->m_test_authz == authz) || (!alt_authz.empty() && (me->m_test_authz == alt_authz))) &&
605609
(requested_path.substr(0, path.size()) == path)) {
606610
return true;
607611
}

src/scitokens_internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ class Validator {
390390
}
391391
}
392392
// std::cout << "Running claim " << claim_pair.first << " through validation." << std::endl;
393-
if (iter != m_validators.end()) for (const auto verification_func : iter->second) {
393+
if (iter != m_validators.end()) for (const auto &verification_func : iter->second) {
394394
const jwt::claim &claim = jwt.get_payload_claim(claim_pair.first);
395395
if (claim.get_type() != jwt::claim::type::string) {
396396
std::stringstream ss;
@@ -409,7 +409,7 @@ class Validator {
409409
}
410410
}
411411
}
412-
if (iter_claim != m_claim_validators.end()) for (const auto verification_pair : iter_claim->second) {
412+
if (iter_claim != m_claim_validators.end()) for (const auto &verification_pair : iter_claim->second) {
413413
const jwt::claim &claim = jwt.get_payload_claim(claim_pair.first);
414414
if (verification_pair.first(claim, verification_pair.second) == false) {
415415
std::stringstream ss;

0 commit comments

Comments
 (0)