pgadmin-org / pgadmin4

pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world.
https://www.pgadmin.org
Other
2.53k stars 656 forks source link

Support for Azure AD OAUTH2 authentication (RM #7325) #5019

Closed dpage closed 2 years ago

dpage commented 2 years ago

Issue migrated from Redmine: https://redmine.postgresql.org/issues/7325 Originally created by Asmita Thapliyal at 2022-04-20 12:43:01 UTC.

I get below error if I use - https://graph.microsoft.com/v1.0/

This one is resp.json() o/p I printed. {'error': {'code': 'BadRequest', 'message': "Resource not found for the segment 'profile'.", 'innerError': {'date': '2022-04-20T09:37:23', 'request-id': 'a16ec3f0-89c5-42ec-a4a2-2e45042a4390', 'client-request-id': 'a16ec3f0-89c5-42ec-a4a2-2e45042a4390'}}}

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://graph.microsoft.com/v1.0/profile

2022-04-20 09:37:23,442: INFO werkzeug: 49.37.172.20 - - [20/Apr/2022 09:37:23] "GET /oauth2/authorize?code=0.ARsA3jZYM-9CokOxRTSMLunKW_3a3dHcJP5MrfqQQJh5-YcbAAA.AQABAAIAAAD--DLA3VO7QrddgJg7WevrZT

Solution Below change is required in configuration -

Name of the Endpoint, ex: user

'OAUTH2_USERINFO_ENDPOINT': 'me',

And Also, the profile returned by Azure AD has the key 'mail' and current pgadmin code checks the value with key = 'email' to retrieve user email id.

dpage commented 2 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/7325#note-1 Originally created by Yogesh Mahajan at 2022-04-21 05:38:47 UTC.

Redmine ticket header update:

Name Old Value New Value
Tracker changed Bug Feature
dpage commented 2 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/7325#note-2 Originally created by Yogesh Mahajan at 2022-04-21 05:41:40 UTC.

Redmine ticket header update:

Name Old Value New Value
Sprint changed EDB Sprint 115
Assigned To changed Yogesh Mahajan
Status changed New In Progress
dpage commented 2 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/7325#note-3 Originally created by Yogesh Mahajan at 2022-04-21 07:18:49 UTC.

Applied in changeset commit:f28e8126af2a57f1f97ef199e986ab9a8989d4ee.

Redmine ticket header update:

Name Old Value New Value
Done Ratio changed 0 90
Status changed In Progress In Testing
dpage commented 2 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/7325#note-4 Originally created by Akshay Joshi at 2022-04-21 07:19:45 UTC.

Redmine ticket header update:

Name Old Value New Value
Fixed Version changed 6.9
dpage commented 2 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/7325#note-5 Originally created by Yogesh Mahajan at 2022-04-27 03:32:06 UTC.

This is working fine.

Redmine ticket header update:

Name Old Value New Value
Status changed In Testing Resolved
dpage commented 2 years ago

Comment migrated from Redmine: https://redmine.postgresql.org/issues/7325#note-6 Originally created by Aditya Toshniwal at 2022-05-06 09:44:18 UTC.

Redmine ticket header update:

Name Old Value New Value
Relationship (duplicated) changed RM #7359
dpage commented 2 years ago

Issue closed on Redmine.