Skip to main content

Create Server Auth

Sets up authentication for the .NET server.

Event Name

CreateServerAuth

Event Params

export interface CreateServerAuthParams extends EventParams {}

This event does not use any additional parameters.

Example

afterCreateServerAuth(
context: dotnetTypes.DsgContext,
eventParams: dotnet.CreateServerAuthParams,
files: FileMap<Class>
): Promise<FileMap<Class>> {
const authFile = files.get("Auth/AuthService.cs");
if (authFile) {
authFile.code.addMethod(
CsharpSupport.method({
name: "ValidateToken",
access: "public",
returnType: CsharpSupport.Types.boolean(),
parameters: [
CsharpSupport.parameter({
name: "token",
type: CsharpSupport.Types.string(),
}),
],
body: "// Add token validation logic here\nreturn true;",
})
);
}
return files;
}