jsm-user-services


Namejsm-user-services JSON
Version 1.5.4 PyPI version JSON
download
home_pageNone
SummaryMiddleware to intercept JWT auth token and more utils functions
upload_time2024-10-28 18:26:53
maintainerNone
docs_urlNone
authorJuntos Somos Mais
requires_python<4.0,>=3.10
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # JSM User JWT Service

Middleware to intercept JWT auth token and more utils functions

## Local development

### Running tests

`docker-compose up integration-tests`

### Running lint and code formatter

`docker-compose up lint-formatter`

## Install - For Django users

`pip install jsm-user-services[drf]`

Add `jsm_user_services` to your `INSTALLED_APPS`:

```python
INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "jsm_user_services",
    "app_test",
]
```

Add the Middleware:

```python
MIDDLEWARE = [
    ...
    "jsm_user_services.middleware.JsmJwtService",
]

# Dev url
USER_API_HOST = "http://ishtar-gate.dev.juntossomosmaisi.com.br/api/v1"
USER_API_TOKEN = "user_api_token"
```

## Install - For Flask users

`pip install jsm-user-services[flask]`

Add the middleware in your Flask app:

```python
from flask import Flask
from jsm_user_services.flask_module import middleware

app = Flask(__name__)

middleware.JsmJwtService(app)
app.config.update(
    USER_API_HOST="http://ishtar-gate.dev.juntossomosmaisi.com.br/api/v1", USER_API_TOKEN="user_api_token"
)
```

**DISCLAIMER**
- Currently, only the middleware is implemented for Flask apps

## Use

```python
from jsm_user_services.services.user import current_jwt_token
from jsm_user_services.services.user import get_jsm_token
from jsm_user_services.services.user import get_jsm_user_data_from_jwt
from jsm_user_services.services.user import get_ltm_token
from jsm_user_services.services.user import get_user_email_from_jwt
from jsm_user_services.services.user import get_user_id_from_jwt
from jsm_user_services.services.user import get_user_data_from_server
from jsm_user_services.services.user import get_user_data_from_cpf
from jsm_user_services.services.user import get_cpf_from_jwt

current_jwt_token()
"""
Response example:
"eyJ0eXAiOi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XX-GmOdHD5sxvC-cd8OWep0r7Pn5URwIdkWFjY_vly8dQDb3Cx2TXx2lXQeXBlj4XwQNlrAJTBGdmnL-Nu6Sk3oyh1_r-u53JyaF4frbt8Q6ZZsNAeZtRNLvM3l1JJ591XpApteouRRFakC6Iu8ED3IRmuzYvCgajDIDede7vtpsBvEp4yxl0"
"""

get_jsm_user_data_from_jwt()
"""
Response example:
{
  "email": "64722338612@loyaltyJSM.com",
  "unique_name": "Test User",
  "website": "ClientApplication",
  "uid": "8735bf8d-5479-4448-83cf-89997d7df608",
  "sellers": "1e3b831f-95d0-41a7-b3e1-1fe03fae2046",
  "role": "Customer",
  "cnpjs": "68.597.280/0001-09",
  "nbf": 1561558635,
  "exp": 1562163435,
  "iat": 1561558635,
  "iss": "tfp://identity.jsm/authority",
  "aud": "bc051de3-aeaa-4ac9-8fbf-05a86e083fcf"
}
"""

get_user_email_from_jwt()
"""
Response example:
"64722338612@loyaltyJSM.com"
"""

get_user_id_from_jwt()
"""
Response example:
"85071dde-b568-41af-a579-3f42c1df0998"
"""

get_user_data_from_server()
"""
Response example:
{
    "id": "85071dde-b568-41af-a579-3f42c1df0998",
    "username": "44444444444",
    "cpf": "44444444444",
    "occupation": "owner",
    "name": "ca1bd09f-b109-435f-b6d5-206d28a3e5e2",
    "birthday": "1990-06-15",
    "phones": [{"number": "5511111111111", "type": "MOBILE"}],
    "emails": [{"email": "fernando@gmail.com", "type": "PERSONAL"}],
    "roles": ["Proprietário"],
    "gender": "male",
    "allow_contact": True,
    "mediums": ["SMS", "Push"],
    "rules_agreement": True,
    "addresses": [
        {
            "postal_code": "06763180",
            "street": "Rua Adolfino Arruda Castanho",
            "number": "200",
            "complement": "Ap 133",
            "district": "Jardim Bom Tempo",
            "city": "Taboao da Serra",
            "state": "SP",
            "country": "Brazil",
            "type": "HOME",
        }
    ]
}
"""

get_user_data_from_cpf(cpf)
"""
Response example:
{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": "888707ab-9866-42a3-a67e-23a937cb3e7f",
            "created_at": "2019-10-18T20:06:44.552669Z",
            "updated_at": "2019-10-23T14:08:05.737326Z",
            "user_id_ref": "5cfd56c1-1bc1-4175-9fa9-00449ec448b8",
            "metadata": {
                "id": "5cfd56c1-1bc1-4175-9fa9-00449ec448b8",
                "cpf": "42879321964",
                "name": "Fernanda Gabrielly Duarte",
                "roles": [
                    "manager"
                ],
                "emails": [
                    {
                        "type": "personal",
                        "email": "fernandagabriellyduarte@ymail.com"
                    }
                ],
                "gender": "female",
                "phones": [
                    {
                        "type": "mobile",
                        "number": "5519991901717"
                    }
                ],
                "status": "active",
                "mediums": [
                    "sms"
                ],
                "birthday": "1982-06-04",
                "username": "42879321964",
                "addresses": [
                    {
                        "city": "Cascavel",
                        "type": "main",
                        "state": "PR",
                        "number": "217",
                        "street": "Rua Riachuelo",
                        "country": "Brazil",
                        "district": "Centro",
                        "postal_code": "85812110"
                    },
                    {
                        "city": "Cascavel",
                        "type": "shipping",
                        "state": "PR",
                        "number": "217",
                        "street": "Rua Riachuelo",
                        "country": "Brazil",
                        "district": "Centro",
                        "postal_code": "85812110"
                    }
                ],
                "occupation": "c85583ef-b602-4fea-b202-6fc5c58d8189",
                "allow_contact": true,
                "blocked_reason": null,
                "favorite_medium": "sms",
                "registered_date": "2019-10-18T20:06:31.705758+00:00",
                "rules_agreement": true,
                "rules_agreement_date": "2019-10-18T20:06:31.708640+00:00"
            },
            "emails": "fernandagabriellyduarte@ymail.com",
            "phones": "5519991901717"
        }
    ]
}
"""

get_cpf_from_jwt()
"""
Response example:
"09345699823"
"""

get_user_ip()
"""
Response example:
"192.168.0.1" or None
"""

```

