BlueBrain / nexus-forge

Building and Using Knowledge Graphs made easy
https://nexus-forge.readthedocs.io
GNU Lesser General Public License v3.0
38 stars 19 forks source link

Add method to generate the contribution information from a token #313

Open crisely09 opened 1 year ago

crisely09 commented 1 year ago

Add a method to generate automatically a contribution object with the shape:

    "type": "Contribution",
    "agent": {
        "id": f"https://bbp.epfl.ch/nexus/v1/realms/bbp/users/{decoded['preferred_username']}",
        "type": ["Agent", "Person"],
        "givenName": decoded["given_name"],
        "familyName": decoded["family_name"],
        "name": decoded["name"],
        "email": decoded["email"]
    }
})

where decoded is the Nexus decoded token: decoded = jwt.decode(TOKEN, "secret", audience="https://slack.com", options={"verify_signature": False})