主要内容

matlab.net.http.authinfo类

Package:matlab.net.http

HTTP消息中的身份验证或授权信息

描述

MATLAB®当您提供凭据HTTPOptions目的。使用authinfoclass to examine authentication, to specify authorization information, or to implement an authentication protocol, such asOAuth,MATLAB HTTP接口不会自动处理。

authinfoclass represents one authentication challenge returned when:

  • You call theAuthenticateField.convert响应消息的方法。

  • You insert credentials in anAuthorizationFieldheader field into a request message. When you store anauthinfo对象在授权字段中,MATLAB在需要的地方自动将值封闭在引号中,并根据需要插入逃生字符。

  • A server returnsauth-info数据中的数据AuthenticationInfoFieldheader field.

AuthenticateFieldAuthorizationFieldconvert方法转换每个name=value该字段中的对属性与参数名称和值对Parametersproperty. Escape characters and any quotes surrounding values are removed.

有关更多信息,请参阅RFC 7235 AuthenticationRFC 2617主机IMP界面(for Basic and Digest authentication).

Class Attributes

Sealed
真的

为了information on class attributes, seeClass Attributes

Creation

描述

obj = matlab.net.http.AuthInfo(Scheme,paramName,paramValue)creates anauthinfo包括Scheme属性和可选paramName,paramValueparameters. You can specify several argument pairs in any order asparamName1,paramValue1,...,paramNameN,paramValueN

obj = matlab.net.http.AuthInfo(paramName,paramValue)creates anauthinfoobject with an emptySchemevalue.

obj = matlab.net.http.AuthInfo(Pstruct)复制参数和值Pstruct

obj = matlab.net.http.AuthInfo(Pstr)creates anauthinfoPstr

Input Arguments

expand all

参数名称,指定为字符串或字符向量。Web服务定义paramName,paramValuepairs that it accepts as part of a request. AparamName参数表示转换为name=value参数when you convert anauthinfoobject to a string.

Data Types:char|string

参数值, specified as a type required byparamName。没有限制paramValue类型,但是价值必须支持万博1manbetxstring或者char方法。

参数和值,在MATLAB结构中指定为字段。该结构至少应具有Scheme场地。MATLAB省略了具有空值的字段。

Data Types:struct

参数和值,指定为字符串。为了Pstrsyntax:

Pstris one of these formats. The values are optionally enclosed in quotes and escape characters are inserted as needed.

SCHEME token SCHEME param1=value1, param2=value2, ... param1=value1, param2=value2, ...

Data Types:string

Properties

expand all

身份验证方案,指定为一个matlab.net.http。Authenticationschemeobject or a string naming the scheme.

  • 如果Scheme是一个字符串,然后Matlab尝试将其转换为Authenticationschemeenumeration. MATLAB does not provide special processing for aScheme数值小于0。

  • 如果theauthinfoobject is a challenge in anAuthenticateField标题字段和Scheme不是Authenticationscheme然后Scheme是字符串。除此以外,Schemeis aAuthenticationscheme目的。

  • 如果authinfo在一个AuthorizationFieldheader field, thenSchemeis anAuthenticationscheme目的。

  • 如果authinfo在一个AuthenticationInfoFieldheader field, thenScheme可能是空的。

属性:

GetAccess
上市
SetAccess
上市

参数名称和值, specified as an n-by-2 cell array.Parameters{i,1}is the name of theith parameter and is a string.Parameters{i,2}is its value. The type depends on the parameter. To get or set this property, use thegetParameter或者setParametermethods.

Parameters属性取决于Schemeproperty and the attributes that followSchemein the header field. Parameter name matching is case-insensitive. Use theaddParameter,setParameter, 和删除参数methods to access the values in theParametersarray.

Some parameter properties have special meanings and syntax, which MATLAB enforces based on theScheme。Parameters with special meanings are listed here. All other parameters arestringobjects.

  • 如果SchemeisAuthenticationscheme。Basic, then one parameter is expected.

    • In anAuthenticateField(服务器的挑战),属性名称为realm。服务器为用户提示提供了领域,该提示符与Credentials.Realmproperty. Anauthinforeturned by theAuthenticateField.convert方法始终具有一个领域参数。

    • In anAuthorizationField(the credentials in a response from a client), the property name is编码。这编码属性是代表用户名和密码的字符的基本64编码序列Scheme。如果you set this parameter, then you must encode it yourself using thebase64encodefunction.

  • 如果Schemeisauthenticationscheme.digest, then the number of properties is variable and corresponds toname=valueattributes in the header field.

  • 如果Schemeis any otherAuthenticationschemeproperty or a string, then all attribute names and values are acceptable, as long as they can be converted to strings.

属性:

GetAccess
上市
SetAccess
上市
依赖
真的

方法

expand all

Version History

Introduced in R2016b