mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-05 19:08:03 +02:00
zero/api: reset token and url cache if 401 is received (#5256)
zero/api: reset token cache if 401 is received
This commit is contained in:
parent
a04d1a450c
commit
ce12e51cf5
8 changed files with 91 additions and 32 deletions
|
@ -63,7 +63,7 @@ func NewAPI(ctx context.Context, opts ...Option) (*API, error) {
|
|||
|
||||
tokenCache := token_api.NewCache(fetcher, cfg.apiToken)
|
||||
|
||||
clusterClient, err := cluster_api.NewAuthorizedClient(cfg.clusterAPIEndpoint, tokenCache.GetToken, cfg.httpClient)
|
||||
clusterClient, err := cluster_api.NewAuthorizedClient(cfg.clusterAPIEndpoint, tokenCache, cfg.httpClient)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating cluster client: %w", err)
|
||||
}
|
||||
|
@ -104,14 +104,14 @@ func (api *API) Watch(ctx context.Context, opts ...WatchOption) error {
|
|||
|
||||
// GetClusterBootstrapConfig fetches the bootstrap configuration from the cluster API
|
||||
func (api *API) GetClusterBootstrapConfig(ctx context.Context) (*cluster_api.BootstrapConfig, error) {
|
||||
return apierror.CheckResponse[cluster_api.BootstrapConfig](
|
||||
return apierror.CheckResponse(
|
||||
api.cluster.GetClusterBootstrapConfigWithResponse(ctx),
|
||||
)
|
||||
}
|
||||
|
||||
// GetClusterResourceBundles fetches the resource bundles from the cluster API
|
||||
func (api *API) GetClusterResourceBundles(ctx context.Context) (*cluster_api.GetBundlesResponse, error) {
|
||||
return apierror.CheckResponse[cluster_api.GetBundlesResponse](
|
||||
return apierror.CheckResponse(
|
||||
api.cluster.GetClusterResourceBundlesWithResponse(ctx),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue