Skip to content

Commit 6870564

Browse files
authored
Merge pull request #32 from bbockelm/alt_write_authz
Add alternate authorization names for compatibility mode
2 parents c00284f + 4cecf0c commit 6870564

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
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
}

0 commit comments

Comments
 (0)