mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 16:59:22 +02:00
k8s: add flush-credentials command (#2379)
* k8s: add flush-credentials command * Update cmd/pomerium-cli/kubernetes.go Co-authored-by: Travis Groth <travisgroth@users.noreply.github.com> Co-authored-by: Travis Groth <travisgroth@users.noreply.github.com>
This commit is contained in:
parent
8a74fae2e7
commit
8be71800c4
2 changed files with 33 additions and 0 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
@ -36,6 +37,25 @@ func cachedCredentialPath(serverURL string) string {
|
|||
return filepath.Join(cachePath(), id+".json")
|
||||
}
|
||||
|
||||
func clearAllCachedCredentials() {
|
||||
_ = filepath.Walk(cachePath(), func(p string, fi fs.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if fi.IsDir() {
|
||||
return nil
|
||||
}
|
||||
|
||||
return os.Remove(p)
|
||||
})
|
||||
}
|
||||
|
||||
func clearCachedCredential(serverURL string) {
|
||||
fn := cachedCredentialPath(serverURL)
|
||||
_ = os.Remove(fn)
|
||||
}
|
||||
|
||||
func loadCachedCredential(serverURL string) *ExecCredential {
|
||||
fn := cachedCredentialPath(serverURL)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue