mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2026-10-18 13:18:26 +02:00
Microsoft Entra ID provider (#2390)
* Microsoft Entra ID Provider * fix typo in function name * documentation tweaks * documentation and comment tweak * docs tweaks * final tweaks * refactor: drop flag for skipping graph groups * update legacy / deprecated provider page and sort provider overview * reformat * move entra-id provider into switch (treat like every other provider * fix test case and reformat * fix sidebar configuration * apply review suggestions * add pagination for graph api * fix: do not error when groups unable to retrieve * doc: number of groups fix * restore master packages * docs: tiny docs tweak * address review comments * fix codegen --------- Co-authored-by: tuunit <jan@larwig.com>
This commit is contained in:
@@ -488,6 +488,7 @@ type LegacyProvider struct {
|
||||
KeycloakGroups []string `flag:"keycloak-group" cfg:"keycloak_groups"`
|
||||
AzureTenant string `flag:"azure-tenant" cfg:"azure_tenant"`
|
||||
AzureGraphGroupField string `flag:"azure-graph-group-field" cfg:"azure_graph_group_field"`
|
||||
EntraIDAllowedTenants []string `flag:"entra-id-allowed-tenant" cfg:"entra_id_allowed_tenants"`
|
||||
BitbucketTeam string `flag:"bitbucket-team" cfg:"bitbucket_team"`
|
||||
BitbucketRepository string `flag:"bitbucket-repository" cfg:"bitbucket_repository"`
|
||||
GitHubOrg string `flag:"github-org" cfg:"github_org"`
|
||||
@@ -550,6 +551,7 @@ func legacyProviderFlagSet() *pflag.FlagSet {
|
||||
flagSet.StringSlice("keycloak-group", []string{}, "restrict logins to members of these groups (may be given multiple times)")
|
||||
flagSet.String("azure-tenant", "common", "go to a tenant-specific or common (tenant-independent) endpoint.")
|
||||
flagSet.String("azure-graph-group-field", "", "configures the group field to be used when building the groups list(`id` or `displayName`. Default is `id`) from Microsoft Graph(available only for v2.0 oidc url). Based on this value, the `allowed-group` config values should be adjusted accordingly. If using `id` as group field, `allowed-group` should contains groups IDs, if using `displayName` as group field, `allowed-group` should contains groups name")
|
||||
flagSet.StringSlice("entra-id-allowed-tenant", []string{}, "list of tenants allowed for MS Entra ID multi-tenant application")
|
||||
flagSet.String("bitbucket-team", "", "restrict logins to members of this team")
|
||||
flagSet.String("bitbucket-repository", "", "restrict logins to user with access to this repository")
|
||||
flagSet.String("github-org", "", "restrict logins to members of this organisation")
|
||||
@@ -756,6 +758,10 @@ func (l *LegacyProvider) convert() (Providers, error) {
|
||||
UseApplicationDefaultCredentials: l.GoogleUseApplicationDefaultCredentials,
|
||||
TargetPrincipal: l.GoogleTargetPrincipal,
|
||||
}
|
||||
case "entra-id":
|
||||
provider.MicrosoftEntraIDConfig = MicrosoftEntraIDOptions{
|
||||
AllowedTenants: l.EntraIDAllowedTenants,
|
||||
}
|
||||
}
|
||||
|
||||
if l.ProviderName != "" {
|
||||
|
||||
@@ -30,6 +30,8 @@ type Provider struct {
|
||||
KeycloakConfig KeycloakOptions `json:"keycloakConfig,omitempty"`
|
||||
// AzureConfig holds all configurations for Azure provider.
|
||||
AzureConfig AzureOptions `json:"azureConfig,omitempty"`
|
||||
// MicrosoftEntraIDConfig holds all configurations for Entra ID provider.
|
||||
MicrosoftEntraIDConfig MicrosoftEntraIDOptions `json:"microsoftEntraIDConfig,omitempty"`
|
||||
// ADFSConfig holds all configurations for ADFS provider.
|
||||
ADFSConfig ADFSOptions `json:"ADFSConfig,omitempty"`
|
||||
// BitbucketConfig holds all configurations for Bitbucket provider.
|
||||
@@ -101,6 +103,9 @@ const (
|
||||
// AzureProvider is the provider type for Azure
|
||||
AzureProvider ProviderType = "azure"
|
||||
|
||||
// MicrosoftEntraIDProvider is the provider type for Entra OIDC
|
||||
MicrosoftEntraIDProvider ProviderType = "entra-id"
|
||||
|
||||
// BitbucketProvider is the provider type for Bitbucket
|
||||
BitbucketProvider ProviderType = "bitbucket"
|
||||
|
||||
@@ -155,6 +160,14 @@ type AzureOptions struct {
|
||||
GraphGroupField string `json:"graphGroupField,omitempty"`
|
||||
}
|
||||
|
||||
type MicrosoftEntraIDOptions struct {
|
||||
// AllowedTenants is a list of allowed tenants. In case of multi-tenant apps, incoming tokens are
|
||||
// issued by different issuers and OIDC issuer verification needs to be disabled.
|
||||
// When not specified, all tenants are allowed. Redundant for single-tenant apps
|
||||
// (regular ID token validation matches the issuer).
|
||||
AllowedTenants []string `json:"allowedTenants,omitempty"`
|
||||
}
|
||||
|
||||
type ADFSOptions struct {
|
||||
// Skip adding the scope parameter in login request
|
||||
// Default value is 'false'
|
||||
|
||||
Reference in New Issue
Block a user