Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mmooS-0003kq-IT for pgadmin-hackers@arkaria.postgresql.org; Tue, 16 Nov 2021 03:07:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mmooR-0002e1-Aj for pgadmin-hackers@arkaria.postgresql.org; Tue, 16 Nov 2021 03:07:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mmooQ-0002dq-HF for pgadmin-hackers@lists.postgresql.org; Tue, 16 Nov 2021 03:07:11 +0000 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mmooN-0003C3-12 for pgadmin-hackers@postgresql.org; Tue, 16 Nov 2021 03:07:09 +0000 Received: by mail-lj1-x22c.google.com with SMTP id e9so39990991ljl.5 for ; Mon, 15 Nov 2021 19:07:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UGkvvs9+hyp8Fsuo/89qARhwFxG6SS2a83rCnB+PvlQ=; b=PxX5AgVcFnRk9gQ8BJ/4rLptoEFRpO2m1Y/duH8zHDbx/GfK/+/yjqP5hwukgm9G2/ okLqEfYNHbcfYCifHQduQgo1IvbsD5XvJXVA/V8fhHDG18LKmlWx5oFIbG6GWeC5eTDb ZHN82Hhw6LlW83QFSl/LpKMcMIBr5RWu9po7cpP/QcMhCUSd+ipVXD+ggc0llCV0JvZK Q9heLUINkzO2s3LjU+3rTns97juCXGhlRbbnBtM6X0nRFEx8xU6YBzc306F1IwLlgJyd lCpzCVYIFgMg0yKdFF9vHcD/yhox8Or2Y6sA3YwrpvAP7/RJpbmetm6SyeH4bt/A/Swv T4OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UGkvvs9+hyp8Fsuo/89qARhwFxG6SS2a83rCnB+PvlQ=; b=QvIilqZf10vph6ymygRxRRLuel56iplc/cS7Ggk9+bBoXbV3qhrLREZBqnDIO6Bk3D 0LQ/8GcJyCfzSWyz6rmWsDafCRk/nFMQu37ZGhdMQbRobrp7PLBnQ/s8APqrvFyX4fC8 fdtJC52wS1BwpUacVgQy8MCdPijLfP8qizIpOH1hyZkcvsWLd3fbADD3d9HxpBmEgK10 xoXB663mTm4HlS+VMCah783bZXuAQXrYe9Pq7NTW5hwH+IYp5m0E4YBP7ounftTeckyE Dp5J4TfgRbbXinI6xRMuh3bkW9ZG73bo6zQM1QTztmVx8TdMZZXd6CQUUVIXNesuFQxE pZKw== X-Gm-Message-State: AOAM533FSB7pBMdYs//YDEA+EUA7LbPWi2Yj5ED7PML4VHMd5VbOP4PL Q4wbRNquM6QNbsVTd58NNHF3FRenBN0UW0JYIzPMbyVIR2VK3FXYC5Y5m4sEfvAzGrPpRNi9prm CddekJ1eq9W9MTdwIf4hR7Gv4qdxnAKR+fwLVZuF7gMEOZTYDi3/uFH0boCTNIBThCJ0BbVuS2v b1sauHdG2oJGNrT90TnKf3iz3Q9qTief6xmTqB2lFnDWqfYCEqAsQvhdEmpL3HLYxatw== X-Google-Smtp-Source: ABdhPJyBx/x3NTAdcdg28IiVGQbhOQ0eYx/nMkYGfxUkI5eucuYU3Op8WtvHTo8wMFht1QK2ihHNuQ7apRoYyDBfhLw= X-Received: by 2002:a2e:9ecb:: with SMTP id h11mr3661577ljk.212.1637032023283; Mon, 15 Nov 2021 19:07:03 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Khushboo Vashi Date: Tue, 16 Nov 2021 08:36:52 +0530 Message-ID: Subject: Re: OAUTH2 Problems To: Francisco Cardoso Cc: "pgadmin-hackers@postgresql.org" , Martin Beno Content-Type: multipart/alternative; boundary="0000000000003bf19605d0df3835" X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000003bf19605d0df3835 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Mon, Nov 15, 2021 at 10:12 PM Francisco Cardoso < francisco.cardoso@datascience-service.at> wrote: > Hello pgadmin hackers, > > > > I have problems with the configuration of the oauth2 with azureAD. > > > > It seems like the configuration is not applied as the display name is not > applied. If I click on the OAUTH2 button I get the error =E2=80=9CPlease = set the > configuration parameters properly.=E2=80=9D In the UI. > > > > Here is my config: > > > > Version: 6.1 > > > > config_local.py > > ``` > > OAUTH2_NAME =3D "azure" > > OAUTH2_BUTTON_COLOR =3D "#3253a8" > > OAUTH2_CLIENT_ID =3D "[ID]" > > OAUTH2_DISPLAY_NAME =3D "Azure" > > OAUTH2_TOKEN_URL =3D " > https://login.microsoftonline.com/.../oauth2/v2.0/token" > > OAUTH2_AUTHORIZATION_URL =3D " > https://login.microsoftonline.com/.../oauth2/v2.0/authorize" > > OAUTH2_CLIENT_SECRET =3D "[secret]" > > OAUTH2_ICON =3D "fa-github" > > OAUTH2_SCOPE =3D "User.Read email openid profile" > > OAUTH2_API_BASE_URL =3D "https://graph.microsoft.com/" > > OAUTH2_USERINFO_ENDPOINT =3D "profile" > > MASTER_PASSWORD_REQUIRED =3D True > > AUTHENTICATION_SOURCES =3D ['oauth2', 'internal'] > > CONSOLE_LOG_LEVEL =3D 10 > > ``` > > > pgAdmin 4 supports multiple Oauth2 configurations at a time, so it should be in an array, like below: OAUTH2_CONFIG =3D [{ 'OAUTH2_NAME': 'azure', 'OAUTH2_DISPLAY_NAME': 'Azure', 'OAUTH2_CLIENT_ID': 'xxxxxx', 'OAUTH2_CLIENT_SECRET': 'xxxxxxxx', 'OAUTH2_TOKEN_URL': 'https://login.microsoftonline.com/.../oauth2/v2.0/token', 'OAUTH2_AUTHORIZATION_URL': 'https://login.microsoftonline.com/.../oauth2/v2.0/authorize', 'OAUTH2_API_BASE_URL': 'https://graph.microsoft.com/"', 'OAUTH2_USERINFO_ENDPOINT': 'profile', 'OAUTH2_ICON': 'fa-github', 'OAUTH2_BUTTON_COLOR': '#3253a8', 'ALLOWED_ORGANIZATIONS': [''] }] Thanks, Khushboo > I run the pgadmin in a container. Here is the docker-compose file I use: > > > > > > ``` > > # https://www.pgadmin.org/docs/pgadmin4/latest/container_deployment.html > > version: "3" > > services: > > pgadmin: > > image: dpage/pgadmin4:6.1 > > restart: always > > environment: > > PGADMIN_DEFAULT_EMAIL: "[MAIL]" > > PGADMIN_DEFAULT_PASSWORD: "[PASS]" > > PGADMIN_LISTEN_PORT: "11111" > > network_mode: host > > volumes: > > - "${PWD}/data:/var/lib/pgadmin" > > - "${PWD}/servers.json:/pgadmin4/servers.json" > > - "${PWD}/config_local.py:/pgadmin4/config_local.py" > > ``` > > > > I also tried before to set everything via env variable but same result. > For completeness here is the yaml with the env set: > > > > ``` > > version: "3" > > services: > > pgadmin: > > image: dpage/pgadmin4:6.1 > > restart: always > > environment: > > PGADMIN_DEFAULT_EMAIL: "[MAIL]" > > PGADMIN_DEFAULT_PASSWORD: "[PASS]" > > PGADMIN_LISTEN_PORT: "11111" > > PGADMIN_CONFIG_USER_INACTIVITY_TIMEOUT: "10800" > > PGADMIN_CONFIG_MAX_QUERY_HIST_STORED : "1000" > > PGADMIN_CONFIG_AUTHENTICATION_SOURCES: "['oauth2', 'internal']" > > PGADMIN_CONFIG_OAUTH2_NAME: "'azure'" > > PGADMIN_CONFIG_OAUTH2_DISPLAY_NAME: "Azure" > > PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "True" > > PGADMIN_CONFIG_OAUTH2_TOKEN_URL: "' > https://login.microsoftonline.com/=E2=80=A6/oauth2/v2.0/token'" > > PGADMIN_CONFIG_OAUTH2_AUTHORIZATION_URL: "' > https://login.microsoftonline.com/=E2=80=A6/oauth2/v2.0/authorize'" > > PGADMIN_CONFIG_OAUTH2_API_BASE_URL: "'https://graph.microsoft.com/'= " > > PGADMIN_CONFIG_OAUTH2_USERINFO_ENDPOINT: " profile " > > PGADMIN_CONFIG_OAUTH2_CLIENT_ID: =E2=80=9C=E2=80=99[ID]=E2=80=99=E2= =80=9D > > PGADMIN_CONFIG_OAUTH2_CLIENT_SECRET: "'[SECRET]'" > > PGADMIN_CONFIG_OAUTH2_BUTTON_COLOR: "'#0000ff'" > > PGADMIN_CONFIG_DEBUG: "True" > > PGADMIN_CONFIG_CONSOLE_LOG_LEVEL: "10" > > network_mode: host > > volumes: > > - "${PWD}/data:/var/lib/pgadmin" > > - "${PWD}/servers.json:/pgadmin4/servers.json" > > ``` > > > > Am I missing something ? Thanks for the help. > > > > Best, > > > > Francisco > --0000000000003bf19605d0df3835 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

