Skip to content

Commit

Permalink
Add token authentication support
Browse files Browse the repository at this point in the history
  • Loading branch information
khurtado committed Dec 5, 2024
1 parent c4a3916 commit f53a5b0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
25 changes: 25 additions & 0 deletions etc/submit_py3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,31 @@ else
fi
echo -e "======== WMAgent Python bootstrap finished at $(TZ=GMT date) ========\n"

echo -e "======= WMAgent token verification at $(TZ=GMT date) ========\n"
echo "Content under _CONDOR_CREDS: ${_CONDOR_CREDS}"
ls -l ${_CONDOR_CREDS}

if [ -f "${_CONDOR_CREDS}/cms.use" ]
then
echo "CMS token found, setting BEARER_TOKEN_FILE=${_CONDOR_CREDS}/cms.use"
export BEARER_TOKEN_FILE=${_CONDOR_CREDS}/cms.use

# Show token information
# This tool requires htgettoken package in the cmssw runtime apptainer image
if command -v httokendecode ls 2>&1 > /dev/null
then
httokendecode -H ${BEARER_TOKEN_FILE}
else
echo "Warning: [WMAgent Token verification] httokendecode tool could not be found."
echo "Warning: Token exists and can be used, but details will not be displayed."
fi
else
echo "[WMAgent token verification]: The bearer token file could not be found."
# Do not fail, we still support x509 proxies
# if we fail here in the future, we need to define an exit code number
# exit 1106
fi


echo "======== WMAgent Unpack the job starting at $(TZ=GMT date) ========"
# Should be ready to unpack and run this
Expand Down
4 changes: 4 additions & 0 deletions src/python/WMCore/BossAir/Plugins/SimpleCondorPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,10 @@ def getJobParameters(self, jobList):
ad['Requirements'] = self.reqStr

ad['My.x509userproxy'] = classad.quote(self.x509userproxy)

# Allow oauth based token authentication
ad['use_oauth_services'] = "cms"

sites = ','.join(sorted(job.get('possibleSites')))
ad['My.DESIRED_Sites'] = classad.quote(str(sites))
sites = ','.join(sorted(job.get('potentialSites')))
Expand Down

0 comments on commit f53a5b0

Please sign in to comment.