Conversation
types/defines/access.d.ts
Outdated
| * Represents the identity of a user authenticated via Cloudflare Access. | ||
| * This matches the result of calling /cdn-cgi/access/get-identity. | ||
| */ | ||
| type Identity = object; |
There was a problem hiding this comment.
Would like to get the team's thoughts on this name. I am unfamiliar with how these types get injected into user's projects (afaiu, Env gets added globally automatically), so maybe a more descriptive name works better than Identity? Perhaps something like CfAccessIdentity?
There was a problem hiding this comment.
Yeah a more specific name would be appropriate but we should also actually give it a type that represents what it can contain
There was a problem hiding this comment.
A specific type here is difficult because this type is mostly what the customer sends us from their identity provider. A full type would likely look something like
type CloudflareAccessIdentity = {
email?: string;
[key: string]: unknown;
}At which point I feel like typing it gives no real benefit over object
petebacondarwin
left a comment
There was a problem hiding this comment.
AccessContext and Identity are quite general types being defined as top level ambient types. This could cause conflicts in the future: I could imagine Identity could be used in a number of scenarios.
Perhaps prefix them with something like CloudflareAccessContext, etc?
|
All contributors have signed the CLA ✍️ ✅ |
Signed-off-by: Matt Provost <mprovost@cloudflare.com>
Signed-off-by: Matt Provost <mprovost@cloudflare.com>
0551908 to
811e3b5
Compare
|
I have read the CLA Document and I hereby sign the CLA |
Adds types for Cloudflare Access integration into Workers