8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the Common Development and Distribution License
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (the License). You may not use this file except in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * compliance with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the License at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If applicable, add the following below the CDDL Header,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with the fields enclosed by brackets [] replaced by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * your own identifying information:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * $Id: HttpCallback.java,v 1.4 2009/07/28 19:40:45 beomsuk Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <code>HttpCallback</code> class implements <code>Callback</code>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * and is used by the authentication module with HTTP protocol based
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * handshaking negotiation.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @supported.all.api
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpublic class HttpCallback implements Callback, Serializable {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private int errorCode = HttpServletResponse.SC_UNAUTHORIZED;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static final String HTTP_NEGOTIATE = "Negotiate";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static final String HTTP_HTTPBASIC = "BASIC realm=\"basic_realm\"";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Creates a <code>HttpCallback</code> object.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param authorizationHeader Header name for the authorization string.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param negotiationHeader Negotiation header string.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param errorCode Error code set in the header for negotiation.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster } catch (Exception e) {}
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster this.negoHeader = negotiationHeader.substring(0, index);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster this.negoValue = negotiationHeader.substring(index+1);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Creates a <code>HttpCallback</code> object.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The negotiation header is constructed using the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * negotiation name and value in the format
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <code>negoName:negoValue</code>.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param authRHeader Header name for the authorization string.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param negoName Negotiation name in the negotiation header.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param negoValue Negotiation value in the negotiation header.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param errorCode Error code set in the header for negotiation.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the authorization header string.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return the authorization header string.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the negotiation header name.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return the negotiation header name.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the negotiation header value.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return the negotiation header value.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the negotiation error code.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return the negotiation error code.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the authorization string.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return the authorization string.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Set the authorization string to a <code>HttpCallback</code> object.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param authorization
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void setAuthorization(String authorization) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns <code>true<code> if the callback is for HTTPBasic.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ? negoValue.equalsIgnoreCase(HTTP_HTTPBASIC) : false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns <code>true<code> if the callback is for WindowsDesktopSSO.