class JaasAuthenticator extends BasicAuthenticator {

    @Override
    public Result authenticate(HttpExchange pHttpExchange) {
        try {
            Result result = super.authenticate(pHttpExchange);
            if (result instanceof Success) {
                Subject subject = subjectThreadLocal.get();
                if (subject != null) {
                    pHttpExchange.setAttribute(ConfigKey.JAAS_SUBJECT_REQUEST_ATTRIBUTE, subject);
                }
            }
            return result;
        } finally {
            subjectThreadLocal.remove();
        }
    }

    public  JaasAuthenticator(String pRealm);

}