On Mon, Nov 15, 2021 at 10:= 12 PM Francisco Cardoso <francisco.cardoso@datascience-service.at> wrote:

Hello pgadmin hackers,

=C2=A0

I have problems with the config= uration of the oauth2 with azureAD.

=C2=A0

It seems like the configuration= is not applied as the display name is not applied. If I click on the OAUTH= 2 button I get the error =E2=80=9CPlease set the configuration parameters p= roperly.=E2=80=9D In the UI.

=C2=A0

Here is my config:

=C2=A0

Version: 6.1

=C2=A0

config_local.py

```

OAUTH2_NAME =3D "azure&quo= t;

OAUTH2_BUTTON_COLOR =3D "#= 3253a8"

OAUTH2_CLIENT_ID =3D "[ID]= "

OAUTH2_DISPLAY_NAME =3D "A= zure"

OAUTH2_TOKEN_URL =3D "https://login.microsoftonline.com/.../oauth2/v2.0/token"=

OAUTH2_AUTHORIZATION_URL =3D &q= uot;https://login.microsoftonline.com/.../oauth2/v2.0/author= ize"

OAUTH2_CLIENT_SECRET =3D "= [secret]"

OAUTH2_ICON =3D "fa-github= "

OAUTH2_SCOPE =3D "User.Rea= d email openid profile"

OAUTH2_API_BASE_URL =3D "<= a href=3D"https://graph.microsoft.com/" target=3D"_blank">https://graph.mic= rosoft.com/"

OAUTH2_USERINFO_ENDPOINT =3D &q= uot;profile"

MASTER_PASSWORD_REQUIRED =3D Tr= ue

AUTHENTICATION_SOURCES =3D [= 9;oauth2', 'internal']

CONSOLE_LOG_LEVEL =3D 10=

```

