This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

matlab.net.http.field.AuthorizationField class

Package: matlab.net.http.field
Superclasses: matlab.net.http.HeaderField

HTTP Authorization or Proxy-Authorization header field

Description

An AuthorizationField object contains credentials in a request message in response to a challenge from a server in an AuthenticateField. The credentials are in the form of an AuthInfo object. For a description of these fields, see RFC 7235 section 4.2 and section 4.4.

MATLAB® automatically creates this field when:

  • HTTPOptions.Authenticate property is true (default) in a request message.

  • You have specified appropriate credentials in the HTTPOptions.Credentials property.

  • MATLAB supports the authentication scheme requested by the server.

You create this field explicitly when you disable automatic authentication or implement an unsupported authentication protocol. If you create this field explicitly, then set the Value property to a valid authorization string or an AuthInfo object.

To see the AuthorizationField that was sent to the server for automatic authentication, examine the completed request or history arguments returned by the RequestMessage.send method.

Class Attributes

Sealed

true

For information on class attributes, see Class Attributes.

Creation

obj = matlab.net.http.field.AuthorizationField(name,value) creates an authorization header field with the Name property set to name and the Value property set to value. Create this field if you disabled automatic authentication or to implement an unsupported authentication protocol.

Properties

expand all

Header field name, specified as 'Authorization' or 'Proxy-Authorization'.

Attributes:

GetAccess

public

SetAccess

public

Authorization, specified as a valid authorization string or a matlab.net.http.AuthInfo object.

Attributes:

GetAccess

public

SetAccess

public

Methods

expand all

Examples

collapse all

import matlab.net.http.*
creds = Credentials('Username','MyName','Password','MyPassword');
options = HTTPOptions('Credentials', creds);
[response, request] = RequestMessage().send('http://myhost.com',options);
authorizationField = request.getFields('Authorization');
authInfo = authorizationField.convert;
disp(string(authInfo));

Introduced in R2016b