Properly export CloudflareAccessClaims and CloudflareAccessIdentityProfile types

This allows these types to be used externally when injecting a custom auth handler.

Signed-off-by: Renlord Yang <me@renlord.com>
This commit is contained in:
Renlord Yang
2022-07-16 11:09:29 +08:00
parent abc1d5c7a4
commit 154544f43e
4 changed files with 76 additions and 12 deletions
+28 -7
View File
@@ -171,8 +171,34 @@ export class CatalogIdentityClient {
resolveCatalogMembership(query: MemberClaimQuery): Promise<string[]>;
}
// Warning: (ae-missing-release-tag) "CloudflareAccessResult" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export type CloudflareAccessClaims = {
aud: string[];
email: string;
exp: number;
iat: number;
nonce: string;
identity_nonce: string;
sub: string;
iss: string;
custom: string;
};
// @public
export type CloudflareAccessGroup = {
id: string;
name: string;
email: string;
};
// @public
export type CloudflareAccessIdentityProfile = {
id: string;
name: string;
email: string;
groups: CloudflareAccessGroup[];
};
// @public (undocumented)
export type CloudflareAccessResult = {
claims: CloudflareAccessClaims;
@@ -740,9 +766,4 @@ export type WebMessageResponse =
type: 'authorization_response';
error: Error;
};
// Warnings were encountered during analysis:
//
// src/providers/cloudflare-access/provider.d.ts:77:5 - (ae-forgotten-export) The symbol "CloudflareAccessClaims" needs to be exported by the entry point index.d.ts
// src/providers/cloudflare-access/provider.d.ts:78:5 - (ae-forgotten-export) The symbol "CloudflareAccessIdentityProfile" needs to be exported by the entry point index.d.ts
```
@@ -14,4 +14,9 @@
* limitations under the License.
*/
export { cfAccess } from './provider';
export type { CloudflareAccessResult } from './provider';
export type {
CloudflareAccessClaims,
CloudflareAccessGroup,
CloudflareAccessResult,
CloudflareAccessIdentityProfile,
} from './provider';
@@ -64,7 +64,14 @@ export type Options = {
cache?: CacheClient;
};
/** @public */
/**
* CloudflareAccessClaims
*
* Can be used in externally provided auth handler or sign in resolver to
* enrich user profile for sign-in user entity
*
* @public
*/
export type CloudflareAccessClaims = {
/**
* `aud` identifies the application to which the JWT is issued.
@@ -103,19 +110,45 @@ export type CloudflareAccessClaims = {
custom: string;
};
type CloudflareAccessGroup = {
/**
* CloudflareAccessGroup
*
* @public
*/
export type CloudflareAccessGroup = {
/**
* Group id
*/
id: string;
/**
* Name of group as defined in Cloudflare zero trust dashboard
*/
name: string;
/**
* Access group email address
*/
email: string;
};
type CloudflareAccessIdentityProfile = {
/**
* CloudflareAccessIdentityProfile
*
* Can be used in externally provided auth handler or sign in resolver to
* enrich user profile for sign-in user entity
*
* @public
*/
export type CloudflareAccessIdentityProfile = {
id: string;
name: string;
email: string;
groups: CloudflareAccessGroup[];
};
/**
*
* @public
*/
export type CloudflareAccessResult = {
claims: CloudflareAccessClaims;
cfIdentity: CloudflareAccessIdentityProfile;
+6 -1
View File
@@ -20,7 +20,12 @@ export type {
BitbucketOAuthResult,
BitbucketPassportProfile,
} from './bitbucket';
export type { CloudflareAccessResult } from './cloudflare-access';
export type {
CloudflareAccessClaims,
CloudflareAccessGroup,
CloudflareAccessResult,
CloudflareAccessIdentityProfile,
} from './cloudflare-access';
export type { GithubOAuthResult } from './github';
export type { OAuth2ProxyResult } from './oauth2-proxy';
export type { OidcAuthResult } from './oidc';