import { BackstageCredentials, BackstageNonePrincipal, BackstageServicePrincipal, BackstageUserPrincipal } from '@backstage/backend-plugin-api'; export declare const DEFAULT_MOCK_USER_ENTITY_REF = "user:default/mock"; export declare const DEFAULT_MOCK_SERVICE_SUBJECT = "external:test-service"; export declare const MOCK_AUTH_COOKIE = "backstage-auth"; export declare const MOCK_NONE_TOKEN = "mock-none-token"; export declare const MOCK_USER_TOKEN = "mock-user-token"; export declare const MOCK_USER_TOKEN_PREFIX = "mock-user-token:"; export declare const MOCK_INVALID_USER_TOKEN = "mock-invalid-user-token"; export declare const MOCK_USER_LIMITED_TOKEN_PREFIX = "mock-limited-user-token:"; export declare const MOCK_INVALID_USER_LIMITED_TOKEN = "mock-invalid-limited-user-token"; export declare const MOCK_SERVICE_TOKEN = "mock-service-token"; export declare const MOCK_SERVICE_TOKEN_PREFIX = "mock-service-token:"; export declare const MOCK_INVALID_SERVICE_TOKEN = "mock-invalid-service-token"; /** * @public */ export declare namespace mockCredentials { /** * Creates a mocked credentials object for a unauthenticated principal. */ function none(): BackstageCredentials; /** * Utilities related to none credentials. */ namespace none { /** * Returns an authorization header that translates to unauthenticated * credentials. * * This is useful when one wants to explicitly test unauthenticated requests * while still using the default behavior of the mock HttpAuthService where * it defaults to user credentials. */ function header(): string; } /** * Creates a mocked credentials object for a user principal. * * The default user entity reference is 'user:default/mock'. */ function user(userEntityRef?: string): BackstageCredentials; /** * Utilities related to user credentials. */ namespace user { /** * Creates a mocked user token. If a payload is provided it will be encoded * into the token and forwarded to the credentials object when authenticated * by the mock auth service. */ function token(userEntityRef?: string): string; /** * Returns an authorization header with a mocked user token. If a payload is * provided it will be encoded into the token and forwarded to the * credentials object when authenticated by the mock auth service. */ function header(userEntityRef?: string): string; function invalidToken(): string; function invalidHeader(): string; } /** * Creates a mocked credentials object for a user principal with limited * access. * * The default user entity reference is 'user:default/mock'. */ function limitedUser(userEntityRef?: string): BackstageCredentials; /** * Utilities related to limited user credentials. */ namespace limitedUser { /** * Creates a mocked limited user token. If a payload is provided it will be * encoded into the token and forwarded to the credentials object when * authenticated by the mock auth service. */ function token(userEntityRef?: string): string; /** * Returns an authorization header with a mocked limited user token. If a * payload is provided it will be encoded into the token and forwarded to * the credentials object when authenticated by the mock auth service. */ function cookie(userEntityRef?: string): string; function invalidToken(): string; function invalidCookie(): string; } /** * Creates a mocked credentials object for a service principal. * * The default subject is 'external:test-service'. */ function service(subject?: string): BackstageCredentials; /** * Utilities related to service credentials. */ namespace service { /** * Options for the creation of mock service tokens. */ type TokenOptions = { onBehalfOf: BackstageCredentials; targetPluginId: string; }; /** * Creates a mocked service token. The provided options will be encoded into * the token and forwarded to the credentials object when authenticated by * the mock auth service. */ function token(options?: TokenOptions): string; /** * Returns an authorization header with a mocked service token. The provided * options will be encoded into the token and forwarded to the credentials * object when authenticated by the mock auth service. */ function header(options?: TokenOptions): string; function invalidToken(): string; function invalidHeader(): string; } }