=C2=A0

<= /div>

pgAdmin 4 supports multiple Oauth2 co= nfigurations at a time, so it should be in an array, like below:=C2=A0
OAUTH2_CONFIG =3D [{
'OAUTH2_NAME': 'azure',
= 'OAUTH2_DISPLAY_NAME': 'Azure',
= 'OAUTH2_CLIENT_ID': '= ;xxxxxx',
'OAUTH= 2_CLIENT_SECRET': 'xxxxx= xxx',
'OAUTH2_TO= KEN_URL': 'https://login.microsoftonline.com/.../oauth2/v2.0/token'
,
'OAUTH2_AUTHORIZATION_URL': 'https://login.micr= osoftonline.com/.../oauth2/v2.0/authorize',
'OAUTH2= _API_BASE_URL': '= https:/= /graph.microsoft.com/"',
'OAUTH2_USERINFO_ENDPOINT': 'profile',
'OAUTH2_ICON= ': 'fa-github',
'OAUTH2_BUTTON_COLOR'= ;: '#3253a8',
'ALLOWED_ORGANIZATIONS': ['']
}]
Thank= s,
Khushboo
=C2=A0

I run the pgadmin in a containe= r. Here is the docker-compose file I use:

=C2=A0

=C2=A0

```

# htt= ps://www.pgadmin.org/docs/pgadmin4/latest/container_deployment.html<= /u>

version: "3"

services:<= /p>

=C2=A0 pgadmin:

=C2=A0=C2=A0=C2=A0 image: dpage= /pgadmin4:6.1

=C2=A0=C2=A0=C2=A0 restart: alw= ays

=C2=A0=C2=A0=C2=A0 environment:=

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_DEFAULT_EMAIL: "[MAIL]"

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_DEFAULT_PASSWORD: "[PASS]"

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_LISTEN_PORT: "11111"

=C2=A0=C2=A0=C2=A0 network_mode= : host

=C2=A0=C2=A0=C2=A0 volumes:<= /u>

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = - "${PWD}/data:/var/lib/pgadmin"

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = - "${PWD}/servers.json:/pgadmin4/servers.json"

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = - "${PWD}/config_local.py:/pgadmin4/config_local.py"

```

