When an instance of this class is created it then can be passed as a parameter to other classes which are initialized using initWithTransport: method.
Once sign-in request is successful, the instance of VPNUTransport manages the created session internally. Therefore, all subsequent requests should be made using the same instance of VPNUTransport.
If you use the standard authorization routine with [ VPNUAuthorizer authorizeWithLogin: ] method, VPNUTransport silently re-authorizes if the session is expired. But if you implement non-standard authorization methods (like authorizing with social networks), it is impossible to re-authorize without calling the third-party code. In this case you must implement methods from VPNUAuthDelegateProtocol and pass the delegate instance to customAuthDelegate property before any usage of this class.
Always use the same instance of VPNUTransport when passing it to initWithTransport: methods. The class provides a special sharedTransport accessor method, which always returns the same global object.
Extends: NSObject
Declared in: VPNUTransport.h
- (void)cancelAllRequests;
- (id)sendRequest:(VPNURequest *)request error:(NSError **)error;
An arbitrary object which represents a server response if no error has occured. Can be nil.
This method sends a previously created instance of VPNURequest synchronously and waits for the response. It blocks a calling thread. This method shouldn't be called from main thread.
+ (void)setSharedTransport:(VPNUTransport *)transport;
An application that has special transporting requirements or constraints should use this method to specify an VPNUTransport instance with customized settings. The application should do so before any calls to the sharedTransport method.
+ (VPNUTransport *)sharedTransport;
The shared VPNUTransport instance.
Applications that do not have special transporting requirements or constraints should find the default shared transport instance acceptable. An application with more specific needs can create a custom VPNUTransport object and set it as the shared transport instance using setSharedTransport:. The application should do so before any calls to this method.
@property (strong) id<VPNUAuthDelegateProtocol> customAuthDelegate;
A delegate object which conforms to VPNUAuthDelegateProtocol protocol.
Once you define an object which conforms to VPNUAuthDelegateProtocol, set this property with it. If you are using non-standard authorization methods (like authorizing with social networks), you must provide an object which resolves custom authorization with third-party server and returns authentication details.