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
015/**
016 * Represents a parsed <l>WWW-Authenticate </l> HTTP response header.
017 * 
018 * <p>
019 * Indicates the authentication scheme that should be used to access the requested entity.
020 * 
021 * <h5 class='figure'>Example</h5>
022 * <p class='bcode'>
023 *    WWW-Authenticate: Basic
024 * </p>
025 * 
026 * <h5 class='topic'>RFC2616 Specification</h5>
027 * 
028 * The WWW-Authenticate response-header field MUST be included in 401 (Unauthorized) response messages.
029 * The field value consists of at least one challenge that indicates the authentication scheme(s) and parameters
030 * applicable to the Request-URI.
031 * 
032 * <p class='bcode'>
033 *    WWW-Authenticate  = "WWW-Authenticate" ":" 1#challenge
034 * </p>
035 * 
036 * <p>
037 * The HTTP access authentication process is described in "HTTP Authentication: Basic and Digest Access Authentication".
038 * User agents are advised to take special care in parsing the WWW-Authenticate field value as it might contain more
039 * than one challenge, or if more than one WWW-Authenticate header field is provided, the contents of a challenge
040 * itself can contain a comma-separated list of authentication parameters.
041 * 
042 * <h5 class='section'>See Also:</h5>
043 * <ul class='doctree'>
044 *    <li class='extlink'><a class='doclink' href='https://www.w3.org/Protocols/rfc2616/rfc2616.html'>Hypertext Transfer Protocol -- HTTP/1.1</a>
045 * </ul>
046 */
047public final class WwwAuthenticate extends HeaderString {
048
049   /**
050    * Returns a parsed <code>WWW-Authenticate</code> header.
051    * 
052    * @param value The <code>WWW-Authenticate</code> header string.
053    * @return The parsed <code>WWW-Authenticate</code> header, or <jk>null</jk> if the string was null.
054    */
055   public static WwwAuthenticate forString(String value) {
056      if (value == null)
057         return null;
058      return new WwwAuthenticate(value);
059   }
060
061   private WwwAuthenticate(String value) {
062      super(value);
063   }
064}