Contents

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 NULL or 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:

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