vt-middleware / passay

Password policy enforcement for Java.
http://www.passay.org
Other
275 stars 63 forks source link

Add method to generate explanation text #137

Closed GregJohnStewart closed 1 year ago

GregJohnStewart commented 1 year ago

I'm currently trying to setup my front-end form to display help text to tell the user up front all the password requirements to set.

I'm building it like this:

    public static String getPasswordRulesDescriptionHtml(){
        List<? extends Rule> rules = VALIDATOR.getRules();
        StringBuilder sb = new StringBuilder("Password requirements: <br />\n<ul>\n");

        for (Rule curRule : rules){
            sb.append("\t<li>");

            sb.append(curRule.toString()); // not a great representation

            sb.append("\t</li>\n");
        }

        sb.append("</ul>");

        return sb.toString();
    }

It would be great to have a new method on Roles to describe themselves in plaintext/ plain language, to make it easier to generate such help text.

dfish3r commented 1 year ago

These type of String representation of objects are generally left for the client to implement. Whether you want to produce JSON, XML or HTML that isn't code we want to maintain as part of this library. It's also unlikely we'd get to one size fits all language surrounding many of these rules. People tend to want to use their own language to describe many of these concepts.

dfish3r commented 1 year ago

No response from reporter, feel free to reopen.