semvec/pypi-packages huggingface dataset:
django-ninja-oauth2 0.1.6
Django Ninja OAuth2 package enables support of OAuth2 / OpenID Connect Authorization Code Flow for your swagger documentation.
Requires Python: >=3.10
Keywords: authentication, django, ninja, oauth2, openapi, openid-connect, swagger

# Django Ninja OAuth2

**Django Ninja OAuth2** package enables support of OAuth2 / OpenID Connect "Authorization Code Flow" for your swagger
documentation.

### Requirements

- Python >= 3.10
- django >= 3.1
- pydantic >= 2.0
- Django-Ninja >= 1.1.0

## Installation

```
pip install django-ninja-oauth2
```

After installation, change settings.py file. Locally it only worked with None. On a real domain it should work with
"same-origin-allow-popups".

```Python 
# in <myapp>/settings.py
SECURE_CROSS_ORIGIN_OPENER_POLICY = None  # or "same-origin-allow-popups"
```

## Usage

Initialize NinjaAPIOAuth2 wherever you would initialize the original Django Ninja api.

Set your authorization, token and public key url

By default, if no HTTP Authorization header is provided, required for OAuth2 authentication, it will automatically cancel the request and send the client an error.

If auto_error is set to False, when the HTTP Authorization header is not available, instead of erroring out, the dependency result will be None.

```Python
from ninja_oauth2 import NinjaAPIOAuth2, SwaggerOAuth2
from ninja_oauth2.security.oauth2 import OAuth2AuthorizationCodeBearer

oauth2 = OAuth2AuthorizationCodeBearer(
    authorization_url="https://test.com/auth/realms/<realm>/protocol/openid-connect/auth",
    token_url="https://test.com/auth/realms/<realm>/protocol/openid-connect/token",
    public_key_url="https://test.com/auth/realms/<realm>",
    auto_error=True # Default True
)

api = NinjaAPIOAuth2(
    docs=SwaggerOAuth2(
        auth={"clientId": "<client_id>"}
    ),
    auth=oauth2) # Use auth for all endpoints, optional

@api.get("/add", tags=["Main"], auth=oauth2) # Use auth for specific endpoint
def add(request, a: int, b: int):
    return {"result": a + b}
```

If you want to check the encoded jwt token against some condition, you can extend the OAuth2AuthorizationCodeBearer
in the following way:

```Python
from typing import Optional, Any
from django.http import HttpRequest
from ninja_oauth2 import NinjaAPIOAuth2, SwaggerOAuth2
from ninja_oauth2.security.oauth2 import OAuth2AuthorizationCodeBearer

class MyOAuth2(OAuth2AuthorizationCodeBearer):
    # token_info returns the encoded jwt token
    def authenticate(self, request: HttpRequest, token_info: dict) -> Optional[Any]:
        if token_info["resource_access"]["<clien_id>"]["roles"] == "admin":
            return token_info
        # Otherwise it will return a 401 unauthorized

        
oauth2 = MyOAuth2(
    authorization_url="https://test.com/auth/realms/<realm>/protocol/openid-connect/auth",
    token_url="https://test.com/auth/realms/<realm>/protocol/openid-connect/token",
    public_key_url="https://test.com/auth/realms/<realm>"
)

api = NinjaAPIOAuth2(
    docs=SwaggerOAuth2(
        auth={"clientId": "<client_id>"}
    ),
    auth=oauth2)
```
scipion-chem-CoPriNet 0.1
Scipion framework plugin for the use of CoPriNet software tools
Keywords: scipion CoPriNet scipion-3.0 cheminformatics

.. |organization| replace:: scipion-chem
.. |repository| replace:: scipion-chem-CoPriNet

========================================
CoPriNet scipion plugin
========================================
**Documentation under development, sorry for the inconvenience**
Scipion framework plugin for the use of CoPriNet software tools.
  
========================================
Install this plugin
========================================
You will need to use `Scipion3 <https://scipion-em.github.io/docs/docs/scipion
-modes/how-to-install.html>`_ to run these protocols.

CoPriNet, is installed automatically by Scipion.

- **Install the stable version**

    Through the plugin manager GUI by launching Scipion and following **Others** >> **Plugin Manager**

    or

.. parsed-literal::

    scipion3 installp -p \ |repository|\ 


- **Developer's version**

    1. Download repository:

    .. parsed-literal::

        git clone \https://github.com/\ |organization|\ /\ |repository|\ .git

    2. Install:

    .. parsed-literal::

        scipion3 installp -p /path/to/\ |repository|\  --devel
  
========================================
Protocols
========================================
This plugin contains the following protocols:

**None for now**

========================================
Packages & enviroments
========================================
Packages installed by this plugin can be located in ``/path/to/scipion/software/em/``.

The following packages will be created:

- CoPriNet-``version``

Where ``version`` is the current version of that specific package.

Also, the following conda enviroments will be created:

- CoPriNet-``version``

As of today, Scipion does not automatically uninstall the conda enviroments created in the installation process when uninstalling a plugin, so keep this list in mind if you want to clean up some disk space if you need to uninstall this one.

========================================
External software
========================================
This plugin integrates the following software:
  
.. _CoPriNet: https://github.com/MolecularAI/CoPriNet
.. |CoPriNet| replace:: **CoPriNet** 

- |CoPriNet|_: Tool for CoPriNet planning.

========================================
Changelog
========================================
All the recent version changes can be found `here <https://github.com/scipion-chem/scipion-chem-CoPriNet/blob/devel/CHANGES.rst>`_.