Trait NWTCPConnectionAuthenticationDelegate

Source
pub unsafe trait NWTCPConnectionAuthenticationDelegate: NSObjectProtocol {
    // Provided methods
    unsafe fn shouldProvideIdentityForConnection(
        &self,
        connection: &NWTCPConnection,
    ) -> bool
       where Self: Sized + Message { ... }
    unsafe fn provideIdentityForConnection_completionHandler(
        &self,
        connection: &NWTCPConnection,
        completion: &DynBlock<dyn Fn(NonNull<SecIdentity>, NonNull<NSArray<AnyObject>>)>,
    )
       where Self: Sized + Message { ... }
    unsafe fn shouldEvaluateTrustForConnection(
        &self,
        connection: &NWTCPConnection,
    ) -> bool
       where Self: Sized + Message { ... }
    unsafe fn evaluateTrustForConnection_peerCertificateChain_completionHandler(
        &self,
        connection: &NWTCPConnection,
        peer_certificate_chain: &NSArray<AnyObject>,
        completion: &DynBlock<dyn Fn(NonNull<SecTrust>)>,
    )
       where Self: Sized + Message { ... }
}
👎Deprecated: Use sec_protocol_options_t in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>
Expand description

Allows the caller to take custom actions on some connection events.

See also Apple’s documentation

Provided Methods§

Source

unsafe fn shouldProvideIdentityForConnection( &self, connection: &NWTCPConnection, ) -> bool
where Self: Sized + Message,

👎Deprecated: Use sec_protocol_options_set_challenge_block in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>

The caller can implement this optional protocol method to decide whether it wants to provide the identity for this connection for authentication. If this delegate method is not implemented, the return value will default to YES if provideIdentityForConnection:completionHandler: is implemented.

Parameter connection: The connection sending this message

Returns: YES to provide the identity for this connection, in which case, the delegate method provideIdentityForConnection:completionHandler: will be called.

Source

unsafe fn provideIdentityForConnection_completionHandler( &self, connection: &NWTCPConnection, completion: &DynBlock<dyn Fn(NonNull<SecIdentity>, NonNull<NSArray<AnyObject>>)>, )
where Self: Sized + Message,

👎Deprecated: Use sec_protocol_options_set_challenge_block in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>
Available on crate features block2 and objc2-security only.

The caller can implement this optional protocol method to provide the identity and an optional certificate chain to be used for authentication.

Parameter connection: The connection sending this message

Parameter completion: The completion handler for passing identity and certificate chain to the connection. The “identity” argument is required and must not be nil. The “certificateChain” argument is optional, and is an array of one or more SecCertificateRef objects. The certificate chain must contain objects of type SecCertificateRef only. If the certificate chain is set, it will be used. Otherwise, the leaf certificate will be extracted from the SecIdentityRef object and will be used for authentication.

The caller is responsible for keeping the argument object(s) alive for the duration of the completion handler invocation.

Source

unsafe fn shouldEvaluateTrustForConnection( &self, connection: &NWTCPConnection, ) -> bool
where Self: Sized + Message,

👎Deprecated: Use sec_protocol_options_set_verify_block in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>

The caller can implement this optional protocol method to decide whether it wants to take over the default trust evaluation for this connection. If this delegate method is not implemented, the return value will default to YES if provideIdentityForConnection:completionHandler: is implemented.

Parameter connection: The connection sending this message

Returns: YES to take over the default trust evaluation, in which case, the delegate method evaluateTrustForConnection:peerCertificateChain:completionHandler: will be called.

Source

unsafe fn evaluateTrustForConnection_peerCertificateChain_completionHandler( &self, connection: &NWTCPConnection, peer_certificate_chain: &NSArray<AnyObject>, completion: &DynBlock<dyn Fn(NonNull<SecTrust>)>, )
where Self: Sized + Message,

👎Deprecated: Use sec_protocol_options_set_verify_block in Network framework instead, see deprecation notice in <NetworkExtension/NWTCPConnection.h>
Available on crate features block2 and objc2-security only.

The caller can implement this optional protocol method to set up custom policies for peer certificate trust evaluation. If the delegate method is implemented, the caller is responsible for creating and setting up the SecTrustRef object and passing it to the completion handler. Otherwise, the default trust evaluation policy is used for the connection.

Parameter connection: The connection sending this message

Parameter peerCertificateChain: The peer certificate chain

Parameter completion: The completion handler for passing the SecTrustRef object to the connection. The SecTrustRef object “trust” is required and must not be nil. It will be evaluated using SecTrustEvaluate() if necessary. The caller is responsible for keeping the argument object alive for the duration of the completion handler invocation.

Trait Implementations§

Source§

impl ProtocolType for dyn NWTCPConnectionAuthenticationDelegate

Source§

const NAME: &'static str = "NWTCPConnectionAuthenticationDelegate"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn NWTCPConnectionAuthenticationDelegate

Implementations on Foreign Types§

Source§

impl<T> NWTCPConnectionAuthenticationDelegate for ProtocolObject<T>

Implementors§