## Versioning
This lib follows the [pypi version format](https://www.python.org/dev/peps/pep-0440/) with the convention of using 
_major_._minor_._patch_ version.

### When to bump a patch version?
Bump the patch version if you are doing a quick fix, nothing that changes the library functionality.

### When to bump the minor version?
Bump the minor version if you are adding new functionality without breaking backwards compatibility. For example, 
adding support to new events.

### When to bump the major version?
Bump the major version if you are breaking backwards compatibility by adding new functionality or refactoring.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "jsm-user-services",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Juntos Somos Mais",
    "author_email": "labs@juntossomosmais.com.br",
    "download_url": "https://files.pythonhosted.org/packages/35/7c/5e98aa2caf3125895f4bb83e03a4357a95d619e16c166faaf2c9b75216a7/jsm_user_services-1.5.4.tar.gz",
    "platform": null,
    "description": "# JSM User JWT Service\n\nMiddleware to intercept JWT auth token and more utils functions\n\n## Local development\n\n### Running tests\n\n`docker-compose up integration-tests`\n\n### Running lint and code formatter\n\n`docker-compose up lint-formatter`\n\n## Install - For Django users\n\n`pip install jsm-user-services[drf]`\n\nAdd `jsm_user_services` to your `INSTALLED_APPS`:\n\n```python\nINSTALLED_APPS = [\n    \"django.contrib.admin\",\n    \"django.contrib.auth\",\n    \"django.contrib.contenttypes\",\n    \"django.contrib.sessions\",\n    \"django.contrib.messages\",\n    \"django.contrib.staticfiles\",\n    \"jsm_user_services\",\n    \"app_test\",\n]\n```\n\nAdd the Middleware:\n\n```python\nMIDDLEWARE = [\n    ...\n    \"jsm_user_services.middleware.JsmJwtService\",\n]\n\n# Dev url\nUSER_API_HOST = \"http://ishtar-gate.dev.juntossomosmaisi.com.br/api/v1\"\nUSER_API_TOKEN = \"user_api_token\"\n```\n\n## Install - For Flask users\n\n`pip install jsm-user-services[flask]`\n\nAdd the middleware in your Flask app:\n\n```python\nfrom flask import Flask\nfrom jsm_user_services.flask_module import middleware\n\napp = Flask(__name__)\n\nmiddleware.JsmJwtService(app)\napp.config.update(\n    USER_API_HOST=\"http://ishtar-gate.dev.juntossomosmaisi.com.br/api/v1\", USER_API_TOKEN=\"user_api_token\"\n)\n```\n\n**DISCLAIMER**\n- Currently, only the middleware is implemented for Flask apps\n\n## Use\n\n```python\nfrom jsm_user_services.services.user import current_jwt_token\nfrom jsm_user_services.services.user import get_jsm_token\nfrom jsm_user_services.services.user import get_jsm_user_data_from_jwt\nfrom jsm_user_services.services.user import get_ltm_token\nfrom jsm_user_services.services.user import get_user_email_from_jwt\nfrom jsm_user_services.services.user import get_user_id_from_jwt\nfrom jsm_user_services.services.user import get_user_data_from_server\nfrom jsm_user_services.services.user import get_user_data_from_cpf\nfrom jsm_user_services.services.user import get_cpf_from_jwt\n\ncurrent_jwt_token()\n\"\"\"\nResponse example:\n\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTY1ODc4MjI4LCJqdGkiOiJiZDFmMzBiMGEzMTc0MmRmYjk3MTBiMzEzMTY0M2E2ZiIsInl1bnRpYW5kdSI6IjhyR0NjVHZGTE9VemR2LWRhTFk4SzdHZTF2MmVyQS01TWJOVkZ4TFBwTUNDTmRwTjQ2bDlJMHZFNG9aTmNNanRfZTh5SWJkTlczN0tKRUhWdzM3dmJjOEdLZmlfd0ZmZDJTRDlIYUJuNk80SVVabWVNUjlROVRqVTd0WFI1WDZPeFoyRDRiNXNHSWlKWGQwcGtPcXptOFpFSUl2Y2xtLUNuMjVJMklKNGJ2M2RaeTVtQUhqUnhaTmNMM2RyX1NkX1FGTFpVMWthNmtfQ0FFTkZxOE9CR1RoelNlRmtxeDFfTFBDLXE1dUVCUE9FSmpVdlF0bXhHTF8zUHNiZ0twLXFaazRfQUJ1enY1Zmk5XzFSaHJ5ZzZVWWF6WFRYNkVxcTdDdUJTUlBRMWFqM0FpU1VadGFmNjZjSTZJSThHMkxKYmd3bHhSZ19aRzY1QlpielJ3QnRvUTllUkNxY2FSRG56ZXhKVEhKMUJ0X2N6Z0J5NGxhRnFmbUZFYWZ6b3RNa0ZrZ2lLT1BNRnhMaFdaZlBEYVB0UFA0UjJjeXJEWWxaMkxNdGhrY09lZmVxMTNLa0doT0FRV2FQUHpEbzBNekRXa0VmbEVFUlpRTHo2NkItSE1TaDE1cHNBR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Nl8uzEEQ0kixlWyueha2e5gZPHPA2TiSb0dt4WdBUqSL9BPXpsCB9TBtyRkU6JeH-DXo05Px02joOUh_MrjqhbXxYtJXWTkX4E6krHI1kS2r75DFU3dUTfQtELrvn1lQxpNCG_FAX0gB5B_XMWiX2Pn6hWE-QO9uglJgnkllxwhBBiwC1K57ony1tgpZLPY7kapAQveGmJAgWAkFXKtR2s4DK9Bkz_Xz-dUdZRONlBIH6yP4QotiE58QT0DFEluRMXhQX6huPSKuVnyaGLRrbFxdocUPuVgLTigg4rk9zgXX-GmOdHD5sxvC-cd8OWep0r7Pn5URwIdkWFjY_vly8dQDb3Cx2TXx2lXQeXBlj4XwQNlrAJTBGdmnL-Nu6Sk3oyh1_r-u53JyaF4frbt8Q6ZZsNAeZtRNLvM3l1JJ591XpApteouRRFakC6Iu8ED3IRmuzYvCgajDIDede7vtpsBvEp4yxl0\"\n\"\"\"\n\nget_jsm_user_data_from_jwt()\n\"\"\"\nResponse example:\n{\n  \"email\": \"64722338612@loyaltyJSM.com\",\n  \"unique_name\": \"Test User\",\n  \"website\": \"ClientApplication\",\n  \"uid\": \"8735bf8d-5479-4448-83cf-89997d7df608\",\n  \"sellers\": \"1e3b831f-95d0-41a7-b3e1-1fe03fae2046\",\n  \"role\": \"Customer\",\n  \"cnpjs\": \"68.597.280/0001-09\",\n  \"nbf\": 1561558635,\n  \"exp\": 1562163435,\n  \"iat\": 1561558635,\n  \"iss\": \"tfp://identity.jsm/authority\",\n  \"aud\": \"bc051de3-aeaa-4ac9-8fbf-05a86e083fcf\"\n}\n\"\"\"\n\nget_user_email_from_jwt()\n\"\"\"\nResponse example:\n\"64722338612@loyaltyJSM.com\"\n\"\"\"\n\nget_user_id_from_jwt()\n\"\"\"\nResponse example:\n\"85071dde-b568-41af-a579-3f42c1df0998\"\n\"\"\"\n\nget_user_data_from_server()\n\"\"\"\nResponse example:\n{\n    \"id\": \"85071dde-b568-41af-a579-3f42c1df0998\",\n    \"username\": \"44444444444\",\n    \"cpf\": \"44444444444\",\n    \"occupation\": \"owner\",\n    \"name\": \"ca1bd09f-b109-435f-b6d5-206d28a3e5e2\",\n    \"birthday\": \"1990-06-15\",\n    \"phones\": [{\"number\": \"5511111111111\", \"type\": \"MOBILE\"}],\n    \"emails\": [{\"email\": \"fernando@gmail.com\", \"type\": \"PERSONAL\"}],\n    \"roles\": [\"Propriet\u00e1rio\"],\n    \"gender\": \"male\",\n    \"allow_contact\": True,\n    \"mediums\": [\"SMS\", \"Push\"],\n    \"rules_agreement\": True,\n    \"addresses\": [\n        {\n            \"postal_code\": \"06763180\",\n            \"street\": \"Rua Adolfino Arruda Castanho\",\n            \"number\": \"200\",\n            \"complement\": \"Ap 133\",\n            \"district\": \"Jardim Bom Tempo\",\n            \"city\": \"Taboao da Serra\",\n            \"state\": \"SP\",\n            \"country\": \"Brazil\",\n            \"type\": \"HOME\",\n        }\n    ]\n}\n\"\"\"\n\nget_user_data_from_cpf(cpf)\n\"\"\"\nResponse example:\n{\n    \"count\": 1,\n    \"next\": null,\n    \"previous\": null,\n    \"results\": [\n        {\n            \"id\": \"888707ab-9866-42a3-a67e-23a937cb3e7f\",\n            \"created_at\": \"2019-10-18T20:06:44.552669Z\",\n            \"updated_at\": \"2019-10-23T14:08:05.737326Z\",\n            \"user_id_ref\": \"5cfd56c1-1bc1-4175-9fa9-00449ec448b8\",\n            \"metadata\": {\n                \"id\": \"5cfd56c1-1bc1-4175-9fa9-00449ec448b8\",\n                \"cpf\": \"42879321964\",\n                \"name\": \"Fernanda Gabrielly Duarte\",\n                \"roles\": [\n                    \"manager\"\n                ],\n                \"emails\": [\n                    {\n                        \"type\": \"personal\",\n                        \"email\": \"fernandagabriellyduarte@ymail.com\"\n                    }\n                ],\n                \"gender\": \"female\",\n                \"phones\": [\n                    {\n                        \"type\": \"mobile\",\n                        \"number\": \"5519991901717\"\n                    }\n                ],\n                \"status\": \"active\",\n                \"mediums\": [\n                    \"sms\"\n                ],\n                \"birthday\": \"1982-06-04\",\n                \"username\": \"42879321964\",\n                \"addresses\": [\n                    {\n                        \"city\": \"Cascavel\",\n                        \"type\": \"main\",\n                        \"state\": \"PR\",\n                        \"number\": \"217\",\n                        \"street\": \"Rua Riachuelo\",\n                        \"country\": \"Brazil\",\n                        \"district\": \"Centro\",\n                        \"postal_code\": \"85812110\"\n                    },\n                    {\n                        \"city\": \"Cascavel\",\n                        \"type\": \"shipping\",\n                        \"state\": \"PR\",\n                        \"number\": \"217\",\n                        \"street\": \"Rua Riachuelo\",\n                        \"country\": \"Brazil\",\n                        \"district\": \"Centro\",\n                        \"postal_code\": \"85812110\"\n                    }\n                ],\n                \"occupation\": \"c85583ef-b602-4fea-b202-6fc5c58d8189\",\n                \"allow_contact\": true,\n                \"blocked_reason\": null,\n                \"favorite_medium\": \"sms\",\n                \"registered_date\": \"2019-10-18T20:06:31.705758+00:00\",\n                \"rules_agreement\": true,\n                \"rules_agreement_date\": \"2019-10-18T20:06:31.708640+00:00\"\n            },\n            \"emails\": \"fernandagabriellyduarte@ymail.com\",\n            \"phones\": \"5519991901717\"\n        }\n    ]\n}\n\"\"\"\n\nget_cpf_from_jwt()\n\"\"\"\nResponse example:\n\"09345699823\"\n\"\"\"\n\nget_user_ip()\n\"\"\"\nResponse example:\n\"192.168.0.1\" or None\n\"\"\"\n\n```\n\n## Versioning\nThis lib follows the [pypi version format](https://www.python.org/dev/peps/pep-0440/) with the convention of using \n_major_._minor_._patch_ version.\n\n### When to bump a patch version?\nBump the patch version if you are doing a quick fix, nothing that changes the library functionality.\n\n### When to bump the minor version?\nBump the minor version if you are adding new functionality without breaking backwards compatibility. For example, \nadding support to new events.\n\n### When to bump the major version?\nBump the major version if you are breaking backwards compatibility by adding new functionality or refactoring.",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Middleware to intercept JWT auth token and more utils functions",
    "version": "1.5.4",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "415e82f3b71fb51719f270cfabb4d3f4b0b52375af097c401cb0eca0b723bbed",
                "md5": "8b3b3c24369ad9ef84bb997f4644e7ee",
                "sha256": "4859c9b40e3ebcaadb28da90a204c02e4b2b34cd88ba3c5233144c048b6eb8b5"
            },
            "downloads": -1,
            "filename": "jsm_user_services-1.5.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8b3b3c24369ad9ef84bb997f4644e7ee",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 30071,
            "upload_time": "2024-10-28T18:26:52",
            "upload_time_iso_8601": "2024-10-28T18:26:52.123740Z",
            "url": "https://files.pythonhosted.org/packages/41/5e/82f3b71fb51719f270cfabb4d3f4b0b52375af097c401cb0eca0b723bbed/jsm_user_services-1.5.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "357c5e98aa2caf3125895f4bb83e03a4357a95d619e16c166faaf2c9b75216a7",
                "md5": "e661e1ce020a84163e277ea5ec9fc460",
                "sha256": "e606b38ffe9b202a3275d9118b518af18e656ff702f7def8ae2a35aeb9d1b209"
            },
            "downloads": -1,
            "filename": "jsm_user_services-1.5.4.tar.gz",
            "has_sig": false,
            "md5_digest": "e661e1ce020a84163e277ea5ec9fc460",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 26239,
            "upload_time": "2024-10-28T18:26:53",
            "upload_time_iso_8601": "2024-10-28T18:26:53.713567Z",
            "url": "https://files.pythonhosted.org/packages/35/7c/5e98aa2caf3125895f4bb83e03a4357a95d619e16c166faaf2c9b75216a7/jsm_user_services-1.5.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-28 18:26:53",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "jsm-user-services"
}
        
Elapsed time: 1.48053s