Class AuthContext
java.lang.Object
com.google.genkit.plugins.firebase.functions.AuthContext
Authentication context for Firebase Cloud Functions.
Contains information about the authenticated user, including their Firebase Auth token and any custom claims.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty auth context.AuthContext(String token) Creates an auth context with the given token. -
Method Summary
Modifier and TypeMethodDescriptionstatic AuthContext.Builderbuilder()Builder for AuthContext.Gets a specific claim value.getEmail()getToken()getUid()booleanChecks if a claim exists and is truthy.booleanvoidvoidvoidsetEmailVerified(boolean emailVerified) voidvoid
-
Constructor Details
-
AuthContext
public AuthContext()Creates an empty auth context. -
AuthContext
Creates an auth context with the given token.- Parameters:
token- the Firebase Auth token
-
-
Method Details
-
getToken
-
setToken
-
getUid
-
setUid
-
getEmail
-
setEmail
-
isEmailVerified
public boolean isEmailVerified() -
setEmailVerified
public void setEmailVerified(boolean emailVerified) -
getClaims
-
setClaims
-
getClaim
Gets a specific claim value.- Parameters:
name- the claim name- Returns:
- the claim value, or null if not present
-
hasClaim
Checks if a claim exists and is truthy.- Parameters:
name- the claim name- Returns:
- true if the claim exists and is truthy
-
builder
Builder for AuthContext.
-