=C2=A0

I also tried before to set ever= ything via env variable but same result. For completeness here is the yaml = with the env set:

=C2=A0

```

version: "3"

services:<= /p>

=C2=A0 pgadmin:

=C2=A0=C2=A0=C2=A0 image: dpage= /pgadmin4:6.1

=C2=A0=C2=A0=C2=A0 restart: alw= ays

=C2=A0=C2=A0=C2=A0 environment:=

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_DEFAULT_EMAIL: "[MAIL]"

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_DEFAULT_PASSWORD: "[PASS]"

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_LISTEN_PORT: "11111"

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_CONFIG_USER_INACTIVITY_TIMEOUT: "10800"

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_CONFIG_MAX_QUERY_HIST_STORED : "1000"

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_CONFIG_AUTHENTICATION_SOURCES: "['oauth2', 'intern= al']"

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_CONFIG_OAUTH2_NAME: "'azure'"

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_CONFIG_OAUTH2_DISPLAY_NAME: "Azure"<= /p>

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "True"

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_CONFIG_OAUTH2_TOKEN_URL: "'https://login.microsoftonline.com/=E2= =80=A6/oauth2/v2.0/token'"

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_CONFIG_OAUTH2_AUTHORIZATION_URL: "'https://login.microsoftonline.com= /=E2=80=A6/oauth2/v2.0/authorize'"

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_CONFIG_OAUTH2_API_BASE_URL: "'https://graph.microsoft.com/'"<= u>

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_CONFIG_OAUTH2_USERINFO_ENDPOINT: " profile "

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_CONFIG_OAUTH2_CLIENT_ID: =E2=80=9C=E2=80=99[ID]=E2=80=99=E2=80=9D

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_CONFIG_OAUTH2_CLIENT_SECRET: "'[SECRET]'"<= u>

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_CONFIG_OAUTH2_BUTTON_COLOR: "'#0000ff'"=

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_CONFIG_DEBUG: "True"

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = PGADMIN_CONFIG_CONSOLE_LOG_LEVEL: "10"

=C2=A0=C2=A0=C2=A0 network_mode= : host

=C2=A0=C2=A0=C2=A0 volumes:<= /u>

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = - "${PWD}/data:/var/lib/pgadmin"

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = - "${PWD}/servers.json:/pgadmin4/servers.json"

```

=C2=A0

Am I missing something ? Thanks= for the help.

=C2=A0

Best,

=C2=A0

Francisco<= /p>

--0000000000003bf19605d0df3835--