Migrate TokenManager types

Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Johan Haals
2023-01-04 11:47:35 +01:00
parent d2a1fcdf09
commit 38dda2beab
5 changed files with 40 additions and 36 deletions
@@ -14,7 +14,26 @@
* limitations under the License.
*/
import { TokenManager } from '@backstage/backend-common';
/**
* Interface for creating and validating tokens.
*
* @public
*/
export interface TokenManagerService {
/**
* Fetches a valid token.
*
* @remarks
*
* Tokens are valid for roughly one hour; the actual deadline is set in the
* payload `exp` claim. Never hold on to tokens for reuse; always ask for a
* new one for each outgoing request. This ensures that you always get a
* valid, fresh one.
*/
getToken(): Promise<{ token: string }>;
/** @public */
export interface TokenManagerService extends TokenManager {}
/**
* Validates a given token.
*/
authenticate(token: string): Promise<void>;
}