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
+1 -1
View File
@@ -3,4 +3,4 @@
'@backstage/backend-common': patch
---
Migrated types related to `CacheService` and `DatabaseService` into backend-plugin-api.
Migrated types related to `TokenManagerService`, `CacheService` and `DatabaseService` into backend-plugin-api.
+5 -7
View File
@@ -51,7 +51,11 @@ import { SearchOptions } from '@backstage/backend-plugin-api';
import { SearchResponse } from '@backstage/backend-plugin-api';
import { SearchResponseFile } from '@backstage/backend-plugin-api';
import { Server } from 'http';
<<<<<<< HEAD
import { TransportStreamOptions } from 'winston-transport';
=======
import { TokenManagerService as TokenManager } from '@backstage/backend-plugin-api';
>>>>>>> 24636656b5 (Migrate TokenManager types)
import { UrlReaderService as UrlReader } from '@backstage/backend-plugin-api';
import { V1PodTemplateSpec } from '@kubernetes/client-node';
import * as winston from 'winston';
@@ -698,13 +702,7 @@ export interface StatusCheckHandlerOptions {
statusCheck?: StatusCheck;
}
// @public
export interface TokenManager {
authenticate(token: string): Promise<void>;
getToken(): Promise<{
token: string;
}>;
}
export { TokenManager };
export { UrlReader };
+1 -23
View File
@@ -14,26 +14,4 @@
* limitations under the License.
*/
/**
* Interface for creating and validating tokens.
*
* @public
*/
export interface TokenManager {
/**
* 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 }>;
/**
* Validates a given token.
*/
authenticate(token: string): Promise<void>;
}
export type { TokenManagerService as TokenManager } from '@backstage/backend-plugin-api';
+11 -2
View File
@@ -12,7 +12,11 @@ import { PluginCacheManager } from '@backstage/backend-common';
import { PluginDatabaseManager } from '@backstage/backend-common';
import { PluginTaskScheduler } from '@backstage/backend-tasks';
import { Readable } from 'stream';
<<<<<<< HEAD
import { TokenManager } from '@backstage/backend-common';
=======
import { TransportStreamOptions } from 'winston-transport';
>>>>>>> 24636656b5 (Migrate TokenManager types)
// @public (undocumented)
export interface BackendFeature {
@@ -323,8 +327,13 @@ export type ServiceRef<
$$ref: 'service';
};
// @public (undocumented)
export interface TokenManagerService extends TokenManager {}
// @public
export interface TokenManagerService {
authenticate(token: string): Promise<void>;
getToken(): Promise<{
token: string;
}>;
}
// @public (undocumented)
export type TypesToServiceRef<T> = {
@@ -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>;
}