IdentityPython/idpy-oidc

op client_db config bug?

Opened this issue · 0 comments

I'm set client_db config, but following error occurred:

  File "[MY_PROJECT_PATH]/server.py", line 187, in oph
    self.init_handler()
  File "[MY_PROJECT_PATH]/server.py", line 181, in init_handler
    server = Server(config, cwd=cwd)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/oidc/lib/python3.12/site-packages/idpyoidc/server/__init__.py", line 77, in __init__
    self.context = EndpointContext(
                   ^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/oidc/lib/python3.12/site-packages/idpyoidc/server/endpoint_context.py", line 138, in __init__
    self.cdb = importer(_client_db["class"])(**_client_db["kwargs"])
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/oidc/lib/python3.12/site-packages/cryptojwt/utils.py", line 228, in importer
    _part = modsplit(name)
            ^^^^^^^^^^^^^^
  File "/opt/conda/envs/oidc/lib/python3.12/site-packages/cryptojwt/utils.py", line 213, in modsplit
    if ":" in name:
       ^^^^^^^^^^^
TypeError: argument of type 'type' is not iterable

my server config

from idpyoidc.server import Server

class ClientDB(object):
  ....

...
config = {
  ...
  "client_db": {
      "class": ClientDB,
      "kwargs": {},
  },
  ...
}
cwd = "/my/project/path"
server = Server(config, cwd=cwd)

In my case, edit idpyoidc/server/endpoint_context.py file.

            # line 136
            # self.cdb = importer(_client_db["class"])(**_client_db["kwargs"])
            try:
                self.cdb = importer(_client_db["class"])(**_client_db["kwargs"])
            except:
                self.cdb = _client_db["class"](**_client_db["kwargs"])

I'm not sure why you'd want to use the "importer" function to create a PR, so I'll leave an issue for now.

Thank you.