flwr-nightly 1.18.0.dev20250418__py3-none-any.whl → 1.18.0.dev20250421__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.
flwr/cli/config_utils.py CHANGED
@@ -197,21 +197,7 @@ def validate_certificate_in_federation_config(
197
197
  - `address` is provided and `insecure = true`. If `root-certificates` is
198
198
  set, exit with an error.
199
199
  """
200
- insecure_value = federation_config.get("insecure")
201
- # Determine the insecure flag
202
- if insecure_value is None:
203
- # Not provided, default to False (TLS enabled)
204
- insecure = False
205
- elif isinstance(insecure_value, bool):
206
- insecure = insecure_value
207
- else:
208
- typer.secho(
209
- "❌ Invalid type for `insecure`: expected a boolean if provided. "
210
- "(`insecure = true` or `insecure = false`)",
211
- fg=typer.colors.RED,
212
- bold=True,
213
- )
214
- raise typer.Exit(code=1)
200
+ insecure = get_insecure_flag(federation_config)
215
201
 
216
202
  # Process root certificates
217
203
  if root_certificates := federation_config.get("root-certificates"):
@@ -250,3 +236,21 @@ def exit_if_no_address(federation_config: dict[str, Any], cmd: str) -> None:
250
236
  bold=True,
251
237
  )
252
238
  raise typer.Exit(code=1)
239
+
240
+
241
+ def get_insecure_flag(federation_config: dict[str, Any]) -> bool:
242
+ """Extract and validate the `insecure` flag from the federation configuration."""
243
+ insecure_value = federation_config.get("insecure")
244
+
245
+ if insecure_value is None:
246
+ # Not provided, default to False (TLS enabled)
247
+ return False
248
+ if isinstance(insecure_value, bool):
249
+ return insecure_value
250
+ typer.secho(
251
+ "❌ Invalid type for `insecure`: expected a boolean if provided. "
252
+ "(`insecure = true` or `insecure = false`)",
253
+ fg=typer.colors.RED,
254
+ bold=True,
255
+ )
256
+ raise typer.Exit(code=1)
flwr/cli/login/login.py CHANGED
@@ -22,6 +22,7 @@ import typer
22
22
 
23
23
  from flwr.cli.config_utils import (
24
24
  exit_if_no_address,
25
+ get_insecure_flag,
25
26
  load_and_validate,
26
27
  process_loaded_project_config,
27
28
  validate_federation_in_project_config,
@@ -80,6 +81,16 @@ def login( # pylint: disable=R0914
80
81
  bold=True,
81
82
  )
82
83
  raise typer.Exit(code=1)
84
+ # Check if insecure flag is set to `True`
85
+ insecure = get_insecure_flag(federation_config)
86
+ if insecure:
87
+ typer.secho(
88
+ "❌ `flwr login` requires TLS to be enabled. `insecure` must NOT be set to "
89
+ "`true` in the federation configuration.",
90
+ fg=typer.colors.RED,
91
+ bold=True,
92
+ )
93
+ raise typer.Exit(code=1)
83
94
 
84
95
  channel = init_channel(app, federation_config, None)
85
96
  stub = ExecStub(channel)
flwr/cli/utils.py CHANGED
@@ -220,17 +220,6 @@ def try_obtain_cli_auth_plugin(
220
220
  if not federation_config.get("enable-user-auth", False):
221
221
  return None
222
222
 
223
- # Check if TLS is enabled. If not, raise an error
224
- if federation_config.get("root-certificates") is None:
225
- typer.secho(
226
- "❌ User authentication requires TLS to be enabled. "
227
- "Please provide 'root-certificates' in the federation"
228
- " configuration.",
229
- fg=typer.colors.RED,
230
- bold=True,
231
- )
232
- raise typer.Exit(code=1)
233
-
234
223
  config_path = get_user_auth_config_path(root_dir, federation)
235
224
 
236
225
  # Get the auth type from the config if not provided
@@ -273,6 +262,16 @@ def init_channel(
273
262
  # Initialize the CLI-side user auth interceptor
274
263
  interceptors: list[grpc.UnaryUnaryClientInterceptor] = []
275
264
  if auth_plugin is not None:
265
+ # Check if TLS is enabled. If not, raise an error
266
+ if insecure:
267
+ typer.secho(
268
+ "❌ User authentication requires TLS to be enabled. "
269
+ "Remove `insecure = true` from the federation configuration.",
270
+ fg=typer.colors.RED,
271
+ bold=True,
272
+ )
273
+ raise typer.Exit(code=1)
274
+
276
275
  auth_plugin.load_tokens()
277
276
  interceptors.append(CliUserAuthInterceptor(auth_plugin))
278
277
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flwr-nightly
3
- Version: 1.18.0.dev20250418
3
+ Version: 1.18.0.dev20250421
4
4
  Summary: Flower: A Friendly Federated AI Framework
5
5
  Home-page: https://flower.ai
6
6
  License: Apache-2.0
@@ -5,13 +5,13 @@ flwr/cli/auth_plugin/__init__.py,sha256=FyaoqPzcxlBTFfJ2sBRC5USwQLmAhFr5KuBwfMO4
5
5
  flwr/cli/auth_plugin/oidc_cli_plugin.py,sha256=gIhW6Jg9QAo-jL43LYPpw_kn7pdUZZae0s0H8dEgjLM,5384
6
6
  flwr/cli/build.py,sha256=sPzCAZC0gDytpDqMO3aHBcdCzQVXqRhts4TJYSZNu1E,6375
7
7
  flwr/cli/cli_user_auth_interceptor.py,sha256=-JqDXpeZNQVwoSG7hMKsiS5qY5k5oklNSlQOVpM0-aY,3126
8
- flwr/cli/config_utils.py,sha256=Si9nKXULxhk0qk5S-ocbu_Shh_EcIKtKrJ5zqb_Xwtg,8998
8
+ flwr/cli/config_utils.py,sha256=IAVn2uWTXpN72YYt7raLtwp8ziwZugUKSURpc471VzU,9123
9
9
  flwr/cli/constant.py,sha256=g7Ad7o3DJDkJNrWS0T3SSJETWSTkkVJWGpLM8zlbpcY,1289
10
10
  flwr/cli/example.py,sha256=SNTorkKPrx1rOryGREUyZu8TcOc1-vFv1zEddaysdY0,2216
11
11
  flwr/cli/install.py,sha256=Jr883qR7qssVpUr3hEOEcLK-dfW67Rsve3lZchjA9RU,8180
12
12
  flwr/cli/log.py,sha256=xpUVMe3K-3XHayerL9H8WaYhm3rKw5YM-T9CZ-bYRPg,6529
13
13
  flwr/cli/login/__init__.py,sha256=B1SXKU3HCQhWfFDMJhlC7FOl8UsvH4mxysxeBnrfyUE,800
14
- flwr/cli/login/login.py,sha256=gLnCEInuw48QxgkBwGPJszUhQiyRbkphGn-tSj5iNCY,3917
14
+ flwr/cli/login/login.py,sha256=JC3T99b9f33zLkJSEQ9_p1qKgVh2VNM5thhSRZ2o1oI,4320
15
15
  flwr/cli/ls.py,sha256=GdaNgEjGWKiMVrUa1CtUdUwBW1oEb4ddTSyZk61OHnc,11433
16
16
  flwr/cli/new/__init__.py,sha256=QA1E2QtzPvFCjLTUHnFnJbufuFiGyT_0Y53Wpbvg1F0,790
17
17
  flwr/cli/new/new.py,sha256=2e4ACJqeZ0W0_FyksQTi7PEzQpXT8KRpBPthFoac6zQ,9917
@@ -70,7 +70,7 @@ flwr/cli/new/templates/app/pyproject.tensorflow.toml.tpl,sha256=KTgLL3aKSqu50GVj
70
70
  flwr/cli/run/__init__.py,sha256=RPyB7KbYTFl6YRiilCch6oezxrLQrl1kijV7BMGkLbA,790
71
71
  flwr/cli/run/run.py,sha256=t3vgDeSGKgptYbGKLLTVAcGB-ZQqu3Ui0cVloA-eoy8,8277
72
72
  flwr/cli/stop.py,sha256=iLbh1dq8XMdcIlh0Lh8ufG6h0VvrP1kyp_mGO-kimt0,4976
73
- flwr/cli/utils.py,sha256=iTxNid0-KmysnH-Q2Nbsno2_ofX34gnCbFdTWvVUgvc,11236
73
+ flwr/cli/utils.py,sha256=FjRYfzTw75qh5YHmrg9XzBA6o73T6xWt9WQYIxq-iHY,11207
74
74
  flwr/client/__init__.py,sha256=FslaZOoCGPIzlK-NhL7bFMVVnmFDOh_PhW4AfGzno68,1192
75
75
  flwr/client/app.py,sha256=N4-LwxoHT_I-O3K1xfkNRh6fyloR-1YFYoWhOxjlRrM,34282
76
76
  flwr/client/client.py,sha256=3HAchxvknKG9jYbB7swNyDj-e5vUWDuMKoLvbT7jCVM,7895
@@ -326,7 +326,7 @@ flwr/superexec/exec_servicer.py,sha256=Z0YYfs6eNPhqn8rY0x_R04XgR2mKFpggt07IH0EhU
326
326
  flwr/superexec/exec_user_auth_interceptor.py,sha256=iqygALkOMBUu_s_R9G0mFThZA7HTUzuXCLgxLCefiwI,4440
327
327
  flwr/superexec/executor.py,sha256=M5ucqSE53jfRtuCNf59WFLqQvA1Mln4741TySeZE7qQ,3112
328
328
  flwr/superexec/simulation.py,sha256=j6YwUvBN7EQ09ID7MYOCVZ70PGbuyBy8f9bXU0EszEM,4088
329
- flwr_nightly-1.18.0.dev20250418.dist-info/METADATA,sha256=tDbwKszWrO98LczNz5bP5Z3xaQhfdwwyvGN_rmWNGPg,15868
330
- flwr_nightly-1.18.0.dev20250418.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
331
- flwr_nightly-1.18.0.dev20250418.dist-info/entry_points.txt,sha256=2-1L-GNKhwGw2_7_RoH55vHw2SIHjdAQy3HAVAWl9PY,374
332
- flwr_nightly-1.18.0.dev20250418.dist-info/RECORD,,
329
+ flwr_nightly-1.18.0.dev20250421.dist-info/METADATA,sha256=eEFwDyhwWT0kVS5NTDw7LHItc6cHrxye-OP7FwbM2Ro,15868
330
+ flwr_nightly-1.18.0.dev20250421.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
331
+ flwr_nightly-1.18.0.dev20250421.dist-info/entry_points.txt,sha256=2-1L-GNKhwGw2_7_RoH55vHw2SIHjdAQy3HAVAWl9PY,374
332
+ flwr_nightly-1.18.0.dev20250421.dist-info/RECORD,,