davido / gerrit-oauth-provider

OAuth2 authentication provider for Gerrit Code Review. Please upload changes for review to: https://gerrit-review.googlesource.com/#/admin/projects/plugins/oauth
Apache License 2.0
140 stars 84 forks source link

Add support for tenant for Azure/office365 #148

Closed DagBertelsen closed 3 years ago

DagBertelsen commented 3 years ago

Adding the realm config parameter so you can lock the Azure oauth to a specific Azure AD controller as described here https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow

Also this github seems to be out of date compared to https://gerrit.googlesource.com/plugins/oauth/ several commits are missing here.

davido commented 3 years ago

Thanks for the contribution. The canonical repository is https://gerrit.googlesource.com/plugins/oauth. Can you upload change there for review?

Also this github seems to be out of date compared to https://gerrit.googlesource.com/plugins/oauth/ several commits are missing here.

Thanks for noticing. Yes, I will sync the missing commits later.

DagBertelsen commented 3 years ago

I tried to upload there but get "No Contributor Agreement on file for user Dag Bertelsen" as response.

But is there any reason that you do not use the ScribeJava https://github.com/scribejava/scribejava/blob/master/scribejava-apis/src/main/java/com/github/scribejava/apis/MicrosoftAzureActiveDirectory20Api.java

davido commented 3 years ago

You should sign Contribution Agreement there.

I wasn't aware of this class. I see, they are using "common" tenant constant for the case without tenant?

protected static final String COMMON_TENANT = "common";

See: https://github.com/scribejava/scribejava/blob/fb240086b4a6c9560c9f30d61633c771b0cd3ed7/scribejava-apis/src/main/java/com/github/scribejava/apis/microsoftazureactivedirectory/BaseMicrosoftAzureActiveDirectoryApi.java#L9

davido commented 3 years ago

Let's continue the review on gerrit-review.gs.com: [1].

[1] https://gerrit-review.googlesource.com/c/plugins/oauth/+/288442