if (authenticator != null) {
// This is temporary workaround for a Grizzly issue that prohibits uploading (deploy) files larger than 2MB when secure admin is enabled.
// The workaround will not be required in trunk when the corresponding Grizzly issue is fixed.
// 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;