Commit Graph
13 Commits
Author SHA1 Message Date
Sakshyam Shah 67757a9fe2 refactor: move msgraph models to models package (#65871)
* refactor: move msgraph models from /lib/msgraph to /lib/msgraph/models package

* test: use msgraphtest server to test TestIterateUsers_Empty

* add comments to exported types

* lint: fix import cadence

* test: DecodeGroupMember

* test: add license header
2026-04-17 17:48:57 +00:00
Hugo Shakaandrosstimothy 8d94614699 Introduce metrics.Registry to pass down registries (#61239)
* Introduce metrics.Registry and use it

* Update lib/metrics/registry.go

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>

* BlackHole -> BlackHoleRegistry

* merge lib/metrics and lib/observability/metrics

* lint

* address noah's feedback

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2025-11-12 21:38:47 +00:00
Hugo Shaka adb674b3e0 Add entra ID metrics (#60537)
* Add entra ID metrics

This commit adds metrics for entra ID sync. This is the OSS part, it
contains the msgraph client metrics.

As many different parts of Teleport are using the msgraph client and
might not have access to a metric registerer yet, the client gracefully
handles not being given a metric registry. In this case it won't
register its metrics, we don't want to continue polluting the global
metrics registry.

* lint
2025-10-24 15:26:34 +00:00
Steven Martin 74be92adc0 Update msgraph http.Response error message (#59411) 2025-09-22 09:50:37 +00:00
Rafał Cieślak 8d2a37fd56 lib/msgraph: Get token before each retry (#58673)
* Get token before each retry

* Add note about caching to AzureTokenProvider.GetToken
2025-09-17 09:08:58 +00:00
Rafał Cieślak 07ee5ba23c lib/msgraph: Add auth error handling, logging, and Client-Request-Id header (#58661)
* Capture status code in GraphError

* Add comments to GraphError fields

* Parse auth errors returned by AzureTokenProvider

* Update tests to use NewClient

* Add logging to lib/msgraph.Client

* Add client-request-id header

* Fix typos in api/types.ValidateMSGraphEndpoints

* Ignore StatusCode field during unmarshalling

* Check for `authFailedError.RawResponse.Body != nil`

* Move credential verification from e/lib/intune to lib/msgraph

* Remove request logging
2025-09-09 08:48:53 +00:00
Rafał Cieślak 12463985c1 Add variadic opts and managed device methods to lib/msgraph.Client (#58398)
* Add variadic opts to lib/msgraph.Client.iterate

* Add IterateManagedDevicePages

* Add GetManagedDevice to lib/msgraph.Client

* Copy all header values
2025-09-05 09:56:00 +00:00
Sakshyam Shah b09f4887be adds user's transitiveMemberOf group lister to lib/msgraph (#58095)
* set and validate default graph endpoint

* add IterateUsersTransitiveMemberOf method to list user groups

* run make fix-imports

* fix: return on group type error:
- updates test
2025-08-22 01:55:29 +00:00
Zac Bergquist a12def583a Apply remaining modernize changes. (#56037)
This is the last of this series of updates.
2025-06-25 21:25:29 +00:00
rosstimothy 2cced62805 Fix violations of non-constant format strings linter (#51812)
Depends on https://github.com/gravitational/teleport.e/pull/6006.
Now that we are compliant, the ignore rule was removed from the
golangci-lint config to prevent future regressions.
2025-02-04 16:43:35 +00:00
Matt Brock b22f342680 Azure integration command (#47541)
* Initial command to create the managed identity and role

* Adding permissions and applying command params

* Adding graph permissions to the MSI

* Updating parameters

* Adding some details and cleaning up comments

* Fixing go.sum

* Linting

* License

* PR feedback

* Decoupling sync config with an interface for testing

* Tweaks to test mocking

* PR feedback

* Rebase adjustments

* PR feedback

* Switch to empty struct maps instead of bool maps for set representation

* Godocs

* Adding user agent to Azure SDK requests

* Linting
2025-01-16 17:43:20 +00:00
Tiago Silva 9379fb7a71 [entraid] Expose Application OptionalClaims and Groups AD settings (#48737)
* [entraid] Expose Application `OptionalClaims` and Groups AD settings

This PR exposes Entra ID settings for `OptionalClaims` where applications store the info regarding how the group claim is mapped to SAML properties.

It also exposes the GroupID settings:

- `onPremisesDomainName`
- `onPremisesNetBiosName`
- `onPremisesSamAccountName`

That will be later used compute group claims with the Teleport SAML connector.

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>

* handle code review comments

---------

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2024-11-11 15:01:45 +00:00
Justinas Stankevičius c5a5f8e7a2 Replace MS Graph SDK with an in-house client (#44069)
* Add MS Graph client skeleton

* Complete retry logic

* Add GetID() to GroupMember

* Parse MS Graph API error responses

* Pull out page size into config

* Add missing "patch" methods to client interface

* Move code around

* Factor out roundtrip()

* Fill out remaining methods

* Add godocs and solve lints

* Run gci

* Move godocs to the interface

* Add missing method

* Finish errors_test

* close body in test

* nit

* Add license headers

* Move azureoidc onboarding code to msgraph.Client

* Make AzureTokenProvider public

* Use cmp.Or to shorten config defaults handling

* Address review nits

* Parallelize tests

* nit

* Respect context cancellation in retry logic

* Utilize BlockUntil in tests

* Remove Client interface, make client struct public

* Prefer defaults.HTTPClient to http.DefaultClient

* Iterate entra apps, do not buffer all in memory

* nit

* Set additional timeouts on default HTTP client

* Escape path segments when constructing URLs

* Add a general timeout for default HTTP client
2024-07-17 15:51:39 +00:00