this.doAsSubject = doAsSubject != null ? doAsSubject :
Subject.getSubject(AccessController.getContext());
if (permsToRunWith != null) {
this.permsToRunWith = permsToRunWith;
} else {
AuthenticationPermission authPerm;
if (serverPrincipal != null) {
authPerm = new AuthenticationPermission(
Collections.singleton(serverPrincipal), null,
"listen");
} else {
authPerm = new AuthenticationPermission(
"javax.security.auth.kerberos.KerberosPrincipal \"*\"",
"listen");
}
this.permsToRunWith = new Permission[] {
new AuthPermission("doAs"),