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

[8.15](backport #40487) x-pack/filebeat/input/entityanalytics/provider/azuread: fix configuration ordering #40493

Merged
merged 2 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Updated Websocket input title to align with existing inputs {pull}39006[39006]
- Relax requirements in Okta entity analytics provider user and device profile data shape. {pull}40359[40359]
- Fix bug in Okta entity analytics rate limit logic. {issue}40106[40106] {pull}40267[40267]
- Fix crashes in the journald input. {pull}40061[40061]
efd6 marked this conversation as resolved.
Show resolved Hide resolved
- Fix order of configuration for EntraID entity analytics provider. {pull}40487[40487]

*Heartbeat*

Expand Down
26 changes: 15 additions & 11 deletions x-pack/filebeat/input/entityanalytics/provider/azuread/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var _ provider.Provider = &azure{}
type azure struct {
*kvstore.Manager

cfg *config.C
conf conf

metrics *inputMetrics
Expand Down Expand Up @@ -74,8 +75,20 @@ func (p *azure) Test(testCtx v2.TestContext) error {
func (p *azure) Run(inputCtx v2.Context, store *kvstore.Store, client beat.Client) error {
p.logger = inputCtx.Logger.With("tenant_id", p.conf.TenantID, "provider", Name)
p.ctx = inputCtx

var err error
p.auth, err = oauth2.New(p.cfg, p.Manager.Logger)
if err != nil {
return fmt.Errorf("unable to create authenticator: %w", err)
}
p.auth.SetLogger(p.logger)

p.fetcher, err = graph.New(ctxtool.FromCanceller(p.ctx.Cancelation), p.ctx.ID, p.cfg, p.Manager.Logger, p.auth)
if err != nil {
return fmt.Errorf("unable to create fetcher: %w", err)
}
p.fetcher.SetLogger(p.logger)

p.metrics = newMetrics(inputCtx.ID, nil)
defer p.metrics.Close()

Expand Down Expand Up @@ -569,19 +582,10 @@ func (p *azure) publishDevice(d *fetcher.Device, state *stateStore, inputID stri

// configure configures this provider using the given configuration.
func (p *azure) configure(cfg *config.C) (kvstore.Input, error) {
var err error

if err = cfg.Unpack(&p.conf); err != nil {
if err := cfg.Unpack(&p.conf); err != nil {
return nil, fmt.Errorf("unable to unpack %s input config: %w", Name, err)
}

if p.auth, err = oauth2.New(cfg, p.Manager.Logger); err != nil {
return nil, fmt.Errorf("unable to create authenticator: %w", err)
}
if p.fetcher, err = graph.New(ctxtool.FromCanceller(p.ctx.Cancelation), p.ctx.ID, cfg, p.Manager.Logger, p.auth); err != nil {
return nil, fmt.Errorf("unable to create fetcher: %w", err)
}

p.cfg = cfg
return p, nil
}

Expand Down
Loading