# SecurityManagerProtocol

> The protocol that the [Titanium.Network.HTTPClient.securityManager](https://titaniumsdk.com/docs/sdk/Titanium.Network.HTTPClient.md#securityManager) must implement.

- Source: https://titaniumsdk.com/docs/sdk/12.5.1/SecurityManagerProtocol
- Titanium SDK version: 12.5.1
- Kind: pseudo
- Platforms: Android, iPhone, iPad, macOS
- Since: Titanium SDK 3.3.0

The object representing [Titanium.Network.HTTPClient.securityManager](https://titaniumsdk.com/docs/sdk/Titanium.Network.HTTPClient.md#securityManager) must implement this protocol.
Assigning the securityManager property to an object that does not implement this protocol will cause an exception to be raised.
All methods in this protocol are required.

## Methods

### connectionDelegateForUrl

- Platforms: iPhone, iPad, macOS

The [APSConnectionDelegate](https://titaniumsdk.com/docs/sdk/APSConnectionDelegate.md) for this connection.

This method is only called if [SecurityManagerProtocol.willHandleURL](https://titaniumsdk.com/docs/sdk/SecurityManagerProtocol.md#willHandleURL) returns true.
See [APSConnectionDelegate](https://titaniumsdk.com/docs/sdk/APSConnectionDelegate.md) for further information.

Parameters:

- `url` (Object): The [NSURL](https://developer.apple.com/documentation/foundation/nsurl?language=objc) representing the end point of this connection.

Returns: APSConnectionDelegate

### getKeyManagers

- Platforms: Android

Returns an array of objects implementing the [X509KeyManager](https://developer.android.com/reference/javax/net/ssl/X509KeyManager.html) protocol for the SSL Context.

This method is only called if [SecurityManagerProtocol.willHandleURL](https://titaniumsdk.com/docs/sdk/SecurityManagerProtocol.md#willHandleURL) returns true.

Return null to set up a SSL Context with the default system key managers.

Parameters:

- `proxy` (Object): The [Titanium.Network.HTTPClient](https://titaniumsdk.com/docs/sdk/Titanium.Network.HTTPClient.md) representing this connection.

Returns: Array<Object>

### getTrustManagers

- Platforms: Android

Returns an array of objects implementing the [X509TrustManager](https://developer.android.com/reference/javax/net/ssl/X509TrustManager.html) protocol for the SSL Context.

This method is only called if [SecurityManagerProtocol.willHandleURL](https://titaniumsdk.com/docs/sdk/SecurityManagerProtocol.md#willHandleURL) returns true.

Return null to set up a SSL Context with the default system trust managers.

Parameters:

- `proxy` (Object): The [Titanium.Network.HTTPClient](https://titaniumsdk.com/docs/sdk/Titanium.Network.HTTPClient.md) representing this connection.

Returns: Array<Object>

### willHandleURL

- Platforms: Android, iPhone, iPad, macOS

Returns if the security manager will participate in authentication of this end point.

The parameter passed to this method is a [NSURL](https://developer.apple.com/documentation/foundation/nsurl?language=objc)
on iOS and a [Uri](https://developer.android.com/reference/android/net/Uri.html) on android.

Return **true** to participate, **false** to allow default authentication flow.

Parameters:

- `url` (Object): The Object representing representing the end point of this connection.

Returns: Boolean

---

- This corpus documents Titanium SDK 13.4.1. Anything here that does not name a version describes 13.4.1.
- Titanium is maintained by TiDev. The Appcelerator toolchain is retired: there is no `appc` CLI, no Appcelerator Studio and no hosted build service. The supported CLI is `titanium` on npm, invoked as `ti`.

