Skip to content

Windows Integrated Security #142

Closed

Description

@vlad-bezden

I could not find out information how to use Windows Integrated Security with asyncpg. I tried to add Integrated Security to the dictionary, but it did not work.

    SERVER_SETTINGS = {'IntegratedSecurity': 'True'}

    conn = await asyncpg.connect(host=HOST,
                                 port=PORT,
                                 user=USER,
                                 database=DATABASE,
                                 server_settings=SERVER_SETTINGS)

I'm always getting following error back:

Traceback (most recent call last):
  File "c:\DEV\PythonPlayground\testdb.py", line 28, in <module>
    loop.run_until_complete(run())
  File "C:\Users\vbezden\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 466, in run_until_complete
    return future.result()
  File "c:\DEV\PythonPlayground\testdb.py", line 21, in run
    server_settings=SERVER_SETTINGS)
  File "C:\dev\venv\lib\site-packages\asyncpg\connection.py", line 1187, in connect
    max_cacheable_statement_size=max_cacheable_statement_size)
  File "C:\dev\venv\lib\site-packages\asyncpg\connect_utils.py", line 306, in _connect
    raise last_error
  File "C:\dev\venv\lib\site-packages\asyncpg\connect_utils.py", line 298, in _connect
    connection_class=connection_class)
  File "C:\dev\venv\lib\site-packages\asyncpg\connect_utils.py", line 274, in _connect_addr
    await asyncio.wait_for(connected, loop=loop, timeout=timeout)
  File "C:\Users\abc\AppData\Local\Programs\Python\Python36-32\lib\asyncio\tasks.py", line 356, in wait_for
    raise futures.TimeoutError()
concurrent.futures._base.TimeoutError

Activity

  1. elprans commented on May 15, 2017

    @elprans
    Member

    asyncpg does not support GSSAPI/Kerberos authentication yet.

  2. JJsrc commented on Aug 20, 2019

    @JJsrc

    Any plans to support it?

  3. eltoder commented on Mar 4, 2024

    @eltoder
    Contributor

    asyncpg now supports GSSAPI, but "Windows Integrated Authentication" actually uses SSPI, which is slightly different:
    https://wiki.postgresql.org/wiki/Configuring_for_single_sign-on_using_SSPI_on_Windows
    https://www.postgresql.org/docs/current/sspi-auth.html

    This should not be hard to add, but I don't have anywhere to test it.

  4. added 4 commits that reference this issue on Mar 5, 2024
    765b30b
    c0219f1
    72a5fda
    69375b1
  5. added a commit that references this issue on Mar 11, 2024
    1aab209
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions