Book Image

DynamoDB Cookbook

By : Tanmay Deshpande
Book Image

DynamoDB Cookbook

By: Tanmay Deshpande

Overview of this book

Table of Contents (18 chapters)
DynamoDB Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Developing services for the sign-in activity for web applications


In the earlier recipe, we wrote and tested services for user registration. In this recipe, we will implement services for the user sign-in.

Getting ready

To get started with this recipe, you should have performed the earlier recipe.

How to do it…

For this recipe, we will use the same project that we created earlier:

  1. To start with, we use the same user model that we defined in the earlier recipe. As we had encrypted the password during registration, it is very important to use the same client, which was initiated by the encryption provider:

    static AmazonDynamoDBClient client = new AmazonDynamoDBClient(
          new ClasspathPropertiesFileCredentialsProvider());
    static DynamoDBMapper mapper = new DynamoDBMapper(client,
      DynamoDBMapperConfig.DEFAULT, new AttributeEncryptor(
          EncryptorProvider.getProvider()));
    static {
    client.setRegion(Region.getRegion(Regions.US_WEST_2));
    }
  2. Next, we write a method which will fetch the user record...