Skip to content
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

OIDC: Aggregated and Distributed Claims #1955

Closed
universam1 opened this issue Feb 14, 2022 · 4 comments · Fixed by #1962
Closed

OIDC: Aggregated and Distributed Claims #1955

universam1 opened this issue Feb 14, 2022 · 4 comments · Fixed by #1962

Comments

@universam1
Copy link
Contributor

universam1 commented Feb 14, 2022

Is your feature request related to a problem? Please describe.

For OIDC (using filter oauthOidcAnyClaims ) with Azure AD we are seeing users who are member of many groups to run into a clipped groups token behaviour of Azure.
The groups claim is replaced by hasToken and a pointer to the Graph API.
That breaks subsequent filter oidcClaimsQuery for group membership, as the expected claim of groups is empty

Describe the solution you would like
Skipper detects this flag hasToken and performs a lookup to the Graph API, retrieving the actual list of groups, storing in the statebag or cookie.
It could be a configurable option to perform this lookup.

Additional context (optional)
Would it make sense to implement this lookup to the Graph API, granted this looks like a Azure-ish behaviour?

Which filter would be the proper place to extend?

Would you like to work on it?
Potentially, with support.

@szuecs
Copy link
Member

szuecs commented Feb 14, 2022

When I check the linked resource, there is:

{
  ...
  "_claim_names": {
   "groups": "src1"
    },
    {
  "_claim_sources": {
    "src1": {
        "endpoint":"[Url to get this user's group membership from]"
        }
       }
     }
  ...
}

I think if we somehow configure that lookup key is _claim_sources.<any>.endpoint it could be done.
Great would be to research how other OpenID Connect providers handle this case. I don't know, maybe they just limit it. It would be great information of how we should generalize this case.

@universam1
Copy link
Contributor Author

universam1 commented Feb 15, 2022

It as actually a well defined standard behaviour:
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

Example implementation:
https://github.com/hashicorp/vault-plugin-auth-jwt/blob/b724ae7ef01864b4f931814d75b875252076936e/provider_azure.go#L51-L64

or: https://github.com/grafana/grafana/blob/main/pkg/login/social/azuread_oauth.go#L167-L183

For other IdP we've seen with ADFS that case is not properly handled eventually causing browser or LB exceptions, no idea about others though.

The Hashicorp example looks well implemented as a good base - what do you think @szuecs ?
Since only oauthOidc*Claims filters have credentials would this be the right filter to extend?

@universam1 universam1 changed the title Azure: Groups overage claim OIDC: Aggregated and Distributed Claims Feb 15, 2022
@webframp
Copy link

If it's part of the oidc standard then it seems potentially useful to implement to me. Interestingly both referenced example implementations look like they were able to be implemented using golang.org/x/oauth2 without requiring any azure specific implementation library. That's a nice design goal I would think.

Although some nice libraries like https://github.com/manicminer/hamilton/ exist, it would not seem very nice to require that just to support this feature.

@szuecs
Copy link
Member

szuecs commented Feb 15, 2022

If it's part of the spec let's build it of course!
So I guess we should put the aggregated data into our container that we pass to stateBag which can queried via oidcClaimsQuery or how do you think to integrate it?

https://openid.net/specs/openid-connect-core-1_0.html#DistributedExample , 5.6.2.2 is in particular an interesting case. We need to query the sources, but this should be done in oauthOidc*Claims to provide a "provisioned" stateBag for oidcClaimsQuery.

universam1 added a commit to o11n/skipper that referenced this issue Feb 18, 2022
fixes: zalando#1955

This solution is scoped to Azure behaviour, taking into account the specs from
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

There are some Azure related API calls included but trying to support other providers, which is though unknown at this time.

Base for discussion with open questions marked with Todo

Signed-off-by: Samuel Lang <gh@lang-sam.de>
universam1 added a commit to o11n/skipper that referenced this issue Feb 18, 2022
fixes: zalando#1955

This solution is scoped to Azure behaviour, taking into account the specs from
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

There are some Azure related API calls included but trying to support other providers, which is though unknown at this time.

Base for discussion with open questions marked with Todo

Signed-off-by: Samuel Lang <gh@lang-sam.de>
universam1 added a commit to o11n/skipper that referenced this issue Feb 25, 2022
fixes: zalando#1955

This solution is scoped to Azure behaviour, taking into account the specs from
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

