- Newest
- Most votes
- Most comments
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.:
- Go to your User Pool in the Cognito console.
- Navigate to Sign-in experience > Password policy.
- Enable “Prevent use of previous passwords” and set how many previous passwords to remember (up to 24).
- 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
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
Relevant content
asked 6 years ago
