Skip to content

Commit

Permalink
Merge pull request #2829 from opensciencegrid/revert-2822-pr/SOFTWARE…
Browse files Browse the repository at this point in the history
…-5412.duplicate-issuer

Revert "Use a config hash as the block name for each scitokens.conf "Issuer" block (SOFTWARE-5412)"
  • Loading branch information
matyasselmeci authored Dec 16, 2022
2 parents b51b4f4 + f765229 commit bf082e4
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/webapp/vos_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import copy
import hashlib

from collections import OrderedDict
from logging import getLogger
Expand Down Expand Up @@ -351,21 +350,10 @@ def __str__(self):
return f"SciToken: issuer={self.issuer} base_path={self.base_path} restricted_path={self.restricted_path} " \
f"map_subject={self.map_subject}"

def _issuer_block_hash(self):
# An 8-character hash of this object's parameters that can be used
# as the name of the generated "Issuer" block to avoid collisions.

# Copied from the format string in __str__() so we can change
# __str__() later without affecting the hash.
return hashlib.sha1(
(f"issuer={self.issuer} base_path={self.base_path} restricted_path={self.restricted_path}"
f"map_subject={self.map_subject}").encode("utf-8", errors="ignore")
).hexdigest()[0:8]

def get_scitokens_conf_block(self, service_name: str):
if service_name not in [XROOTD_CACHE_SERVER, XROOTD_ORIGIN_SERVER]:
raise ValueError(f"service_name must be '{XROOTD_CACHE_SERVER}' or '{XROOTD_ORIGIN_SERVER}'")
block = (f"[Issuer {self.issuer} {self._issuer_block_hash()}]\n"
block = (f"[Issuer {self.issuer}]\n"
f"issuer = {self.issuer}\n"
f"base_path = {self.base_path}\n")
if self.restricted_path:
Expand Down

0 comments on commit bf082e4

Please sign in to comment.