2728N/A/*
2728N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2728N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2728N/A *
2728N/A * This code is free software; you can redistribute it and/or modify it
2728N/A * under the terms of the GNU General Public License version 2 only, as
2728N/A * published by the Free Software Foundation. Oracle designates this
2728N/A * particular file as subject to the "Classpath" exception as provided
2728N/A * by Oracle in the LICENSE file that accompanied this code.
2728N/A *
2728N/A * This code is distributed in the hope that it will be useful, but WITHOUT
2728N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2728N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2728N/A * version 2 for more details (a copy is included in the LICENSE file that
2728N/A * accompanied this code).
2728N/A *
2728N/A * You should have received a copy of the GNU General Public License version
2728N/A * 2 along with this work; if not, write to the Free Software Foundation,
2728N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2728N/A *
2728N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2728N/A * or visit www.oracle.com if you need additional information or have any
2728N/A * questions.
2728N/A */
2728N/A
2728N/Apackage com.sun.security.ntlm;
2728N/A
2728N/Aimport java.security.GeneralSecurityException;
2728N/A
2728N/A/**
2728N/A * An NTLM-related Exception
2728N/A */
2728N/Apublic final class NTLMException extends GeneralSecurityException {
2728N/A
2728N/A /**
2728N/A * If the incoming packet is invalid.
2728N/A */
2728N/A public final static int PACKET_READ_ERROR = 1;
2728N/A
2728N/A /**
2728N/A * If the client cannot get a domain value from the server and the
2728N/A * caller has not provided one.
2728N/A */
2728N/A public final static int NO_DOMAIN_INFO = 2;
2728N/A
2728N/A /**
2728N/A * If the domain provided by the client does not match the one received
2728N/A * from server.
2728N/A */
2728N/A //public final static int DOMAIN_UNMATCH = 3;
2728N/A
2728N/A /**
2728N/A * If the client name is not found on server's user database.
2728N/A */
2728N/A public final static int USER_UNKNOWN = 3;
2728N/A
2728N/A /**
2728N/A * If authentication fails.
2728N/A */
2728N/A public final static int AUTH_FAILED = 4;
2728N/A
2728N/A /**
2728N/A * If an illegal version string is provided.
2728N/A */
2728N/A public final static int BAD_VERSION = 5;
2728N/A
4357N/A /**
4357N/A * Protocol errors.
4357N/A */
4357N/A public final static int PROTOCOL = 6;
4357N/A
2728N/A private int errorCode;
2728N/A
2728N/A /**
2728N/A * Constructs an NTLMException object.
2728N/A * @param errorCode the error code, which can be retrieved by
2728N/A * the {@link #errorCode() } method.
2728N/A * @param msg the string message, which can be retrived by
2728N/A * the {@link Exception#getMessage() } method.
2728N/A */
2728N/A public NTLMException(int errorCode, String msg) {
2728N/A super(msg);
2728N/A this.errorCode = errorCode;
2728N/A }
2728N/A
2728N/A /**
2728N/A * Returns the error code associated with this NTLMException.
2728N/A * @return the error code
2728N/A */
2728N/A public int errorCode() {
2728N/A return errorCode;
2728N/A }
2728N/A}