Validates local account passwords against length and character diversity requirements. Use when implementing user registration and authentication security.
// Source: https://github.com/iflytek/skillhub | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package com.iflytek.skillhub.auth.local;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Component;
/**
* Validates local-account passwords against the platform's length and character diversity rules.
*/
@Component
public class PasswordPolicyValidator {
private static final int MIN_LENGTH = 8;
private static final int MAX_LENGTH = 128;
private static final int MIN_CHAR_TYPES = 3;
public List<String> validate(String password) {
List<String> errors = new ArrayList<>();
if (password == null || password.length() <
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key