public inbox for [email protected]  
help / color / mirror / Atom feed
OAUTH2 Problems
2+ messages / 2 participants
[nested] [flat]

* OAUTH2 Problems
@ 2021-11-12 14:50 Francisco Cardoso <[email protected]>
  2021-11-16 03:06 ` Re: OAUTH2 Problems Khushboo Vashi <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Francisco Cardoso @ 2021-11-12 14:50 UTC (permalink / raw)
  To: pgadmin-hackers; +Cc: Martin Beno <[email protected]>

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 “Please set the configuration parameters properly.” In the UI.

Here is my config:

Version: 6.1

config_local.py
```
OAUTH2_NAME = "azure"
OAUTH2_BUTTON_COLOR = "#3253a8"
OAUTH2_CLIENT_ID = "[ID]"
OAUTH2_DISPLAY_NAME = "Azure"
OAUTH2_TOKEN_URL = "https://login.microsoftonline.com/.../oauth2/v2.0/token";
OAUTH2_AUTHORIZATION_URL = "https://login.microsoftonline.com/.../oauth2/v2.0/authorize";
OAUTH2_CLIENT_SECRET = "[secret]"
OAUTH2_ICON = "fa-github"
OAUTH2_SCOPE = "User.Read email openid profile"
OAUTH2_API_BASE_URL = "https://graph.microsoft.com/";
OAUTH2_USERINFO_ENDPOINT = "profile"
MASTER_PASSWORD_REQUIRED = True
AUTHENTICATION_SOURCES = ['oauth2', 'internal']
CONSOLE_LOG_LEVEL = 10
```

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/…/oauth2/v2.0/token'";
      PGADMIN_CONFIG_OAUTH2_AUTHORIZATION_URL: "'https://login.microsoftonline.com/…/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: “’[ID]’”
      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


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: OAUTH2 Problems
  2021-11-12 14:50 OAUTH2 Problems Francisco Cardoso <[email protected]>
@ 2021-11-16 03:06 ` Khushboo Vashi <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Khushboo Vashi @ 2021-11-16 03:06 UTC (permalink / raw)
  To: Francisco Cardoso <[email protected]>; +Cc: pgadmin-hackers; Martin Beno <[email protected]>

Hi,

On Mon, Nov 15, 2021 at 10:12 PM Francisco Cardoso <
[email protected]> 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 “Please set the
> configuration parameters properly.” In the UI.
>
>
>
> Here is my config:
>
>
>
> Version: 6.1
>
>
>
> config_local.py
>
> ```
>
> OAUTH2_NAME = "azure"
>
> OAUTH2_BUTTON_COLOR = "#3253a8"
>
> OAUTH2_CLIENT_ID = "[ID]"
>
> OAUTH2_DISPLAY_NAME = "Azure"
>
> OAUTH2_TOKEN_URL = "
> https://login.microsoftonline.com/.../oauth2/v2.0/token";
>
> OAUTH2_AUTHORIZATION_URL = "
> https://login.microsoftonline.com/.../oauth2/v2.0/authorize";
>
> OAUTH2_CLIENT_SECRET = "[secret]"
>
> OAUTH2_ICON = "fa-github"
>
> OAUTH2_SCOPE = "User.Read email openid profile"
>
> OAUTH2_API_BASE_URL = "https://graph.microsoft.com/";
>
> OAUTH2_USERINFO_ENDPOINT = "profile"
>
> MASTER_PASSWORD_REQUIRED = True
>
> AUTHENTICATION_SOURCES = ['oauth2', 'internal']
>
> CONSOLE_LOG_LEVEL = 10
>
> ```
>
>
>

pgAdmin 4 supports multiple Oauth2 configurations at a time, so it should
be in an array, like below:

OAUTH2_CONFIG = [{
     '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/…/oauth2/v2.0/token'";
>
>       PGADMIN_CONFIG_OAUTH2_AUTHORIZATION_URL: "'
> https://login.microsoftonline.com/…/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: “’[ID]’”
>
>       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
>


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-11-16 03:06 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 14:50 OAUTH2 Problems Francisco Cardoso <[email protected]>
2021-11-16 03:06 ` Khushboo Vashi <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox