https://github.com/ai4os/ai4-flwr

AI4OS Flower extensions

https://github.com/ai4os/ai4-flwr

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.2%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

AI4OS Flower extensions

Basic Info
  • Host: GitHub
  • Owner: ai4os
  • License: gpl-3.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 85.9 KB
Statistics
  • Stars: 0
  • Watchers: 4
  • Forks: 1
  • Open Issues: 0
  • Releases: 2
Created over 2 years ago · Last pushed about 1 year ago
Metadata Files
Readme License

README.md

logo

ai4-flwr

Conventional Commits GitHub license GitHub release PyPI Python versions

This repository contains the AI4OS extensions for the Flower framework.

Authentication

Authentication for Flower is implemented directly via GRPC: interceptors (server side) and authentication medatata plugins (client side). Please note that for authentication to work, you need to secure your connection with SSL, otherwise it will not work.

In order to enable authentication, the server must be initialized with any object of the ai4flwr.auth package as interceptor. See the examples below for more details.

Bearer token authentication

String-based bearer token authentication is possible using the ai4flwr.auth.bearer.BearerTokenInterceptor class. You can use more than one token.

In your server, start it as follows:

import ai4flwr.auth.bearer

token_interceptor = ai4flwr.auth.bearer.BearerTokenInterceptor("token1", "token2")

fl.server.start_server(
    server_address="0.0.0.0:5000",
    certificates=(...),
    interceptors=[token_interceptor]
)

Alternatively, you can pass the tokens inside a text file and use the file keyword argument. The file must contain one token per line, empty lines are ignored. If the file is updated, you can send SIGUSR1 fo the server process, and the tokens will be reloaded from disk.

Then, in your client, start it as follows:

import ai4flwr.auth.bearer

token = "token1"

fl.client.start_numpy_client(
    server_address=f"localhost:5000",
    client=...,
    root_certificates=...
    call_credentials=grpc.metadata_call_credentials(
        ai4flwr.auth.bearer.BearerTokenAuthPlugin(token)
    ),
)

Bearer token authentication with Vault

The same Bearer token authentication can be implemented via Vault, storing the secret tokens on the service.

Examples

The examples/ file contains additional examples. In order to run them you must first generate the certificates for the server, as other

./examples/certificates/generate.sh

Then run the server with:

poetry run examples/bearer_server.py mytoken

And the client(s) with:

poetry run examples/client.py mytoken

Vault

Test with:

./examples/certificates/generate.sh
export OIDC_ACCESS_TOKEN=<token>
poetry install --group examples --extras
poetry run examples/vault_server.py <FAKE ID> <vault_server>
poetry run examples/client.py <token>

Owner

  • Name: AI4OS
  • Login: ai4os
  • Kind: organization
  • Email: ai4eosc-po@listas.csic.es

AI4OS is the software powering the AI4EOSC platform

GitHub Events

Total
  • Delete event: 4
  • Issue comment event: 11
  • Member event: 1
  • Push event: 12
  • Pull request event: 4
  • Create event: 1
Last Year
  • Delete event: 4
  • Issue comment event: 11
  • Member event: 1
  • Push event: 12
  • Pull request event: 4
  • Create event: 1

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 0
  • Total pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: 8 months
  • Total issue authors: 0
  • Total pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 1.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: 24 days
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • alvarolopez (6)
  • judithspd (3)
  • IgnacioHeredia (1)
Top Labels
Issue Labels
Pull Request Labels
autorelease: pending (1)

Dependencies

.github/workflows/ci.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/publish.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
pyproject.toml pypi
  • tox ^4.11.4 develop
  • flwr ^1.6.0
  • grpcio ^1.60.0
  • python ^3.10
  • pytest ^7.4.4 test
  • pytest-cov ^4.1.0 test
  • bandit ^1.7.6 test-bandit
  • black ^23.12.1 test-black
  • flake8 ^7.0.0 test-flake8
  • flake8-bugbear ^23.12.2 test-flake8
  • flake8-colors ^0.1.9 test-flake8
  • flake8-docstrings ^1.7.0 test-flake8
  • flake8-typing-imports ^1.15.0 test-flake8
  • pep8-naming ^0.13.3 test-flake8
  • pydocstyle ^6.3.0 test-flake8
  • mypy ^1.8.0 test-mypy
  • pip-check-reqs ^2.5.3 test-pip-missing-reqs
  • twine ^4.0.2 test-pypi
.github/workflows/release-please.yml actions
  • actions/checkout v4 composite
  • google-github-actions/release-please-action v4 composite