There are some Azure related API calls included but trying to support other providers, which is though unknown at this time.

it transforms a distributed claim

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    }
}
```

into a full populated token, which is saved in `statebag` and in the `cookie` for follow up processing

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    },
    "groups": [
        "group1",
        "group2",
        ...
    ]
}
```

Signed-off-by: Samuel Lang <gh@lang-sam.de>
universam1 added a commit to o11n/skipper that referenced this issue Feb 25, 2022
fixes: zalando#1955

This solution is scoped to Azure behaviour, taking into account the specs from
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

There are some Azure related API calls included but trying to support other providers, which is though unknown at this time.

it transforms a distributed claim

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    }
}
```

into a full populated token, which is saved in `statebag` and in the `cookie` for follow up processing

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    },
    "groups": [
        "group1",
        "group2",
        ...
    ]
}
```

Signed-off-by: Samuel Lang <gh@lang-sam.de>
universam1 added a commit to o11n/skipper that referenced this issue Feb 25, 2022
fixes: zalando#1955

This solution is scoped to Azure behaviour, taking into account the specs from
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

There are some Azure related API calls included but trying to support other providers, which is though unknown at this time.

it transforms a distributed claim

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    }
}
```

into a full populated token, which is saved in `statebag` and in the `cookie` for follow up processing

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    },
    "groups": [
        "group1",
        "group2",
        ...
    ]
}
```

Signed-off-by: Samuel Lang <gh@lang-sam.de>
universam1 added a commit to o11n/skipper that referenced this issue Feb 28, 2022
fixes: zalando#1955

This solution is scoped to Azure behaviour, taking into account the specs from
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

There are some Azure related API calls included but trying to support other providers, which is though unknown at this time.

it transforms a distributed claim

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    }
}
```

into a full populated token, which is saved in `statebag` and in the `cookie` for follow up processing

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    },
    "groups": [
        "group1",
        "group2",
        ...
    ]
}
```
universam1 added a commit to o11n/skipper that referenced this issue Feb 28, 2022
fixes: zalando#1955

This solution is scoped to Azure behaviour, taking into account the specs from
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

There are some Azure related API calls included but trying to support other providers, which is though unknown at this time.

it transforms a distributed claim

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    }
}
```

into a full populated token, which is saved in `statebag` and in the `cookie` for follow up processing

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    },
    "groups": [
        "group1",
        "group2",
        ...
    ]
}
```

Signed-off-by: Samuel Lang <gh@lang-sam.de>
universam1 added a commit to o11n/skipper that referenced this issue Feb 28, 2022
fixes: zalando#1955

This solution is scoped to Azure behaviour, taking into account the specs from
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

There are some Azure related API calls included but trying to support other providers, which is though unknown at this time.

it transforms a distributed claim

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    }
}
```

into a full populated token, which is saved in `statebag` and in the `cookie` for follow up processing

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    },
    "groups": [
        "group1",
        "group2",
        ...
    ]
}
```

Signed-off-by: Samuel Lang <gh@lang-sam.de>
universam1 added a commit to o11n/skipper that referenced this issue Feb 28, 2022
fixes: zalando#1955

This solution is scoped to Azure behaviour, taking into account the specs from
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

There are some Azure related API calls included but trying to support other providers, which is though unknown at this time.

it transforms a distributed claim

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    }
}
```

into a full populated token, which is saved in `statebag` and in the `cookie` for follow up processing

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    },
    "groups": [
        "group1",
        "group2",
        ...
    ]
}
```

Signed-off-by: Samuel Lang <gh@lang-sam.de>
universam1 added a commit to o11n/skipper that referenced this issue Feb 28, 2022
fixes: zalando#1955

This solution is scoped to Azure behaviour, taking into account the specs from
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

There are some Azure related API calls included but trying to support other providers, which is though unknown at this time.

it transforms a distributed claim

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    }
}
```

into a full populated token, which is saved in `statebag` and in the `cookie` for follow up processing

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    },
    "groups": [
        "group1",
        "group2",
        ...
    ]
}
```

Signed-off-by: Samuel Lang <gh@lang-sam.de>
universam1 added a commit to o11n/skipper that referenced this issue Mar 2, 2022
fixes: zalando#1955

This solution is scoped to Azure behaviour, taking into account the specs from
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

There are some Azure related API calls included but trying to support other providers, which is though unknown at this time.

