Skip to content

Commit 352b890

Browse files
authored
Merge pull request #5757 from TaykYoku/int_renameValues
[integration] rename downloadablePersonalProxy value
2 parents 87059a3 + 45d88fc commit 352b890

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/DIRAC/ConfigurationSystem/Client/Utilities.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -671,10 +671,10 @@ def getAuthorizationServerMetadata(issuer=None, ignoreErrors=False):
671671
return S_OK(data) if data["issuer"] else S_ERROR("Cannot find DIRAC Authorization Server issuer.")
672672

673673

674-
def isDownloadablePersonalProxy():
675-
"""Get downloadablePersonalProxy flag
674+
def isDownloadProxyAllowed():
675+
"""Get allowProxyDownload flag
676676
677677
:return: S_OK(bool)/S_ERROR()
678678
"""
679679
cs_path = "/Systems/Framework/%s/APIs/Auth" % getSystemInstance("Framework")
680-
return gConfig.getValue(cs_path + "/downloadablePersonalProxy", True)
680+
return gConfig.getValue(cs_path + "/allowProxyDownload", True)

src/DIRAC/FrameworkSystem/ConfigTemplate.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ APIs
66
{
77
Port = 8000
88
# Allow download personal proxy. By default: True
9-
downloadablePersonalProxy = True
9+
allowProxyDownload = True
1010
}
1111
##END
1212
}

src/DIRAC/FrameworkSystem/private/authorization/AuthServer.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from DIRAC.FrameworkSystem.DB.AuthDB import AuthDB
1616
from DIRAC.Resources.IdProvider.Utilities import getProvidersForInstance, getProviderInfo
1717
from DIRAC.Resources.IdProvider.IdProviderFactory import IdProviderFactory
18-
from DIRAC.ConfigurationSystem.Client.Utilities import isDownloadablePersonalProxy
18+
from DIRAC.ConfigurationSystem.Client.Utilities import isDownloadProxyAllowed
1919
from DIRAC.ConfigurationSystem.Client.Helpers.Registry import (
2020
getUsernameForDN,
2121
getEmailsForGroup,
@@ -143,10 +143,10 @@ def generateProxyOrToken(
143143
# User request a proxy
144144
if "proxy" in scope_to_list(scope):
145145
# Try to return user proxy if proxy scope present in the authorization request
146-
if not isDownloadablePersonalProxy():
147-
raise OAuth2Error("You can't get proxy, configuration(downloadablePersonalProxy) not allow to do that.")
148-
self.log.debug(
149-
"Try to query %s@%s proxy%s" % (user, group, (" with lifetime:%s" % lifetime) if lifetime else "")
146+
if not isDownloadProxyAllowed():
147+
raise OAuth2Error("You can't get proxy, configuration(allowProxyDownload) not allow to do that.")
148+
sLog.debug(
149+
"Try to query %s@%s proxy%s" % (user, group, ("with lifetime:%s" % lifetime) if lifetime else "")
150150
)
151151
# Get user DNs
152152
result = getDNForUsername(userName)
@@ -368,7 +368,7 @@ def create_authorization_response(self, response, username):
368368
:return: TornadoResponse object
369369
"""
370370
try:
371-
response = super(AuthServer, self).create_authorization_response(response, username)
371+
response = super().create_authorization_response(response, username)
372372
response.clear_cookie("auth_session")
373373
return response
374374
except Exception as e:

tests/Integration/Framework/Test_AuthServer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def getToken(self, *args, **kwargs):
3535
mockgetIdPForGroup = MagicMock(return_value=S_OK("IdP"))
3636
mockgetDNForUsername = MagicMock(return_value=S_OK("DN"))
3737
mockgetUsernameForDN = MagicMock(return_value=S_OK("user"))
38-
mockisDownloadablePersonalProxy = MagicMock(return_value=True)
38+
mockisDownloadProxyAllowed = MagicMock(return_value=True)
3939
mockgetAuthorizationServerMetadata = MagicMock(return_value=S_OK(dict(issuer="https://issuer.url/")))
4040

4141

@@ -48,7 +48,7 @@ def auth_server(monkeypatch):
4848
monkeypatch.setattr(AuthServer, "getUsernameForDN", mockgetUsernameForDN)
4949
monkeypatch.setattr(AuthServer, "ProxyManagerClient", ProxyManagerClient)
5050
monkeypatch.setattr(AuthServer, "TokenManagerClient", TokenManagerClient)
51-
monkeypatch.setattr(AuthServer, "isDownloadablePersonalProxy", mockisDownloadablePersonalProxy)
51+
monkeypatch.setattr(AuthServer, "isDownloadProxyAllowed", mockisDownloadProxyAllowed)
5252
return AuthServer.AuthServer()
5353

5454

0 commit comments

Comments
 (0)