matlab.net.http.field.AuthenticateField class
Package:matlab.net.http.field
Superclasses:matlab.net.http.HeaderField
HTTP WWW-Authenticate or Proxy-Authenticate header field
Description
AnAuthenticateField
object contains one or more challenges from a server asking for authentication information. A server or proxy creates anAuthenticateField
in a response message.
When you send a request message to a server or through a proxy that requires authentication, MATLAB®automatically tries to authenticate to the server or proxy when:
HTTPOptions.Authenticate
property is true (default)HTTPOptions.Credentials
property contains the necessary names and passwords.
If authentication is successful, then the response message returns anOK
status and does not contain an authentication field.
If you disable authentication or if authentication failed, then the response message returns an authentication field. In that case, the status code of the response message is either 401 (Unauthorized
) or 407 (ProxyAuthenticationRequired
). Examine theAuthInfo
object and respond by adding the appropriateAuthorizationField
to the request message containing your credentials. Or resend the request by setting the correctCredentials
property inHTTPOptions
.
If the server or proxy requires an authentication scheme that MATLAB does not support, you must implement the authentication protocol yourself. Create a request message with the appropriate credentials and other information.