Settings

Settings for oic objects.

Caution

This part is under development. Most of the configuration options are being converted from keyword arguments to settings class. Using the settings class is optional for now, but will become a necessity later on.

In order to configure some objects in PyOIDC, you need a settings object. If you need to add some settings, make sure that you settings class inherits from the appropriate class in this module.

The settings make use of pydantic library. It is possible to instance them directly or use environment values to fill the settings.

pydantic settings oic.utils.settings.PyoidcSettings

Bases: BaseSettings

Main class for all settings shared among consumer and client.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Fields:
field client_cert: Union[None, str, Tuple[str, str]] = None

Local cert to use as client side certificate. Can be a single file (containing the private key and the certificate) or a tuple of both file’s path.

field timeout: Union[float, Tuple[float, float]] = 5

Timeout for requests library. Can be specified either as a single float or as a tuple of floats. For more details, refer to requests documentation.

field verify_ssl: Union[bool, str] = True

Control TLS server certificate validation:

  • If set to True the certificate is validated against the global settings,

  • If set to False, no validation is performed.

  • If set to a filename this is used as a certificate bundle in openssl format.

  • If set to a directory name this is used as a CA directory in the openssl format.

pydantic settings oic.utils.settings.ClientSettings

Bases: PyoidcSettings

Base settings for consumer shared among OAuth 2.0 and OpenID Connect.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Fields:
field requests_session: Optional[Session] = None

Instance of requests.Session with configuration options.

pydantic settings oic.utils.settings.OauthClientSettings

Bases: ClientSettings

Specific settings for OAuth 2.0 consumer.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Fields:
field client_cert: Union[None, str, Tuple[str, str]] = None

Local cert to use as client side certificate. Can be a single file (containing the private key and the certificate) or a tuple of both file’s path.

field requests_session: Optional[Session] = None

Instance of requests.Session with configuration options.

field timeout: Union[float, Tuple[float, float]] = 5

Timeout for requests library. Can be specified either as a single float or as a tuple of floats. For more details, refer to requests documentation.

field verify_ssl: Union[bool, str] = True

Control TLS server certificate validation:

  • If set to True the certificate is validated against the global settings,

  • If set to False, no validation is performed.

  • If set to a filename this is used as a certificate bundle in openssl format.

  • If set to a directory name this is used as a CA directory in the openssl format.

pydantic settings oic.utils.settings.OicClientSettings

Bases: OauthClientSettings

Settings for OpenID Connect Client.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Fields:
field client_cert: Union[None, str, Tuple[str, str]] = None

Local cert to use as client side certificate. Can be a single file (containing the private key and the certificate) or a tuple of both file’s path.

field requests_session: Optional[Session] = None

Instance of requests.Session with configuration options.

field timeout: Union[float, Tuple[float, float]] = 5

Timeout for requests library. Can be specified either as a single float or as a tuple of floats. For more details, refer to requests documentation.

field verify_ssl: Union[bool, str] = True

Control TLS server certificate validation:

  • If set to True the certificate is validated against the global settings,

  • If set to False, no validation is performed.

  • If set to a filename this is used as a certificate bundle in openssl format.

  • If set to a directory name this is used as a CA directory in the openssl format.

pydantic settings oic.utils.settings.OauthConsumerSettings

Bases: OauthClientSettings

Settings for OAuth 2.0 client.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Fields:
field client_cert: Union[None, str, Tuple[str, str]] = None

Local cert to use as client side certificate. Can be a single file (containing the private key and the certificate) or a tuple of both file’s path.

field requests_session: Optional[Session] = None

Instance of requests.Session with configuration options.

field timeout: Union[float, Tuple[float, float]] = 5

Timeout for requests library. Can be specified either as a single float or as a tuple of floats. For more details, refer to requests documentation.

field verify_ssl: Union[bool, str] = True

Control TLS server certificate validation:

  • If set to True the certificate is validated against the global settings,

  • If set to False, no validation is performed.

  • If set to a filename this is used as a certificate bundle in openssl format.

  • If set to a directory name this is used as a CA directory in the openssl format.

