mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-11-03 12:49:23 -06:00
Added support for OAuth 2 authentication. Fixes #5940
Initial patch sent by: Florian Sabonchi
This commit is contained in:
1 parent
fff4060b31
commit
48ca83f31d
35 files changed
+750
-227
No files matched your search
@@ -37,6 +37,7 @@ Mode is pre-configured for security.
|
||||
change_user_password
|
||||
ldap
|
||||
kerberos
|
||||
oauth2
|
||||
|
||||
|
||||
.. note:: Pre-compiled and configured installation packages are available for
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 110 KiB |
@@ -34,6 +34,7 @@ from *config.py* file and modify the values for the following parameters.
|
||||
Please note that if it is not set, it will take the value of
|
||||
*default_server* parameter."
|
||||
|
||||
|
||||
Keytab file for HTTP Service
|
||||
============================
|
||||
|
||||
@@ -116,3 +117,13 @@ PostgreSQL Server settings to configure Kerberos Authentication
|
||||
|
||||
* Note that, you have to login into pgAdmin with Kerberos authentication to
|
||||
then connect to PostgreSQL using Kerberos.
|
||||
|
||||
|
||||
Master Password
|
||||
===============
|
||||
|
||||
In the multi user mode, pgAdmin uses user's login password to encrypt/decrypt the PostgreSQL server password.
|
||||
In the Kerberos authentication, the pgAdmin user does not have the password, so we need an encryption key to store
|
||||
the PostgreSQL server password for the servers which are not configured to use the Kerberos authentication.
|
||||
To accomplish this, set the configuration parameter MASTER_PASSWORD to *True*, so upon setting the master password,
|
||||
it will be used as an encryption key while storing the password. If it is False, the server password can not be stored.
|
||||
@@ -0,0 +1,61 @@
|
||||
.. _oauth2:
|
||||
|
||||
*****************************************
|
||||
`Enabling OAUTH2 Authentication`:index:
|
||||
*****************************************
|
||||
|
||||
|
||||
To enable OAUTH2 authentication for pgAdmin, you must configure the OAUTH2
|
||||
settings in the *config_local.py* or *config_system.py* file (see the
|
||||
:ref:`config.py <config_py>` documentation) on the system where pgAdmin is
|
||||
installed in Server mode. You can copy these settings from *config.py* file
|
||||
and modify the values for the following parameters:
|
||||
|
||||
|
||||
.. csv-table::
|
||||
:header: "**Parameter**", "**Description**"
|
||||
:class: longtable
|
||||
:widths: 35, 55
|
||||
|
||||
"AUTHENTICATION_SOURCES", "The default value for this parameter is *internal*.
|
||||
To enable OAUTH2 authentication, you must include *oauth2* in the list of values
|
||||
for this parameter. you can modify the value as follows:
|
||||
|
||||
* [‘oauth2’, ‘internal’]: pgAdmin will display an additional button for authenticating with oauth2"
|
||||
"OAUTH2_NAME", "The name of the Oauth2 provider, ex: Google, Github"
|
||||
"OAUTH2_DISPLAY_NAME", "Oauth2 display name in pgAdmin"
|
||||
"OAUTH2_CLIENT_ID", "Oauth2 Client ID"
|
||||
"OAUTH2_CLIENT_SECRET", "Oauth2 Client Secret"
|
||||
"OAUTH2_TOKEN_URL", "Oauth2 Access Token endpoint"
|
||||
"OAUTH2_AUTHORIZATION_URL", "Endpoint for user authorization"
|
||||
"OAUTH2_API_BASE_URL", "Oauth2 base URL endpoint to make requests simple, ex: *https://api.github.com/*"
|
||||
"OAUTH2_USERINFO_ENDPOINT", "User Endpoint, ex: *user* (for github) and *useinfo* (for google)"
|
||||
"OAUTH2_ICON", "The Font-awesome icon to be placed on the oauth2 button, ex: fa-github"
|
||||
"OAUTH2_BUTTON_COLOR", "Oauth2 button color"
|
||||
"OAUTH2_AUTO_CREATE_USER", "Set the value to *True* if you want to automatically
|
||||
create a pgAdmin user corresponding to a successfully authenticated Oauth2 user.
|
||||
Please note that password is not stored in the pgAdmin database."
|
||||
|
||||
Redirect URL
|
||||
============
|
||||
|
||||
The redirect url to configure Oauth2 server is *http://<pgAdmin Server URL>/oauth2/authorize*
|
||||
|
||||
Master Password
|
||||
===============
|
||||
|
||||
In the multi user mode, pgAdmin uses user's login password to encrypt/decrypt the PostgreSQL server password.
|
||||
In the Oauth2 authentication, the pgAdmin does not store the user's password, so we need an encryption key to store
|
||||
the PostgreSQL server password.
|
||||
To accomplish this, set the configuration parameter MASTER_PASSWORD to *True*, so upon setting the master password,
|
||||
it will be used as an encryption key while storing the password. If it is False, the server password can not be stored.
|
||||
|
||||
|
||||
Login Page
|
||||
============
|
||||
|
||||
After configuration, on restart, you can see the login page with the Oauth2 login button(s).
|
||||
|
||||
.. image:: images/oauth2_login.png
|
||||
:alt: Oauth2 login
|
||||
:align: center
|
||||
@@ -12,6 +12,7 @@ New features
|
||||
| `Issue #1975 <https://redmine.postgresql.org/issues/1975>`_ - Highlighted long running queries on the dashboards.
|
||||
| `Issue #3893 <https://redmine.postgresql.org/issues/3893>`_ - Added support for Reassign/Drop Owned for login roles.
|
||||
| `Issue #3920 <https://redmine.postgresql.org/issues/3920>`_ - Do not block the query editor window when running a query.
|
||||
| `Issue #5940 <https://redmine.postgresql.org/issues/5940>`_ - Added support for OAuth 2 authentication.
|
||||
| `Issue #6559 <https://redmine.postgresql.org/issues/6559>`_ - Added option to provide maximum width of the column when 'Resize by data?’ option in the preferences is set to True.
|
||||
|
||||
Housekeeping
|
||||
|
||||
Reference in new issue
Block a user