// Please see http://java.net/jira/browse/GLASSFISH-16665 for details
// The workaround duplicates code from AdminAdapter.
ServerEnvironment serverEnvironment = habitat.getByContract(ServerEnvironment.class);
final Principal sslPrincipal = !serverEnvironment.isDas() || Boolean.getBoolean(DAS_LOOK_FOR_CERT_PROPERTY_NAME) ? req.getUserPrincipal() : null;
AdminService as = habitat.getByType(AdminService.class);
access = authenticator.loginAsAdmin(user, password, as.getAuthRealmName(), remoteHost, getAuthRelatedHeaders(req), sslPrincipal);
}
return access;
}