-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Microsoft Entra ID provider #2390
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some remarks I already have before doing a indepth review.
@tuunit I have renamed methods and settings to reflect Microsoft Entra ID name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a quick read-through of the documentation. @tuunit can you take a look at the Golang code?
Also, are we 100% sure the Azure AD code can be deleted immediately? As this would be a breaking change I think I'd slightly prefer the removal in a separate PR.
This pull request has been inactive for 60 days. If the pull request is still relevant please comment to re-activate the pull request. If no action is taken within 7 days, the pull request will be marked closed. |
98e291f
to
58a7f7c
Compare
549e96c
to
e273e8a
Compare
In general, +1 to the direction this is going, will try to find time for a thorough review. Thank you for the in-depth analysis you've done there. |
67dab69
to
21e69b5
Compare
@tuunit I have rebased and addressed most of your comments 👌 |
Amazing I'll try to do a review this week! |
@jjlakis I've created an Azure test account and I'll do some testing tomorrow and on Tuesday. I hope that we can get this merged soon :) |
This pull request has been inactive for 60 days. If the pull request is still relevant please comment to re-activate the pull request. If no action is taken within 7 days, the pull request will be marked closed. |
Hi! Any update on this? Do we have any ETA? |
dfe9d6d
to
6b0a955
Compare
a089d48
to
be79e5d
Compare
### Example configurations | ||
Single-tenant app without groups (*groups claim* not enabled). Consider using generic OIDC provider: | ||
```shell | ||
provider="entra-id" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps at some point we should standardise these, so they are all, for example, PascalCase or something?
client_id="<client-id>" | ||
client_secret="<client-secret>" | ||
scope="openid" | ||
allowed_groups=["ac51800c-2679-4ecb-8130-636380a3b491"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future, maybe it would be possible/better to have the group names/email addresses? But I guess that doesn't make things unique at the provider side 🤔
} | ||
|
||
if hasGroupOverage { | ||
logger.Printf("entra overage found, reading groups from Graph API") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want to log this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is an exceptional case, I vote for keeping it.
Microsoft Entra ID Provider
This PR contains a proposal for a new implementation of Azure provider, that:
OIDCPRovider
Changes
New OIDC-compliant provider is added -
ms-entra-id
. Provider-specific configuration flags are:--ms-entra-id-allowed-tenant=<tenant-id>
- When specified, multi-tenant app authentication only allows tokens incomming from specific tenants.Remarks:
Usage
Detailed usage instructions with different scenarios, permissions, multi-tenancy considerations and examples with Azure Portal and Terraform are added to provider documentation.
Features
Outside of the generic OIDC behavior, provider implements the following:
EnrichSession()
checks for group overage (If not disabled by--ms-entra-id-skip-graph-groups
).--insecure-oidc-skip-issuer-verification
flag to be set. Custom implementaion ofValidateSession()
fills the security gap by comparing Tenant ID from incomming token with list specified in--ms-entra-id-multi-tenant-allowed-tenant
.Other considerations
Scope
This provider requires scope to be set explicitly (
openid
for azure only, andopenid profile email
for MS personal accounts). Default behavior addsgroups
scope when--allowed-group
is set. This claim isn't supported by Azure (it's also incompliant with OIDC). Fix proposed separately: #2392Missing e-mail in claim
When Azure user has no e-mail set (for example: it's created quickly for testing), oauth2-proxy fails with 500 with following:
When e-mail is added, everything works as expected.
How this was tested
This was carefully manually tested on Kubernetes with Traefik forward auth middleware. Following scenarios were covered:
--allowed-group
.--allowed-group
+ behavior for missing permissions.--allowed-group
, tested from 2 tenants & personal MS account--allowed-group
, tested from 2 tenants & personal MS account, check behavior for missing permissions.Implemented unit tests cover the corner cases - group overage & multi tenancy.
Related PRs and issues