001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.http;
014
015import org.apache.juneau.http.annotation.*;
016
017/**
018 * Represents a parsed <l>WWW-Authenticate </l> HTTP response header.
019 *
020 * <p>
021 * Indicates the authentication scheme that should be used to access the requested entity.
022 *
023 * <h5 class='figure'>Example</h5>
024 * <p class='bcode w800'>
025 *    WWW-Authenticate: Basic
026 * </p>
027 *
028 * <h5 class='topic'>RFC2616 Specification</h5>
029 *
030 * The WWW-Authenticate response-header field MUST be included in 401 (Unauthorized) response messages.
031 * The field value consists of at least one challenge that indicates the authentication scheme(s) and parameters
032 * applicable to the Request-URI.
033 *
034 * <p class='bcode w800'>
035 *    WWW-Authenticate  = "WWW-Authenticate" ":" 1#challenge
036 * </p>
037 *
038 * <p>
039 * The HTTP access authentication process is described in "HTTP Authentication: Basic and Digest Access Authentication".
040 * User agents are advised to take special care in parsing the WWW-Authenticate field value as it might contain more
041 * than one challenge, or if more than one WWW-Authenticate header field is provided, the contents of a challenge
042 * itself can contain a comma-separated list of authentication parameters.
043 *
044 * <h5 class='section'>See Also:</h5>
045 * <ul class='doctree'>
046 *    <li class='extlink'>{@doc RFC2616}
047 * </ul>
048 */
049@Header("WWW-Authenticate")
050public final class WwwAuthenticate extends HeaderString {
051
052   /**
053    * Returns a parsed <code>WWW-Authenticate</code> header.
054    *
055    * @param value The <code>WWW-Authenticate</code> header string.
056    * @return The parsed <code>WWW-Authenticate</code> header, or <jk>null</jk> if the string was null.
057    */
058   public static WwwAuthenticate forString(String value) {
059      if (value == null)
060         return null;
061      return new WwwAuthenticate(value);
062   }
063
064   private WwwAuthenticate(String value) {
065      super(value);
066   }
067}