Skip to main content

Method /auth for EIDA authentication

This projects is the implementation of the /auth method as described in EIDA.

Input : a signed token (validity will be checked by the program)

Output : a login and password in the login:password form

This login and password is valid for a certain amount of time (24h typically)

Playing around

pip install gunicorn httpie
gunicorn --reload -w 1 eidaws_auth:auth

Then, to send a post request :

http localhost:8000/version
http POST localhost:8000 < token.asc

Running tests

pip install -e .
pytest

Configuration

The conifguration is set in the eidawsauth/config.py file.

There are 4 classes :

  • Config : the root class with some defaults
  • Production : the configuration suitable for production
  • Test : the configuration suitable for pytest
  • Dev : the configuration for the developpment environment

You can choose the configuration class by setting up the RUNMODE environment variable. Default value is DEVELOPMENT

RUNMODE=PRODUCTION gunicorn -w 4 eidaws_auth:aut

Database initialisation

User and minimum privileges

grant connect on database "resifAuth" to eidawsauth;
grant connect on database "resifInv-Prod" to eidawsauth;
\c "resifAuth"
grant select,insert,update,delete on table users,credentials TO eidawsauth ;
grant select,update on sequence  users_user_index_seq TO eidawsauth ;
\c "resifInv-Prod"
grant select,insert,update,delete on table eida_temp_users TO eidawsauth;
grant select on table networks to eidawsauth;
grant select,update on sequence aut_user_user_id_seq to eidawsauth ;

Expected tables schema

AUTHDB

Table users: From the existing table, we have to add an expires_at column.

alter table users add column if not exists expires_at timestamp default value null;

Table credentials : No modification to the resifAuth schema

PRIVILEDGEDB

Table aut_user. No modification to the resifInv-Prod schema.

  Colonne   |  Type   | Collationnement | NULL-able |                Par défaut                 | Stockage |
------------+---------+-----------------+-----------+-------------------------------------------+----------+
 user_id    | integer |                 | not null  | nextval('aut_user_user_id_seq'::regclass) | plain    |
 network_id | bigint  |                 |           | 0                                         | plain    |
 network    | text    |                 | not null  |                                           | extended |
 start_year | integer |                 | not null  | 0                                         | plain    |
 end_year   | integer |                 | not null  | 0                                         | plain    |
 name       | text    |                 | not null  |                                           | extended |
Index :
    "aut_user_pkey" PRIMARY KEY, btree (user_id)
    "uniq_aut_user" UNIQUE CONSTRAINT, btree (network, start_year, end_year, name)
Contraintes de clés étrangères :
    "aut_user_network_id_fkey" FOREIGN KEY (network_id) REFERENCES networks(network_id) ON DELETE SET DEFAULT

Explanations

What does this program do ?

Steps

  1. Get all configurations and setup database connections
  2. Read the data from POST request NOTE : We should put a size limit on the WSGI server
  3. Verify the token's signature using the geofon public key
  4. Parse the token's informations
  5. Compute a random login and password
  6. Register this in the resifAuth database, along with the expires_at value (24h)
  7. From the member-of field in the token :
    • do the mapping from EPOS names to FDSN reference from the epos_fdsn table in the resifAuth database the FDSN reference is the network name, startyear, endyear
    • register the login along with the FDSN references and the expiration date in the resifInv-Prod database, table access
  8. Return the login:password to the client

Other methods

/version

returns the version number and environment string.

/cleanup

Remove old users, credentials and privileges.

It's probably a good idea to protect this method at the webserver level.

Metadata

Release files for eidawsauth 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eidawsauth 0.3.1
File Size Uploaded Provenance
eidawsauth-0.3.1.tar.gz 7.5 kB Without provenance Details

Release files / eidawsauth-0.3.1.tar.gz

Download URL eidawsauth-0.3.1.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
95268167b071ffc0fd39363079fe47f0117422ba2e28aefcff443121b0d729fa
BLAKE2b-256 checksum
How to use checksums
12b59b7443d4a84c6b4acb1c44545519e8257048cdd9cfd690045273a7c96653
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

Security for eidawsauth 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page