001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.http.header;
018
019import java.util.function.*;
020
021import org.apache.juneau.http.annotation.*;
022
023/**
024 * Represents a parsed <l> Proxy-Authenticate</l> HTTP response header.
025 *
026 * <p>
027 * Request authentication to access the proxy.
028 *
029 * <h5 class='figure'>Example</h5>
030 * <p class='bcode'>
031 *    Proxy-Authenticate: Basic
032 * </p>
033 *
034 * <h5 class='topic'>RFC2616 Specification</h5>
035 *
036 * The Proxy-Authenticate response-header field MUST be included as part of a 407 (Proxy Authentication Required)
037 * response.
038 * The field value consists of a challenge that indicates the authentication scheme and parameters applicable to the
039 * proxy for this Request-URI.
040 *
041 * <p class='bcode'>
042 *    Proxy-Authenticate  = "Proxy-Authenticate" ":" 1#challenge
043 * </p>
044 *
045 * <p>
046 * The HTTP access authentication process is described in "HTTP Authentication: Basic and Digest Access Authentication".
047 * Unlike WWW-Authenticate, the Proxy-Authenticate header field applies only to the current connection and SHOULD NOT
048 * be passed on to downstream clients.
049 * However, an intermediate proxy might need to obtain its own credentials by requesting them from the downstream
050 * client, which in some circumstances will appear as if the proxy is forwarding the Proxy-Authenticate header field.
051 *
052 * <h5 class='section'>See Also:</h5><ul>
053 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauRestCommonBasics">juneau-rest-common Basics</a>
054 *    <li class='extlink'><a class="doclink" href="https://www.w3.org/Protocols/rfc2616/rfc2616.html">Hypertext Transfer Protocol -- HTTP/1.1</a>
055 * </ul>
056 *
057 * @serial exclude
058 */
059@Header("Proxy-Authenticate")
060public class ProxyAuthenticate extends BasicStringHeader {
061   private static final long serialVersionUID = 1L;
062   private static final String NAME = "Proxy-Authenticate";
063
064   /**
065    * Static creator.
066    *
067    * @param value
068    *    The header value.
069    *    <br>Can be <jk>null</jk>.
070    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
071    */
072   public static ProxyAuthenticate of(String value) {
073      return value == null ? null : new ProxyAuthenticate(value);
074   }
075
076   /**
077    * Static creator with delayed value.
078    *
079    * <p>
080    * Header value is re-evaluated on each call to {@link #getValue()}.
081    *
082    * @param value
083    *    The supplier of the header value.
084    *    <br>Can be <jk>null</jk>.
085    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
086    */
087   public static ProxyAuthenticate of(Supplier<String> value) {
088      return value == null ? null : new ProxyAuthenticate(value);
089   }
090
091   /**
092    * Constructor.
093    *
094    * @param value
095    *    The header value.
096    *    <br>Can be <jk>null</jk>.
097    */
098   public ProxyAuthenticate(String value) {
099      super(NAME, value);
100   }
101
102   /**
103    * Constructor with delayed value.
104    *
105    * <p>
106    * Header value is re-evaluated on each call to {@link #getValue()}.
107    *
108    * @param value
109    *    The supplier of the header value.
110    *    <br>Can be <jk>null</jk>.
111    */
112   public ProxyAuthenticate(Supplier<String> value) {
113      super(NAME, value);
114   }
115}