pydantic settings oic.utils.settings.ServerSettings

Bases: PyoidcSettings

Base settings for server shared among OAuth 2.0 and OpenID Connect.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Fields:
field client_cert: Union[None, str, Tuple[str, str]] = None

Local cert to use as client side certificate. Can be a single file (containing the private key and the certificate) or a tuple of both file’s path.

field timeout: Union[float, Tuple[float, float]] = 5

Timeout for requests library. Can be specified either as a single float or as a tuple of floats. For more details, refer to requests documentation.

field verify_ssl: Union[bool, str] = True

Control TLS server certificate validation:

  • If set to True the certificate is validated against the global settings,

  • If set to False, no validation is performed.

  • If set to a filename this is used as a certificate bundle in openssl format.

  • If set to a directory name this is used as a CA directory in the openssl format.

pydantic settings oic.utils.settings.OauthServerSettings

Bases: ServerSettings

Specific settings for OAuth 2.0 server.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Fields:
field client_cert: Union[None, str, Tuple[str, str]] = None

Local cert to use as client side certificate. Can be a single file (containing the private key and the certificate) or a tuple of both file’s path.

field timeout: Union[float, Tuple[float, float]] = 5

Timeout for requests library. Can be specified either as a single float or as a tuple of floats. For more details, refer to requests documentation.

field verify_ssl: Union[bool, str] = True

Control TLS server certificate validation:

  • If set to True the certificate is validated against the global settings,

  • If set to False, no validation is performed.

  • If set to a filename this is used as a certificate bundle in openssl format.

  • If set to a directory name this is used as a CA directory in the openssl format.

pydantic settings oic.utils.settings.OicServerSettings

Bases: OauthServerSettings

Specific settings for OpenID Connect server.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Fields:
field client_cert: Union[None, str, Tuple[str, str]] = None

Local cert to use as client side certificate. Can be a single file (containing the private key and the certificate) or a tuple of both file’s path.

field timeout: Union[float, Tuple[float, float]] = 5

Timeout for requests library. Can be specified either as a single float or as a tuple of floats. For more details, refer to requests documentation.

field verify_ssl: Union[bool, str] = True

Control TLS server certificate validation:

  • If set to True the certificate is validated against the global settings,

  • If set to False, no validation is performed.

  • If set to a filename this is used as a certificate bundle in openssl format.

  • If set to a directory name this is used as a CA directory in the openssl format.

pydantic settings oic.utils.settings.OauthProviderSettings

Bases: OauthServerSettings

Specific settings for OAuth 2.0 provider.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Fields:
field client_cert: Union[None, str, Tuple[str, str]] = None

Local cert to use as client side certificate. Can be a single file (containing the private key and the certificate) or a tuple of both file’s path.

field timeout: Union[float, Tuple[float, float]] = 5

Timeout for requests library. Can be specified either as a single float or as a tuple of floats. For more details, refer to requests documentation.

field verify_ssl: Union[bool, str] = True

Control TLS server certificate validation:

  • If set to True the certificate is validated against the global settings,

  • If set to False, no validation is performed.

  • If set to a filename this is used as a certificate bundle in openssl format.

  • If set to a directory name this is used as a CA directory in the openssl format.

pydantic settings oic.utils.settings.OicProviderSettings

Bases: OicServerSettings

Specific settings for OpenID Connect provider.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Fields:
field client_cert: Union[None, str, Tuple[str, str]] = None

Local cert to use as client side certificate. Can be a single file (containing the private key and the certificate) or a tuple of both file’s path.

field timeout: Union[float, Tuple[float, float]] = 5

Timeout for requests library. Can be specified either as a single float or as a tuple of floats. For more details, refer to requests documentation.

field verify_ssl: Union[bool, str] = True

Control TLS server certificate validation:

  • If set to True the certificate is validated against the global settings,

  • If set to False, no validation is performed.

  • If set to a filename this is used as a certificate bundle in openssl format.

  • If set to a directory name this is used as a CA directory in the openssl format.