CFHTTPAuthenticationCreateFromResponse(_:_:)
Uses an authentication failure response to create a CFHTTPAuthentication object.
Declaration
func CFHTTPAuthenticationCreateFromResponse(_ alloc: CFAllocator?, _ response: CFHTTPMessage) -> Unmanaged<CFHTTPAuthentication>Parameters
- alloc:
The allocator to use to allocate memory for the new object. Pass
NULLor kCFAllocatorDefault to use the current default allocator. - response:
Response indicating an authentication failure; usually a 401 or a 407 response.
Return Value
CFHTTPAuthentication object that can be used for adding credentials to future requests. Ownership follows the The Create Rule.
Discussion
This function uses a response containing authentication failure information to create a reference to a CFHTTPAuthentication object. You can use the object to add credentials to future requests. You can query the object to get the following information:
whether it can be used and re-used to authenticate with its corresponding server [CFHTTPAuthenticationIsValid(_:_:)]
the authentication method that will be used when it is used to perform an authentication [CFHTTPAuthenticationCopyMethod(_:)]
whether it is associated with a particular CFHTTPMessageRef [CFHTTPAuthenticationAppliesToRequest(_:_:)
whether a user name and a password will be required when it is used to perform an authentication [CFHTTPAuthenticationRequiresUserNameAndPassword(_:)]
whether an account domain will be required when it is used to perform an authentication [CFHTTPAuthenticationRequiresAccountDomain(_:)]
whether authentication requests should be sent one at a time to the corresponding server [CFHTTPAuthenticationRequiresOrderedRequests(_:)]
the namespace (if any) that the domain uses to prompt for a name and password [CFHTTPAuthenticationCopyRealm(_:)]
the domain URLs the instance applies to [CFHTTPAuthenticationCopyDomains(_:)]
When you have determined what information will be needed to perform the authentication and accumulated that information, call CFHTTPMessageApplyCredentials(_:_:_:_:_:) or CFHTTPMessageApplyCredentialDictionary(_:_:_:_:) to perform the authentication.
See Also
HTTP Authentication
CFHTTPAuthenticationCFHTTPAuthenticationAppliesToRequest(_:_:)CFHTTPAuthenticationCopyDomains(_:)CFHTTPAuthenticationCopyMethod(_:)CFHTTPAuthenticationCopyRealm(_:)CFHTTPAuthenticationGetTypeID()CFHTTPAuthenticationIsValid(_:_:)CFHTTPAuthenticationRequiresAccountDomain(_:)CFHTTPAuthenticationRequiresOrderedRequests(_:)CFHTTPAuthenticationRequiresUserNameAndPassword(_:)kCFHTTPAuthenticationAccountDomainkCFHTTPAuthenticationPasswordkCFHTTPAuthenticationSchemeBasickCFHTTPAuthenticationSchemeDigestkCFHTTPAuthenticationSchemeKerberos