@Override
    public boolean login() throws LoginException {
        val nameCallback = new NameCallback("username");
        val passwordCallback = new PasswordCallback("password", false);

        FunctionUtils.doAndHandle(o -> {
            callbackHandler.handle(new Callback[]{nameCallback, passwordCallback});
        }, throwable -> {
            throw new FailedLoginException(throwable.getMessage());
        }).accept(nameCallback);

        val username = nameCallback.getName();
        if (accounts.containsKey(username)) {
            val password = new String(passwordCallback.getPassword());
            this.succeeded = accounts.get(username).equals(password);
            subject.getPrincipals().add(new StaticPrincipal(username));
            return true;
        }
        this.succeeded = false;
        return false;
    }
This is {@link AccountsPreDefinedLoginModule}.

@author Misagh Moayyed
@since 5.3.0
core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/handler/support/jaas/AccountsPreDefinedLoginModule.java