rucio 37.2.0__py3-none-any.whl → 37.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rucio might be problematic. Click here for more details.
- rucio/cli/rule.py +1 -1
- rucio/client/accountclient.py +205 -60
- rucio/client/accountlimitclient.py +84 -25
- rucio/client/baseclient.py +85 -48
- rucio/client/client.py +49 -41
- rucio/client/configclient.py +36 -13
- rucio/client/credentialclient.py +16 -6
- rucio/client/didclient.py +321 -133
- rucio/client/diracclient.py +13 -6
- rucio/client/downloadclient.py +435 -165
- rucio/client/exportclient.py +8 -2
- rucio/client/fileclient.py +10 -3
- rucio/client/importclient.py +4 -1
- rucio/client/lifetimeclient.py +48 -31
- rucio/client/lockclient.py +22 -7
- rucio/client/metaconventionsclient.py +59 -21
- rucio/client/pingclient.py +3 -1
- rucio/client/replicaclient.py +213 -96
- rucio/client/requestclient.py +123 -16
- rucio/client/rseclient.py +385 -160
- rucio/client/ruleclient.py +147 -51
- rucio/client/scopeclient.py +35 -10
- rucio/client/subscriptionclient.py +60 -27
- rucio/client/touchclient.py +16 -7
- rucio/common/plugins.py +1 -1
- rucio/core/did.py +2 -3
- rucio/core/permission/generic.py +37 -1
- rucio/core/replica.py +6 -6
- rucio/core/rule.py +5 -3
- rucio/daemons/judge/evaluator.py +1 -1
- rucio/db/sqla/util.py +1 -1
- rucio/gateway/authentication.py +58 -88
- rucio/gateway/config.py +63 -75
- rucio/gateway/did.py +245 -329
- rucio/gateway/dirac.py +33 -34
- rucio/gateway/exporter.py +27 -30
- rucio/gateway/importer.py +12 -14
- rucio/gateway/lifetime_exception.py +16 -24
- rucio/gateway/lock.py +27 -40
- rucio/gateway/replica.py +334 -249
- rucio/gateway/request.py +176 -103
- rucio/gateway/rse.py +191 -218
- rucio/gateway/rule.py +115 -146
- rucio/gateway/scope.py +18 -25
- rucio/gateway/subscription.py +90 -108
- rucio/gateway/trace.py +48 -0
- rucio/vcsversion.py +3 -3
- rucio/web/rest/flaskapi/v1/accounts.py +2 -2
- rucio/web/rest/flaskapi/v1/auth.py +15 -0
- rucio/web/rest/flaskapi/v1/common.py +3 -0
- rucio/web/rest/flaskapi/v1/config.py +7 -7
- rucio/web/rest/flaskapi/v1/dids.py +55 -55
- rucio/web/rest/flaskapi/v1/dirac.py +2 -2
- rucio/web/rest/flaskapi/v1/export.py +1 -1
- rucio/web/rest/flaskapi/v1/import.py +1 -1
- rucio/web/rest/flaskapi/v1/lifetime_exceptions.py +5 -5
- rucio/web/rest/flaskapi/v1/locks.py +4 -4
- rucio/web/rest/flaskapi/v1/main.py +17 -10
- rucio/web/rest/flaskapi/v1/redirect.py +1 -1
- rucio/web/rest/flaskapi/v1/replicas.py +30 -29
- rucio/web/rest/flaskapi/v1/requests.py +211 -20
- rucio/web/rest/flaskapi/v1/rses.py +37 -37
- rucio/web/rest/flaskapi/v1/rules.py +15 -15
- rucio/web/rest/flaskapi/v1/scopes.py +3 -3
- rucio/web/rest/flaskapi/v1/subscriptions.py +9 -9
- rucio/web/rest/flaskapi/v1/traces.py +75 -77
- {rucio-37.2.0.data → rucio-37.4.0.data}/data/rucio/etc/rucio.cfg.template +0 -1
- {rucio-37.2.0.data → rucio-37.4.0.data}/data/rucio/etc/rucio_multi_vo.cfg.template +0 -1
- {rucio-37.2.0.dist-info → rucio-37.4.0.dist-info}/METADATA +1 -1
- {rucio-37.2.0.dist-info → rucio-37.4.0.dist-info}/RECORD +127 -126
- {rucio-37.2.0.dist-info → rucio-37.4.0.dist-info}/WHEEL +1 -1
- {rucio-37.2.0.data → rucio-37.4.0.data}/data/rucio/etc/alembic.ini.template +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/data/rucio/etc/alembic_offline.ini.template +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/data/rucio/etc/globus-config.yml.template +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/data/rucio/etc/ldap.cfg.template +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/data/rucio/etc/mail_templates/rule_approval_request.tmpl +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/data/rucio/etc/mail_templates/rule_approved_admin.tmpl +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/data/rucio/etc/mail_templates/rule_approved_user.tmpl +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/data/rucio/etc/mail_templates/rule_denied_admin.tmpl +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/data/rucio/etc/mail_templates/rule_denied_user.tmpl +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/data/rucio/etc/mail_templates/rule_ok_notification.tmpl +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/data/rucio/etc/rse-accounts.cfg.template +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/data/rucio/etc/rucio.cfg.atlas.client.template +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/data/rucio/requirements.server.txt +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/data/rucio/tools/bootstrap.py +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/data/rucio/tools/merge_rucio_configs.py +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/data/rucio/tools/reset_database.py +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-abacus-account +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-abacus-collection-replica +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-abacus-rse +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-admin +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-atropos +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-auditor +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-automatix +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-bb8 +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-cache-client +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-cache-consumer +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-conveyor-finisher +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-conveyor-poller +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-conveyor-preparer +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-conveyor-receiver +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-conveyor-stager +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-conveyor-submitter +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-conveyor-throttler +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-dark-reaper +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-dumper +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-follower +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-hermes +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-judge-cleaner +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-judge-evaluator +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-judge-injector +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-judge-repairer +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-kronos +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-minos +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-minos-temporary-expiration +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-necromancer +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-oauth-manager +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-reaper +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-replica-recoverer +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-rse-decommissioner +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-storage-consistency-actions +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-transmogrifier +0 -0
- {rucio-37.2.0.data → rucio-37.4.0.data}/scripts/rucio-undertaker +0 -0
- {rucio-37.2.0.dist-info → rucio-37.4.0.dist-info}/licenses/AUTHORS.rst +0 -0
- {rucio-37.2.0.dist-info → rucio-37.4.0.dist-info}/licenses/LICENSE +0 -0
- {rucio-37.2.0.dist-info → rucio-37.4.0.dist-info}/top_level.txt +0 -0
rucio/daemons/judge/evaluator.py
CHANGED
|
@@ -122,7 +122,7 @@ def run_once(
|
|
|
122
122
|
|
|
123
123
|
try:
|
|
124
124
|
start_time = time.time()
|
|
125
|
-
re_evaluate_did(scope=did.scope, name=did.name, rule_evaluation_action=did.rule_evaluation_action)
|
|
125
|
+
re_evaluate_did(scope=did.scope, name=did.name, rule_evaluation_action=did.rule_evaluation_action, logger=logger)
|
|
126
126
|
logger(logging.DEBUG, 'evaluation of %s:%s took %f', did.scope, did.name, time.time() - start_time)
|
|
127
127
|
delete_updated_did(id_=did.id)
|
|
128
128
|
done_dids[did_tag].append(did.rule_evaluation_action)
|
rucio/db/sqla/util.py
CHANGED
|
@@ -337,7 +337,7 @@ def list_oracle_global_temp_tables(session: "Session") -> list[str]:
|
|
|
337
337
|
global_temp_tables = [
|
|
338
338
|
str(t[0]).upper()
|
|
339
339
|
for t in session.execute(
|
|
340
|
-
text(
|
|
340
|
+
text("SELECT /*+ OPT_PARAM('OPTIMIZER_FEATURES_ENABLE', '11.2.0.4') */ UPPER(table_name) "
|
|
341
341
|
'FROM all_tables '
|
|
342
342
|
'WHERE OWNER = :owner AND IOT_NAME IS NULL AND DURATION IS NOT NULL'),
|
|
343
343
|
dict(owner=models.BASE.metadata.schema.upper())
|
rucio/gateway/authentication.py
CHANGED
|
@@ -12,27 +12,21 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
-
from typing import
|
|
15
|
+
from typing import Any, Optional
|
|
16
16
|
|
|
17
17
|
from rucio.common import exception
|
|
18
18
|
from rucio.common.types import InternalAccount, TokenDict
|
|
19
19
|
from rucio.common.utils import gateway_update_return_dict
|
|
20
20
|
from rucio.core import authentication, identity, oidc
|
|
21
|
-
from rucio.db.sqla.constants import IdentityType
|
|
22
|
-
from rucio.db.sqla.session import
|
|
21
|
+
from rucio.db.sqla.constants import DatabaseOperationType, IdentityType
|
|
22
|
+
from rucio.db.sqla.session import db_session
|
|
23
23
|
from rucio.gateway import permission
|
|
24
24
|
|
|
25
|
-
if TYPE_CHECKING:
|
|
26
|
-
from sqlalchemy.orm import Session
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
@transactional_session
|
|
30
26
|
def refresh_cli_auth_token(
|
|
31
27
|
token_string: str,
|
|
32
28
|
account: str,
|
|
33
29
|
vo: str = 'def',
|
|
34
|
-
*,
|
|
35
|
-
session: "Session"
|
|
36
30
|
) -> Optional[tuple[str, int]]:
|
|
37
31
|
"""
|
|
38
32
|
Checks if there is active refresh token and if so returns
|
|
@@ -40,20 +34,18 @@ def refresh_cli_auth_token(
|
|
|
40
34
|
refresh and returns new access token.
|
|
41
35
|
:param token_string: token string
|
|
42
36
|
:param account: Rucio account for which token refresh should be considered
|
|
43
|
-
:param session: The database session in use.
|
|
44
37
|
|
|
45
38
|
:return: tuple of (access token, expiration epoch), None otherswise
|
|
46
39
|
"""
|
|
47
40
|
internal_account = InternalAccount(account, vo=vo)
|
|
48
|
-
|
|
41
|
+
|
|
42
|
+
with db_session(DatabaseOperationType.WRITE) as session:
|
|
43
|
+
return oidc.refresh_cli_auth_token(token_string, internal_account, session=session)
|
|
49
44
|
|
|
50
45
|
|
|
51
|
-
@transactional_session
|
|
52
46
|
def redirect_auth_oidc(
|
|
53
47
|
authn_code: str,
|
|
54
48
|
fetchtoken: bool = False,
|
|
55
|
-
*,
|
|
56
|
-
session: "Session"
|
|
57
49
|
) -> Optional[str]:
|
|
58
50
|
"""
|
|
59
51
|
Finds the Authentication URL in the Rucio DB oauth_requests table
|
|
@@ -63,21 +55,18 @@ def redirect_auth_oidc(
|
|
|
63
55
|
authorization securely to IdP via Rucio Auth server through a browser.
|
|
64
56
|
:param fetchtoken: If True, valid token temporarily saved in the oauth_requests table
|
|
65
57
|
will be returned. If False, redirection URL is returned.
|
|
66
|
-
:param session: The database session in use.
|
|
67
58
|
|
|
68
59
|
:returns: result of the query (authorization URL or a
|
|
69
60
|
token if a user asks with the correct code) or None.
|
|
70
61
|
Exception thrown in case of an unexpected crash.
|
|
71
62
|
"""
|
|
72
|
-
|
|
63
|
+
with db_session(DatabaseOperationType.WRITE) as session:
|
|
64
|
+
return authentication.redirect_auth_oidc(authn_code, fetchtoken, session=session)
|
|
73
65
|
|
|
74
66
|
|
|
75
|
-
@transactional_session
|
|
76
67
|
def get_auth_oidc(
|
|
77
68
|
account: str,
|
|
78
69
|
vo: str = 'def',
|
|
79
|
-
*,
|
|
80
|
-
session: "Session",
|
|
81
70
|
**kwargs
|
|
82
71
|
) -> str:
|
|
83
72
|
"""
|
|
@@ -107,7 +96,6 @@ def get_auth_oidc(
|
|
|
107
96
|
:param refresh_lifetime: specifies how long the OAuth daemon should
|
|
108
97
|
be refreshing this token. Default is 96 hours.
|
|
109
98
|
:param ip: IP address of the client as a string.
|
|
110
|
-
:param session: The database session in use.
|
|
111
99
|
|
|
112
100
|
:returns: User & Rucio OIDC Client specific Authorization or Redirection URL as a string
|
|
113
101
|
OR a redirection url to be used in user's browser for authentication.
|
|
@@ -115,16 +103,14 @@ def get_auth_oidc(
|
|
|
115
103
|
# no permission layer for the moment !
|
|
116
104
|
|
|
117
105
|
internal_account = InternalAccount(account, vo=vo)
|
|
118
|
-
|
|
106
|
+
with db_session(DatabaseOperationType.WRITE) as session:
|
|
107
|
+
return oidc.get_auth_oidc(internal_account, session=session, **kwargs)
|
|
119
108
|
|
|
120
109
|
|
|
121
|
-
@transactional_session
|
|
122
110
|
def get_token_oidc(
|
|
123
111
|
auth_query_string: str,
|
|
124
112
|
ip: Optional[str] = None,
|
|
125
|
-
|
|
126
|
-
session: "Session"
|
|
127
|
-
) -> Optional[dict[str, Optional[Union[str, bool]]]]:
|
|
113
|
+
) -> Optional[dict[str, Any]]:
|
|
128
114
|
"""
|
|
129
115
|
After Rucio User got redirected to Rucio /auth/oidc_token (or /auth/oidc_code)
|
|
130
116
|
REST endpoints with authz code and session state encoded within the URL.
|
|
@@ -132,17 +118,16 @@ def get_token_oidc(
|
|
|
132
118
|
|
|
133
119
|
:param auth_query_string: IdP redirection URL query string (AuthZ code & user session state).
|
|
134
120
|
:param ip: IP address of the client as a string.
|
|
135
|
-
:param session: The database session in use.
|
|
136
121
|
|
|
137
122
|
:returns: One of the following tuples: ("fetchcode", <code>); ("token", <token>);
|
|
138
123
|
("polling", True); The result depends on the authentication strategy being used
|
|
139
124
|
(no auto, auto, polling).
|
|
140
125
|
"""
|
|
141
126
|
# no permission layer for the moment !
|
|
142
|
-
|
|
127
|
+
with db_session(DatabaseOperationType.WRITE) as session:
|
|
128
|
+
return oidc.get_token_oidc(auth_query_string, ip, session=session)
|
|
143
129
|
|
|
144
130
|
|
|
145
|
-
@transactional_session
|
|
146
131
|
def get_auth_token_user_pass(
|
|
147
132
|
account: str,
|
|
148
133
|
username: str,
|
|
@@ -150,8 +135,6 @@ def get_auth_token_user_pass(
|
|
|
150
135
|
appid: str,
|
|
151
136
|
ip: Optional[str] = None,
|
|
152
137
|
vo: str = 'def',
|
|
153
|
-
*,
|
|
154
|
-
session: "Session"
|
|
155
138
|
) -> Optional[TokenDict]:
|
|
156
139
|
"""
|
|
157
140
|
Authenticate a Rucio account temporarily via username and password.
|
|
@@ -164,30 +147,27 @@ def get_auth_token_user_pass(
|
|
|
164
147
|
:param appid: The application identifier as a string.
|
|
165
148
|
:param ip: IP address of the client as a string.
|
|
166
149
|
:param vo: The VO to act on.
|
|
167
|
-
:param session: The database session in use.
|
|
168
150
|
|
|
169
151
|
:returns: A dict with token and expires_at entries.
|
|
170
152
|
"""
|
|
171
153
|
|
|
172
154
|
kwargs = {'account': account, 'username': username, 'password': password}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
155
|
+
with db_session(DatabaseOperationType.WRITE) as session:
|
|
156
|
+
auth_result = permission.has_permission(issuer=account, vo=vo, action='get_auth_token_user_pass', kwargs=kwargs, session=session)
|
|
157
|
+
if not auth_result.allowed:
|
|
158
|
+
raise exception.AccessDenied('User with identity %s can not log to account %s. %s' % (username, account, auth_result.message))
|
|
176
159
|
|
|
177
|
-
|
|
160
|
+
internal_account = InternalAccount(account, vo=vo)
|
|
178
161
|
|
|
179
|
-
|
|
162
|
+
return authentication.get_auth_token_user_pass(internal_account, username, password, appid, ip, session=session)
|
|
180
163
|
|
|
181
164
|
|
|
182
|
-
@transactional_session
|
|
183
165
|
def get_auth_token_gss(
|
|
184
166
|
account: str,
|
|
185
167
|
gsscred: str,
|
|
186
168
|
appid: str,
|
|
187
169
|
ip: Optional[str] = None,
|
|
188
170
|
vo: str = 'def',
|
|
189
|
-
*,
|
|
190
|
-
session: "Session"
|
|
191
171
|
) -> Optional[TokenDict]:
|
|
192
172
|
"""
|
|
193
173
|
Authenticate a Rucio account temporarily via a GSS token.
|
|
@@ -199,30 +179,27 @@ def get_auth_token_gss(
|
|
|
199
179
|
:param appid: The application identifier as a string.
|
|
200
180
|
:param ip: IP address of the client as a string.
|
|
201
181
|
:param vo: The VO to act on.
|
|
202
|
-
:param session: The database session in use.
|
|
203
182
|
|
|
204
183
|
:returns: A dict with token and expires_at entries.
|
|
205
184
|
"""
|
|
206
185
|
|
|
207
186
|
kwargs = {'account': account, 'gsscred': gsscred}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
187
|
+
with db_session(DatabaseOperationType.WRITE) as session:
|
|
188
|
+
auth_result = permission.has_permission(issuer=account, vo=vo, action='get_auth_token_gss', kwargs=kwargs, session=session)
|
|
189
|
+
if not auth_result.allowed:
|
|
190
|
+
raise exception.AccessDenied('User with identity %s can not log to account %s. %s' % (gsscred, account, auth_result.message))
|
|
211
191
|
|
|
212
|
-
|
|
192
|
+
internal_account = InternalAccount(account, vo=vo)
|
|
213
193
|
|
|
214
|
-
|
|
194
|
+
return authentication.get_auth_token_gss(internal_account, gsscred, appid, ip, session=session)
|
|
215
195
|
|
|
216
196
|
|
|
217
|
-
@transactional_session
|
|
218
197
|
def get_auth_token_x509(
|
|
219
198
|
account: Optional[str],
|
|
220
199
|
dn: str,
|
|
221
200
|
appid: str,
|
|
222
201
|
ip: Optional[str] = None,
|
|
223
202
|
vo: str = 'def',
|
|
224
|
-
*,
|
|
225
|
-
session: "Session"
|
|
226
203
|
) -> Optional[TokenDict]:
|
|
227
204
|
"""
|
|
228
205
|
Authenticate a Rucio account temporarily via an x509 certificate.
|
|
@@ -234,7 +211,6 @@ def get_auth_token_x509(
|
|
|
234
211
|
:param appid: The application identifier as a string.
|
|
235
212
|
:param ip: IP address of the client as a string.
|
|
236
213
|
:param vo: The VO to act on.
|
|
237
|
-
:param session: The database session in use.
|
|
238
214
|
|
|
239
215
|
:returns: A dict with token and expires_at entries.
|
|
240
216
|
"""
|
|
@@ -243,24 +219,23 @@ def get_auth_token_x509(
|
|
|
243
219
|
account = identity.get_default_account(dn, IdentityType.X509).external
|
|
244
220
|
|
|
245
221
|
kwargs = {'account': account, 'dn': dn}
|
|
246
|
-
auth_result = permission.has_permission(issuer=account, vo=vo, action='get_auth_token_x509', kwargs=kwargs, session=session)
|
|
247
|
-
if not auth_result.allowed:
|
|
248
|
-
raise exception.AccessDenied('User with identity %s can not log to account %s. %s' % (dn, account, auth_result.message))
|
|
249
222
|
|
|
250
|
-
|
|
223
|
+
with db_session(DatabaseOperationType.WRITE) as session:
|
|
224
|
+
auth_result = permission.has_permission(issuer=account, vo=vo, action='get_auth_token_x509', kwargs=kwargs, session=session)
|
|
225
|
+
if not auth_result.allowed:
|
|
226
|
+
raise exception.AccessDenied('User with identity %s can not log to account %s. %s' % (dn, account, auth_result.message))
|
|
227
|
+
|
|
228
|
+
internal_account = InternalAccount(account, vo=vo)
|
|
251
229
|
|
|
252
|
-
|
|
230
|
+
return authentication.get_auth_token_x509(internal_account, dn, appid, ip, session=session)
|
|
253
231
|
|
|
254
232
|
|
|
255
|
-
@transactional_session
|
|
256
233
|
def get_auth_token_ssh(
|
|
257
234
|
account: str,
|
|
258
235
|
signature: str,
|
|
259
236
|
appid: str,
|
|
260
237
|
ip: Optional[str] = None,
|
|
261
238
|
vo: str = 'def',
|
|
262
|
-
*,
|
|
263
|
-
session: "Session"
|
|
264
239
|
) -> Optional[TokenDict]:
|
|
265
240
|
"""
|
|
266
241
|
Authenticate a Rucio account temporarily via SSH key exchange.
|
|
@@ -272,29 +247,27 @@ def get_auth_token_ssh(
|
|
|
272
247
|
:param appid: The application identifier as a string.
|
|
273
248
|
:param ip: IP address of the client as a string.
|
|
274
249
|
:param vo: The VO to act on.
|
|
275
|
-
:param session: The database session in use.
|
|
276
250
|
|
|
277
251
|
:returns: A dict with token and expires_at entries.
|
|
278
252
|
"""
|
|
279
253
|
|
|
280
254
|
kwargs = {'account': account, 'signature': signature}
|
|
281
|
-
auth_result = permission.has_permission(issuer=account, vo=vo, action='get_auth_token_ssh', kwargs=kwargs, session=session)
|
|
282
|
-
if not auth_result.allowed:
|
|
283
|
-
raise exception.AccessDenied('User with provided signature can not log to account %s. %s' % (account, auth_result.message))
|
|
284
255
|
|
|
285
|
-
|
|
256
|
+
with db_session(DatabaseOperationType.WRITE) as session:
|
|
257
|
+
auth_result = permission.has_permission(issuer=account, vo=vo, action='get_auth_token_ssh', kwargs=kwargs, session=session)
|
|
258
|
+
if not auth_result.allowed:
|
|
259
|
+
raise exception.AccessDenied('User with provided signature can not log to account %s. %s' % (account, auth_result.message))
|
|
260
|
+
|
|
261
|
+
internal_account = InternalAccount(account, vo=vo)
|
|
286
262
|
|
|
287
|
-
|
|
263
|
+
return authentication.get_auth_token_ssh(internal_account, signature, appid, ip, session=session)
|
|
288
264
|
|
|
289
265
|
|
|
290
|
-
@transactional_session
|
|
291
266
|
def get_ssh_challenge_token(
|
|
292
267
|
account: str,
|
|
293
268
|
appid: str,
|
|
294
269
|
ip: Optional[str] = None,
|
|
295
270
|
vo: str = 'def',
|
|
296
|
-
*,
|
|
297
|
-
session: "Session"
|
|
298
271
|
) -> Optional[TokenDict]:
|
|
299
272
|
"""
|
|
300
273
|
Get a challenge token for subsequent SSH public key authentication.
|
|
@@ -305,30 +278,28 @@ def get_ssh_challenge_token(
|
|
|
305
278
|
:param appid: The application identifier as a string.
|
|
306
279
|
:param ip: IP address of the client as a string.
|
|
307
280
|
:param vo: The VO to act on.
|
|
308
|
-
:param session: The database session in use.
|
|
309
281
|
|
|
310
282
|
:returns: A dict with token and expires_at entries.
|
|
311
283
|
"""
|
|
312
284
|
|
|
313
285
|
kwargs = {'account': account}
|
|
314
|
-
auth_result = permission.has_permission(issuer=account, vo=vo, action='get_auth_token_ssh', kwargs=kwargs, session=session)
|
|
315
|
-
if not auth_result.allowed:
|
|
316
|
-
raise exception.AccessDenied('User can not get challenge token for account %s. %s' % (account, auth_result.message))
|
|
317
286
|
|
|
318
|
-
|
|
287
|
+
with db_session(DatabaseOperationType.WRITE) as session:
|
|
288
|
+
auth_result = permission.has_permission(issuer=account, vo=vo, action='get_auth_token_ssh', kwargs=kwargs, session=session)
|
|
289
|
+
if not auth_result.allowed:
|
|
290
|
+
raise exception.AccessDenied('User can not get challenge token for account %s. %s' % (account, auth_result.message))
|
|
291
|
+
|
|
292
|
+
internal_account = InternalAccount(account, vo=vo)
|
|
319
293
|
|
|
320
|
-
|
|
294
|
+
return authentication.get_ssh_challenge_token(internal_account, appid, ip, session=session)
|
|
321
295
|
|
|
322
296
|
|
|
323
|
-
@transactional_session
|
|
324
297
|
def get_auth_token_saml(
|
|
325
298
|
account: str,
|
|
326
299
|
saml_nameid: str,
|
|
327
300
|
appid: str,
|
|
328
301
|
ip: Optional[str] = None,
|
|
329
302
|
vo: str = 'def',
|
|
330
|
-
*,
|
|
331
|
-
session: "Session"
|
|
332
303
|
) -> Optional[TokenDict]:
|
|
333
304
|
"""
|
|
334
305
|
Authenticate a Rucio account temporarily via SSO.
|
|
@@ -339,26 +310,24 @@ def get_auth_token_saml(
|
|
|
339
310
|
:param saml_nameid: NameId returned in SAML response as a string.
|
|
340
311
|
:param appid: The application identifier as a string.
|
|
341
312
|
:param ip: IP address of the client as a string.
|
|
342
|
-
:param session: The database session in use.
|
|
343
313
|
|
|
344
314
|
:returns: A dict with token and expires_at entries.
|
|
345
315
|
"""
|
|
346
316
|
|
|
347
317
|
kwargs = {'account': account, 'saml_nameid': saml_nameid}
|
|
348
|
-
auth_result = permission.has_permission(issuer=account, vo=vo, action='get_auth_token_saml', kwargs=kwargs, session=session)
|
|
349
|
-
if not auth_result.allowed:
|
|
350
|
-
raise exception.AccessDenied('User with identity %s can not log to account %s. %s' % (saml_nameid, account, auth_result.message))
|
|
351
318
|
|
|
352
|
-
|
|
319
|
+
with db_session(DatabaseOperationType.WRITE) as session:
|
|
320
|
+
auth_result = permission.has_permission(issuer=account, vo=vo, action='get_auth_token_saml', kwargs=kwargs, session=session)
|
|
321
|
+
if not auth_result.allowed:
|
|
322
|
+
raise exception.AccessDenied('User with identity %s can not log to account %s. %s' % (saml_nameid, account, auth_result.message))
|
|
323
|
+
|
|
324
|
+
internal_account = InternalAccount(account, vo=vo)
|
|
353
325
|
|
|
354
|
-
|
|
326
|
+
return authentication.get_auth_token_saml(internal_account, saml_nameid, appid, ip, session=session)
|
|
355
327
|
|
|
356
328
|
|
|
357
|
-
@transactional_session
|
|
358
329
|
def validate_auth_token(
|
|
359
330
|
token: str,
|
|
360
|
-
*,
|
|
361
|
-
session: "Session"
|
|
362
331
|
) -> dict[str, Any]:
|
|
363
332
|
"""
|
|
364
333
|
Validate an authentication token.
|
|
@@ -374,8 +343,9 @@ def validate_auth_token(
|
|
|
374
343
|
vo: <vo> }
|
|
375
344
|
"""
|
|
376
345
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
346
|
+
with db_session(DatabaseOperationType.WRITE) as session:
|
|
347
|
+
auth = authentication.validate_auth_token(token, session=session)
|
|
348
|
+
vo = auth['account'].vo
|
|
349
|
+
auth = gateway_update_return_dict(auth, session=session)
|
|
350
|
+
auth['vo'] = vo
|
|
381
351
|
return auth
|