LazyStack generates the application {appName}ClientSDK library project and the {appName}Schema library project. You use these libraries, along with the LazyStackAuth library, in your client application to make secure calls against your AWS Application Stack. Consider the following diagram of the PetStore application.

  • LazyStackAuth

    The AWS Cognito Authentication libraries are rather involved and require a substantial time investment to master. They are also 100% AWS specific and do not attempt to present a generalized process. On the other hand, these Cognito libraries are robust and implement a well known challenge/response pattern. The LazyStackAuth library wraps the AWS Cognito authentication libraries with a fully generalized challenge/response model that provides for the implementation of other authentication providers or for extensions to the the Cognito authentication process.

    The LazyStackAuth project is available as a NuGet package, a LazyStack template project and as a MIT licensed source project in the LazyStackLibs GitHub repository. It provides a generalized challenge/response based user management library that uses the Amazon.Extension.CognitoAuthentication library to make calls against the Cognito authentication service. Note that it also calls AWS STS to get temporary credentials if necessary.

    The LazyStackAuth authentication classes require configuration to reach the AWS Application Stack. This configuration is provided in the AwsSettings.json file described below. The "AwsSettings.json" file is usually included as an embedded resource in the client app and read into the applications IConfiguration appConfig. This appConfig is passed into the LazyStackAuth AuthProcess class constructor so that AuthProcess has the necessary information to connect to your AWS Application Stack.

    After authenticating against Cognito, your client application uses the LazyStackAuth LzHttpClient class to make secure calls against AWS ApiGateways. This class uses configuration information from AwsSettings.json along with configuration information in the "MethodMap.json" configuration file provided in the ClientSDK.

    The "MethodMap.json" file is an embedded resource in the ClientSDK. Like "AwsSettings.json", this resource is generally loaded into the applications IConfiguration appConfig. This appConfig reference is passed into the LzHttpClient constructor. The LazyStack generated file "MethodMap.json" contains a map of methods to ApiGateways that LzHttpClient uses to discover which ApiGateway services each method.

  • PetStoreClientSDK

    The PetStoreClientSDK is comprised of two files. The ClientSDK library class (PetStore.cs) generated by NSwag and the MethodMap.json file generated by LazyStack. PetStore.cs contains methods that make calls to your ApiGateway endpoints. The PetStore class constructor is passed a reference to an instance of the LzHttpClient class so that calls against the PetStore.cs class can be securely made against one or more AWS ApiGateways.

    Note:There are a variety of OpenApi → C# code generators available. Some of these offer substantially more features than the current version of NSwag. However, NSwag is native C#, very robust and under active development so we have chosen to use it.

  • PetStoreSchema

    The PetStoreSchema project is a library of data schema types that are used to transport data among the client and server. This library is used on both the client and server. LazyStack uses NSwag to generate this library.

  • Note:Users familiar with NSwag know that NSWag generates separate schema classes for the client and server code. LazyStack extracts the Schema class from the NSwag generated client library into a single separate project for use in both client and server code. This makes writing dependent libraries that can be references by both client and server code simple.

  • AwsSettings

    The AwsSettings.json file contains the configuration values necessary to configure the client to use the AWS application stack. It is normally an embedded resource in the client application. LazyStack generates the AwsSettings.json file for you. There are separate versions of the AwsSettings.json file for each stack environment. For instance you might have separate stacks for Dev, Test and Prod. Each of these will have their own AwsSettings.json file. See the AwsSettings for instructions on how to generate AwsSettings.json files.