MCPcopy
hub / github.com/cloudflare/cloudflared / getTokenIfExists

Function getTokenIfExists

token/token.go:516–526  ·  view source on GitHub ↗

GetTokenIfExists will return the token from local storage if it exists and not expired

(path string)

Source from the content-addressed store, hash-verified

514
515// GetTokenIfExists will return the token from local storage if it exists and not expired
516func getTokenIfExists(path string) (*jose.JSONWebSignature, error) {
517 content, err := os.ReadFile(path) // nolint: gosec
518 if err != nil {
519 return nil, err
520 }
521 token, err := jose.ParseSigned(string(content), signatureAlgs)
522 if err != nil {
523 return nil, err
524 }
525 return token, nil
526}
527
528// RemoveTokenIfExists removes the a token from local storage if it exists
529func RemoveTokenIfExists(appInfo *AppInfo) error {

Callers 2

GetOrgTokenIfExistsFunction · 0.85
GetAppTokenIfExistsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected