-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Enabling host certificate #13
Open
CinziaLu
wants to merge
3
commits into
DIRACGrid:integration
Choose a base branch
from
CinziaLu:integration
base: integration
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+97
−5
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from tornado import web, gen | ||
from RESTDIRAC.RESTSystem.Base.RESTHandler import RESTHandler | ||
from RESTDIRAC.ConfigurationSystem.Client.Helpers import RESTConf | ||
|
||
class CSHandler( RESTHandler ): | ||
|
||
ROUTE = "/config/(Sections|Options|Value)" | ||
|
||
@web.asynchronous | ||
def get( self, reqType ): | ||
if reqType == "Sections": | ||
return self.SectionsAction() | ||
elif reqType == "Options": | ||
return self.OptionsAction() | ||
elif reqType == "Value": | ||
return self.ValueAction() | ||
|
||
|
||
@gen.engine | ||
def ValueAction( self ): | ||
args = self.request.arguments | ||
try: | ||
path = args[ 'ValuePath' ][0] | ||
except KeyError: | ||
self.send_error( 400 ) | ||
return | ||
condDict = {} | ||
if 'allOwners' not in self.request.arguments: | ||
condDict[ 'Owner' ] = self.getUserName() | ||
result = RESTConf.getValue( path ) | ||
self.finish( result ) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
""" | ||
Test script that ask a token to the REST SERVER using a trusted host certificate. | ||
Gets the job history using the token. | ||
Gets the pilot commands using the token. | ||
""" | ||
import requests | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The content of this file is a bit too "personal". Please add at least some explanations on what it's for. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll do it. |
||
import json | ||
|
||
|
||
# The REST server url | ||
REST_URL = 'https://0.0.0.0:9910' | ||
|
||
########################################### | ||
# Get the access token first | ||
|
||
# GET request parameters | ||
params = {'grant_type':'client_credentials', | ||
'group':'TrustedHost', | ||
'setup':'LHCb-Certification'} | ||
|
||
# The user certificate, password will be asked for to the user | ||
# before request submission | ||
#certificate = ('/home/cinzia/.globus/usercert.pem', | ||
# '/home/cinzia/.globus/userkey.pem') | ||
|
||
|
||
certificate = ('/home/cinzia/devRoot/etc/grid-security/hostcert.pem','/home/cinzia/devRoot/etc/grid-security/hostkey.pem') | ||
# proxies=('/tmp/x509up_u1000','/tmp/x509up_u1000') | ||
# result = requests.get(REST_URL+"/oauth2/token",params=params,cert=proxies, verify=False) | ||
|
||
result = requests.get(REST_URL+"/oauth2/token",params=params,cert=certificate,verify=False) | ||
|
||
|
||
# the output is returned as a json encoded string, decode it here | ||
resultDict = json.loads( result.text ) | ||
access_token = resultDict['token'] | ||
|
||
JobHistory = requests.get(REST_URL+'/jobs/history',params={'access_token':access_token}, | ||
verify=False) | ||
|
||
PilotCommands = requests.get(REST_URL+'/config/Value',params={'access_token':access_token,'ValuePath':'/Operations/LHCb-Certification/Pilot/Commands/BOINC'}, verify=False) | ||
|
||
######################################## |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't so much get the code, but IIUC, out of the above, only "ValueAction" is implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I need to finish the implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I marked this as a "WIP" (Work In progress) PR, when finished please remove the tag