authenticate: have an option to trim the contents of the callback (#4090)

This commit is contained in:
Denis Mishin 2023-03-31 11:48:31 -04:00 committed by GitHub
parent 7d53575bdb
commit 860a881fe0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View file

@ -3,10 +3,12 @@ package authenticate
import (
"github.com/pomerium/pomerium/config"
"github.com/pomerium/pomerium/internal/identity"
identitypb "github.com/pomerium/pomerium/pkg/grpc/identity"
)
type authenticateConfig struct {
getIdentityProvider func(options *config.Options, idpID string) (identity.Authenticator, error)
profileTrimFn func(*identitypb.Profile)
}
// An Option customizes the Authenticate config.
@ -27,3 +29,10 @@ func WithGetIdentityProvider(getIdentityProvider func(options *config.Options, i
cfg.getIdentityProvider = getIdentityProvider
}
}
// WithProfileTrimFn sets the profileTrimFn function in the config
func WithProfileTrimFn(profileTrimFn func(*identitypb.Profile)) Option {
return func(cfg *authenticateConfig) {
cfg.profileTrimFn = profileTrimFn
}
}