Dex TypeScript SDK 1.28.1
    Preparing search index...

    Class FileCredential

    Reads a bearer token from a rotating file.

    Construction reads the file immediately. Calls check its modification time and size at most once per second and reread when either changes. Surrounding whitespace is ignored. An empty or unreadable file fails calls until a later check succeeds; no stale token is sent.

    const credential = new FileCredential("/var/run/secrets/dex/token");
    const client = new Client(registry, cache, { credential });
    const worker = new Worker(registry, cache, { credential, pull: {} });

    Implements

    Index

    Constructors

    Methods

    Constructors

    • Reads the initial token from path.

      Parameters

      • path: string

        Path to the bearer token file.

      Returns FileCredential

      When the file cannot be read or contains only whitespace.

    Methods

    • Returns the cached token after any due file check. A changed file is reloaded on the next check, at most one second after the previous check.

      Returns string

      The current token without surrounding whitespace.

      When the file has become unreadable or empty.