Files
coder/enterprise/coderd/enidpsync/groups.go
Rafael Rodriguez 5b1e809862 fix: support oidc group allowlist in oss (#19430)
## Summary

In this pull request we're adding support for OIDC allowed groups in the
OSS version as part of work for
https://github.com/coder/coder/issues/17027.

### Changes

- Restored support for parsing group allow list in OSS code

### Testing

- Added tests for OSS code
- Tested allowed/prohibited group OIDC flows in premium and OSS
2025-08-20 10:09:13 -05:00

31 lines
998 B
Go

package enidpsync
import (
"context"
"github.com/golang-jwt/jwt/v4"
"github.com/coder/coder/v2/coderd/idpsync"
"github.com/coder/coder/v2/codersdk"
)
func (e EnterpriseIDPSync) GroupSyncEntitled() bool {
return e.entitlements.Enabled(codersdk.FeatureTemplateRBAC)
}
// ParseGroupClaims parses the user claims and handles deployment wide group behavior.
// Almost all behavior is deferred since each organization configures it's own
// group sync settings.
// GroupAllowList is implemented here to prevent login by unauthorized users.
// TODO: GroupAllowList overlaps with the default organization group sync settings.
func (e EnterpriseIDPSync) ParseGroupClaims(ctx context.Context, mergedClaims jwt.MapClaims) (idpsync.GroupParams, *idpsync.HTTPError) {
resp, err := e.AGPLIDPSync.ParseGroupClaims(ctx, mergedClaims)
if err != nil {
return idpsync.GroupParams{}, err
}
return idpsync.GroupParams{
SyncEntitled: e.GroupSyncEntitled(),
MergedClaims: resp.MergedClaims,
}, nil
}