it transforms a distributed claim

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    }
}
```

into a full populated token, which is saved in `statebag` and in the `cookie` for follow up processing

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    },
    "groups": [
        "group1",
        "group2",
        ...
    ]
}
```

Signed-off-by: Samuel Lang <gh@lang-sam.de>
universam1 added a commit to o11n/skipper that referenced this issue Mar 3, 2022
fixes: zalando#1955

This solution is scoped to Azure behaviour, taking into account the specs from
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

There are some Azure related API calls included but trying to support other providers, which is though unknown at this time.

it transforms a distributed claim

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    }
}
```

into a full populated token, which is saved in `statebag` and in the `cookie` for follow up processing

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    },
    "groups": [
        "group1",
        "group2",
        ...
    ]
}
```

Signed-off-by: Samuel Lang <gh@lang-sam.de>
universam1 added a commit to o11n/skipper that referenced this issue Mar 3, 2022
fixes: zalando#1955

This solution is scoped to Azure behaviour, taking into account the specs from
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

There are some Azure related API calls included but trying to support other providers, which is though unknown at this time.

it transforms a distributed claim

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    }
}
```

into a full populated token, which is saved in `statebag` and in the `cookie` for follow up processing

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    },
    "groups": [
        "group1",
        "group2",
        ...
    ]
}
```

Signed-off-by: Samuel Lang <gh@lang-sam.de>
universam1 added a commit to o11n/skipper that referenced this issue Mar 4, 2022
fixes: zalando#1955

This solution is scoped to Azure behaviour, taking into account the specs from
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

There are some Azure related API calls included but trying to support other providers, which is though unknown at this time.

it transforms a distributed claim

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    }
}
```

into a full populated token, which is saved in `statebag` and in the `cookie` for follow up processing

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    },
    "groups": [
        "group1",
        "group2",
        ...
    ]
}
```

Signed-off-by: Samuel Lang <gh@lang-sam.de>
universam1 added a commit to o11n/skipper that referenced this issue Mar 30, 2022
fixes: zalando#1955

This solution is scoped to Azure behaviour, taking into account the specs from
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

There are some Azure related API calls included but trying to support other providers, which is though unknown at this time.

it transforms a distributed claim

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    }
}
```

into a full populated token, which is saved in `statebag` and in the `cookie` for follow up processing

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    },
    "groups": [
        "group1",
        "group2",
        ...
    ]
}
```

Signed-off-by: Samuel Lang <gh@lang-sam.de>
universam1 added a commit to o11n/skipper that referenced this issue May 4, 2022
fixes: zalando#1955

This solution is scoped to Azure behaviour, taking into account the specs from
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

There are some Azure related API calls included but trying to support other providers, which is though unknown at this time.

it transforms a distributed claim

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    }
}
```

into a full populated token, which is saved in `statebag` and in the `cookie` for follow up processing

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    },
    "groups": [
        "group1",
        "group2",
        ...
    ]
}
```

Signed-off-by: Samuel Lang <gh@lang-sam.de>
universam1 added a commit to o11n/skipper that referenced this issue May 4, 2022
fixes: zalando#1955

This solution is scoped to Azure behaviour, taking into account the specs from
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

There are some Azure related API calls included but trying to support other providers, which is though unknown at this time.

it transforms a distributed claim

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    }
}
```

into a full populated token, which is saved in `statebag` and in the `cookie` for follow up processing

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    },
    "groups": [
        "group1",
        "group2",
        ...
    ]
}
```

Signed-off-by: Samuel Lang <gh@lang-sam.de>
szuecs pushed a commit that referenced this issue May 4, 2022
fixes: #1955

This solution is scoped to Azure behaviour, taking into account the specs from
https://openid.net/specs/openid-connect-core-1_0.html#AggregatedDistributedClaims

There are some Azure related API calls included but trying to support other providers, which is though unknown at this time.

it transforms a distributed claim

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    }
}
```

into a full populated token, which is saved in `statebag` and in the `cookie` for follow up processing

```json
{
    "_claim_names": {
        "groups": "src1"
    },
    "_claim_sources": {
        "src1": {
            "endpoint": "https://graph.windows.net/.../getMemberObjects"
        }
    },
    "groups": [
        "group1",
        "group2",
        ...
    ]
}
```

Signed-off-by: Samuel Lang <gh@lang-sam.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants