Skip to content

Cognito features

0

question 1

we use cognito for identity management

we have a UI and API that we provide to customers

how can we enforce password complexity like not allowing "Password123" as a password or "Aa123456"

Is there a way to dictionary block certain passwords from AWS cognito side

We have password complexity rules like uppercase, lowercase, numbers, min length, but all these rules do not stop something like 0123456789Aa

how to resolve?

question 2

for the same scenario can we prevent passwords that have been used before?

how to directly from cognito

question 3

do you support session timeout in 15 mins? if not how do you recommend for API and UI users with cognito being used

AWS

asked a year ago277 views

2 Answers
5

Question 1: Blocking Weak or Dictionary Passwords Cognito does not natively support dictionary-based password blocking (e.g., rejecting "Password123" or "Aa123456"). The built-in password policy only allows you to enforce: • Minimum length • Uppercase/lowercase letters • Numbers • Special characters To block specific patterns or dictionary words: Suggestion • Implement a custom password validation layer in your UI or API before calling Cognito’s SignUp or ChangePassword APIs. • Use libraries like zxcvbn to score password strength and reject weak ones. • Maintain a list of banned passwords or patterns and check against it.

Question 2: Preventing Password Reuse Cognito now supports password reuse prevention as part of its Advanced Security Features.:

  1. Go to your User Pool in the Cognito console.
  2. Navigate to Sign-in experience > Password policy.
  3. Enable “Prevent use of previous passwords” and set how many previous passwords to remember (up to 24).
  4. Save changes.

Question 3: Enforcing Session Timeout (15 Minutes) Cognito does not support idle session timeout directly (like auto-logout after 15 minutes of inactivity). Token expiration is based on: • Access token: default 1 hour • ID token: default 1 hour • Refresh token: configurable (up to 10 years) Suggestion To simulate a 15-minute timeout: • In your UI, implement an idle timer that: o Tracks user activity (mouse, keyboard, etc.) o Calls Cognito’s GlobalSignOut or revokes tokens via API when idle o Redirects to login page • For API, enforce token expiration by: o Validating token age on each request o Rejecting requests if token is older than 15 minutes o Optionally, use short-lived access tokens and avoid automatic refresh

EXPERT

answered a year ago

0

Hey,

Hope you're keeping well.

Cognito’s built-in password policy can enforce length, character types, and special characters, but it doesn’t support dictionary-based blocking. To reject passwords like “Password123” or specific patterns, you’ll need to add validation in your application layer before calling Cognito’s SignUp or ChangePassword APIs, possibly using a library such as zxcvbn and a custom banned list. For password reuse prevention, Cognito supports this in User Pool settings under Sign-in experience > Password policy where you can set how many previous passwords to disallow.

Thanks and regards,
Taz

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.