Skip to content

Commit

Permalink
Updated info page with curl examples; added new @authentication attri…
Browse files Browse the repository at this point in the history
…bute stating the authentication type in use; updated RelaxNG schema
  • Loading branch information
proycon committed Sep 13, 2017
1 parent 31a209f commit d8a9124
Show file tree
Hide file tree
Showing 4 changed files with 223 additions and 158 deletions.
20 changes: 17 additions & 3 deletions clam/clamservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,17 @@ def parsecredentials(credentials):
return user, oauth_access_token


def auth_type():
if settings.OAUTH:
return "oauth"
elif settings.PREAUTHHEADER:
return "preauth"
elif (settings.ASSUMESSL or settings.BASICAUTH) and (settings.USERS or settings.USERS_MYSQL):
return "basic"
elif settings.USERS or settings.USERS_MYSQL:
return "digest"
else:
return "none"

################# Views ##########################

Expand Down Expand Up @@ -387,7 +398,8 @@ def index(credentials = None):
interfaceoptions=settings.INTERFACEOPTIONS,
customhtml=settings.CUSTOMHTML_INDEX,
allow_origin=settings.ALLOW_ORIGIN,
oauth_access_token=oauth_encrypt(oauth_access_token)
oauth_access_token=oauth_encrypt(oauth_access_token),
auth_type=auth_type()
)), headers={'allow_origin':settings.ALLOW_ORIGIN}) #pylint: disable=bad-continuation


Expand Down Expand Up @@ -436,7 +448,8 @@ def info(credentials=None):
interfaceoptions=settings.INTERFACEOPTIONS,
customhtml=settings.CUSTOMHTML_INDEX,
allow_origin=settings.ALLOW_ORIGIN,
oauth_access_token=oauth_encrypt(oauth_access_token)
oauth_access_token=oauth_encrypt(oauth_access_token),
auth_type=auth_type()
)), headers={'allow_origin': settings.ALLOW_ORIGIN})

class Admin:
Expand Down Expand Up @@ -939,7 +952,8 @@ def response(user, project, parameters, errormsg = "", datafile = False, oauth_a
interfaceoptions=settings.INTERFACEOPTIONS,
customhtml=customhtml,
allow_origin=settings.ALLOW_ORIGIN,
oauth_access_token=oauth_encrypt(oauth_access_token)
oauth_access_token=oauth_encrypt(oauth_access_token),
auth_type=auth_type()
),http_code), headers={'allow_origin':settings.ALLOW_ORIGIN})


Expand Down

0 comments on commit d8a9124

Please sign in to comment.