1 | import { JwtPayload } from 'jsonwebtoken';
|
2 | import { JwtKeyMapping } from './jwt';
|
3 | /**
|
4 | * Mapping between key name in the Tenant and key name in decoded JWT.
|
5 | */
|
6 | export declare const mappingTenantFields: JwtKeyMapping<Tenant, 'zid' | 'zdn'>;
|
7 | /**
|
8 | * Get the tenant id of a decoded JWT.
|
9 | * @param jwtPayload - Token payload to read the tenant id from.
|
10 | * @returns The tenant id, if available.
|
11 | */
|
12 | export declare function tenantId(jwtPayload: JwtPayload): string | undefined;
|
13 | /**
|
14 | * Get the tenant name of a decoded JWT.
|
15 | * @param jwtPayload - Token payload to read the tenant name from.
|
16 | * @returns The tenant name, if available.
|
17 | */
|
18 | export declare function tenantName(jwtPayload: JwtPayload): string | undefined;
|
19 | /**
|
20 | * @deprecated Since v1.46.0. This interface will not be replaced. Use the higher level JWT types directly.
|
21 | * Keys in the JWT related to the tenant.
|
22 | */
|
23 | export interface RegisteredJWTClaimsTenant {
|
24 | zid?: string;
|
25 | zdn?: string;
|
26 | }
|
27 | /**
|
28 | * Representation of the tenant. A tenant represents the customer account on Cloud Foundry.
|
29 | */
|
30 | export interface Tenant {
|
31 | id: string;
|
32 | name?: string;
|
33 | }
|
34 | /**
|
35 | * Creates a tenant object from the JWT payload.
|
36 | * Throws an error if the property `id` is not present in the payload.
|
37 | * @param jwtPayload - Token payload to get the tenant information from.
|
38 | * @returns Representation of the tenant.
|
39 | */
|
40 | export declare function tenantFromJwt(jwtPayload: JwtPayload): Tenant;
|
41 | /**
|
42 | * Compare two decoded JWTs based on their `tenantId`s.
|
43 | * @param userTokenPayload - User JWT payload.
|
44 | * @param providerTokenPayload - Provider JWT payload.
|
45 | * @returns Whether the tenant is identical.
|
46 | */
|
47 | export declare function isIdenticalTenant(userTokenPayload: JwtPayload, providerTokenPayload: JwtPayload): boolean;
|
48 | //# sourceMappingURL=tenant.d.ts.map |
\ | No newline at end of file |