/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @author Vivek Pandey
*/
//can user.home value be null?
public static final String defaultAuthfile = System.getProperty("user.home")+ System.getProperty("file.separator")+".metro"+System.getProperty("file.separator")+"auth";
private boolean giveError;
public DefaultAuthenticator(@NotNull ErrorReceiver receiver, @NotNull File authfile) throws BadCommandLineException {
this.errReceiver = receiver;
this.giveError = true;
}
try {
error(new SAXParseException(WscompileMessages.WSIMPORT_AUTH_FILE_NOT_FOUND(authFile.getCanonicalPath(), defaultAuthfile), null));
} catch (IOException e) {
error(new SAXParseException(WscompileMessages.WSIMPORT_FAILED_TO_PARSE(authFile,e.getMessage()), null));
}
return;
}
error(new SAXParseException("Authorization file: "+authFile + " does not have read permission!", null));
return;
}
parseAuth();
}
//If user sets proxy user and passwd and the RequestType is from proxy server then create
// PasswordAuthentication using proxyUser and proxyClass;
}
}
}
return null;
}
private void parseAuth() {
errReceiver.info(new SAXParseException(WscompileMessages.WSIMPORT_READING_AUTH_FILE(authFile), null));
try {
} catch (UnsupportedEncodingException e) {
return;
} catch (FileNotFoundException e) {
error(new SAXParseException(WscompileMessages.WSIMPORT_AUTH_FILE_NOT_FOUND(authFile, defaultAuthfile), null, e));
return;
}
try {
int lineno = 1;
try {
if (i >= 0) {
} else {
}
} else {
}
} catch (NumberFormatException e) {
}
}
} catch (IOException e) {
error(new SAXParseException(WscompileMessages.WSIMPORT_FAILED_TO_PARSE(authFile,e.getMessage()), locator));
}
}
/**
* When user provides authfile explicitly using -Xauthfile we throw error otherwise show the mesage by default with -Xdebug flag
*/
if(giveError){
errReceiver.error(e);
} else{
errReceiver.debug(e);
}
}
}